Merge branch 'mysql4-utf8' of git://github.com/takuya-o/scuttle
[scuttle] / header.inc.php
1 <?php
2 session_start();
3
4 require_once dirname(__FILE__) .'/services/servicefactory.php';
5 require_once dirname(__FILE__) .'/config.inc.php';
6 require_once dirname(__FILE__) .'/functions.inc.php';
7
8 // Determine the base URL
9 if (!isset($root)) {
10   $pieces = explode('/', $_SERVER['SCRIPT_NAME']);
11   $root   = '/';
12   foreach ($pieces as $piece) {
13     if ($piece != '' && !strstr($piece, '.php')) {
14       $root .= $piece .'/';
15     }
16   }
17   if (($root != '/') && (substr($root, -1, 1) != '/')) {
18     $root .= '/';
19   }
20   $path = $root;
21
22   $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
23   $root     = $protocol .'://'. $_SERVER['HTTP_HOST'] . $root;
24 }
25
26 define('GENERAL_MESSAGE',  200);
27 define('GENERAL_ERROR',    202);
28 define('CRITICAL_MESSAGE', 203);
29 define('CRITICAL_ERROR',   204);
30
31 if (defined('SCUTTLE_DEBUG') && SCUTTLE_DEBUG) {
32   ini_set('display_errors',   '1');
33   ini_set('mysql.trace_mode', '1');
34   error_reporting(E_ALL);
35 }
36 else {
37   ini_set('display_errors',   '0');
38   ini_set('mysql.trace_mode', '0');
39   error_reporting(E_ALL);
40 }

Benjamin Mako Hill || Want to submit a patch?