1
0
mirror of https://github.com/e107inc/e107.git synced 2025-02-06 23:39:11 +01:00
php-e107/e107_admin/cron.php

593 lines
15 KiB
PHP
Raw Normal View History

<?php
/*
2010-11-15 16:32:33 +00:00
* e107 website system
*
* Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Cron Administration
*
* $URL$
* $Id$
*
*/
2010-01-04 21:35:38 +00:00
/**
2010-11-15 16:32:33 +00:00
*
2010-01-04 21:35:38 +00:00
* @package e107
* @subpackage admin
2010-11-15 16:32:33 +00:00
* @version $Id$
2010-01-04 21:35:38 +00:00
* Admin-related functions for cron (Scheduler) management
2010-11-15 16:32:33 +00:00
*/
2010-01-04 21:35:38 +00:00
require_once('../class2.php');
if (!getperms('U'))
{
2010-11-15 16:32:33 +00:00
header('location:'.e_BASE.'index.php');
exit;
}
2009-08-28 16:11:02 +00:00
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'cron';
require_once('auth.php');
2010-11-15 16:32:33 +00:00
$frm = e107::getForm();
$cron = new cron();
require_once(e_ADMIN.'footer.php');
2009-07-08 12:01:06 +00:00
exit;
class cron
{
2010-11-15 16:32:33 +00:00
protected $coreCrons = array();
protected $cronAction;
protected $e_cron = array();
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
public function __construct()
{
2010-11-15 16:32:33 +00:00
$pref = e107::getPref();
$mes = e107::getMessage();
$this->cronAction = e_QUERY;
// The 'available' flag only gives the option to configure the cron if the underlying feature is enabled
$this->coreCrons['_system'] = array(
0 => array('name' => 'Test Email', 'function' => 'sendEmail', 'description' => 'Send a test email to '.$pref['siteadminemail'].'<br />Recommended to test the scheduling system.'),
1 => array('name' => 'Mail Queue', 'function' => 'procEmailQueue', 'description' => 'Process mail queue'),
2 => array('name' => 'Mail Bounce Check', 'function' => 'procEmailBounce', 'description' => 'Check for bounced emails', 'available' => vartrue($pref['mail_bounce_auto'])),
2010-11-15 16:32:33 +00:00
// 1 => array('name'=>'User Purge', 'function' => 'userPurge', 'description'=>'Purge Unactivated Users'),
// 2 => array('name'=>'User UnActivated', 'function' => 'userUnactivated', 'description'=>'Resend activation email to unactivated users.'),
// 3 => array('name'=>'News Sticky', 'function' => 'newsPurge', 'description'=>'Remove Sticky News Items')
);
if (!vartrue($pref['e_cron_pwd']))
{
2009-10-24 10:15:05 +00:00
$pwd = $this->setCronPwd();
}
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
if (isset($_POST['submit']))
{
2010-11-15 16:32:33 +00:00
$this->cronSave();
}
2010-11-15 16:32:33 +00:00
2009-10-24 12:01:24 +00:00
$this->lastRefresh();
$this->cronLoad();
2010-11-15 16:32:33 +00:00
if (isset($_POST['save_prefs']))
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$this->cronSavePrefs();
2009-07-08 12:01:06 +00:00
}
2010-11-15 16:32:33 +00:00
if (isset($_POST['execute']))
{
2009-10-24 12:01:24 +00:00
2009-10-23 14:16:08 +00:00
$class_func = key($_POST['execute']);
2010-11-15 16:32:33 +00:00
$this->cronExecute($class_func);
}
2009-07-08 12:01:06 +00:00
// Set Core Cron Options.
2010-11-15 16:32:33 +00:00
// These core functions need to be put into e_BASE/cron.php ie. news_purge()
2010-11-15 16:32:33 +00:00
if ($this->cronAction == "" || $this->cronAction == "main")
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$this->cronRenderPage();
2009-07-08 12:01:06 +00:00
}
2010-11-15 16:32:33 +00:00
if ($this->cronAction == "pref")
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$this->cronRenderPrefs();
2009-07-08 12:01:06 +00:00
}
}
2009-10-24 10:07:30 +00:00
function lastRefresh()
{
2010-11-15 16:32:33 +00:00
$pref = e107::getPref();
2009-10-24 10:07:30 +00:00
e107::getCache()->CachePageMD5 = '_';
2010-11-15 16:32:33 +00:00
$lastload = e107::getCache()->retrieve('cronLastLoad', FALSE, TRUE, TRUE);
2009-10-24 10:07:30 +00:00
$mes = e107::getMessage();
2010-11-15 16:32:33 +00:00
$ago = (time() - $lastload);
$active = ($ago < 901) ? TRUE : FALSE;
2009-10-24 12:01:24 +00:00
$status = ($active) ? LAN_ENABLED : LAN_DISABLED; // "Enabled" : "Offline";
2010-11-15 16:32:33 +00:00
$mins = floor($ago / 60);
$secs = $ago % 60;
$lastRun = ($mins) ? $mins." minutes and ".$secs." seconds ago." : $secs." seconds ago.";
$lastRefresh = ($ago < 10000) ? $lastRun : 'Never';
2010-11-15 16:32:33 +00:00
2009-10-24 10:07:30 +00:00
$mes->add("Status: <b>".$status."</b>", E_MESSAGE_INFO);
2010-11-15 16:32:33 +00:00
2009-10-24 10:39:42 +00:00
// print_a($pref['e_cron_pref']);
2010-11-15 16:32:33 +00:00
if ($pref['e_cron_pref']) // grab cron
2009-10-24 10:07:30 +00:00
{
2010-11-15 16:32:33 +00:00
foreach ($pref['e_cron_pref'] as $func => $cron)
2009-10-24 10:07:30 +00:00
{
2010-11-15 16:32:33 +00:00
if ($cron['active'] == 1)
2009-10-24 10:07:30 +00:00
{
2010-11-15 16:32:33 +00:00
$list[$func] = $cron;
2009-10-24 10:07:30 +00:00
}
}
}
2010-11-15 16:32:33 +00:00
$mes->add("Active Crons: <b>".count($list)."</b>", E_MESSAGE_INFO);
$mes->add("Last cron refresh: ".$lastRefresh, E_MESSAGE_INFO);
2009-10-24 10:39:42 +00:00
//FIXME: for Windows, the is_executable() function only checks the file
// extensions of exe, com, bat and cmd.
2010-11-15 16:32:33 +00:00
if (!is_executable(e_BASE."cron.php"))
2009-10-25 15:23:28 +00:00
{
2010-11-15 16:32:33 +00:00
$mes->add("Please CHMOD /cron.php to 755", E_MESSAGE_WARNING);
2009-10-25 15:23:28 +00:00
}
2010-11-15 16:32:33 +00:00
elseif (!$active)
2009-10-24 10:07:30 +00:00
{
2010-11-15 16:32:33 +00:00
$setpwd_message = "Use the following Cron Command: <b style='color:black'>".$_SERVER['DOCUMENT_ROOT'].e_HTTP."cron.php ".$pref['e_cron_pwd']."</b><br />
2009-10-24 10:48:11 +00:00
Using your server control panel (eg. cPanel,Plesk etc.) please create a crontab to run this command on your server every minute.";
2010-11-15 16:32:33 +00:00
$mes->add($setpwd_message, E_MESSAGE_INFO);
2009-10-24 12:01:24 +00:00
}
2009-10-25 15:23:28 +00:00
2009-10-24 10:07:30 +00:00
}
2010-11-15 16:32:33 +00:00
function cronName($classname, $method)
2009-10-24 12:01:24 +00:00
{
2010-11-15 16:32:33 +00:00
$tp = e107::getParser();
foreach ($this->e_cron as $class => $val)
2009-10-24 12:01:24 +00:00
{
2010-11-15 16:32:33 +00:00
if ($class == $classname)
2009-10-24 12:01:24 +00:00
{
2010-11-15 16:32:33 +00:00
foreach ($val as $func)
2009-10-24 12:01:24 +00:00
{
2010-11-15 16:32:33 +00:00
if ($func['function'] == $method)
{
return $tp->toHtml($func['name']);
}
2009-10-24 12:01:24 +00:00
}
}
}
}
2010-11-15 16:32:33 +00:00
2009-10-23 14:16:08 +00:00
function cronExecute($class_func)
{
//TODO LANs
2010-11-15 16:32:33 +00:00
list($class_name, $method_name) = explode("__", $class_func);
2009-10-24 10:07:30 +00:00
$mes = e107::getMessage();
2010-11-15 16:32:33 +00:00
$taskName = $class_name;
2010-11-15 16:32:33 +00:00
if ($class_name == '_system')
{
require_once(e_HANDLER.'cron_class.php');
2009-10-24 12:01:24 +00:00
}
else
{
require_once(e_PLUGIN.$class_name.'/e_cron.php');
}
2010-01-04 21:35:38 +00:00
$class_name .= '_cron';
2010-11-15 16:32:33 +00:00
$status = $this->cronExecuteMethod($class_name, $method_name) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Running <b>".$this->cronName($taskName, $method_name)."</b>", $status);
2009-10-24 12:01:24 +00:00
}
2010-11-15 16:32:33 +00:00
function cronSavePref()
{
2010-11-15 16:32:33 +00:00
// Store the USERID with the password.
2009-07-08 12:01:06 +00:00
// This way only the one password is needed, and the user login can be looked up in e_base/cron.php
}
function cronSave()
{
global $pref;
2010-11-15 16:32:33 +00:00
2009-10-23 09:08:15 +00:00
$mes = e107::getMessage();
2009-10-23 14:16:08 +00:00
$activeCount = 0;
2010-11-15 16:32:33 +00:00
foreach ($_POST['cron'] as $key => $val)
{
2010-11-15 16:32:33 +00:00
if (!$val['active'])
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$val['active'] = 0;
2009-07-08 12:01:06 +00:00
}
2009-10-23 14:16:08 +00:00
else
{
$activeCount++;
}
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
$t['minute'] = implode(",", $_POST['tab'][$key]['minute']);
$t['hour'] = implode(",", $_POST['tab'][$key]['hour']);
$t['day'] = implode(",", $_POST['tab'][$key]['day']);
$t['month'] = implode(",", $_POST['tab'][$key]['month']);
$t['weekday'] = implode(",", $_POST['tab'][$key]['weekday']);
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
$val['tab'] = implode(" ", $t);
2009-07-08 12:01:06 +00:00
$tabs .= $val['tab']."<br />";
2010-11-15 16:32:33 +00:00
list($class, $func) = explode("__", $key);
2009-10-23 09:08:15 +00:00
$val['function'] = $func;
2010-11-15 16:32:33 +00:00
$val['class'] = $class;
$val['path'] = $class;
$cron[$key] = $val;
}
2009-07-08 12:01:06 +00:00
$pref['e_cron_pref'] = $cron;
2010-11-15 16:32:33 +00:00
if (!vartrue($pref['e_cron_pwd']) || varset($_POST['generate_pwd']))
{
2009-10-24 10:15:05 +00:00
$pwd = $this->setCronPwd();
2010-11-15 16:32:33 +00:00
2009-10-24 10:15:05 +00:00
$setpwd_message = "Use the following Cron Command:<br /><b style='color:black'>".$_SERVER['DOCUMENT_ROOT'].e_HTTP."cron.php ".$pwd."</b><br />
This cron command is unique and will not be displayed again. Please copy and paste it into your webserver cron area to be run every minute (or 15 minutes) of every day.";
2009-10-23 14:16:08 +00:00
$mes->add($setpwd_message, E_MESSAGE_WARNING);
}
2009-10-23 09:08:15 +00:00
2010-11-15 16:32:33 +00:00
// print_a($pref['e_cron_pref']);
if (save_prefs())
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$mes->add(LAN_SETSAVED, E_MESSAGE_SUCCESS);
2009-10-23 14:16:08 +00:00
$mes->add($activeCount." Cron(s) Active", E_MESSAGE_SUCCESS);
2009-07-08 12:01:06 +00:00
}
else
{
2010-11-15 16:32:33 +00:00
$mes->add("There was a problem saving your settings.", E_MESSAGE_ERROR);
2009-07-08 12:01:06 +00:00
}
}
2009-10-24 10:15:05 +00:00
2010-11-15 16:32:33 +00:00
function setCronPwd()
{
//global $pref;
$userMethods = e107::getUserSession();
$newpwd = $userMethods->generateRandomString('*^*#.**^*');
2010-11-15 16:32:33 +00:00
$newpwd = sha1($newpwd.time());
//$pref['e_cron_pwd'] = $newpwd;
e107::getConfig()->set('e_cron_pwd', $newpwd)->save(false);
return true;
}
// --------------------------------------------------------------------------
2009-07-08 12:01:06 +00:00
function cronRenderPrefs()
{
2010-11-15 16:32:33 +00:00
//global $frm,$ns;
$frm = e107::getForm();
$text = "<div style='text-align:center'>
<form method='post' action='"
.e_SELF."' id='linkform'>
2009-07-08 12:01:06 +00:00
<table class='adminlist'>
<tr>
<td style='width:30%'>Cron Password</td>
<td style='width:70%'>
2010-11-15 16:32:33 +00:00
"
.$frm->password('cron_password', 100)."
2009-07-08 12:01:06 +00:00
</td>
</tr>
2009-10-23 14:16:08 +00:00
2009-07-08 12:01:06 +00:00
<tr style='vertical-align:top'>
<td colspan='2' class='center buttons-bar'>";
2010-11-15 16:32:33 +00:00
$text .= $frm->admin_button('save_prefs', LAN_SAVE, 'update');
$text .= "</td>
2009-07-08 12:01:06 +00:00
</tr>
</table>
</form>
</div>";
2010-11-15 16:32:33 +00:00
e107::getRender()->tablerender(LAN_PREFS, $text);
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
}
function cronLoad() //TODO Make a generic function to work with e_cron, e_sitelink, e_url etc.
2010-11-15 16:32:33 +00:00
2009-10-24 12:01:24 +00:00
{
2010-11-15 16:32:33 +00:00
$pref = e107::getPref();
$core_cron = $this->coreCrons; // May need to check 'available' flag here
$new_cron = e107::getAddonConfig('e_cron');
2010-11-15 16:32:33 +00:00
$this->e_cron = array_merge($core_cron, $new_cron);
return;
2009-11-18 21:59:16 +00:00
2009-10-24 12:01:24 +00:00
}
2010-11-15 16:32:33 +00:00
// ----------- Grab All e_cron parameters -----------------------------------
2009-07-08 12:01:06 +00:00
function cronRenderPage()
{
2010-11-15 16:32:33 +00:00
$pref = e107::getPref();
$cronpref = $pref['e_cron_pref'];
2009-10-23 09:08:15 +00:00
$ns = e107::getRender();
$frm = e107::getForm();
$mes = e107::getMessage();
2010-11-15 16:32:33 +00:00
2009-10-24 12:01:24 +00:00
$e_cron = $this->e_cron;
2010-11-15 16:32:33 +00:00
// ---------------------- List All Functions -----------------------------
2009-07-08 12:01:06 +00:00
$text = "<div style='text-align:center'>
2010-11-15 16:32:33 +00:00
<form method='post' action='"
.e_SELF."' id='cronform'>
2009-07-08 12:01:06 +00:00
<table class='adminlist'>
<colgroup span='8'>
<col></col>
<col></col>
<col></col>
<col></col>
<col></col>
<col></col>
<col></col>
<col></col>
</colgroup>
<thead>
<tr>
2010-11-15 16:32:33 +00:00
<th>"
.LAN_CRON_1."</th>
<th>"
.LAN_CRON_2."</th>
<th>"
.LAN_CRON_3."</th>
<th>"
.LAN_CRON_4."</th>
<th>"
.LAN_CRON_5."</th>
<th>"
.LAN_CRON_6."</th>
<th>"
.LAN_CRON_7."</th>
<th>"
.LAN_CRON_8."</th>
<th>Run Now</th>
2009-07-08 12:01:06 +00:00
</tr>
</thead>
<tbody>";
2010-11-15 16:32:33 +00:00
foreach ($e_cron as $plug => $cfg)
{
2010-11-15 16:32:33 +00:00
foreach ($cfg as $class => $cron)
{
2010-11-15 16:32:33 +00:00
if (!isset($cron['available']) || $cron['available']) // Only display cron functions which are available
{
$c = $plug.'__'.$cron['function']; // class and function.
$sep = array();
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
list($sep['minute'], $sep['hour'], $sep['day'], $sep['month'], $sep['weekday']) = explode(" ", $cronpref[$c]['tab']);
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
foreach ($sep as $key => $value)
{
2010-11-15 16:32:33 +00:00
if ($value == "")
{
$sep[$key] = "*";
}
}
2010-11-15 16:32:33 +00:00
$minute = explode(",", $sep['minute']);
$hour = explode(",", $sep['hour']);
$day = explode(",", $sep['day']);
$month = explode(",", $sep['month']);
$weekday = explode(",", $sep['weekday']);
$min_options = array(
"*" => LAN_CRON_11,
"0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58" => LAN_CRON_12,
"0,5,10,15,20,25,30,35,40,45,50,55" => LAN_CRON_13,
"0,10,20,30,40,50" => LAN_CRON_14,
"0,15,30,45" => LAN_CRON_10,
"0,30" => LAN_CRON_15
);
$hour_options = array(
"*" => LAN_CRON_16,
"0,2,4,6,8,10,12,14,16,18,20,22" => LAN_CRON_17,
"0,3,6,9,12,15,18,21" => LAN_CRON_18,
"0,6,12,18" => LAN_CRON_19
);
$text .= "<tr>
<td>"
.$cron['name']."</td>
<td>"
.$cron['description']."</td>
<td>
<input type='hidden' name='cron[$c][path]' value='".$cron['path']."' />
<select class='tbox' style='height:70px' multiple='multiple' name='tab[$c][minute][]'>\n";
2010-11-15 16:32:33 +00:00
foreach ($min_options as $key => $val)
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
if ($sep['minute'] == $key)
{
$sel = "selected='selected'";
$minute = array();
}
else
{
2010-11-15 16:32:33 +00:00
$sel = "";
}
$text .= "<option value='$key' $sel>".$val."</option>\n";
2009-07-08 12:01:06 +00:00
}
2010-11-15 16:32:33 +00:00
for ($i = 0; $i <= 59; $i++)
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$sel = (in_array(strval($i), $minute)) ? "selected='selected'" : "";
$text .= "<option value='$i' $sel>".$i."</option>\n";
2009-07-08 12:01:06 +00:00
}
$text .= "</select>
</td>
<td>
<select class='tbox' style='height:70px' multiple='multiple' name='tab[$c][hour][]'>
\n";
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
foreach ($hour_options as $key => $val)
{
2010-11-15 16:32:33 +00:00
if ($sep['hour'] == $key)
{
$sel = "selected='selected'";
$hour = array();
}
else
{
2010-11-15 16:32:33 +00:00
$sel = "";
}
$text .= "<option value='$key' $sel>".$val."</option>\n";
}
2009-07-08 12:01:06 +00:00
2010-11-15 16:32:33 +00:00
for ($i = 0; $i <= 23; $i++)
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$sel = (in_array(strval($i), $hour)) ? "selected='selected'" : "";
$diz = mktime($i, 00, 00, 1, 1, 2000);
$text .= "<option value='$i' $sel>".$i." - ".date("g A", $diz)."</option>\n";
2009-07-08 12:01:06 +00:00
}
$text .= "</select>
</td>
<td>
<select class='tbox' style='height:70px' multiple='multiple' name='tab[$c][day][]'>\n";
$sel_day = ($day[0] == "*") ? "selected='selected'" : "";
$text .= "<option value='*' {$sel_day}>".LAN_CRON_20."</option>\n"; // Every Day
2010-11-15 16:32:33 +00:00
for ($i = 1; $i <= 31; $i++)
2009-07-08 12:01:06 +00:00
{
2010-11-15 16:32:33 +00:00
$sel = (in_array($i, $day)) ? "selected='selected'" : "";
$text .= "<option value='$i' $sel>".$i."</option>\n";
2009-07-08 12:01:06 +00:00
}
$text .= "</select>
</td>
<td>
<select class='tbox' style='height:70px' multiple='multiple' name='tab[$c][month][]'>\n";
2009-07-08 12:01:06 +00:00
$sel_month = ($month[0] == "*") ? "selected='selected'" : "";
$text .= "<option value='*' $sel_month>".LAN_CRON_21."</option>\n"; // Every Month
2010-11-15 16:32:33 +00:00
for ($i = 1; $i <= 12; $i++)
{
2010-11-15 16:32:33 +00:00
$sel = (in_array($i, $month)) ? "selected='selected'" : "";
$diz = mktime(00, 00, 00, $i, 1, 2000);
$text .= "<option value='$i' $sel>".strftime("%B", $diz)."</option>\n";
}
$text .= "</select>
</td>
<td>
<select class='tbox' style='height:70px' multiple='multiple' name='tab[$c][weekday][]'>\n";
$sel_weekday = ($weekday[0] == "*") ? "selected='selected'" : "";
$text .= "<option value='*' $sel_weekday>".LAN_CRON_22."</option>\n"; // Every Week Day.
2010-11-15 16:32:33 +00:00
$days = array(LAN_SUN, LAN_MON, LAN_TUE, LAN_WED, LAN_THU, LAN_FRI, LAN_SAT);
2010-11-15 16:32:33 +00:00
for ($i = 0; $i <= 6; $i++)
{
2010-11-15 16:32:33 +00:00
$sel = (in_array(strval($i), $weekday)) ? "selected='selected'" : "";
$text .= "<option value='$i' $sel>".$days[$i]."</option>\n";
}
$text .= "</select>
</td>
<td class='center'>";
$checked = ($cronpref[$c]['active'] == 1) ? "checked='checked'" : "";
$text .= "<input type='checkbox' name='cron[$c][active]' value='1' $checked />
</td>
<td class='center'>".$frm->admin_button('execute['.$c.']', 'Run Now')."</td>
</tr>";
2010-11-15 16:32:33 +00:00
}
}
2009-07-08 12:01:06 +00:00
}
$text .= "
<tr >
2009-10-23 09:08:15 +00:00
<td colspan='9' class='center'>
2009-07-08 12:01:06 +00:00
<div class='center buttons-bar'>";
2010-11-15 16:32:33 +00:00
// $text .= "<input class='button' type='submit' name='submit' value='".LAN_SAVE."' />";
$text .= $frm->admin_button('submit', LAN_SAVE, $action = 'update');
$text .= $frm->checkbox_switch('generate_pwd', 1, '', 'Generate new cron command');
$text .= "</div></td>
2009-07-08 12:01:06 +00:00
</tr>
</tbody>
</table>
</form>
</div>";
2010-11-15 16:32:33 +00:00
$ns->tablerender(PAGE_NAME, $mes->render().$text);
2009-07-08 12:01:06 +00:00
}
2009-07-08 12:01:06 +00:00
function cronOptions()
{
2010-11-15 16:32:33 +00:00
$e107 = e107::getInstance();
2009-07-08 12:01:06 +00:00
$var['main']['text'] = PAGE_NAME;
$var['main']['link'] = e_SELF;
2010-11-15 16:32:33 +00:00
/*
$var['pref']['text'] = LAN_PREFS;
$var['pref']['link'] = e_SELF."?pref";
$var['pref']['perm'] = "N";
*/ $action = ($this->cronAction) ? $this->cronAction : 'main';
2009-07-08 12:01:06 +00:00
e_admin_menu(PAGE_NAME, $action, $var);
}
2010-11-15 16:32:33 +00:00
function cronExecuteMethod($class_name, $method_name, $return = 'boolean')
2009-10-24 12:01:24 +00:00
{
$mes = e107::getMessage();
2010-11-15 16:32:33 +00:00
if (class_exists($class_name))
2009-10-24 12:01:24 +00:00
{
$obj = new $class_name;
2010-11-15 16:32:33 +00:00
if (method_exists($obj, $method_name))
2009-10-24 12:01:24 +00:00
{
2010-11-15 16:32:33 +00:00
$mes->add("Executing config function <b>".$class_name." : ".$method_name."()</b>", E_MESSAGE_DEBUG);
if ($return == 'boolean')
2009-11-16 22:39:53 +00:00
{
2010-11-15 16:32:33 +00:00
call_user_func(array($obj, $method_name));
2009-11-16 22:39:53 +00:00
return TRUE;
}
else
{
2010-11-15 16:32:33 +00:00
return call_user_func(array($obj, $method_name));
2009-11-16 22:39:53 +00:00
}
2009-10-24 12:01:24 +00:00
}
else
{
2010-11-15 16:32:33 +00:00
$mes->add("Config function <b>".$method_name."()</b> NOT found.", E_MESSAGE_DEBUG);
}
2009-10-24 12:01:24 +00:00
}
return FALSE;
}
}
2009-07-08 12:01:06 +00:00
function cron_adminmenu()
{
global $cron;
$cron->cronOptions();
}
?>