当前位置: 首页>>代码示例>>PHP>>正文


PHP zmf::uid方法代码示例

本文整理汇总了PHP中zmf::uid方法的典型用法代码示例。如果您正苦于以下问题:PHP zmf::uid方法的具体用法?PHP zmf::uid怎么用?PHP zmf::uid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在zmf的用法示例。


在下文中一共展示了zmf::uid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 public static function add($params = array())
 {
     $uid = zmf::uid();
     $data = array('uid' => $params['uid'], 'authorid' => $uid, 'content' => $params['content'], 'new' => 1, 'type' => $params['type'], 'cTime' => zmf::now(), 'from_id' => $params['from_id'], 'from_idtype' => $params['from_idtype'], 'from_num' => 1);
     if ($uid == $params['uid']) {
         return false;
     }
     $model = new Notification();
     $info = $model->find("uid=:uid AND authorid=:authorid AND from_id=:from AND type=:type", array(':uid' => $params['uid'], ':authorid' => $uid, ':from' => $params['from_id'], ':type' => $params['type']));
     if ($info) {
         //存在则更新最新操作时间
         if ($model->updateByPk($info['id'], array('cTime' => time(), 'new' => 1, 'from_num' => $info['from_num'] + 1))) {
             return true;
         } else {
             return false;
         }
     } else {
         //不存在则新增
         $model->attributes = $data;
         if ($model->save()) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:ph7pal,项目名称:mei,代码行数:26,代码来源:Notification.php

示例2: init

 public function init()
 {
     parent::init();
     $passwdErrorTimes = zmf::getCookie('checkWithCaptcha');
     $time = zmf::config('adminErrorTimes');
     if ($time > 0) {
         if ($passwdErrorTimes >= $time) {
             header('Content-Type: text/html; charset=utf-8');
             echo '您暂时已被禁止访问';
             Yii::app()->end();
         }
     }
     $uid = zmf::uid();
     if ($uid) {
         //            $randKey_cookie = zmf::getCookie('adminRandKey' . $uid);
         //            $randKey_cache = zmf::getFCache('adminRandKey' . $uid);
         //            if (!$randKey_cookie || ($randKey_cache != $randKey_cookie)) {
         //                Yii::app()->user->logout();
         //                $this->message(0, '登录已过期,请重新登录', Yii::app()->createUrl('admin/site/login'));
         //            }
         $this->userInfo = Users::getOne($uid);
         $this->uid = $uid;
     } else {
         $currentUrl = Yii::app()->request->url;
         if (strpos($currentUrl, '/site/') === false) {
             $this->message(0, '请先登录', Yii::app()->createUrl('/site/login'));
         }
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:29,代码来源:Admin.php

示例3: init

 public function init()
 {
     if (!zmf::uid()) {
         $this->redirect(zmf::config('baseurl'));
     }
     Users::checkPower('admin');
     Yii::app()->language = 'zh_cn';
 }
开发者ID:ph7pal,项目名称:mei,代码行数:8,代码来源:H.php

示例4: getNum

 public function getNum()
 {
     $uid = zmf::uid();
     if (!$uid) {
         return '0';
     }
     $num = Notification::model()->count('new=1 AND uid=:uid', array(':uid' => $uid));
     if ($num > 0) {
         return $num;
     } else {
         return '0';
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:13,代码来源:Notification.php

示例5: init

 function init()
 {
     parent::init();
     $this->layout = 'user';
     if (!$this->uid) {
         $this->redirect(array('site/login'));
     }
     if ($this->uid == zmf::uid()) {
         $this->mySelf = 'yes';
     }
     $this->pageTitle = $this->userInfo['truename'] . ' - ' . zmf::config('sitename');
     $this->mobileTitle = '个人中心';
     $this->pageDescription = $this->userInfo['truename'] . '的【' . zmf::config('sitename') . '】的个人主页,包括TA的原创文章、精美图片及各类悉心收藏,快来看看吧!';
 }
开发者ID:ph7pal,项目名称:naodong,代码行数:14,代码来源:UsersController.php

示例6: recordAction

 public static function recordAction($logid, $type, $touid, $uid = '')
 {
     $data = array('uid' => $uid != '' ? $uid : zmf::uid(), 'logid' => $logid, 'touid' => $touid, 'classify' => $type, 'cTime' => time(), 'ip' => ip2long(Yii::app()->request->userHostAddress));
     $model = new UserAction();
     $model->attributes = $data;
     if ($model->validate()) {
         if ($model->save()) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:15,代码来源:UserAction.php

示例7: init

 function init()
 {
     parent::init();
     Yii::app()->theme = 'web';
     if (zmf::config('mobile')) {
         if (zmf::checkmobile($this->platform)) {
             Yii::app()->theme = 'mobile';
             $this->isMobile = true;
         }
     }
     $uid = zmf::uid();
     if ($uid) {
         $this->uid = $uid;
         $this->userInfo = Users::getOne($uid);
     }
     self::_referer();
 }
开发者ID:ph7pal,项目名称:momo,代码行数:17,代码来源:Q.php

示例8: init

 function init()
 {
     parent::init();
     if (zmf::config('closeSite')) {
         header("Content-type: text/html; charset=utf-8");
         exit(zmf::config('closeSiteReason'));
     }
     $this->uid = zmf::uid();
     if (!Yii::app()->user->isGuest) {
         $uid = Yii::app()->user->id;
         $userInfo = Users::getUserInfo($uid);
         $this->truename = $userInfo['username'];
         $this->userInfo = $userInfo;
     }
     $this->pageTitle = zmf::config('sitename');
     self::_referer();
     $this->mobileTitle = zmf::config('sitename');
 }
开发者ID:ph7pal,项目名称:mei,代码行数:18,代码来源:Q.php

示例9: checkFavored

 public static function checkFavored($logid, $type)
 {
     if (Yii::app()->user->isGuest) {
         return false;
     }
     if (!is_numeric($logid)) {
         return false;
     }
     if (!isset($type) or !in_array($type, array('posts', 'attachments', 'poi', 'user', 'question', 'goods'))) {
         return false;
     }
     $attr = array('uid' => zmf::uid(), 'logid' => $logid, 'classify' => $type);
     if (Favorites::model()->findByAttributes($attr)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:18,代码来源:Favorites.php

示例10: init

 public function init()
 {
     Yii::app()->language = 'zh_cn';
     if (zmf::config('mobile')) {
         if (tools::checkmobile($this->platform)) {
             Yii::app()->theme = 'frozen';
             $this->isMobile = 'yes';
             $this->layout = '//layouts/mobile';
             $this->currentModule = 'frozen';
         }
     }
     if (zmf::uid()) {
         $this->uid = zmf::uid();
         $userInfo = Users::getUserInfo($this->uid);
         $this->truename = $userInfo['truename'];
         $this->userInfo = $userInfo;
     }
     self::_referer();
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:19,代码来源:T.php

示例11: init

 function init()
 {
     parent::init();
     if (zmf::config('closeSite')) {
         header("Content-type: text/html; charset=utf-8");
         exit(zmf::config('closeSiteReason'));
     }
     $this->uid = zmf::uid();
     if ($this->uid) {
         $uid = $this->uid;
         $userInfo = Users::getUserInfo($uid);
         $this->truename = $userInfo['truename'];
         $this->userInfo = $userInfo;
         $this->userCode = zmf::jiaMi('zmf#' . $this->uid);
     }
     $this->pageTitle = zmf::config('sitename');
     $this->mobileTitle = zmf::config('sitename');
     if ($this->isMobile == 'yes') {
         Yii::app()->theme = 'mobile';
     } else {
         Yii::app()->theme = 'naodong';
     }
     self::_referer();
 }
开发者ID:ph7pal,项目名称:naodong,代码行数:24,代码来源:Q.php

示例12: actionView

 public function actionView($id)
 {
     $this->layout = '/layouts/group';
     $this->currentModule = 'group';
     $info = WeddingGroup::model()->findByPk($id);
     if (!$info) {
         throw new CHttpException(404, '你所查看的页面不存在');
     }
     $info->avatar = $info->getAvatar($info->avatar);
     if (zmf::uid()) {
         $reInfo = GroupLink::findRelation($this->uid, $id);
         if ($reInfo) {
             $this->joined = true;
         }
     }
     //获取团队成员
     $criteria = new CDbCriteria(array('condition' => 'gl.groupid=' . $id, 'join' => 'LEFT JOIN {{group_link}} gl ON t.id=gl.uid', 'select' => 't.id,t.truename,t.avatar'));
     $members = new CActiveDataProvider('Users', array('pagination' => array('pageSize' => 10), 'criteria' => $criteria));
     //获取团队案例列表
     $sql = "SELECT p.id,p.title,p.faceimg,p.uid,p.colid,p.cTime,p.updateTime FROM {{posts}} p WHERE p.groupid='{$id}' AND p.classify=" . Posts::CLASSIFY_WEDDING . " AND p.status=" . Posts::STATUS_PASSED . " ORDER BY p.cTime DESC";
     Posts::getAll(array('sql' => $sql), $pages, $posts);
     if (!empty($posts)) {
         foreach ($posts as $k => $p) {
             if ($p['faceimg'] > 0) {
                 $_attach = Attachments::getOne($p['faceimg']);
                 $_url = Attachments::getUrl($_attach);
                 $posts[$k]['faceimg'] = $_url;
             } else {
                 $posts[$k]['faceimg'] = '';
             }
         }
     }
     $data = array('info' => $info, 'posts' => $posts, 'pages' => $pages);
     $this->pageTitle = $info['title'] . ' - ' . zmf::config('sitename');
     $this->render('view', $data);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:36,代码来源:GroupController.php

示例13: checkFavored

 public static function checkFavored($logid, $type, $uid = '')
 {
     if (!$uid) {
         $uid = zmf::uid();
     }
     if (!$uid) {
         if (zmf::actionLimit('favorite-' . $type, $logid, 1, 86400, true, true)) {
             return true;
         }
         return false;
     }
     if (!is_numeric($logid)) {
         return false;
     }
     if (!isset($type) or !in_array($type, array('post'))) {
         return false;
     }
     $attr = array('uid' => $uid, 'logid' => $logid, 'classify' => $type);
     if (Favorites::model()->findByAttributes($attr)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:24,代码来源:Favorites.php

示例14: actionSettings

 public function actionSettings()
 {
     array_pop($_POST);
     $arr = $_POST;
     if (Yii::app()->user->isGuest) {
         $this->message(0, Yii::t('default', 'loginfirst'), Yii::app()->createUrl('site/login'), 1);
     }
     $uid = zmf::uid();
     foreach ($arr as $key => $val) {
         $_k = zmf::filterInput($key, 't', 1);
         $_v = zmf::filterInput($val, 't', 1);
         $sinfo = UserSetting::model()->findByAttributes(array('stype' => $_k), "uid='{$uid}'");
         $model = new UserSetting();
         if (!$sinfo) {
             $_input = array('uid' => $uid, 'stype' => $_k, 'svalue' => $_v);
             $model->attributes = $_input;
             if ($model->validate()) {
                 $model->save();
             }
         } elseif ($sinfo->svalue != $_v) {
             $model->updateByPk($sinfo->id, array('svalue' => $_v));
         }
     }
     zmf::setFCache("userSettings{$uid}", $arr);
     $this->redirect(array('users/config'));
 }
开发者ID:ph7pal,项目名称:mei,代码行数:26,代码来源:UsersController.php

示例15: isForbidden

 /**
  * 判断发布内容是否应被禁止通过
  * @param string $content
  * @param string $type
  * @return array
  */
 public static function isForbidden($content, $type = 'post')
 {
     //todo,增加开关
     //        $checkStatus=zmf::config('ugcForbidCheck');
     //        if(!$checkStatus){
     //            return array(
     //                'status' => Posts::STATUS_PASSED,
     //                'msg' => '',
     //            );
     //        }
     $status = Posts::STATUS_PASSED;
     $uid = zmf::uid();
     $reason = '';
     $forbidden = false;
     //判断文章的重复率
     $rate = tools::calStrRate($content);
     if ($rate < 0.1) {
         $status = Posts::STATUS_STAYCHECK;
         $reason = '重复率太高';
         $forbidden = true;
     }
     //判断和以前发布的内容的重复率
     if (!$forbidden) {
         $posts = Users::getNewUgc($type, $uid, 5, 'content');
         if (!empty($posts)) {
             foreach ($posts as $val) {
                 $_content = tools::getContentOnly($val['content']);
                 similar_text($_content, $content, $_per);
                 if ($_per >= 85) {
                     $status = Posts::STATUS_STAYCHECK;
                     $reason = '和以前的重复';
                     $forbidden = true;
                     break;
                 }
             }
         }
     }
     //todo,根据内容KNN判断是否是广告
     if (!$forbidden) {
     }
     return array('status' => $status, 'msg' => $reason);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:48,代码来源:Posts.php


注:本文中的zmf::uid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。