diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-21 10:44:28 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-21 10:44:28 +0000 |
commit | 3c181054dbe60467cc744c447010f525a862c26e (patch) | |
tree | caf19eca71e1339768620b8b2936c12f36dbdac7 /header.inc.php | |
parent | 8ca4455dc7add53f496161eda1e86c455d4ce37c (diff) | |
download | semanticscuttle-3c181054dbe60467cc744c447010f525a862c26e.tar.gz semanticscuttle-3c181054dbe60467cc744c447010f525a862c26e.tar.bz2 |
Refactoring: improve debug_mode, constants and other stuff
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@168 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'header.inc.php')
-rw-r--r-- | header.inc.php | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/header.inc.php b/header.inc.php index 820b5f9..f94ce0d 100644 --- a/header.inc.php +++ b/header.inc.php @@ -1,35 +1,31 @@ <?php -ini_set('display_errors', '1'); -ini_set('mysql.trace_mode', '0'); +if(!file_exists(dirname(__FILE__) .'/config.inc.php')) { + die("Please, create the 'config.inc.php' file. You can copy the 'config.inc.php.example' file."); +} -error_reporting(E_ALL ^ E_NOTICE); -//error_reporting(E_ALL); +// First requirements part (before debug management) +require_once(dirname(__FILE__) .'/config.inc.php'); +require_once(dirname(__FILE__) .'/constants.inc.php'); // some constants are based on variables from config file -define('DEBUG', true); -session_start(); -if(!file_exists(dirname(__FILE__) .'/config.inc.php')) { - die("Please, create the 'config.inc.php' file. You can copy the 'config.inc.php.example' file."); +// Debug Management using constants +if(DEBUG_MODE) { + ini_set('display_errors', '1'); + ini_set('mysql.trace_mode', '1'); + error_reporting(E_ALL); + //error_reporting(E_ALL^E_NOTICE); +} else { + ini_set('display_errors', '0'); + ini_set('mysql.trace_mode', '0'); + error_reporting(0); } + +// Second requirements part which could display bugs (must come after debug management) require_once(dirname(__FILE__) .'/services/servicefactory.php'); -require_once(dirname(__FILE__) .'/config.inc.php'); -require_once(dirname(__FILE__) .'/constants.inc.php'); require_once(dirname(__FILE__) .'/functions.inc.php'); -// Determine the base URL -if (!isset($root)) { - $pieces = explode('/', $_SERVER['SCRIPT_NAME']); - $root = '/'; - foreach($pieces as $piece) { - if ($piece != '' && !strstr($piece, '.php')) { - $root .= $piece .'/'; - } - } - if (($root != '/') && (substr($root, -1, 1) != '/')) { - $root .= '/'; - } - $root = 'http://'. $_SERVER['HTTP_HOST'] . $root; -} + +session_start(); ?> |