<?php
/**
* Hide session from outside referers
* @package phlyMail Nahariya 4.0+ Default branch
* @copyright 2001-2009 phlyLabs, Berlin (http://phlylabs.de)
* @version 0.2.3 2009-11-14
*/
// Load necessary files
$choices = '../choices.ini.php';
if (!file_exists($choices) || !is_readable($choices)) die('Could not initialise basic settings.');
$_PM_ = parse_ini_file($choices, true);
// Global Choices, overloading core settings
if (file_exists($_PM_['path']['conf'].'/global.choices.ini.php')) {
$_PM_ = init_merge_PM($_PM_, parse_ini_file($_PM_['path']['conf'].'/global.choices.ini.php', true));
}
$_PM_['core']['file_umask'] = octdec($_PM_['core']['file_umask']);
$_PM_['core']['dir_umask'] = octdec($_PM_['core']['dir_umask']);
// Handling special proxy calls here. Very often used for SSL calls thorugh an SSL proxy used for all instances of a hoster
if (isset($_PM_['proxy']['prepend_path']) && $_PM_['proxy']['prepend_path']
&& (isset($_SERVER[$_PM_['proxy']['server_param']]) && $_SERVER[$_PM_['proxy']['server_param']] == $_PM_['proxy']['server_value'])) {
define('PHP_SELF', (isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'])
? $_PM_['proxy']['prepend_path'].'/'.$_SERVER['SCRIPT_NAME']
: $_PM_['proxy']['prepend_path'].'/'.$_SERVER['PHP_SELF']);
} else {
define('PHP_SELF', (isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']);
}
if (isset($_GET[session_name()]) || isset($_POST[session_name()])) {
header('Location: '.PHP_SELF.'?go='.($_REQUEST['go']));
exit;
}
if (!isset($_REQUEST['go'])) exit;
$go = preg_replace('!\r|\n|\t!', '', $_REQUEST['go']);
if (strlen($go) == 0) exit;
if (!preg_match('!^(http://|https://|ftp://)!', $go) && $go{0} != '/') $go = 'http://'.$go;
header('Location: '.$go);
exit;
// Since array_merge canonly merge flat arrays and array_merge_recursive appends doublettes
// to the father element we have to do the merge "manually"
function init_merge_PM($_PM_, $import)
{
foreach ($import as $k => $v) {
if (is_array($v)) { foreach ($v as $k2 => $v2) { $_PM_[$k][$k2] = $v2; } } else { $_PM_[$k] = $v; }
}
return $_PM_;
}
?>