diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 0b3c34a57..c60fa2593 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ -| $Revision: 1.41 $ -| $Date: 2009-07-09 21:39:31 $ -| $Author: e107steved $ +| $Revision: 1.42 $ +| $Date: 2009-08-17 12:48:52 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -108,6 +108,8 @@ function update_check() { global $ns, $dont_check_update, $e107info; + + $update_needed = FALSE; if ($dont_check_update === FALSE) @@ -128,6 +130,9 @@ function update_check() } } + + + // Now check plugins foreach($dbupdatep as $func => $rmks) { @@ -148,7 +153,6 @@ function update_check() $update_needed = ($dont_check_update == '2'); } - if ($update_needed === TRUE) { require_once (e_HANDLER."form_handler.php"); @@ -170,6 +174,15 @@ function update_check() } } + $curTheme = e107::getPref('sitetheme'); + $curVersion = e107::getPref('sitetheme_version'); + $curUrl = e107::getPref('sitetheme_releaseUrl'); + +require_once(e_HANDLER."theme_handler.php"); +$thm = new themeHandler; +$thm->themeReleaseCheck($curTheme,$curVersion,$curUrl); + + //-------------------------------------------- // Check current prefs against latest list diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 63248a994..c28b4f029 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -10,8 +10,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $ -| $Revision: 1.44 $ -| $Date: 2009-08-17 11:25:01 $ +| $Revision: 1.45 $ +| $Date: 2009-08-17 12:48:52 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -973,6 +973,8 @@ class themeHandler{ $pref['sitetheme_deflayout'] = $this->findDefault($themeArray[$this -> id]); $pref['sitetheme_layouts'] = is_array($this->themeArray[$pref['sitetheme']]['layouts']) ? $this->themeArray[$pref['sitetheme']]['layouts'] : array(); $pref['sitetheme_custompages'] = $this->themeArray[$pref['sitetheme']]['custompages']; + $pref['sitetheme_version'] = $this->themeArray[$pref['sitetheme']]['version']; + $pref['sitetheme_releaseUrl'] = $this->themeArray[$pref['sitetheme']]['releaseUrl']; $sql -> db_Delete("menus", "menu_layout !='' "); @@ -1188,6 +1190,7 @@ class themeHandler{ $vars['version'] = varset($vars['@attributes']['version']); $vars['date'] = varset($vars['@attributes']['date']); $vars['compatibility'] = varset($vars['@attributes']['compatibility']); + $vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']); $vars['email'] = varset($vars['author']['@attributes']['email']); $vars['website'] = varset($vars['author']['@attributes']['url']); $vars['author'] = varset($vars['author']['@attributes']['name']); @@ -1238,5 +1241,69 @@ class themeHandler{ return $vars; } + + + function themeReleaseCheck($curTheme,$curVersion,$releaseUrl,$cache=TRUE) + { + global $e107cache; + + if(!$releaseUrl) + { + return; + } + + $e107cache->CachePageMD5 = md5($curTheme.$curVersion); + + if(($cache==TRUE) && ($cacheData = $e107cache->retrieve('themeUpdateCheck', 3600, TRUE))) + { + require_once(e_HANDLER."message_handler.php"); + $emessage = &eMessage::getInstance(); + $emessage->add($cacheData); + return; + } + + require_once(e_HANDLER.'xml_class.php'); + $xml = new xmlClass; + + if(substr($releaseUrl,-4) == ".php") + { + $releaseUrl .= "?name=".$curTheme."&ver".$curVersion; + } + + if($rawData = $xml -> loadXMLfile($releaseUrl, TRUE)) + { + if(!$rawData['release'][1]) + { + $rawData['release'] = $rawData; + } + + $txt = ""; + + foreach($rawData['release'] as $val) + { + $name = $val['@attributes']['foldername']; + $version = $val['@attributes']['version']; + $url = $val['@attributes']['url']; + + if(($name == $curTheme) && version_compare($version,$curVersion)==1) + { + $txt .= ADLAN_161." ".$name ." v".$version."
"; + break; + } + } + + if($txt) + { + require_once (e_HANDLER."message_handler.php"); + $emessage = &eMessage::getInstance(); + $emessage->add($txt); + if($cache==TRUE) + { + $e107cache->set('themeUpdateCheck', $txt, TRUE); + } + } + } + } + } ?> \ No newline at end of file diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index 7d3901ccf..0d6efba24 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $ -| $Revision: 1.11 $ -| $Date: 2009-07-14 03:18:16 $ +| $Revision: 1.12 $ +| $Date: 2009-08-17 12:48:52 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -48,13 +48,15 @@ class xmlClass $address = str_replace(array("\r","\n", "\t"),'',$address); // May be paranoia, but streaky thought it might be a good idea // ... and there shouldn't be unprintable characters in the URL anyway - + if(function_exists('file_get_contents')) { + $old_timeout = e107_ini_set('default_socket_timeout', $timeout); -// $data = file_get_contents(urlencode($address)); - $data = file_get_contents(htmlspecialchars($address)); // PHP manual says to use urlencode() - but this seems to work better + $data = file_get_contents(urlencode($address)); + // $data = file_get_contents(htmlspecialchars($address)); // buggy - sometimes fails. if ($old_timeout !== FALSE) { e107_ini_set('default_socket_timeout', $old_timeout); } + if ($data) { return $data; diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 833595f01..095e2b996 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -1,7 +1,7 @@ - + Classic e107 theme