includes/common.php
changeset 32 4d87aad3c4c0
parent 30 7e8fd44b36b0
child 73 0a74676a2f2f
equal deleted inserted replaced
31:dc8741857bde 32:4d87aad3c4c0
   189 $template = new template();
   189 $template = new template();
   190 $email = new EmailEncryptor();
   190 $email = new EmailEncryptor();
   191 
   191 
   192 define('ENANO_BASE_CLASSES_INITIALIZED', '');
   192 define('ENANO_BASE_CLASSES_INITIALIZED', '');
   193 
   193 
   194 $code = $plugins->setHook('base_classes_initted');
   194 if ( !defined('IN_ENANO_INSTALL') )
   195 foreach ( $code as $cmd )
   195 {
   196 {
   196   $code = $plugins->setHook('base_classes_initted');
   197   eval($cmd);
   197   foreach ( $code as $cmd )
   198 }
   198   {
   199   
   199     eval($cmd);
   200 $p = RenderMan::strToPageId($paths->get_pageid_from_url());
   200   }
   201 if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
   201     
   202 {
   202   $p = RenderMan::strToPageId($paths->get_pageid_from_url());
   203   @call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
   203   if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
   204 }
   204   {
   205 
   205     @call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
   206 $session->start();
   206   }
   207 $paths->init();
   207   
   208 
   208   $session->start();
   209 define('ENANO_MAINSTREAM', '');
   209   $paths->init();
   210 
   210   
   211 // If the site is disabled, bail out, unless we're trying to log in or administer the site
   211   define('ENANO_MAINSTREAM', '');
   212 if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
   212   
   213 {
   213   // If the site is disabled, bail out, unless we're trying to log in or administer the site
   214   if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->cpage['urlname_nons'] == 'CSS' || $paths->cpage['urlname_nons'] == 'Administration' || $paths->cpage['urlname_nons'] == 'Login' ) ) )
   214   if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
   215   {
   215   {
   216     // do nothing; allow execution to continue
   216     if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->cpage['urlname_nons'] == 'CSS' || $paths->cpage['urlname_nons'] == 'Administration' || $paths->cpage['urlname_nons'] == 'Login' ) ) )
   217   }
       
   218   else
       
   219   {
       
   220     if(!$n = getConfig('site_disabled_notice')) 
       
   221     {
   217     {
   222       $n = 'The administrator has disabled the site. Please check back later.';
   218       // do nothing; allow execution to continue
   223     }
   219     }
   224     
   220     else
   225     $text = RenderMan::render($n) . '
   221     {
   226     <div class="info-box">
   222       if(!$n = getConfig('site_disabled_notice')) 
   227       If you have an administrative account, you may <a href="'.makeUrlNS('Special', 'Login').'">log in</a> to the site or <a href="'.makeUrlNS('Special', 'Administration').'">use the administration panel</a>.
   223       {
   228     </div>';
   224         $n = 'The administrator has disabled the site. Please check back later.';
   229     $paths->wiki_mode = 0;
   225       }
   230     die_semicritical('Site disabled', $text);
   226       
   231   }
   227       $text = RenderMan::render($n) . '
   232 }
   228       <div class="info-box">
   233 else if(getConfig('site_disabled') == '1' && $session->user_level >= USER_LEVEL_ADMIN)
   229         If you have an administrative account, you may <a href="'.makeUrlNS('Special', 'Login').'">log in</a> to the site or <a href="'.makeUrlNS('Special', 'Administration').'">use the administration panel</a>.
   234 {
   230       </div>';
   235   $template->site_disabled = true;
   231       $paths->wiki_mode = 0;
   236 }
   232       die_semicritical('Site disabled', $text);
   237 
   233     }
   238 $code = $plugins->setHook('session_started');
   234   }
   239 foreach ( $code as $cmd )
   235   else if(getConfig('site_disabled') == '1' && $session->user_level >= USER_LEVEL_ADMIN)
   240 {
   236   {
   241   eval($cmd);
   237     $template->site_disabled = true;
   242 }
   238   }
   243 
   239   
   244 if(isset($_GET['noheaders'])) $template->no_headers = true;
   240   $code = $plugins->setHook('session_started');
       
   241   foreach ( $code as $cmd )
       
   242   {
       
   243     eval($cmd);
       
   244   }
       
   245   
       
   246   if(isset($_GET['noheaders'])) $template->no_headers = true;
       
   247 }
   245 
   248 
   246 ?>
   249 ?>