"Fossies" - the Fresh Open Source Software Archive

Member "fogproject-1.5.9/packages/web/status/mainversion.php" (13 Sep 2020, 2497 Bytes) of package /linux/misc/fogproject-1.5.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "mainversion.php" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.5.8_vs_1.5.9.

    1 <?php
    2 /**
    3  * Gets version information
    4  *
    5  * PHP version 5
    6  *
    7  * @category Mainversion
    8  * @package  FOGProject
    9  * @author   Tom Elliott <tommygunsster@gmail.com>
   10  * @license  http://opensource.org/licenses/gpl-3.0 GPLv3
   11  * @link     https://fogproject.org
   12  */
   13 /**
   14  * Gets version information
   15  *
   16  * @category Mainversion
   17  * @package  FOGProject
   18  * @author   Tom Elliott <tommygunsster@gmail.com>
   19  * @license  http://opensource.org/licenses/gpl-3.0 GPLv3
   20  * @link     https://fogproject.org
   21  */
   22 require '../commons/base.inc.php';
   23 session_write_close();
   24 ignore_user_abort(true);
   25 set_time_limit(0);
   26 
   27 $curversion = FOG_VERSION;
   28 $urls = array(
   29     'https://api.github.com/repos/fogproject/fogproject/tags',
   30     'https://raw.githubusercontent.com/FOGProject/fogproject/dev-branch/packages/web/lib/fog/system.class.php',
   31     'https://raw.githubusercontent.com/FOGProject/fogproject/working-1.6/packages/web/lib/fog/system.class.php'
   32 );
   33 $resp = $FOGURLRequests->process($urls);
   34 
   35 $tags = json_decode(array_shift($resp));
   36 foreach ($tags as $tag) {
   37     if (preg_match('/^[0-9]\.[0-9]\.[0-9]$/', $tag->name)) {
   38         $stableversion = $tag->name;
   39         break;
   40     }
   41 }
   42 $systemclass = array_shift($resp);
   43 if (preg_match("/FOG_VERSION', '([0-9.RCalphbet-]*)'/", $systemclass, $fogver)) {
   44     $devversion = $fogver[1];
   45 }
   46 $systemclass = array_shift($resp);
   47 if (preg_match("/FOG_VERSION', '([0-9.RCalphbet-]*)'/", $systemclass, $fogver)) {
   48     $alphaversion = $fogver[1];
   49 }
   50 
   51 $stablecheck = version_compare($curversion, $stableversion, '=');
   52 $devcheck = version_compare($curversion, $devversion, '=');
   53 $alphacheck = version_compare($curversion, $alphaversion, '=');
   54 
   55 if (!$stablecheck && !$devcheck && !$alphacheck) {
   56     $result = '<font face="arial" color="red" size="4"><b>You are not running the most current version of FOG!</b></font>'
   57     . "<p>You are currently running version: $curversion</p>"
   58     . "<p>Latest stable version is " . $stableversion . "</p>"
   59     . "<p>Latest dev-branch version is $devversion</p>"
   60     . "<p>Latest alpha-branch version is $alphaversion</p>";
   61 } else {
   62     $result = "<b>Your version of FOG is up to date.</b><br/>";
   63     if ($stablecheck) {
   64         $result .= "You're running the latest stable version: " . $stableversion;
   65     } elseif ($devcheck) {
   66         $result .= "You're running the latest dev-branch version: " . $devversion;
   67     } else {
   68         $result .= "You're running the latest alpha-branch version: " . $alphaversion;
   69     }
   70 }
   71 
   72 
   73 echo json_encode($result);
   74 exit;