/** * Register any values that needed on beforeAction * @param CAction $action action * @return boolean whether the action is allowed ? */ public function beforeAction($action) { if ($action->controller->route !== Yii::app()->errorHandler->errorAction) { $userWeb = UserWeb::instance(); if (isset($_GET['lang'])) { $cookie = new CHttpCookie('lang', $_GET['lang']); $cookie->expire = time() + 60 * 60 * 24 * 180; Yii::app()->request->cookies['lang'] = $cookie; $this->redirect(array("{$this->route}")); } $this->language = Yii::app()->request->cookies->contains('lang') ? Yii::app()->request->cookies['lang']->value : 'id'; $this->renderJS(['baseURL' => Yii::app()->baseUrl], ['lang' => $this->language]); $isIndonesian = $this->language === 'id'; if (!$userWeb->isGuest) { $user = $userWeb->user(); if (isset($user) && !$user->verifiedUser) { $this->data['notifications']['verifyEmail'] = ['URL' => $this->createUrl('/site/verify'), 'title' => 'Pastikan email kamu terverifikasi', 'message' => "Silahkan periksa email anda untuk verifikasi", 'labelButton' => 'Verifikasi Ulang']; } } } return parent::beforeAction($action); }