diff --git a/cron.php b/cron.php index 4851e2d3c..a53e7ff87 100644 --- a/cron.php +++ b/cron.php @@ -12,9 +12,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/cron.php,v $ -| $Revision: 1.3 $ -| $Date: 2009-07-23 08:34:20 $ -| $Author: marj_nl_fr $ +| $Revision: 1.4 $ +| $Date: 2009-10-23 09:08:15 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -32,12 +32,10 @@ if($pref['e_cron_pref']) // grab cron { foreach($pref['e_cron_pref'] as $func=>$cron) { - if($cron['active']==1) { $list[$func] = $cron; } - } } @@ -56,6 +54,10 @@ foreach($list as $func=>$val) // echo date("r")." ".$func."\n"; require_once(e_PLUGIN.$val['path']."/e_cron.php"); + require_once(e_HANDLER."mail.php"); + $message = "Your Cron Job worked correctly. Sent at ".date("r")."."; + sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']); + if(call_user_func($func)===FALSE) { // echo "\nerror running the function ".$func.".\n"; log the error. diff --git a/e107_admin/cron.php b/e107_admin/cron.php index 5c9cbd94e..9b26d0e02 100644 --- a/e107_admin/cron.php +++ b/e107_admin/cron.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/cron.php,v $ -| $Revision: 1.4 $ -| $Date: 2009-09-10 12:49:47 $ +| $Revision: 1.5 $ +| $Date: 2009-10-23 09:08:15 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -64,9 +64,15 @@ class cron // Set Core Cron Options. - $this->coreCrons[] = array('name'=>'User Purge','function' => 'user_purge', 'description'=>'Purge Unactivated Users'); - $this->coreCrons[] = array('name'=>'User UnActivated','function' => 'user_unactivated', 'description'=>'Resend activation email to unactivated users.'); - $this->coreCrons[] = array('name'=>'News Sticky','function' => 'news_purge', 'description'=>'Remove Sticky News Items'); + $this->coreCrons['user'] = array( + 0 => array('name'=>'User Purge','function' => 'user_purge', 'description'=>'Purge Unactivated Users'), + 1 => array('name'=>'User UnActivated','function' => 'user_unactivated', 'description'=>'Resend activation email to unactivated users.') + ); + + $this->coreCrons['news'] = array( + 0 => array('name'=>'News Sticky','function' => 'news_purge', 'description'=>'Remove Sticky News Items') + ); + // These core functions need to be put into e_BASE/cron.php ie. news_purge() @@ -85,15 +91,14 @@ class cron function cronExecute($func) { //TODO LANs - $emessage = eMessage::getInstance(); + $mes = eMessage::getInstance(); if(!function_exists($func) || !call_user_func($func)) - { - - $emessage->add("Error running ".$func."()", E_MESSAGE_ERROR); + { + $mes->add("Error running ".$func."()", E_MESSAGE_ERROR); } else { - $emessage->add("Success running ".$func."()", E_MESSAGE_SUCCESS); + $mes->add("Success running ".$func."()", E_MESSAGE_SUCCESS); } } @@ -107,6 +112,9 @@ class cron function cronSave() { global $pref; + + $mes = e107::getMessage(); + foreach($_POST['cron'] as $key=>$val) { if(!$val['active']) @@ -122,18 +130,26 @@ class cron $val['tab'] = implode(" ",$t); $tabs .= $val['tab']."
"; + + list($class,$func) = explode("__",$key); + + $val['function'] = $func; + $val['class'] = $class; + $cron[$key] = $val; } $pref['e_cron_pref'] = $cron; - $emessage = &eMessage::getInstance(); + + // print_a($pref['e_cron_pref']); + if(save_prefs()) { - $emessage->add(LAN_SETSAVED, E_MESSAGE_SUCCESS); + $mes->add(LAN_SETSAVED, E_MESSAGE_SUCCESS); } else { - $emessage->add("There was a problem saving your settings.", E_MESSAGE_ERROR); + $mes->add("There was a problem saving your settings.", E_MESSAGE_ERROR); } } @@ -180,34 +196,46 @@ class cron function cronRenderPage() { - global $pref,$ns,$frm; + global $pref; $cronpref = $pref['e_cron_pref']; - - - - // $count = 0; - - $e_cron = $this->coreCrons; - $count = count($this->coreCrons); + $ns = e107::getRender(); + $frm = e107::getForm(); + $mes = e107::getMessage(); + $core_cron = $this->coreCrons; + foreach($pref['e_cron_list'] as $key=>$val) { $eplug_cron = array(); if(is_readable(e_PLUGIN.$key."/e_cron.php")) { require_once(e_PLUGIN.$key."/e_cron.php"); - foreach($eplug_cron as $v) + + $class_name = $key."_cron"; + $method_name = 'config'; + + if(class_exists($class_name)) { - $e_cron[$count]['name'] = $v['name']; - $e_cron[$count]['function'] = $v['function']; - $e_cron[$count]['description'] = $v['description']; - $e_cron[$count]['path'] = $key; - $count++; + $obj = new $class_name; + if(method_exists($obj,$method_name)) + { + $mes->add("Executing config function ".$key." : ".$method_name."()", E_MESSAGE_DEBUG); + $new_cron[$key] = call_user_func(array($obj,$method_name)); + + + } + else + { + $mes->add("Config function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); + } } + } - } - + + $e_cron = array_merge($core_cron,$new_cron); + + // ---------------------- List All Functions ----------------------------- $text = "
@@ -238,10 +266,11 @@ class cron "; - - foreach($e_cron as $cron) + foreach($e_cron as $plug=>$cfg) + { + foreach($cfg as $class=>$cron) { - $c = $cron['function']; + $c = $plug.'__'. $cron['function']; // class and function. $sep = array(); list($sep['minute'],$sep['hour'],$sep['day'],$sep['month'],$sep['weekday']) = explode(" ",$cronpref[$c]['tab']); @@ -379,11 +408,11 @@ class cron ".$frm->admin_button('execute['.$c.']', 'Run Now')." "; } - + } $text .= " - +
"; // $text .= ""; $text .= $frm->admin_button('submit', LAN_SAVE, $action = 'update'); @@ -394,8 +423,8 @@ class cron
"; - $emessage = &eMessage::getInstance(); - $ns -> tablerender(PAGE_NAME, $emessage->render() . $text); + $mes = e107::getMessage(); + $ns -> tablerender(PAGE_NAME, $mes->render() . $text); } function cronOptions() diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 7496debd9..db58bb759 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ -| $Revision: 1.104 $ -| $Date: 2009-10-22 04:14:35 $ +| $Revision: 1.105 $ +| $Date: 2009-10-23 09:08:15 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -45,7 +45,8 @@ class e107plugin 'e_header', 'e_userinfo', 'e_tagwords', - 'e_url' + 'e_url', + 'e_cron' ); // List of all plugin variables which need to be checked - install required if one or more set and non-empty @@ -160,7 +161,7 @@ class e107plugin $p_installed = e107::getPref('plug_installed',array()); // load preference; require_once(e_HANDLER."message_handler.php"); - $emessage = eMessage::getInstance(); + $mes = eMessage::getInstance(); foreach($pluginList as $p) { @@ -169,7 +170,7 @@ class e107plugin if(strpos($plugin_path,'e107_')!==FALSE) { - $emessage->add("Folder error: {$p['path']}. 'e107_' is not permitted within plugin folder names.", E_MESSAGE_WARNING); + $mes->add("Folder error: {$p['path']}. 'e107_' is not permitted within plugin folder names.", E_MESSAGE_WARNING); continue; } $plug['plug_action'] = 'scan'; // Make sure plugin.php knows what we're up to @@ -179,16 +180,11 @@ class e107plugin if(!$this->parse_plugin($p['path'])) { //parsing of plugin.php/plugin.xml failed. - $emessage->add("Parsing failed - file format error: {$p['path']}", E_MESSAGE_ERROR); + $mes->add("Parsing failed - file format error: {$p['path']}", E_MESSAGE_ERROR); continue; // Carry on and do any others that are OK } $plug_info = $this->plug_vars; - // $plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1); - - // scan for addons. - $eplug_addons = $this->getAddons($plugin_path); // Returns comma-separated list - // $eplug_addons = $this->getAddons($plugin_path,'check'); // Checks opening/closing tags on addon files //Ensure the plugin path lives in the same folder as is configured in the plugin.php/plugin.xml if ($plugin_path == $plug_info['folder']) @@ -236,25 +232,21 @@ class e107plugin } } } - else - { // New plugin - not in table yet, so add it. If no install needed, mark it as 'installed' - //SecretR - update to latest XML version + else // New plugin - not in table yet, so add it. If no install needed, mark it as 'installed' + { if ($plug_info['@attributes']['name']) { -// echo "New plugin to add: {$plug_info['name']}
"; - // Can just add to DB - shouldn't matter that its not in our current table - // echo "Trying to insert: ".$eplug_folder."
"; + $eplug_addons = $this->getAddons($plugin_path); // Only scan for newly installed. + $_installed = ($plug_info['@attributes']['installRequired'] == 'true' || $plug_info['@attributes']['installRequired'] == 1 ? 0 : 1 ); if(e107::getDb()->db_Insert("plugin", "0, '".$tp -> toDB($plug_info['@attributes']['name'], true)."', '".$tp -> toDB($plug_info['@attributes']['version'], true)."', '".$tp -> toDB($plugin_path, true)."', {$_installed}, '{$eplug_addons}', '".$this->manage_category($plug_info['category'])."', '".varset($plug_info['@attributes']['releaseUrl'])."' ")) { - $emessage->add("Added ".$plug_info['@attributes']['name']." to the plugin table.", E_MESSAGE_DEBUG); + $mes->add("Added ".$plug_info['@attributes']['name']." to the plugin table.", E_MESSAGE_DEBUG); } else { - $emessage->add("Failed to add ".$plug_info['@attributes']['name']." to the plugin table.", E_MESSAGE_DEBUG); - } - - + $mes->add("Failed to add ".$plug_info['@attributes']['name']." to the plugin table.", E_MESSAGE_DEBUG); + } } } } @@ -309,7 +301,7 @@ class e107plugin { global $iconpool,$pref; - $emessage = eMessage::getInstance(); + $mes = eMessage::getInstance(); $sql = e107::getDb(); $tp = e107::getParser(); $fl = e107::getFile(); @@ -321,7 +313,7 @@ class e107plugin $ipool_entry = 'plugin-'.$plugin; e107::getConfig('ipool')->remove($ipool_entry); // FIXME - ipool removal issue. $status = (e107::getConfig('ipool')->save(FALSE)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add('Removing Icon-Pool entry: '.$ipool_entry, $status); + $mes->add('Removing Icon-Pool entry: '.$ipool_entry, $status); } return; } @@ -893,12 +885,12 @@ class e107plugin // 'del_userclasses' - to delete userclasses created // 'del_tables' - to delete DB tables // 'del_extended' - to delete extended fields - function manage_plugin_xml($id, $function='', $options = FALSE) + function install_plugin_xml($id, $function='', $options = FALSE) { global $pref; $sql = e107::getDb(); - $emessage = eMessage::getInstance(); + $mes = eMessage::getInstance(); $error = array(); // Array of error messages $canContinue = TRUE; // Clear flag if must abort part way through @@ -975,7 +967,7 @@ class e107plugin $tableList = $dbHandler->get_table_def('',$path.$sqlFile); if (!is_array($tableList)) { - $emessage->add("Can't read SQL definition: ".$path.$sqlFile,E_MESSAGE_ERROR); + $mes->add("Can't read SQL definition: ".$path.$sqlFile,E_MESSAGE_ERROR); break; } // Got the required definition here @@ -989,7 +981,7 @@ class e107plugin $sqlTable = str_replace("CREATE TABLE ".MPREFIX.'`', "CREATE TABLE `".MPREFIX, preg_replace("/create table\s+/si", "CREATE TABLE ".MPREFIX, $ct[0])); $txt = "Adding table: {$ct[1]} ... "; $status = $this->manage_tables('add', array($sqlTable)) ? E_MESSAGE_SUCCESS: E_MESSAGE_ERROR; // Pass the statement to create the table - $emessage->add($txt,$status); + $mes->add($txt,$status); break; case 'upgrade' : $tmp = $dbHandler->update_table_structure($ct,FALSE,TRUE, $pref['multilanguage']); @@ -1009,11 +1001,11 @@ class e107plugin { $txt = "Removing table {$ct[1]}
"; $status = $this->manage_tables('remove', array($ct[1])) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; // Delete the table - $emessage->add($txt,$status); + $mes->add($txt,$status); } else { - $emessage->add("Table {$ct[1]} left in place.",E_MESSAGE_SUCCESS); + $mes->add("Table {$ct[1]} left in place.",E_MESSAGE_SUCCESS); } break; } @@ -1099,7 +1091,7 @@ class e107plugin { if(isset($plug_vars['management']['installDone'][0])) { - $emessage->add($plug_vars['management']['installDone'][0], E_MESSAGE_SUCCESS); + $mes->add($plug_vars['management']['installDone'][0], E_MESSAGE_SUCCESS); } }*/ @@ -1114,7 +1106,7 @@ class e107plugin $text .= " [".LAN_CONFIGURE."]"; } - $emessage->add($text, E_MESSAGE_SUCCESS); + $mes->add($text, E_MESSAGE_SUCCESS); } } @@ -1133,7 +1125,7 @@ class e107plugin function XmlDependencies($tag) { $canContinue = TRUE; - $emessage = eMessage::getInstance(); + $mes = eMessage::getInstance(); $error = array(); foreach ($tag as $dt => $dv) @@ -1190,7 +1182,7 @@ class e107plugin if(count($error)) { $text = ''.LAN_INSTALL_FAIL.'
'.implode('
',$error); - $emessage->add($text, E_MESSAGE_ERROR); + $mes->add($text, E_MESSAGE_ERROR); } return $canContinue; @@ -1254,7 +1246,7 @@ class e107plugin */ function XmlSiteLinks($function,$array) { - $emessage = &eMessage::getInstance(); + $mes = e107::getMessage(); foreach($array['link'] as $link) { @@ -1272,13 +1264,13 @@ class e107plugin if(!$remove) // Add any non-deprecated link { $status = ($this->manage_link('add', $url, $linkName, $perm)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add("Adding Link: {$linkName} with url [{$url}] and perm {$perm} ", $status); + $mes->add("Adding Link: {$linkName} with url [{$url}] and perm {$perm} ", $status); } if($function == 'upgrade' && $remove) //remove inactive links on upgrade { $status = ($this->manage_link('remove', $url, $linkName)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add("Removing Link: {$linkName} with url [{$url}]", $status); + $mes->add("Removing Link: {$linkName} with url [{$url}]", $status); } break; @@ -1288,7 +1280,7 @@ class e107plugin case 'uninstall': //remove all links $status = ($this->manage_link('remove', $url, $linkName)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add("Removing Link: {$linkName} with url [{$url}]", $status); + $mes->add("Removing Link: {$linkName} with url [{$url}]", $status); break; } } @@ -1322,7 +1314,7 @@ class e107plugin */ function XmlUserClasses($function,$array) { - $emessage = &eMessage::getInstance(); + $mes = e107::getMessage(); foreach($array['class'] as $uclass) { @@ -1340,14 +1332,14 @@ class e107plugin if(!$remove) // Add all active userclasses (code checks for already installed) { $status = $this->manage_userclass('add', $name, $description) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add('Adding Userclass: '.$name, $status); + $mes->add('Adding Userclass: '.$name, $status); } if($function == 'upgrade' && $remove) //If upgrading, removing any inactive userclass { $status = $this->manage_userclass('remove', $name, $description) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add('Removing Userclass: '.$name, $status); + $mes->add('Removing Userclass: '.$name, $status); } break; @@ -1358,11 +1350,11 @@ class e107plugin if (varsettrue($this->unInstallOpts['del_userclasses'], FALSE)) { $status = $this->manage_userclass('remove', $name, $description) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add('Removing Userclass: '.$name, $status); + $mes->add('Removing Userclass: '.$name, $status); } else { - $emessage->add('Userclass: '.$name.' left in place'.$name, $status); + $mes->add('Userclass: '.$name.' left in place'.$name, $status); } break; @@ -1379,7 +1371,7 @@ class e107plugin */ function XmlExtendedFields($function,$array) { - $emessage = &eMessage::getInstance(); + $mes = e107::getMessage(); foreach($array['field'] as $efield) { @@ -1398,13 +1390,13 @@ class e107plugin if(!$remove) { $status = $this->manage_extended_field('add', $name, $type, $attrib['default'], $source) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add('Adding Extended Field: '.$name.' ... ', $status); + $mes->add('Adding Extended Field: '.$name.' ... ', $status); } if($function == 'upgrade' && $remove) //If upgrading, removing any inactive extended fields { $status = $this->manage_extended_field('remove', $name, $source) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add('Removing Extended Field: '.$name.' ... ', $status); + $mes->add('Removing Extended Field: '.$name.' ... ', $status); } break; @@ -1414,11 +1406,11 @@ class e107plugin if (varsettrue($this->unInstallOpts['del_extended'], FALSE)) { $status = ($this->manage_extended_field('remove', $name, $source)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; - $emessage->add('Removing Extended Field: '.$name.' ... ', $status); + $mes->add('Removing Extended Field: '.$name.' ... ', $status); } else { - $emessage->add('Extended Field: '.$name.' left in place'.$name, E_MESSAGE_SUCCESS); + $mes->add('Extended Field: '.$name.' left in place'.$name, E_MESSAGE_SUCCESS); } break; } @@ -1439,7 +1431,7 @@ class e107plugin //XXX Could also be used for theme prefs.. perhaps this function should be moved elsewhere? //TODO array support for prefs. ? or array() as used in xml site export? - $emessage = &eMessage::getInstance(); + $mes = e107::getMessage(); if(!varset($prefArray) || !varset($prefArray)) { @@ -1456,14 +1448,14 @@ class e107plugin if(varset($tag['@attributes']['value'])) { - $emessage->add("Deprecated plugin.xml spec. found. Use the following format: ".htmlentities("value"), E_MESSAGE_ERROR); + $mes->add("Deprecated plugin.xml spec. found. Use the following format: ".htmlentities("value"), E_MESSAGE_ERROR); } switch($function) { case 'install': $config->add($key,$value); - $emessage->add("Adding Pref: ".$key, E_MESSAGE_SUCCESS); + $mes->add("Adding Pref: ".$key, E_MESSAGE_SUCCESS); break; case 'upgrade' : @@ -1471,19 +1463,19 @@ class e107plugin if($remove) // remove active='false' prefs. { $config->remove($key,$value); - $emessage->add("Removing Pref: ".$key, E_MESSAGE_SUCCESS); + $mes->add("Removing Pref: ".$key, E_MESSAGE_SUCCESS); } else { $config->update($key,$value); - $emessage->add("Updating Pref: ".$key, E_MESSAGE_SUCCESS); + $mes->add("Updating Pref: ".$key, E_MESSAGE_SUCCESS); } break; case 'uninstall': $config->remove($key,$value); - $emessage->add("Removing Pref: ".$key, E_MESSAGE_SUCCESS); + $mes->add("Removing Pref: ".$key, E_MESSAGE_SUCCESS); break; } @@ -1510,7 +1502,7 @@ class e107plugin */ function execute_function($path = '', $what='', $when='') { - $emessage = eMessage::getInstance(); + $mes = eMessage::getInstance(); $class_name = $this->plugFolder."_setup"; $method_name = $what."_".$when; @@ -1525,7 +1517,7 @@ class e107plugin if(is_readable($setup_file)) { - $emessage->add("Found setup file ".$setup_file." ", E_MESSAGE_DEBUG); + $mes->add("Found setup file ".$setup_file." ", E_MESSAGE_DEBUG); include_once($setup_file); if(class_exists($class_name)) @@ -1533,27 +1525,27 @@ class e107plugin $obj = new $class_name; if(method_exists($obj,$method_name)) { - $emessage->add("Executing setup function ".$method_name."()", E_MESSAGE_DEBUG); + $mes->add("Executing setup function ".$method_name."()", E_MESSAGE_DEBUG); return call_user_func(array($obj,$method_name), $this); } else { - $emessage->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); + $mes->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); return FALSE; } } else { - $emessage->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); + $mes->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); return FALSE; } } else { - $emessage->add("Optional Setup File NOT Found ".$setup_file." ", E_MESSAGE_DEBUG); + $mes->add("Optional Setup File NOT Found ".$setup_file." ", E_MESSAGE_DEBUG); } - $emessage->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); + $mes->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); return FALSE; // IMPORTANT. } @@ -1718,7 +1710,7 @@ class e107plugin $_path = e_PLUGIN.$plug['plugin_path'].'/'; if(file_exists($_path.'plugin.xml')) { - $text = $this->manage_plugin_xml($id, 'install'); + $text = $this->install_plugin_xml($id, 'install'); } elseif(file_exists($_path.'plugin.php')) { @@ -1858,6 +1850,9 @@ class e107plugin } echo $plugin_path."/".$addon.".php - ".$passfail."
"; } + $mes = e107::getMessage(); + $mes->add('Detected addon: '.$addon.'', E_MESSAGE_DEBUG); + $p_addons[] = $addon; } } @@ -2042,8 +2037,8 @@ class e107plugin if ($this->plug_vars === FALSE) { require_once(e_HANDLER."message_handler.php"); - $emessage = &eMessage::getInstance(); - $emessage->add("Error reading {$plugName}/plugin.xml", E_MESSAGE_ERROR); + $mes = e107::getMessage(); + $mes->add("Error reading {$plugName}/plugin.xml", E_MESSAGE_ERROR); return FALSE; } diff --git a/e107_plugins/gsitemap/e_cron.php b/e107_plugins/gsitemap/e_cron.php index 08f8f07c2..991b23ad4 100644 --- a/e107_plugins/gsitemap/e_cron.php +++ b/e107_plugins/gsitemap/e_cron.php @@ -9,17 +9,17 @@ * Plugin configuration module - gsitemap * * $Source: /cvs_backup/e107_0.8/e107_plugins/gsitemap/e_cron.php,v $ - * $Revision: 1.2 $ - * $Date: 2008-12-20 21:48:06 $ - * $Author: e107steved $ + * $Revision: 1.3 $ + * $Date: 2009-10-23 09:08:15 $ + * $Author: e107coders $ * */ if (!defined('e107_INIT')) { exit; } -if(!plugInstalled('gsitemap')) +/*if(!plugInstalled('gsitemap')) { return; -} +}*/ // -------- e_cron setup ----------------------------------------------------- @@ -31,26 +31,52 @@ $cron2['name'] = "Test Email"; $cron2['function'] = "gsitemap_myfunction2"; $cron2['description'] = "Sends a test email to ".$pref['siteadminemail']; -$eplug_cron[] = $cron; -$eplug_cron[] = $cron2; + +// $eplug_cron[] = $cron2; // ------------------------- Functions ----------------------------------------- -function gsitemap_myfunction() // include plugin-folder in the function name. +class gsitemap_cron // include plugin-folder in the name. { - // Whatever code you wish. + function config() + { + global $pref; + + $cron = array(); + + $cron[] = array( + 'name' => "Update Records", + 'function' => "myfunction", + 'description' => "Dummy example." + ); + + $cron[] = array( + 'name' => "Test Email", + 'function' => "sendEmail", + 'description' => "Sends a test email to ".$pref['siteadminemail'] + ); + + return $cron; + } + + + + function myfunction() + { + // Whatever code you wish. + } + + + + function sendEmail() + { + global $pref; + require_once(e_HANDLER."mail.php"); + $message = "Your Cron Job worked correctly. Sent at ".date("r")."."; + sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']); + } } -function gsitemap_myfunction2() -{ - require_once(e_HANDLER."mail.php"); - $message = "Your Cron Job worked correctly. Sent at ".date("r")."."; - sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']); -} - - - - ?> \ No newline at end of file