includes/common.php
changeset 326 ab66d6d1f1f4
parent 313 854eecfada20
parent 322 5f1cd51bf1be
child 331 03850e101d7f
equal deleted inserted replaced
314:474f8be55943 326:ab66d6d1f1f4
   153 //
   153 //
   154 
   154 
   155 // The first thing we need to do is start the database connection. At this point, for all we know, Enano might not
   155 // The first thing we need to do is start the database connection. At this point, for all we know, Enano might not
   156 // even be installed. If this connection attempt fails and it's because of a missing or corrupt config file, the
   156 // even be installed. If this connection attempt fails and it's because of a missing or corrupt config file, the
   157 // user will be redirected (intelligently) to install.php.
   157 // user will be redirected (intelligently) to install.php.
   158 $db = new mysql();
   158 
       
   159 @include(ENANO_ROOT . '/config.php');
       
   160 unset($dbuser, $dbpasswd);
       
   161 if ( !isset($dbdriver) )
       
   162   $dbdriver = 'mysql';
       
   163 
       
   164 $db = new $dbdriver();
   159 $db->connect();
   165 $db->connect();
   160 
   166 
   161 // The URL separator is the character appended to contentPath + url_title type strings.
   167 // The URL separator is the character appended to contentPath + url_title type strings.
   162 // If the contentPath has a ? in it, this should be an ampersand; else, it should be a
   168 // If the contentPath has a ? in it, this should be an ampersand; else, it should be a
   163 // question mark.
   169 // question mark.
   345   define('ENANO_MAINSTREAM', '');
   351   define('ENANO_MAINSTREAM', '');
   346   
   352   
   347   // If the site is disabled, bail out, unless we're trying to log in or administer the site
   353   // If the site is disabled, bail out, unless we're trying to log in or administer the site
   348   if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
   354   if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
   349   {
   355   {
   350     if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->cpage['urlname_nons'] == 'CSS' || $paths->cpage['urlname_nons'] == 'Administration' || $paths->cpage['urlname_nons'] == 'Login' ) ) )
   356     if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->page_id == 'CSS' || $paths->page_id == 'Administration' || $paths->page_id == 'Login' ) ) )
   351     {
   357     {
   352       // do nothing; allow execution to continue
   358       // do nothing; allow execution to continue
   353     }
   359     }
   354     else
   360     else
   355     {
   361     {