Location: PHPKode > projects > phlyMail Lite > phlymail/config/lib/init.script.php
<?php
/**
 * Initialise all bells and whistles to ring
 * @package phlyMail Nahariya 4.0+
 * @subpackage Config application
 * @copyright 2001-2009 phlyLabs, Berlin (http://phlylabs.de)
 * @version 3.4.3 2009-11-05
 */
// Only valid within phlyMail
if (!defined('_IN_PHM_')) die();

define('SESS_NAME', session_name());
define('SESS_ID', preg_replace('![^-,a-zA-Z0-9]!', '', session_id())); // Allow up to 6bits per character session IDs
define('CRLF', "\r\n");
define('LF', "\n");
require($_PM_['path']['lib'].'/functions.php');
require($_PM_['path']['lib'].'/basemethods.php');
require($_PM_['path']['lib'].'/uctc.php');
// 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']);
// Config Choices
$WP_conf = (file_exists($_PM_['path']['conf'].'/config.choices.ini.php'))
        ? parse_ini_file($_PM_['path']['conf'].'/config.choices.ini.php')
        : array('scheme' => 'default', 'language' => 'de', 'allow_ip' => 0)
        ;
// 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']);
}
require($_PM_['path']['driver'].'/'.$_PM_['core']['database'].'/driver.php');
require($_PM_['path']['driver'].'/'.$_PM_['core']['database'].'/admin.php');
$DB = new admin($_PM_['path']['conf'].'/driver.'.$_PM_['core']['database'].'.ini.php'
        ,(isset($_PM_['core']['accountpass_security']) && $_PM_['core']['accountpass_security'] == 'cleartext' ? false : true));
// require($WP_core['page_path'].'/lib/user.choices.php');
require(CONFIGPATH.'/messages/'.$WP_conf['language'].'.php');
require($_PM_['path']['lib'].'/fxl_template.inc.php');

// Theme related
if (file_exists($_PM_['path']['theme'].'/'.$_PM_['core']['theme_name'].'/choices.ini.php')) {
    $WP_theme = parse_ini_file($_PM_['path']['theme'].'/'.$_PM_['core']['theme_name'].'/choices.ini.php');
}
//

// Rise security of the config interface by blocking everything but allowed IPs
if (isset($WP_conf['allow_ip']) && $WP_conf['allow_ip']) {
    if (!isset($_SESSION['allowed_ips'])) {
        if (file_exists($_PM_['path']['conf'].'/config.allowed_ips.php')
                && is_readable($_PM_['path']['conf'].'/config.allowed_ips.php')) {
            $allowed_ips = file_get_contents($_PM_['path']['conf'].'/config.allowed_ips.php');
            $_SESSION['allowed_ips'] = explode(LF, trim(str_replace('<?php die(); ?>', '', $allowed_ips)));
        } else {
            $_SESSION['allowed_ips'] = array(getenv('REMOTE_ADDR'));
        }
    }
    if (isset($_SESSION['allowed_ips']) && is_array($_SESSION['allowed_ips'])) {
        $treffer = 0;
        $zeilen = 0;
        $client_ip = getenv('REMOTE_ADDR');
        foreach ($_SESSION['allowed_ips'] as $test) {
            ++$zeilen;
            if (!$test) continue;
            if (substr($client_ip, 0, strlen($test)) == $test) {
                $treffer = 1;
                break;
            }
        }
        if (!$treffer && $zeilen) $_SESSION = array('blocked' => 'IP');
    }
}
// Keep track of activated handlers
$_PM_['handlers'] = parse_ini_file($_PM_['path']['conf'].'/active_handlers.ini.php');

// 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_;
}
?>
Return current item: phlyMail Lite