/** * Show an error message to the user and log the error if needed. * Current 404 errors are not logged. This function ends execution. * @param $errNum int the HTTP error code to return, typically 404 for missing page or 500. * @param $info string (optional) with the message to log, not displayed in production. */ public static function showError($errNum, $info = null) { Language::load('Errors'); ob_get_clean(); $defError = Language::tr('500_default_error'); switch ($errNum) { case 404: Error::error404(); die; break; case 500: default: break; } if ($info != null) { Logger::error('[' . $errNum . '] ' . strip_tags($info)); } $data['title'] = Language::tr('500_title'); $data['error'] = $info != null ? Config::SITE_ENVIRONMENT() == 'development' ? $defError . '<br/>' . $info : $defError : $defError; View::addHeader("HTTP/1.0 500 Internal Server Error"); View::renderTemplate('header', $data); View::render('error/500', $data); View::renderTemplate('footer', $data); die; }
/** * Define Subpage page title and load template files */ public function subPage() { $data['title'] = Language::tr('subpage_text'); $data['welcome_message'] = Language::tr('subpage_message'); View::renderTemplate('header', $data); View::render('welcome/subpage', $data); View::renderTemplate('footer', $data); }
function addNotice() { View::addHeader('X-Uses: HMC-soft MVC'); }