diff --git a/include/init.inc.php b/include/init.inc.php new file mode 100644 index 0000000..f83b425 --- /dev/null +++ b/include/init.inc.php @@ -0,0 +1,60 @@ + | +| Mehdi Achour | +| Gabor Hojtsy | +| Sean Coates | ++----------------------------------------------------------------------+ +$Id$ +*/ + +error_reporting(E_ALL); + +define('PATH_ROOT', realpath(dirname(__FILE__) . '/../')); +define('SQLITE_DIR', PATH_ROOT . '/sqlite/'); +define('CVS_DIR', PATH_ROOT . '/cvs/'); + +// project & language config +require_once('lib_proj_lang.inc.php'); + +// get defaults +list($defaultProject) = array_keys($PROJECTS); +list($defaultLanguage) = array_keys($LANGUAGES); + +// set up constants (use defaults if necessary) +define('SITE', isset($project) ? $project : $defaultProject); +define('LANGC', isset($language) ? $language : $defaultLanguage); +define('URI', isset($uri) ? $uri : $_SERVER['REQUEST_URI']); +define('LANGD', $LANGUAGES[LANGC]); + +// set up BASE_URL +if (substr($_SERVER['REQUEST_URI'], -1, 1) == '/') { + // is a directory, use verbatim + $baseURL = $_SERVER['REQUEST_URI']; +} else { + // not a dir, use the dirname + $baseURL = dirname($_SERVER['REQUEST_URI']); +} + +// this very dirty fix makes /rfc work +$baseURL = str_replace('/rfc', '', $baseURL); + +// actually define the constant (trim off any trailing slashes): +define('BASE_URL', rtrim($baseURL, '/')); + +require_once('lib_general.inc.php'); + +?> diff --git a/include/lib_general.inc.php b/include/lib_general.inc.php index 06f8a12..89b71e3 100644 --- a/include/lib_general.inc.php +++ b/include/lib_general.inc.php @@ -21,40 +21,6 @@ $Id$ */ -error_reporting(E_ALL); - -define('PATH_ROOT', realpath(dirname(__FILE__) . '/../')); -define('SQLITE_DIR', PATH_ROOT . '/sqlite/'); -define('CVS_DIR', PATH_ROOT . '/cvs/'); - -// project & language config -require_once('lib_proj_lang.inc.php'); - -// get defaults -list($defaultProject) = array_keys($PROJECTS); -list($defaultLanguage) = array_keys($LANGUAGES); - -// set up constants (use defaults if necessary) -define('SITE', isset($project) ? $project : $defaultProject); -define('LANGC', isset($language) ? $language : $defaultLanguage); -define('URI', isset($uri) ? $uri : $_SERVER['REQUEST_URI']); -define('LANGD', $LANGUAGES[LANGC]); - -// set up BASE_URL -if (substr($_SERVER['REQUEST_URI'], -1, 1) == '/') { - // is a directory, use verbatim - $baseURL = $_SERVER['REQUEST_URI']; -} else { - // not a dir, use the dirname - $baseURL = dirname($_SERVER['REQUEST_URI']); -} - -// this very dirty fix makes /rfc work -$baseURL = str_replace('/rfc', '', $baseURL); - -// actually define the constant (trim off any trailing slashes): -define('BASE_URL', rtrim($baseURL, '/')); - function is_translation($project, $language) { return is_dir(CVS_DIR . $GLOBALS['PROJECTS'][$project] . '/' . $language); @@ -88,7 +54,7 @@ function site_header($title = '', $style = array()) $project = (in_array(SITE, array('www', 'livedocs')) ? 'php' : SITE); $locallinks = site_nav_provider(); $extlinks = ext_nav_provider(); - + $extra_style = ''; // prevent errors $guess_style = (in_array(SITE, array('www', 'livedocs', 'pecl')) ? '' : SITE . '.css'); @@ -96,7 +62,7 @@ function site_header($title = '', $style = array()) foreach ($styles as $style_file) { if (!empty($style_file)) { $extra_style .= '@import url(/style/'. $style_file .");\n"; - } + } } // Set proper encoding with HTTP header first @@ -114,7 +80,7 @@ function site_header($title = '', $style = array()) - +