includes/functions.php
changeset 500 455277559782
parent 481 07bf15b066bc
child 504 bc8e0e9ee01d
equal deleted inserted replaced
499:6b7fdd898ba3 500:455277559782
   548   global $db, $session, $paths, $template, $plugins; // Common objects
   548   global $db, $session, $paths, $template, $plugins; // Common objects
   549   $db->close();
   549   $db->close();
   550 
   550 
   551   if ( ob_get_status() )
   551   if ( ob_get_status() )
   552     ob_end_clean();
   552     ob_end_clean();
       
   553   
       
   554   if ( defined('ENANO_CLI') )
       
   555   {
       
   556     grinding_halt($t, $p);
       
   557   }
   553 
   558 
   554   if ( $no_wrapper )
   559   if ( $no_wrapper )
   555   {
   560   {
   556     echo '<h2>' . htmlspecialchars($t) . '</h2>';
   561     echo '<h2>' . htmlspecialchars($t) . '</h2>';
   557     echo "<p>$p</p>";
   562     echo "<p>$p</p>";
   607   if ( !defined('scriptPath') )
   612   if ( !defined('scriptPath') )
   608     require( ENANO_ROOT . '/config.php' );
   613     require( ENANO_ROOT . '/config.php' );
   609 
   614 
   610   if ( is_object($db) )
   615   if ( is_object($db) )
   611     $db->close();
   616     $db->close();
   612 
   617   
   613   if ( ob_get_status() )
   618   if ( ob_get_status() )
   614     ob_end_clean();
   619     ob_end_clean();
       
   620   
       
   621   if ( defined('ENANO_CLI') )
       
   622   {
       
   623     // set console color
       
   624     echo "\x1B[31;1m";
       
   625     // error title
       
   626     echo "Critical error in Enano runtime: ";
       
   627     // unbold
       
   628     echo "$t\n";
       
   629     // bold
       
   630     echo "\x1B[37;1m";
       
   631     echo "Error: ";
       
   632     // unbold
       
   633     echo "\x1B[0m";
       
   634     echo "$p\n";
       
   635     exit;
       
   636   }
   615 
   637 
   616   $tpl = new template_nodb();
   638   $tpl = new template_nodb();
   617   $tpl->load_theme('oxygen', 'bleu');
   639   $tpl->load_theme('oxygen', 'bleu');
   618   $tpl->tpl_strings['SITE_NAME'] = 'Critical error';
   640   $tpl->tpl_strings['SITE_NAME'] = 'Critical error';
   619   $tpl->tpl_strings['SITE_DESC'] = 'This website is experiencing a serious error and cannot load.';
   641   $tpl->tpl_strings['SITE_DESC'] = 'This website is experiencing a serious error and cannot load.';