<?php session_start();
//Copyright (c) Florian Grannemann
//Last change in version: 2.1 Alpha 4
/*
******************************************************************************
ADbNewsSender 2
Copyright (C) 2010 Florian Grannemann (hide@address.com)
Website: http://adbnewssender.sf.net
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
******************************************************************************
*/
//Do not edit anything unless you realy REALY know what you are doing!
//for security reasons:
//regenerate the session every 30 minutes:
if(!isset($_SESSION["renewSSID"]))
{
$_SESSION["renewSSID"]=strtotime("+ 90 minutes");
}
if($_SESSION["renewSSID"] <= time())
{
$_SESSION["renewSSID"]=strtotime("+ 90 minutes");
session_regenerate_id(TRUE);
}
//to avoid problems on some servers:
//if that does not work, use
//$path_to_protected=".."; or enter the absolute path instead
//But this should work on all UNIX-like systems
$path_to_protected=dirname(__FILE__)."/..";
include "$path_to_protected/skeleton/public_apis.class.php.inc";
include "$path_to_protected/skeleton/private_apis.class.php.inc";
include "$path_to_protected/skeleton/sessionhandler.class.php.inc";
include "$path_to_protected/skeleton/requesthandler.class.php.inc";
$path_to_db_conf="$path_to_protected/database/DBconf.php.inc";
$path_to_db_defs="$path_to_protected/skeleton/includes/db_defs";
$MyDB = new ADBNS_DB($path_to_db_defs,$path_to_db_conf);
$MyCFG= new global_config_rw($MyDB);
//creating session handler object
$MySessionHandler = new ADBNS_SessionHandler();
//creating the request handler object
$MyRequestHandler = new ADBNS_RequestHandler();
//trying to override the time zone:
$MyCFG->setTimeZone();
$path_to_languagefolder="$path_to_protected/localization/lang/".$MyCFG->get_config_value("Language")."/";
//to apply to changed global language settings immediately:
if($MyRequestHandler->getKeyValue("GlobalCFoption") =="GlobalCFGchange")
{
if($MyRequestHandler->getKeyValue("Language"))
{
if($MyRequestHandler->getKeyValue("Language") != $MyCFG->get_config_value("Language"))
{
$path_to_languagefolder="$path_to_protected/localization/lang/".preg_replace("/\.\./","",addslashes($MyRequestHandler->getKeyValue("Language")))."/";
}
}
}
include "admin_modules.php.inc";
include "$path_to_languagefolder/lang_admin_modules.php.inc";
$CurrentNL=0;
$newsletters=array();
$newsletters=$MyCFG->get_all_newsletters();
//if only one NL exists:
if(count($newsletters)==1)
{
$MySessionHandler->setNLID($newsletters[0]);
}
if($MyRequestHandler->getKeyValue("SelectNL") && $MyRequestHandler->getKeyValue("SelectNL") > 0)
{
if($MyCFG->NL_exists(intval($MyRequestHandler->getKeyValue("SelectNL"))))
{
$MySessionHandler->setNLID(intval($MyRequestHandler->getKeyValue("SelectNL")));
}
}
if($MySessionHandler->getNLID() <1 ){
//if no newsletter has been set, try to use the default newsletter:
$MySessionHandler->setNLID($MyCFG->get_config_value("DefaultNL"));
}
//if the selected nl does not exist, unset it.
if($MyCFG->NL_exists($MySessionHandler->getNLID())){
$MyNL= new priv_Newsletter($MySessionHandler->getNLID(),$MyDB);
}
else{
$MySessionHandler->setNLID(0);
}
if(!$MySessionHandler->getCurrentModule(""))
{
$MySessionHandler->setCurrentModuleType("global");
$MySessionHandler->setCurrentModuleNumber(0);
}
if($MyRequestHandler->getKeyValue("modul"))
{
$newModul=$MyRequestHandler->getKeyValue("modul");
$newModul=explode("|",$newModul);
if($newModul[0]=="global" || $newModul[0]=="nl")
{
if(intval($newModul[1]) < count ($admin_modules[$newModul[0]]) && intval($newModul[1]) >=0)
{
$MySessionHandler->setCurrentModuleType($newModul[0]);
$MySessionHandler->setCurrentModuleNumber($newModul[1]);
}
}
}
//setting the current NLID to the request handler:
if($MySessionHandler->getNLID()>0){
$MyRequestHandler->setNLID($MySessionHandler->getNLID());
}
//setting current mudule type to the request handler:
$MyRequestHandler->setCurrentModuleType($MySessionHandler->getCurrentModuleType());
//setting current mudule number to the request handler:
$MyRequestHandler->setCurrentModuleNumber($MySessionHandler->getCurrentModuleNumber());
include "$path_to_languagefolder/localsettings.php.inc";
?>
<html>
<head>
<title><?php
print "$admin_title - ";
print $admin_modules[$MySessionHandler->getCurrentModuleType()][$MySessionHandler->getCurrentModuleNumber()]["title"];
?></title>
<?
//special headers for a modul:
if($admin_modules[$MySessionHandler->getCurrentModuleType()][$MySessionHandler->getCurrentModuleNumber()]["specialheaders"]){
include $admin_modules[$MySessionHandler->getCurrentModuleType()][$MySessionHandler->getCurrentModuleNumber()]["specialheaders"];
}
?>
<meta http-equiv="content-type" content="text/html; charset=<?php print $Charset_Websites;?>">
<style type="text/css" media="screen">
<?php include "css.php.inc";?>
</style>
</head>
<body>
<div id="contents">
<?php include "./".$MySessionHandler->getCurrentModuleType()."/".$admin_modules[$MySessionHandler->getCurrentModuleType()][$MySessionHandler->getCurrentModuleNumber()]["file"];?>
</div>
<div id="header">
<small>ADbNewsSender
<?php
print $MyCFG->getCurrentVersion();
if($MySessionHandler->getNLID() !=0 && $MyCFG->NL_exists($MySessionHandler->getNLID()))
{
print " | $txt_current_newsletter: <b>".$MyCFG->get_NL_name($MySessionHandler->getNLID())."</b>";
}
?> </small><br>
<?php include "global_menu.php.inc";?>
<hr width="100%">
</div>
<div id="menu">
<?php include "nl_menu.php.inc";?>
</div>
</body>
</html>