Ejemplo n.º 1
0
 /**
  * 动作权限控制
  * 
  * @see CController::beforeAction()
  */
 public function beforeAction($action)
 {
     $action_id = strtolower($action->id);
     if (in_array($action_id, array('index', 'home', 'keyword'))) {
         parent::auth();
     }
     return true;
 }
Ejemplo n.º 2
0
 public function init()
 {
     parent::init();
     parent::auth();
 }
Ejemplo n.º 3
0
 /**
  * 自动获取关键词(调用第三方插件)
  * @return [type] [description]
  */
 public function actionKeyword()
 {
     parent::auth();
     $mailer = Yii::createComponent('application.extensions.autokeyword.AutoKeyword');
     $title = trim($this->_request->getParam('title'));
     $content = trim($this->_request->getParam('content'));
     //$return  = XAutoKeyword::discuz($string);
     $return = AutoKeyword::simple($title, $content);
     if ($return == 'empty') {
         $data['state'] = 'error';
         $data['message'] = Yii::t('admin', 'Failed Get');
     } else {
         $data['state'] = 'success';
         $data['message'] = Yii::t('success', 'Success Get');
         $data['datas'] = $return;
     }
     exit(CJSON::encode($data));
 }