/** * 动作权限控制 * * @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; }
public function init() { parent::init(); parent::auth(); }
/** * 自动获取关键词(调用第三方插件) * @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)); }