public function actionIndex() { $slug = isset($_GET['slug']) ? fn_clean_input($_GET['slug']) : ''; if ($slug == '') { $slug = Yii::app()->settings->get('general', 'homepage'); } parent::renderPageSlug($slug); }
public function renderPageSlug($slug) { $slug = fn_clean_input($slug); $page = Page::model()->find(array('condition' => 'slug=:paramId', 'params' => array(':paramId' => $slug))); if ($page) { $this->layout = 'main'; //depend on the layout of the page, use the corresponding file to render $this->render('common.front_layouts.' . $page->layout . '.' . $page->display_type, array('page' => $page)); } else { throw new CHttpException('404', t('Oops! Page not found!')); } }
public function __construct($id, $module = null) { parent::__construct($id, $module); if (YII_DEBUG) { $this->backend_asset = Yii::app()->assetManager->publish(Yii::getPathOfAlias('cms.assets.backend'), false, -1, true); } else { $this->backend_asset = Yii::app()->assetManager->publish(Yii::getPathOfAlias('cms.assets.backend'), false, -1, false); } if (isset($_POST)) { $_POST = fn_clean_input($_POST); } if (isset($_GET)) { $_GET = fn_clean_input($_GET); } }
/** * Authenticates the password. * This is the 'authenticate' validator as declared in rules(). */ public function authenticate($attribute, $params) { if (!$this->hasErrors()) { $this->username = fn_clean_input($this->username); $this->_identity = new UserIdentityDb($this->username, $this->password); if ($this->_identity->authenticate() > 0) { switch ($this->_identity->errorCode) { case ConstantDefine::USER_ERROR_NOT_ACTIVE: $this->addError('username', t('User is not Active.')); break; default: $this->addError('password', t('Incorrect username or password.')); break; } } } }