Example #1
0
 /**
  * beforeAction method, performs operations before an action is presented
  * @param $action, the action being called
  * @see http://www.yiiframework.com/doc/api/1.1/CController#beforeAction-detail
  */
 public function beforeAction($action)
 {
     if (!Yii::app()->getRequest()->isSecureConnection && Cii::getConfig('forceSecureSSL', false)) {
         $this->redirect('https://' . Yii::app()->getRequest()->serverName . Yii::app()->getRequest()->requestUri);
     }
     return parent::beforeAction($action);
 }
 /**
  * Base filter, allows logged in and non-logged in users to cache the page
  */
 public function filters()
 {
     $id = Yii::app()->getRequest()->getQuery('id');
     if ($id == NULL || $id === false) {
         throw new CHttpException(400, Yii::t('ciims.controllers.Categories', 'Invalid routing'));
     }
     return CMap::mergeArray(parent::filters(), array(array('CHttpCacheFilter + index', 'cacheControl' => Cii::get(Yii::app()->user->id) == NULL ? 'public' : 'private' . ', no-cache, must-revalidate', 'etagSeed' => $id), array('COutputCache + list', 'duration' => YII_DEBUG ? 1 : 86400, 'varyByParam' => array('page'), 'varyByLanguage' => true, 'dependency' => array('class' => 'CDbCacheDependency', 'sql' => 'SELECT MAX(updated) FROM content WHERE category_id = :id', 'params' => array(':id' => $id))), array('COutputCache + rss', 'duration' => YII_DEBUG ? 1 : 86400, 'dependency' => array('class' => 'CDbCacheDependency', 'sql' => 'SELECT MAX(updated) FROM content WHERE category_id = :id', 'params' => array(':id' => $id)))));
 }
Example #3
0
 /**
  * Base filter, allows logged in and non-logged in users to cache the page
  */
 public function filters()
 {
     $id = Yii::app()->getRequest()->getQuery('id');
     if ($id != NULL) {
         $vid = Yii::app()->getRequest()->getQuery('vid');
         return array('accessControl', array('CHttpCacheFilter + index', 'cacheControl' => Cii::get(Yii::app()->user->id) == NULL ? 'public' : 'private' . ', no-cache, must-revalidate', 'etagSeed' => $id . $vid), array('COutputCache + index', 'duration' => YII_DEBUG ? 1 : 86400, 'varyByParam' => array('id', 'vid'), 'varyByLanguage' => true, 'varyByExpression' => 'Yii::app()->user->isGuest'));
     }
     return CMap::mergeArray(parent::filters(), array(array('COutputCache + list', 'duration' => YII_DEBUG ? 1 : 86400, 'varyByParam' => array('page'), 'varyByLanguage' => true, 'dependency' => array('class' => 'CDbCacheDependency', 'sql' => 'SELECT MAX(updated) FROM content'))));
 }
Example #4
0
 /**
  * Before Action
  * Checks the theme to determine if bootstrap is required. If it is, preload it
  *
  * This effectively elinminates bootstrap from every part of CiiMS except the DefaultTheme, and should improve performance.
  * However we may have to rewrite a bunch of stuff in the theme layer.
  * 
  * @param  CAction $action    The action we are executing
  * @see CiiController::beforeAction($action)
  */
 public function beforeAction($action)
 {
     Yii::import('webroot.themes.' . $this->getTheme() . '.Theme');
     $theme = new Theme();
     if ($theme->useBootstrap) {
         Yii::app()->getComponent("bootstrap");
     }
     return parent::beforeAction($action);
 }
 /**
  * @return array action filters
  */
 public function filters()
 {
     return CMap::mergeArray(parent::filters(), array('accessControl'));
 }