當前位置: 首頁>>代碼示例>>PHP>>正文


PHP zmf::delFCache方法代碼示例

本文整理匯總了PHP中zmf::delFCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP zmf::delFCache方法的具體用法?PHP zmf::delFCache怎麽用?PHP zmf::delFCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zmf的用法示例。


在下文中一共展示了zmf::delFCache方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionLogin

 public function actionLogin()
 {
     $this->onlyOnPc();
     $this->layout = 'common';
     if (!Yii::app()->user->isGuest) {
         $this->message(0, '您已登錄,請勿重複操作');
     }
     $canLogin = true;
     $ip = Yii::app()->request->getUserHostAddress();
     $cacheKey = 'loginErrors-' . $ip;
     $errorTimes = zmf::getFCache($cacheKey);
     if ($errorTimes >= 5) {
         $canLogin = false;
     }
     if ($canLogin) {
         $model = new FrontLogin();
         if (isset($_POST['FrontLogin'])) {
             $model->attributes = $_POST['FrontLogin'];
             if ($model->validate() && $model->login()) {
                 $arr = array('latestLoginTime' => zmf::now());
                 $uid = Yii::app()->user->id;
                 //                    User::model()->updateByPk($uid, $arr);
                 zmf::delCookie('checkWithCaptcha');
                 zmf::delFCache($cacheKey);
                 if ($this->referer) {
                     $this->redirect($this->referer);
                 } else {
                     $this->redirect(zmf::config('baseurl'));
                 }
             } else {
                 zmf::updateFCacheCounter($cacheKey, 1, 3600);
                 zmf::setCookie('checkWithCaptcha', 1, 86400);
             }
         }
     }
     $this->pageTitle = '登錄';
     $this->render('login', array('model' => $model));
 }
開發者ID:ph7pal,項目名稱:momo,代碼行數:38,代碼來源:SiteController.php

示例2: actionUpdate

 public function actionUpdate($type)
 {
     if (!in_array($type, array('info', 'passwd', 'tags'))) {
         $this->message(0, '您的操作有誤');
     }
     if (isset($_POST) and !empty($_POST)) {
         $model = new Users();
         if ($type == 'info') {
             $intoData['truename'] = zmf::filterInput($_POST['truename'], 't', 1);
             if (!$intoData['truename']) {
                 $this->message(0, '用戶名不能為空');
             }
             //如果用戶修改了用戶名,則判斷是否被使用
             if ($intoData['truename'] != $this->userInfo['truename']) {
                 $info = Users::getInfoByName($intoData['truename']);
                 if ($info) {
                     $this->message(0, '該用戶名已被使用');
                 }
             }
             $intoData['sex'] = tools::val('sex');
             $intoData['areaid'] = tools::val('areaid');
             $intoData['content'] = zmf::filterInput($_POST['desc'], 't', 1);
         } elseif ($type == 'passwd') {
             $old = zmf::filterInput($_POST['old_password'], 't', 1);
             $info = Users::model()->findByPk($this->uid);
             if (!$old) {
                 $this->message(0, '請輸入原始密碼');
             } elseif (md5($old) != $info['password']) {
                 $this->message(0, '原始密碼不正確');
             }
             if (!$_POST['password']) {
                 $this->message(0, '請輸入密碼');
             } elseif (strlen($_POST['password']) < 5) {
                 $this->message(0, '新密碼過短,請重新輸入');
             }
             $intoData['password'] = md5($_POST['password']);
         } elseif ($type == 'tags') {
             //相關標簽
             $tags = $_POST['tagnames'];
             $tags = !empty($tags) ? array_unique(array_filter($tags)) : array();
             $tagids = array();
             if (!empty($tags)) {
                 foreach ($tags as $str) {
                     $_tmp = explode('-', $str);
                     if ($_tmp[1] > 0) {
                         //添加對應關係
                         if (Tags::addRelation($_tmp[1], $this->uid, 'user')) {
                             $tagids[] = $_tmp[1];
                         }
                     } else {
                         //查找是否有對應話題
                         $_tagid = Tags::findAndAdd($_tmp[0], 'user', $this->uid);
                         if ($_tagid) {
                             $tagids[] = $_tagid;
                         }
                     }
                 }
                 $tagids = !empty($tagids) ? array_unique(array_filter($tagids)) : array();
             }
             $tagStr = join(',', $tagids);
             $intoData['tagids'] = $tagStr;
         }
         zmf::delFCache("userInfo-{$this->uid}");
         if ($model->updateByPk($this->uid, $intoData)) {
             $this->message(1, '修改成功', Yii::app()->createUrl('users/config'));
         } else {
             $this->message(1, '修改成功', Yii::app()->createUrl('users/config'));
         }
     }
     $suggestTags = array();
     if ($type == 'tags') {
         //推薦的標簽
         $suggestTags = Tags::getTops('posts');
     }
     $data = array('info' => $this->userInfo, 'type' => $type, 'suggestTags' => $suggestTags);
     $this->render('update', $data);
 }
