diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php
index e12ef58cebf..7c85f820eab 100644
--- a/htdocs/admin/tools/update.php
+++ b/htdocs/admin/tools/update.php
@@ -24,6 +24,7 @@
require '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
+include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
$langs->load("admin");
$langs->load("other");
@@ -105,28 +106,39 @@ llxHeader('',$langs->trans("Upgrade"),$wikihelp);
print_fiche_titre($langs->trans("Upgrade"),'','setup');
print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
';
-if ($sfurl = simplexml_load_file('http://sourceforge.net/projects/dolibarr/rss')) {
- $title=$sfurl->channel[0]->item[0]->title;
-function word_limiter( $text, $limit = 30, $chars = '0123456789.' ) {
- if( strlen( $text ) > $limit ) {
- $words = str_word_count( $text, 2, $chars );
- $words = array_reverse( $words, TRUE );
- foreach( $words as $length => $word ) {
- if( $length + strlen( $word ) >= $limit ) {
- array_shift( $words );
- } else {
- break;
- }
- }
- $words = array_reverse( $words );
- $text = implode( " ", $words ) . '';
- }
- return $text;
-}
-$str = $title;
-print $langs->trans("LastStableVersion").' : '. word_limiter( $str ).'
';
-} else {
+$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
+//var_dump($result['content']);
+$sfurl = simplexml_load_string($result['content']);
+if ($sfurl)
+{
+ $title=$sfurl->channel[0]->item[0]->title;
+
+ function word_limiter($text, $limit = 30, $chars = '0123456789.')
+ {
+ if (strlen( $text ) > $limit)
+ {
+ $words = str_word_count($text, 2, $chars);
+ $words = array_reverse($words, TRUE);
+ foreach($words as $length => $word) {
+ if ($length + strlen( $word ) >= $limit)
+ {
+ array_shift($words);
+ } else {
+ break;
+ }
+ }
+ $words = array_reverse($words);
+ $text = implode(" ", $words) . '';
+ }
+ return $text;
+ }
+
+ $str = $title;
+ print $langs->trans("LastStableVersion").' : '. word_limiter( $str ).'
';
+}
+else
+{
print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
';
}
print '
';