includes/functions.php
changeset 533 698a8f04957c
parent 519 94214ec0871c
child 536 218a627eb53e
equal deleted inserted replaced
532:03429d7b1537 533:698a8f04957c
   545 
   545 
   546 function die_semicritical($t, $p, $no_wrapper = false)
   546 function die_semicritical($t, $p, $no_wrapper = false)
   547 {
   547 {
   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   
   553 
       
   554   // If the config hasn't been fetched yet, call grinding_halt.
       
   555   if ( !defined('ENANO_CONFIG_FETCHED') )
       
   556   {
       
   557     grinding_halt($t, $p);
       
   558   }
       
   559   
       
   560   // also do grinding_halt() if we're in CLI mode
   554   if ( defined('ENANO_CLI') )
   561   if ( defined('ENANO_CLI') )
   555   {
   562   {
   556     grinding_halt($t, $p);
   563     grinding_halt($t, $p);
   557   }
   564   }
   558 
   565 
   561     echo '<h2>' . htmlspecialchars($t) . '</h2>';
   568     echo '<h2>' . htmlspecialchars($t) . '</h2>';
   562     echo "<p>$p</p>";
   569     echo "<p>$p</p>";
   563     exit;
   570     exit;
   564   }
   571   }
   565   
   572   
       
   573   $theme = ( defined('ENANO_CONFIG_FETCHED') ) ? getConfig('theme_default') : 'oxygen';
       
   574   $style = ( defined('ENANO_CONFIG_FETCHED') ) ? '__foo__' : 'bleu';
       
   575   
   566   $tpl = new template_nodb();
   576   $tpl = new template_nodb();
   567   $tpl->load_theme('oxygen', 'bleu');
   577   $tpl->load_theme($theme, $style);
   568   $tpl->tpl_strings['SITE_NAME'] = getConfig('site_name');
   578   $tpl->tpl_strings['SITE_NAME'] = getConfig('site_name');
   569   $tpl->tpl_strings['SITE_DESC'] = getConfig('site_desc');
   579   $tpl->tpl_strings['SITE_DESC'] = getConfig('site_desc');
   570   $tpl->tpl_strings['COPYRIGHT'] = getConfig('copyright_notice');
   580   $tpl->tpl_strings['COPYRIGHT'] = getConfig('copyright_notice');
   571   $tpl->tpl_strings['PAGE_NAME'] = $t;
   581   $tpl->tpl_strings['PAGE_NAME'] = $t;
   572   $tpl->header();
   582   $tpl->header();
   632     // unbold
   642     // unbold
   633     echo "\x1B[0m";
   643     echo "\x1B[0m";
   634     echo "$p\n";
   644     echo "$p\n";
   635     exit;
   645     exit;
   636   }
   646   }
   637 
   647   $theme = ( defined('ENANO_CONFIG_FETCHED') ) ? getConfig('theme_default') : 'oxygen';
       
   648   $style = ( defined('ENANO_CONFIG_FETCHED') ) ? '__foo__' : 'bleu';
       
   649   
   638   $tpl = new template_nodb();
   650   $tpl = new template_nodb();
   639   $tpl->load_theme('oxygen', 'bleu');
   651   $tpl->load_theme($theme, $style);
   640   $tpl->tpl_strings['SITE_NAME'] = 'Critical error';
   652   $tpl->tpl_strings['SITE_NAME'] = 'Critical error';
   641   $tpl->tpl_strings['SITE_DESC'] = 'This website is experiencing a serious error and cannot load.';
   653   $tpl->tpl_strings['SITE_DESC'] = 'This website is experiencing a serious error and cannot load.';
   642   $tpl->tpl_strings['COPYRIGHT'] = 'Unable to retrieve copyright information';
   654   $tpl->tpl_strings['COPYRIGHT'] = 'Unable to retrieve copyright information';
   643   $tpl->tpl_strings['PAGE_NAME'] = $t;
   655   $tpl->tpl_strings['PAGE_NAME'] = $t;
   644   $tpl->header();
   656   $tpl->header();
   645   echo $p;
   657   echo $p;
   646   $tpl->footer();
   658   $tpl->footer();
       
   659   
   647   exit;
   660   exit;
   648 }
   661 }
   649 
   662 
   650 /**
   663 /**
   651  * Prints out the categorization box found on most regular pages. Doesn't take or return anything, but assumes that the page information is already set in $paths.
   664  * Prints out the categorization box found on most regular pages. Doesn't take or return anything, but assumes that the page information is already set in $paths.