gb::verify_config(); } } #------------------------------------------------------------------------------ # Initialize constants gb::$dir = dirname(__FILE__); ini_set('include_path', ini_get('include_path') . ':' . gb::$dir . '/lib'); if (gb::$request_query === 'PATH_INFO') { gb::$index_prefix = rtrim(gb::$index_prefix, '/') . '/'; } $u = dirname($_SERVER['SCRIPT_NAME']); $s = dirname($_SERVER['SCRIPT_FILENAME']); if (substr($_SERVER['SCRIPT_FILENAME'], -20) === '/gitblog/gitblog.php') { exit('you can not run gitblog.php directly'); } gb::$is_internal_call = (strpos($s, '/gitblog/') !== false || substr($s, -8) === '/gitblog') && strpos(realpath($s), realpath(gb::$dir)) === 0; # gb::$site_dir if (isset($gb_site_dir)) { gb::$site_dir = $gb_site_dir; unset($gb_site_dir); } else { if (gb::$is_internal_call) { # confirmed: inside gitblog -- back up to before the gitblog dir and # assume that's the site dir. $max = 20; while ($s !== '/' && $max--) { if (substr($s, -7) === 'gitblog') { $s = dirname($s); $u = dirname($u); break; }