<?php
/******************************************************************************
 @Author:     Björn Brockmann, Paul Eppner (paul@twomoons.de)
                              Sven Bräutigam, Jürgen Brändle
 @Homepage    http://www.der-dirigent.de
 Last update : 2005-11-24
 Part of     : Update to Version 01.00.02
******************************************************************************/
if(! defined("SKIP_COMMON_SETTINGS") ){
        // Output buffering starten
        ob_start();

        // Magic Quotes ausschalten
        set_magic_quotes_runtime (0);

        // zeige alle Fehlermeldungen, aber keine Warnhinweise
				error_reporting (E_ALL & ~E_NOTICE);

        // alle GET, POST und COOKIE wegen Globals_off parsen
				ignore_user_abort(true);
				if (!(bool) ini_get('register_globals')) import_request_variables('gp');
        $cfg_dedi = ''; $cfg_client ='';
        $dedi = ( empty($dedi) ) ? $_COOKIE['dedi']: $dedi;
}

// notwendige Dateien includen
$this_dir = str_replace ('\\', '/', dirname(__FILE__) . '/');
//go directory up
$strip_slash = substr ($this_dir, 0, strlen($folder)-1);
$to_replace = strrchr ($strip_slash, "/");
$pos = strrpos ($strip_slash, $to_replace);
$this_dir = substr($strip_slash, "0",$pos )."/";
chdir($this_dir);
if(! defined("SKIP_COMMON_SETTINGS") ){
        require_once ($this_dir.'inc/config.php');
        require_once ($this_dir.'inc/class.dedi_debug.php');
        include_once ($this_dir.'external/phplib/prepend.php');
        include_once ($this_dir.'inc/class.user_perms.php');
        include_once ($this_dir.'inc/class.values_ct.php');
        require_once ($this_dir.'inc/fnc.general.php');
        include_once ($this_dir.'inc/class.querybuilder_factory.php');

        // Klassen initialisieren
        $deb    = &new dedi_debug;
        $db     = &new DB_dedi;
        $val_ct = &new values_ct();

        // Konfigurationsparameter einlesen
        $cfg_dedi_temp = $val_ct -> get_cfg();
        $cfg_dedi = array_merge($cfg_dedi, $cfg_dedi_temp);
        //print_r($cfg_dedi);
        unset($cfg_dedi_temp);
}

// Session starten
page_open(array('sess' => 'dedi_Backend_Session',
                'auth' => 'dedi_Backend_Auth'));

// Sessionvariablen initialisieren
$sess->register('sid_client');
$sess->register('sid_lang');
$sess->register('sid_lang_charset');
$sess->register('sid_area');
$sess->register('sid_sniffer');
$client       = (empty($client))       ? $sid_client       : $client;
$lang         = (empty($lang))         ? $sid_lang         : $lang;
$lang_charset = (empty($lang_charset)) ? $sid_lang_charset : $lang_charset;


$perm         = &new dedi_perms($client, $lang);
$client       = $perm -> get_client();
$lang         = $perm -> get_lang();
$lang_charset = $perm -> get_lang_charset();

// Projekt initialisieren
$sid_client = $client;
$cfg_client = $val_ct -> get_by_group('cfg_client', $client);

// Sprache initialisieren
$sid_lang         = $lang;
$sid_lang_charset = $lang_charset;

// Sprachdatei einlesen
// change jb
$lang_dir = $this_dir.'tpl/'.$cfg_dedi['skin'].'/lang/'.$cfg_dedi['backend_lang'].'_'.$lang_charset.'/';
if (file_exists ($lang_dir.'lang_general.php')) {
        require_once($lang_dir.'lang_general.php');
} else {
        require_once($this_dir.'tpl/standard/lang/deutsch_iso-8859-1/lang_general.php');
}
// Sprachdatei speziell für externe Einbindungen einlesen
if (file_exists ($lang_dir.'lang_general_external.php')) {
        require_once($lang_dir.'lang_general_external.php');
} else {
        require_once($this_dir.'tpl/standard/lang/deutsch_iso-8859-1/lang_general_external.php');
}
// change jb
?>