} 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; } $s = dirname($s); $u = dirname($u); } } gb::$site_dir = realpath($s); } # gb::$site_path -- must end in a slash ("/"). if (isset($gb_site_path)) { gb::$site_path = $gb_site_path; unset($gb_site_path); } else { gb::$site_path = $u === '/' ? $u : $u . '/'; } # gb::$site_url -- URL to the base of the site. Must end in a slash ("/"). if (isset($gb_site_url)) { gb::$site_url = $gb_site_url; unset($gb_site_url); } else { gb::$site_url = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] !== '80' && $_SERVER['SERVER_PORT'] !== '443' ? ':' . $_SERVER['SERVER_PORT'] : '') . gb::$site_path; }