本文整理汇总了PHP中Env::deleteCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::deleteCookie方法的具体用法?PHP Env::deleteCookie怎么用?PHP Env::deleteCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::deleteCookie方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEdit
public function actionEdit($id)
{
if (isset($_POST['SlideForm'])) {
$error = "";
if (empty($_POST['SlideForm']['name'])) {
$error = "name";
}
if (empty($_POST['SlideForm']['content'])) {
$error = "content";
}
if (Env::getCurrentUser() == null) {
$error = "auth";
}
if (Env::getCurrentUser()->isBanned()) {
$error = "banned";
}
if (!empty($error)) {
Env::setCookie("slider_content", $_POST['SlideForm']['content']);
Env::setCookie("slider_name", $_POST['SlideForm']['name']);
$this->redirect('/slider/edit/#error-' . $error);
} else {
Env::deleteCookie("slider_content");
Env::deleteCookie("slider_name");
$slide = Slide::model()->findByPk($id);
$slide->name = Env::clear($_POST['SlideForm']['name']);
$slide->content = $_POST['SlideForm']['content'];
$slide->update();
$this->redirect('/slider');
}
} else {
$this->render('edit', array("slide" => Slide::model()->findByPk($id)));
}
}
示例2: actionCreate
public function actionCreate()
{
$this->checkAddAccess(Env::getCurrentUser());
if (isset($_POST['PostForm'])) {
$error = "";
if (empty($_POST['PostForm']['title'])) {
$error = "title";
}
if (empty($_POST['PostForm']['content'])) {
$error = "content";
}
if (empty($_POST['PostForm']['type'])) {
$error = "type";
}
if (empty($_POST['PostForm']['logo'])) {
$error = "logo";
}
if ($this->checkTags($_POST['PostForm']['tags'])) {
$error = "tags";
}
if (Env::getCurrentUser() == null) {
$error = "auth";
}
if (Env::getCurrentUser()->isBanned()) {
$error = "banned";
}
if (!empty($error)) {
Env::setCookie("post_logo", $_POST['PostForm']['logo']);
Env::setCookie("post_content", $_POST['PostForm']['content']);
Env::setCookie("post_type", $_POST['PostForm']['type']);
Env::setCookie("post_tags", $_POST['PostForm']['tags']);
Env::setCookie("post_title", $_POST['PostForm']['title']);
$this->redirect('/video/create/#error-' . $error);
} else {
Env::deleteCookie("post_logo");
Env::deleteCookie("post_content");
Env::deleteCookie("post_type");
Env::deleteCookie("post_tags");
Env::deleteCookie("post_title");
$post = new Post();
$post->title = Env::clear($_POST['PostForm']['title']);
$post->content = $_POST['PostForm']['content'];
$post->type = Env::clear($_POST['PostForm']['type']);
$post->logo = Env::clear($_POST['PostForm']['logo']);
$post->uid = Env::getCurrentUser()->id;
$post->time = time();
$post->save();
$post->addTags(Env::clear($_POST['PostForm']['tags']));
$this->redirect(Yii::app()->homeUrl);
}
} else {
$this->render('create');
}
}
示例3: actionEdit
public function actionEdit($id)
{
$post = Post::model()->findByPk($id);
if (!$post->isAbleToEdit(Env::getCurrentUser())) {
throw new AccessException();
}
if (isset($_POST['PostForm'])) {
$error = "";
if (empty($_POST['PostForm']['title'])) {
$error = "title";
}
if (empty($_POST['PostForm']['desc'])) {
$error = "desc";
}
if (empty($_POST['PostForm']['content'])) {
$error = "content";
}
if (empty($_POST['PostForm']['type'])) {
$error = "type";
}
if (empty($_POST['PostForm']['logo'])) {
$error = "logo";
}
if ($this->checkTags($_POST['PostForm']['tags'])) {
$error = "tags";
}
if (Env::getCurrentUser() == null) {
$error = "auth";
}
if (Env::getCurrentUser()->isBanned()) {
$error = "banned";
}
if (!empty($error)) {
Env::setCookie("post_logo", $_POST['PostForm']['logo']);
Env::setCookie("post_desc", $_POST['PostForm']['desc']);
Env::setCookie("post_content", $_POST['PostForm']['content']);
Env::setCookie("post_type", $_POST['PostForm']['type']);
Env::setCookie("post_tags", $_POST['PostForm']['tags']);
Env::setCookie("post_title", $_POST['PostForm']['title']);
$this->redirect('/post/edit/#error-' . $error);
} else {
Env::deleteCookie("post_logo");
Env::deleteCookie("post_desc");
Env::deleteCookie("post_content");
Env::deleteCookie("post_type");
Env::deleteCookie("post_tags");
Env::deleteCookie("post_title");
$post->title = Env::clear($_POST['PostForm']['title']);
$post->desc = Env::clear($_POST['PostForm']['desc']);
$post->content = Env::xss_clean($_POST['PostForm']['content']);
$post->type = Env::clear($_POST['PostForm']['type']);
$post->logo = Env::clear($_POST['PostForm']['logo']);
$post->time = time();
$post->update();
$post->clearTags();
$post->addTags(Env::clear($_POST['PostForm']['tags']));
$this->redirect('/post/' . $post->id);
}
} else {
$this->render('edit', array("post" => Post::model()->findByPk($id)));
}
}