includes/dbal.php
changeset 220 2d4bb97fa75a
parent 218 e0ec986c0af3
child 222 acfdccf7a2bf
equal deleted inserted replaced
219:96524a56d475 220:2d4bb97fa75a
   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']) )
       
   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