開發者ID:ph7pal,項目名稱:wedding,代碼行數:77,代碼來源:UsersController.php

示例3: addAds

 public static function addAds($uid)
 {
     if (!$uid) {
         return false;
     }
     $model = new Ads();
     $thekeyid = zmf::filterInput($_POST['Ads']['id']);
     $attachid = zmf::filterInput($_POST['Ads']['attachid'], 't', 1);
     $intoData = $_POST['Ads'];
     $intoData['attachid'] = $attachid;
     $intoData['status'] = 1;
     $intoData['uid'] = $uid;
     if (isset($intoData['start_time'])) {
         $intoData['start_time'] = strtotime($intoData['start_time']);
     }
     if (isset($intoData['expired_time'])) {
         $intoData['expired_time'] = strtotime($intoData['expired_time']);
     }
     $model->attributes = $intoData;
     if ($model->validate()) {
         if ($model->updateByPk($thekeyid, $intoData)) {
             zmf::delFCache("notSaveAds{$uid}");
             if ($attachid) {
                 Attachments::model()->updateAll(array('status' => Posts::STATUS_DELED), "logid={$thekeyid} AND uid={$uid} AND classify='ads'");
                 Attachments::model()->updateAll(array('status' => Posts::STATUS_PASSED), "id={$attachid}");
             }
             return true;
         } else {
             $info = $_POST['Ads'];
         }
     } else {
         $info = $_POST['Ads'];
     }
     return $info;
 }
開發者ID:ph7pal,項目名稱:wedding,代碼行數:35,代碼來源:Publish.php

示例4: actionDelUploadImg

 public function actionDelUploadImg($_attachid = '')
 {
     if (!empty($_attachid)) {
         $attachid = $_attachid;
     } else {
         $attachid = zmf::filterInput($_POST['attachid'], 't', 1);
     }
     //$attachid=tools::jieMi($attachid);
     if (!Yii::app()->request->isAjaxRequest) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if (Yii::app()->user->isGuest) {
         $this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
     }
     $info = Attachments::getOne($attachid);
     if (!$info) {
         $this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
     }
     if ($info['uid'] != Yii::app()->user->id and !$admin) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if ($info['classify'] == 'coverimg') {
         $model = new Posts();
     } elseif ($info['classify'] == 'columns') {
         $model = new Columns();
     } elseif ($info['classify'] == 'ads') {
         $model = new Ads();
     }
     $dirs = zmf::uploadDirs($info['logid'], 'app', $info['classify']);
     if (empty($dirs)) {
         $this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
     }
     foreach ($dirs as $dir) {
         $filePath = $dir . '/' . $info['filePath'];
         //$this->delItem($attchid, $filePath);
         @unlink($filePath);
     }
     if (Attachments::model()->deleteByPk($attachid)) {
         zmf::delFCache("attach{$attachid}");
         if (isset($model)) {
             $model->updateAll(array('attachid' => 0), 'id=:id', array(':id' => $info['logid']));
         }
         if ($admin) {
             $this->jsonOutPut(1, '操作成功!');
         } else {
             $this->jsonOutPut(1, '操作成功!');
         }
     } else {
         $this->jsonOutPut(0, '操作失敗');
     }
 }
開發者ID:ph7pal,項目名稱:wedding,代碼行數:51,代碼來源:AttachmentsController.php


注:本文中的zmf::delFCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。