Location: PHPKode > projects > ADbNewsSender > ADbNewsSender 2.1.0/maintenance.php
<?php

//File: maintainance.php
//Last change in version: 2.1.Beta 2
/*
    ******************************************************************************
    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 until you realy REALY know what you are doing!
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// This file is used to delete Email-adresses from your maillinglist that Abonnement has expired
// and to delete Emailadresses from PendingList, that are older than 24 hours.
// This File should be executed every hour.
// You may do this by a cron job or by accessing it as an image
// by including it to all of your sites:
//<img src="http://yourdomain.com/maintenance.php?fakecronjob=yes" width="0" height="0">
//
//

//Please enter the relative or absolute path to folder ./protected
$path_to_protected_folder=dirname(__FILE__)."/protected";
//That should set the absolute path to the protected folder (if this file was not moved).
//It should work on all UNIX-like Server Operating Systems (e.g. Linux, *BSD, Solaris)
//If it does not work, try to enter the absolute path manualy or try the relative path: 
//$path_to_protected_folder="./protected";


include "$path_to_protected_folder/skeleton/public_apis.class.php.inc";
include "$path_to_protected_folder/skeleton/private_apis.class.php.inc";

$path_to_DB_defs="$path_to_protected_folder/skeleton/includes/db_defs/";
$path_to_DB_conf="$path_to_protected_folder/database/DBconf.php.inc";

$MyDB = new ADBNS_DB($path_to_DB_defs,$path_to_DB_conf);
if(!@$MyDB->connect())
{
    die("");
}
$MyCFGro=new global_config_ro($MyDB);
$MyCFGrw=new global_config_rw($MyDB);

//trying to override the time zone:
$MyCFGro->setTimeZone();



$fakecronjob=$_REQUEST["fakecronjob"];


if($fakecronjob=="yes")
{
	
	//Getting Timestamp of next planed Maintenance
	$NextMaintenance=$MyCFGrw->get_NextMaintenance();
}
else
{
	$NextMaintenance=0;

}

//Getting current timestamp

$today=time(); 


if($NextMaintenance <= $today)
{

	
	//including modul information:
	include "$path_to_protected_folder/maintenance/modules_reg.php.inc";
	
	//loading modules:

	$i=0;

	
	while ($i <count($maint_modules))
	{
		
		include "$path_to_protected_folder/maintenance/".$maint_modules[$i];
		$i++;
		
	}

	
	if($fakecronjob=="yes")
	{
		//next maintenance  shall be in 1 hour:
		$MyCFGrw->set_NextMaintenance();
	}
        
	
}
?>
Return current item: ADbNewsSender