static function start() { // Force transfer session id to cookies if it passed via url if (!empty($_REQUEST[SESS_NAME])) { self::set_id($_REQUEST[SESS_NAME]); } session_name(SESS_NAME); session_start(); // Session checker (for external services, returns "OK" if session exists, empty - otherwise) if (!empty($_REQUEST['check_session'])) { die(!empty($_SESSION) ? 'OK' : ''); } // Validate session if (!defined('SKIP_SESSION_VALIDATION')) { $validator_data = self::get_validator_data(); if (!isset($_SESSION['_validator_data'])) { $_SESSION['_validator_data'] = $validator_data; } else { if ($_SESSION['_validator_data'] != $validator_data) { session_regenerate_id(); $_SESSION = array(); } } } // _SESSION superglobal variable populates here, so remove it from global scope if needed if (fn_get_ini_param('register_globals')) { fn_unregister_globals('_SESSION'); } }
/** * Get file contents from local or remote filesystem * * @param string $location file location * @param string $base_dir * @return string $result */ function fn_get_contents($location, $base_dir = '') { $result = ''; $path = $base_dir . $location; if (!empty($base_dir) && !fn_check_path($path)) { return $result; } // Location is regular file if (is_file($path)) { $result = @file_get_contents($path); // Location is url } elseif (strpos($path, '://') !== false) { // Prepare url $path = str_replace(' ', '%20', $path); if (fn_get_ini_param('allow_url_fopen') == true) { $result = @file_get_contents($path); } else { list(, $result) = fn_http_request('GET', $path); } } return $result; }
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // for isapi_rewrite $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; } // Define real URL define('REAL_URL', (defined('HTTPS') ? 'https://' : 'http://') . REAL_HOST . !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''); } if (!defined('PATH_SEPARATOR')) { define('PATH_SEPARATOR', defined('IS_WINDOWS') ? ';' : ':'); } define('PS', PATH_SEPARATOR); if (!empty($_SERVER['QUERY_STRING'])) { $_SERVER['QUERY_STRING'] = defined('QUOTES_ENABLED') ? stripslashes($_SERVER['QUERY_STRING']) : $_SERVER['QUERY_STRING']; $_SERVER['QUERY_STRING'] = str_replace(array('"', "'"), array('', ''), $_SERVER['QUERY_STRING']); } if (fn_get_ini_param('register_globals')) { fn_unregister_globals(); } // create REQUEST from stripped GET and POST $_REQUEST = fn_safe_input(array_merge($_POST, $_GET)); // Set pear include path @ini_set('include_path', DIR_ROOT . '/lib/pear/' . ini_get('include_path')); /** * Retrieve parameter from php options * * @param string $param parameter to get value for * @param boolean $get_value if true, get value, otherwise return true if parameter enabled, false if disabled * @return mixed parameter value */ function fn_get_ini_param($param, $get_value = false) {