1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Theme release alerts added. Also, XML class was failing with remote files.

This commit is contained in:
CaMer0n
2009-08-17 12:48:52 +00:00
parent a7fb046ba6
commit 8ae34841ab
5 changed files with 98 additions and 13 deletions

View File

@@ -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

View File

@@ -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." <a href='".$url."'>".$name ." v".$version."</a><br />";
break;
}
}
if($txt)
{
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$emessage->add($txt);
if($cache==TRUE)
{
$e107cache->set('themeUpdateCheck', $txt, TRUE);
}
}
}
}
}
?>

View File

@@ -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;

View File

@@ -1,7 +1,7 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: lan_admin.php,v 1.23 2009-07-18 15:53:10 marj_nl_fr Exp $
* $Id: lan_admin.php,v 1.24 2009-08-17 12:48:52 e107coders Exp $
*
* Admin Language File
*/
@@ -180,6 +180,7 @@ define("ADLAN_158", "Cron Jobs and Automated Tasks");
define("ADLAN_159", "URL Configuration");
define("ADLAN_160", "Configure Site URLs");
define("ADLAN_161", "A newer version of your site-theme is available:");
define('ADLAN_CL_1', 'Settings');
define('ADLAN_CL_2', 'Users');
@@ -296,3 +297,5 @@ define("LAN_CATEGORY", "Category");
define("LAN_HELP", "Help");
define("LAN_MENULAYOUT", "Menu Layout");
define("LAN_IMAGEMANAGER", "Image Manager");
define("LAN_MOREINFO","More Information...");

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<e107Theme name="e107.v4" version="3.0" date="2003-06-11" compatibility="0.8">
<e107Theme name="e107.v4" version="3.0" date="2003-06-11" compatibility="0.8" releaseUrl='http://www.e107.org/themeupdate.php'>
<author name ="Steve Dunstan [jalist]" email="jalist@e107.org" url="http://e107.org" />
<description>Classic e107 theme</description>
<compliance xhtml="1.1" css="2.1" />