includes/dbal.php
changeset 279 8acd77a6c19d
parent 271 f088805540ae
parent 276 acfdccf7a2bf
child 304 e2cb5f1432c8
equal deleted inserted replaced
278:53ba55d33abb 279:8acd77a6c19d
   140       unset($crypto_key); // Get this sucker out of memory fast
   140       unset($crypto_key); // Get this sucker out of memory fast
   141     
   141     
   142     if ( !defined('ENANO_INSTALLED') && !defined('MIDGET_INSTALLED') && !defined('IN_ENANO_INSTALL') )
   142     if ( !defined('ENANO_INSTALLED') && !defined('MIDGET_INSTALLED') && !defined('IN_ENANO_INSTALL') )
   143     {
   143     {
   144       dc_here('dbal: oops, looks like Enano isn\'t set up. Constants ENANO_INSTALLED, MIDGET_INSTALLED, and IN_ENANO_INSTALL are all undefined.');
   144       dc_here('dbal: oops, looks like Enano isn\'t set up. Constants ENANO_INSTALLED, MIDGET_INSTALLED, and IN_ENANO_INSTALL are all undefined.');
   145       header('Location: install.php'); 
   145       // scriptPath isn't set yet - we need to autodetect it to avoid infinite redirects
       
   146       if ( !defined('scriptPath') )
       
   147       {
       
   148         if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) )
       
   149         {
       
   150           $_SERVER['REQUEST_URI'] = preg_replace(';' . preg_quote($_SERVER['PATH_INFO']) . '$;', '', $_SERVER['REQUEST_URI']);
       
   151         }
       
   152         $sp = dirname($_SERVER['REQUEST_URI']);
       
   153         if($sp == '/' || $sp == '\\') $sp = '';
       
   154         define('scriptPath', $sp);
       
   155         define('contentPath', "$sp/index.php?title=");
       
   156       }
       
   157       $loc = scriptPath . '/install.php';
       
   158       // header("Location: $loc");
       
   159       redirect($loc, 'Enano not installed', 'We can\'t seem to find an Enano installation (valid config file). You will be transferred to the installation wizard momentarily...', 3);
   146       exit;
   160       exit;
   147     }
   161     }
   148     $this->_conn = @mysql_connect($dbhost, $dbuser, $dbpasswd);
   162     $this->_conn = @mysql_connect($dbhost, $dbuser, $dbpasswd);
   149     unset($dbuser);
   163     unset($dbuser);
   150     unset($dbpasswd); // Security
   164     unset($dbpasswd); // Security