protected function render($view, $data) { if (Yii::app()->areAllClassesImported()) { parent::render($view, $data); } else { $data['version'] = $this->getVersionInfo(); $data['time'] = time(); $data['admin'] = $this->adminInfo; include $this->getViewFile($view, $data['code']); } }
public function render($view, $data) { if (CONFIG == 'production') { try { if ($data['type'] == 'CHttpException' && $data['code'] == 404) { Yii::app()->runController($this->error404); return true; } if ($view == 'exception' || $view == 'error') { Yii::app()->user->setFlash('error', $data['message']); } $this->tryRedirectOnPreviousUrl(); } catch (Exception $e) { Yii::log($e->getTraceAsString(), CLogger::LEVEL_ERROR); } Yii::app()->user->setFlash('error', $data['message']); $this->redirect($this->maintanance); } else { parent::render($view, $data); } }
/** * Forwards an exception to Whoops. * @param Exception $exception */ protected function handleException($exception) { if ($this->beforeHandling($exception)) { if (!headers_sent()) { $code = $exception instanceof CHttpException ? $exception->statusCode : 500; $msg = $this->getHttpHeader($code, get_class($exception)); header("{$_SERVER['SERVER_PROTOCOL']} {$code} {$msg}"); } if ($exception instanceof CHttpException || !YII_DEBUG) { parent::render('error', $exception); } else { if ($this->isAjaxRequest()) { Yii::app()->displayException($exception); } else { if ($this->errorAction) { Yii::app()->runController($this->errorAction); } if (!$this->handled) { $this->whoops->handleException($exception); } } } } }