Location: PHPKode > projects > ADbNewsSender > ADbNewsSender_2.0.4/protected/admin/index.php
<?php session_start();

//Copyright (c) Florian Grannemann
//Last change in version: 2.0 RC 2
/*
    ******************************************************************************
    ADbNewsSender 2

    Copyright (C) 2009  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("+ 30 minutes");
    
}
if($_SESSION["renewSSID"] <= time())
{
     $_SESSION["renewSSID"]=strtotime("+ 30 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";

$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);

$path_to_languagefolder="$path_to_protected/localisation/lang/".$MyCFG->get_config_value("Language")."/";

//to apply to changed global language settings immediately:
if($_POST["GlobalCFoption"] =="GlobalCFGchange")
{
    if($_POST["Language"])
    {
	
	if($_POST["Language"] != $MyCFG->get_config_value("Language"))
	{
	    $path_to_languagefolder="$path_to_protected/localisation/lang/".preg_replace("/\.\./","",addslashes($_POST["Language"]))."/";
	}
    }

}


include "admin_modules.php.inc";
include "$path_to_languagefolder/lang_admin_modules.php.inc";


$newsletters=array();
$newsletters=$MyCFG->get_all_newsletters();
//if only one NL exists:
if(count($newsletters)==1)
{
    $_SESSION["CurrentNL"]=$newsletters[0];

} 


if(isset($_REQUEST["SelectNL"]) && $_REQUEST["SelectNL"] > 0)
{
    if($MyCFG->NL_exists(intval($_REQUEST["SelectNL"])))
    {
	$_SESSION["CurrentNL"]=intval($_REQUEST["SelectNL"]);
    }
}

if(isset($_SESSION["CurrentNL"]) && $_SESSION["CurrentNL"] !=0 )
{
    if($MyCFG->NL_exists(intval($_SESSION["CurrentNL"])))
    {
	$MyNL= new priv_Newsletter(intval($_SESSION["CurrentNL"]),$MyDB);
    }
    else
    {
	$_SESSION["CurrentNL"]=0;
    }
}
if(!isset($_SESSION["currentModulType"])) 
{
    $_SESSION["currentModulType"]="global";
    $_SESSION["currentModulNr"]=0;
}

if(isset($_REQUEST["modul"]))
{
    $newModul=$_REQUEST["modul"];
    $newModul=explode("|",$newModul);
    if($newModul[0]=="global" || $newModul[0]=="nl")
    {
	if(intval($newModul[1]) < count ($admin_modules[$newModul[0]]) && intval($newModul[1]) >=0)
	{
	    $_SESSION["currentModulType"]=$newModul[0];
	    $_SESSION["currentModulNr"]=intval($newModul[1]);
	}
    }
}
?>
<html>
  <head>
    <title><?php
print "$admin_title - ";
print $admin_modules[$_SESSION["currentModulType"]][$_SESSION["currentModulNr"]]["title"]; 
?></title>
<? 
//special headers for a modul:
if($admin_modules[$_SESSION["currentModulType"]][$_SESSION["currentModulNr"]]["specialheaders"])
{
   include $admin_modules[$_SESSION["currentModulType"]][$_SESSION["currentModulNr"]]["specialheaders"];
}
?>

    <style type="text/css" media="screen">
<?php include "css.php.inc";?>
</style>
  </head>
  <body>



 <div id="contents">
    <?php include "./".$_SESSION["currentModulType"]."/".$admin_modules[$_SESSION["currentModulType"]][$_SESSION["currentModulNr"]]["file"];?>

    </div>


<div id="header">
<small>ADbNewsSender 
<?php 
print $MyCFG->get_config_value("Version");

if(isset($_SESSION["CurrentNL"]) && $_SESSION["CurrentNL"]!=0 && $MyCFG->NL_exists($_SESSION["CurrentNL"]))
{
    
    print " | $txt_current_newsletter: <b>".$MyCFG->get_NL_name($_SESSION["CurrentNL"])."</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>
Return current item: ADbNewsSender