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


PHP OAuth::model方法代码示例

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


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

示例1: loadModel

 /**
  * 判断数据是否存在
  * 
  * return \$this->model
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (isset($_GET['id'])) {
             $this->model = OAuth::model()->findbyPk($_GET['id']);
         }
         if ($this->model === null) {
             throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
         }
     }
     return $this->model;
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:17,代码来源:OAuthController.php

示例2: run

 public function run()
 {
     $this->controller->layout = false;
     //登录状态
     if (!Yii::app()->user->getIsGuest()) {
         $this->controller->redirect(Yii::app()->homeUrl);
         exit;
     }
     //获取登录前的URL
     $get_url = Yii::app()->request->getParam('ret_url');
     if (!empty($get_url)) {
         $ret_url = trim($get_url);
     } else {
         if (isset($_SERVER['HTTP_REFERER'])) {
             $ret_url = $_SERVER['HTTP_REFERER'];
         } else {
             $ret_url = Yii::app()->user->returnUrl;
         }
     }
     /* 防止登陆成功后跳转到登陆、退出等页面 */
     $deny_enter = array('user/login', 'user/logout', 'user/register', 'user/forgetPwd', 'user/resetPwd', 'user/authEmail', 'user/cancel');
     if (str_replace($deny_enter, '', $ret_url) != $ret_url) {
         $ret_url = Yii::app()->user->returnUrl;
     }
     $model = new FloginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['FloginForm'])) {
         $model->attributes = $_POST['FloginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             //更新登录次数和ip
             $user = $this->controller->loadModel();
             $user->logins = $user->logins + 1;
             $user->last_login_ip = Yii::app()->request->userHostAddress;
             $user->save();
             $this->controller->redirect($ret_url);
         }
     }
     //set seo
     $this->controller->_seoTitle = Yii::t('common', 'Login') . ' - ' . $this->controller->_setting['site_name'];
     $this->controller->_seoKeywords = Yii::t('common', 'Login');
     $this->controller->_seoDescription = Yii::t('common', 'Login');
     //第三方登录授权
     $oauth = OAuth::model()->findAll('status=:status', array(':status' => 'Y'));
     // display the login form
     $this->controller->render('login', array('model' => $model, 'ret_url' => $ret_url, 'oauth' => $oauth));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:52,代码来源:LoginAction.php

示例3: run

 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'Enable':
             //显示
             OAuth::model()->updateAll(['status' => 'Y'], $criteria);
             break;
         case 'Disable':
             //隐藏
             OAuth::model()->updateAll(['status' => 'N'], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:24,代码来源:BatchAction.php


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