1<?php
2/**
3 * Update Check
4 *
5 *
6 * @desc Find VFront availables updates
7 * @package VFront
8 * @subpackage Administration
9 * @author M.Marcello Verona
10 * @copyright 2007-2010 M.Marcello Verona
11 * @version 0.96 $Id$
12 * @license http://www.gnu.org/licenses/gpl.html GNU Public License
13 */
14
15require_once("../inc/conn.php");
16require_once("../inc/func.comuni.php");
17
18
19
20
21$URL="http://www.vfront.org/version.rss";
22
23$RSS=@join("",@file($URL));
24
25if($RSS!==null){
26
27	$xml = new SimpleXMLElement($RSS);
28
29	foreach(@$xml->channel->item as $val){
30
31		if(preg_match("|\.zip|",$val->title)){
32
33			$last_data=(string) $val->pubDate;
34
35			preg_match("|/([a-z0-9_.-]+)\.zip|u",$val->title,$version_name);
36
37			break;
38		}
39	}
40
41	// Condition .svn?
42
43	$totime=strtotime($last_data);
44
45	$data_last = date("Ymd",$totime);
46
47	// Compare to...
48
49	$XML_VERSION=join('',file(FRONT_ROOT."/vf_version.xml"));
50
51	$xml2 = new SimpleXMLElement($XML_VERSION);
52
53	preg_match("|([0-9]{4}-[0-9]{2}-[0-9]{2})|",$xml2->subversion_date[0],$ff);
54
55	$data_version=str_replace("-",'',$ff[0]);
56
57	if(strlen($data_last)==8 && strlen($data_version)==8 && (intval($data_last) > intval($data_version))){
58
59		$find=array('last_data'=>date("Y-m-d",$totime), 'name'=>$version_name[1]);
60	}
61	else{
62		$find=array();
63	}
64
65
66	if(count($find)==0){
67
68		echo "";
69	}
70	else{
71
72		echo sprintf(_("Warning: your VFront version is out to date. The %s version is online (%s)."),
73					"<strong>".$find['name']."</strong>",
74					"<strong>".date_encode($find['last_data'])."</strong>");
75	}
76
77
78}
79
80
81
82
83
84
85
86
87
88
89
90?>