1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-12 01:25:01 +02:00

Code cleanup / globals removal etc.

This commit is contained in:
Cameron
2015-02-15 16:07:27 -08:00
parent 83ea70f881
commit 9a21cad851
39 changed files with 198 additions and 154 deletions

View File

@@ -83,66 +83,66 @@ class _system_cron
{
// Check if there's a core e107 update available
// Get site version
if (is_readable(e_ADMIN."ver.php"))
{
include (e_ADMIN."ver.php"); // $e107info['e107_version'];
}
else
{
// Find alternate way to get local site version or throw an error
}
// Check for updates for currently installed version
$localVersion = (int) $e107info['e107_version'];
switch ($localVersion) {
case 0:
// Local version is <= 0.7
// Run update routine for 0.x
break;
case 1:
// Local version is == 1.x
// Run update routine for 1.x
break;
case 2:
// Local version is == 2.x
// Run update routine for 2.x
// Get newest available release version
$xml = e107::getXml();
$file = "http://e107.org/releases.php?mode=2";
$xdata = $xml->loadXMLfile($file,true,false);
// Check for update
if ($e107info['e107_version'] < $xdata['core']['@attributes']['version'])
{
// If there is a new version of e107 available, notify Site Admin by email, make a log entry, and notify Admin in Admin Area, $versionTest = false
$pref = e107::getPref();
require_once(e_HANDLER.'mail.php');
$message = "There is a new version of e107 available. Please visit http://www.e107.org for further details.";
sendemail($pref['siteadminemail'], "e107 - Update(s) Available For " . $pref['sitename'], $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
// Add entry to the log
e107::getAdminLog()->add("Update(s) Available", "There is a new version of e107 available. Please visit http://www.e107.org for further details.", 3);
// Get site version
if (is_readable(e_ADMIN."ver.php"))
{
include (e_ADMIN."ver.php"); // $e107info['e107_version'];
}
else
{
// Find alternate way to get local site version or throw an error
}
$versionTest = $xdata['core']['@attributes']['version'];
}
else
{
// If there is not a new version of e107 available, $versionTest = false
// Check for updates for currently installed version
$localVersion = (int) $e107info['e107_version'];
switch ($localVersion) {
case 0:
// Local version is <= 0.7
// Run update routine for 0.x
break;
case 1:
// Local version is == 1.x
// Run update routine for 1.x
break;
case 2:
// Local version is == 2.x
// Run update routine for 2.x
// Get newest available release version
$xml = e107::getXml();
$file = "http://e107.org/releases.php?mode=2";
$xdata = $xml->loadXMLfile($file,true,false);
// Check for update
if ($e107info['e107_version'] < $xdata['core']['@attributes']['version'])
{
// If there is a new version of e107 available, notify Site Admin by email, make a log entry, and notify Admin in Admin Area, $versionTest = false
$pref = e107::getPref();
require_once(e_HANDLER.'mail.php');
$message = "There is a new version of e107 available. Please visit http://www.e107.org for further details.";
sendemail($pref['siteadminemail'], "e107 - Update(s) Available For " . $pref['sitename'], $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
// Add entry to the log
e107::getAdminLog()->add("Update(s) Available", "There is a new version of e107 available. Please visit http://www.e107.org for further details.", 3);
$versionTest = $xdata['core']['@attributes']['version'];
}
else
{
// If there is not a new version of e107 available, $versionTest = false
$versionTest = false;
}
break;
}
break;
}
//$versionTest = "{CHECK THE VERSION}"; // If out of date, return some text, if up-to-date , return false;
$che = e107::getCache();
$che->setMD5(e_LANGUAGE);
$che = e107::getCache();
$che->setMD5(e_LANGUAGE);
if($versionTest)
{
@@ -222,7 +222,7 @@ class _system_cron
$ipManager->banRetriggerAction();
if (CRON_RETRIGGER_DEBUG)
{
$e107->admin_log->e_log_event(10,debug_backtrace(),'DEBUG','CRON Ban Retrigger','Retrigger processing completed',FALSE,LOG_TO_ROLLING);
e107::getLog()->e_log_event(10,debug_backtrace(),'DEBUG','CRON Ban Retrigger','Retrigger processing completed',FALSE,LOG_TO_ROLLING);
}
}