Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * 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);
 }
Example #3
0
File: 500.php Project: hmc-soft/mvc
		margin-left: auto;
		margin-right: auto;
		border-radius: 10px;
		border: 1px solid #000;
	}
  pre {
    font-family: "Andale Mono","Consolas",monospace;
    text-align: left;
    margin: 0 10% 0 10%;
    background-color: #0a0a0a;
    color: #004400;
    padding: 10px;
    border-radius: 5px;
  }
</style>
<div id="page500">
  <h1><?php 
echo $data['title'];
?>
</h1>
  <div id="error">
    <?php 
echo $data['error'];
?>
  </div>
  <?php 
echo \HMC\Language::tr('500_after_error');
?>
  <br/>&nbsp;<br/>
</div>
Example #4
0
File: 404.php Project: hmc-soft/mvc
			 x="167.68532"
			 y="770.5296" />
		</g>
	  </g>
	</svg>

	<ul>
		<li><?php 
echo Language::tr('404_help_check_address');
?>
</li>

	<?php 
if (\HMC\Config::SITE_EMAIL() !== '') {
    ?>
		<li><?php 
    echo Language::tr('404_help_email_admin');
    ?>
</li>
	<?php 
}
?>

		<li><?php 
echo Language::tr('404_help_goto_home');
?>
</li>

	</ul>
</div>
Example #5
0
<?php

use HMC\Config;
use HMC\Language;
?>

<div class="page-header">
	<h1><?php 
echo $data['title'];
?>
</h1>
</div>

<p><?php 
echo $data['welcome_message'];
?>
</p>

<a class="btn btn-md btn-success" href="<?php 
echo Config::SITE_URL();
?>
/subpage">
	<?php 
echo Language::tr('open_subpage');
?>
</a>
Example #6
0
<?php

use HMC\Config;
use HMC\Language;
?>

<div class="page-header">
	<h1><?php 
echo $data['title'];
?>
</h1>
</div>

<p><?php 
echo $data['welcome_message'];
?>
</p>

<a class="btn btn-md btn-success" href="<?php 
echo Config::SITE_URL();
?>
/">
	<?php 
echo Language::tr('back_home', 'welcome', 'Back to Home');
?>
</a>
Example #7
0
 /**
  * on run make an instance of the config class and view class
  */
 public function __construct()
 {
     Language::load(str_replace('Controllers\\', '', get_class($this)));
 }