From 100909a910c2cac1f36af5df6140dbc96807d607 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 10 Apr 2014 11:19:45 +0200 Subject: [PATCH] check for new versions --- out/out.Info.php | 9 ++++++++- views/bootstrap/class.Info.php | 13 +++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/out/out.Info.php b/out/out.Info.php index 7918c2e44..045c54b5d 100644 --- a/out/out.Info.php +++ b/out/out.Info.php @@ -30,9 +30,16 @@ if (!$user->isAdmin()) { } $v = new SeedDMS_Version; +if(@ini_get('allow_url_fopen') == '1') { + $lines = file('http://www.seeddms.org/latest', FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); + $versions = array(); + foreach($lines as $line) { + $versions[] = explode(':', $line); + } +} $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'version'=>$v)); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'version'=>$v, 'availversions'=>$versions)); if($view) { $view->show(); exit; diff --git a/views/bootstrap/class.Info.php b/views/bootstrap/class.Info.php index 050bc4855..7d800f573 100644 --- a/views/bootstrap/class.Info.php +++ b/views/bootstrap/class.Info.php @@ -35,11 +35,24 @@ class SeedDMS_View_Info extends SeedDMS_Bootstrap_Style { $dms = $this->params['dms']; $user = $this->params['user']; $version = $this->params['version']; + $availversions = $this->params['availversions']; $this->htmlStartPage(getMLText("admin_tools")); $this->globalNavigation(); $this->contentStart(); $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); + if($availversions) { + $newversion = ''; + foreach($availversions as $availversion) { + if($availversion[0] == 'stable') + $newversion = $availversion[1]; + } + if($newversion > $version->_number) { + $this->warningMsg(getMLText('no_current_version', array('latestversion'=>$newversion))); + } + } else { + $this->warningMsg(getMLText('no_version_check')); + } $this->contentContainerStart(); echo $version->banner(); $this->contentContainerEnd();