/** * Inits the controller class. * * - Force Installer when not HumHub is not installed yet. * - Registers Event Interceptor * - Loads Basic HSetting * - Set Language * - Check Database Version */ public function init() { Yii::app()->interceptor->intercept($this); // Force installer, when not installed if (!Yii::app()->params['installed']) { if ($this->getModule() != null && $this->getModule()->id == "installer") { return parent::init(); } $this->redirect(array('//installer/index')); } // Switch to correct user language if (Yii::app()->user->language) { Yii::app()->language = Yii::app()->user->language; } // Enable Jquery Globally Yii::app()->clientScript->registerCoreScript('jquery'); // Tweaks for Ajax Requests Yii::app()->user->loginRequiredAjaxResponse = "<script>window.location.href = '" . Yii::app()->user->id . "';</script>"; if (Yii::app()->request->isAjaxRequest) { Yii::app()->clientScript->scriptMap = array('jquery.js' => false, 'jquery.min.js' => false); } // Set a javascript variable which holds the Name and the Value of the CSRF Variable. Yii::app()->clientScript->setJavascriptVariable('csrfName', Yii::app()->request->csrfTokenName); Yii::app()->clientScript->setJavascriptVariable('csrfValue', Yii::app()->request->csrfToken); Yii::app()->clientScript->setJavascriptVariable('baseUrl', Yii::app()->getBaseUrl(true)); Yii::app()->clientScript->setJavascriptVariable('localeId', Yii::app()->locale->id); $this->initAjaxCsrfToken(); // Temporary force set the system timezone to avoid php 5.5+ warnings until we create an admin/config option for that date_default_timezone_set(@date_default_timezone_get()); return parent::init(); }
/** * Inits the controller class. * * - Force Installer when not HumHub is not installed yet. * - Registers Event Interceptor * - Loads Basic HSetting * - Set Language * - Check Database Version */ public function init() { Yii::app()->interceptor->intercept($this); $this->handleLocale(); // Force installer, when not installed if (!Yii::app()->params['installed']) { if ($this->getModule() != null && $this->getModule()->id == "installer") { return parent::init(); } $this->redirect(array('//installer/index')); } // Enable Jquery Globally Yii::app()->clientScript->registerCoreScript('jquery'); // Tweaks for Ajax Requests Yii::app()->user->loginRequiredAjaxResponse = "<script>window.location.href = '" . Yii::app()->user->id . "';</script>"; if (Yii::app()->request->isAjaxRequest) { Yii::app()->clientScript->scriptMap = array('jquery.js' => false, 'jquery.min.js' => false); } // Set a javascript variable which holds the Name and the Value of the CSRF Variable. Yii::app()->clientScript->setJavascriptVariable('csrfName', Yii::app()->request->csrfTokenName); Yii::app()->clientScript->setJavascriptVariable('csrfValue', Yii::app()->request->csrfToken); Yii::app()->clientScript->setJavascriptVariable('baseUrl', Yii::app()->getBaseUrl(true)); $this->initAjaxCsrfToken(); return parent::init(); }