| 831 | 
           florian | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
            | 
            | 
           3 | 
           ////////////////////////////////////////////////////////////////////////////////
  | 
        
        
            | 
            | 
           4 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           5 | 
           //   Copyright (C) 2006  Phorum Development Team                              //
  | 
        
        
            | 
            | 
           6 | 
           //   http://www.phorum.org                                                    //
  | 
        
        
            | 
            | 
           7 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           8 | 
           //   This program is free software. You can redistribute it and/or modify     //
  | 
        
        
            | 
            | 
           9 | 
           //   it under the terms of either the current Phorum License (viewable at     //
  | 
        
        
            | 
            | 
           10 | 
           //   phorum.org) or the Phorum License that was distributed with this file    //
  | 
        
        
            | 
            | 
           11 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           12 | 
           //   This program is distributed in the hope that it will be useful,          //
  | 
        
        
            | 
            | 
           13 | 
           //   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
  | 
        
        
            | 
            | 
           14 | 
           //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
  | 
        
        
            | 
            | 
           15 | 
           //                                                                            //
  | 
        
        
            | 
            | 
           16 | 
           //   You should have received a copy of the Phorum License                    //
  | 
        
        
            | 
            | 
           17 | 
           //   along with this program.                                                 //
  | 
        
        
            | 
            | 
           18 | 
           ////////////////////////////////////////////////////////////////////////////////
  | 
        
        
            | 
            | 
           19 | 
              | 
        
        
            | 
            | 
           20 | 
           // Check for a new version of the Phorum software. If there's a new version,
  | 
        
        
            | 
            | 
           21 | 
           // inform the admin about this.
  | 
        
        
            | 
            | 
           22 | 
              | 
        
        
            | 
            | 
           23 | 
           if(!defined("PHORUM_ADMIN")) return;
  | 
        
        
            | 
            | 
           24 | 
              | 
        
        
            | 
            | 
           25 | 
           require_once("./include/version_functions.php");
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           // Put in a variable, for easy testing of other version numbers.
  | 
        
        
            | 
            | 
           28 | 
           $phorum_ver = PHORUM;
  | 
        
        
            | 
            | 
           29 | 
              | 
        
        
            | 
            | 
           30 | 
           print '<div class="PhorumAdminTitle">Check for new Phorum version</div>';
  | 
        
        
            | 
            | 
           31 | 
           print '<br/>';
  | 
        
        
            | 
            | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
           // Show the current software version.
  | 
        
        
            | 
            | 
           34 | 
           list ($running_type, $dummy) = phorum_parse_version($phorum_ver);
  | 
        
        
            | 
            | 
           35 | 
           print "You are currently running the $running_type version $phorum_ver " .
  | 
        
        
            | 
            | 
           36 | 
                 " of the Phorum software.<br/>";
  | 
        
        
            | 
            | 
           37 | 
              | 
        
        
            | 
            | 
           38 | 
              | 
        
        
            | 
            | 
           39 | 
           // Find all available upgrades. If no releases can be found
  | 
        
        
            | 
            | 
           40 | 
           // for some reason, we ignore this and simply pretend the installation
  | 
        
        
            | 
            | 
           41 | 
           // is up-to-date.
  | 
        
        
            | 
            | 
           42 | 
           $releases = phorum_find_upgrades($phorum_ver);
  | 
        
        
            | 
            | 
           43 | 
              | 
        
        
            | 
            | 
           44 | 
           $new_s = isset($releases["stable"]) && $releases["stable"]["upgrade"];
  | 
        
        
            | 
            | 
           45 | 
           $new_d = isset($releases["development"]) && $releases["development"]["upgrade"];
  | 
        
        
            | 
            | 
           46 | 
              | 
        
        
            | 
            | 
           47 | 
           // Notice: when running a snapshot version.
  | 
        
        
            | 
            | 
           48 | 
           if ($running_type == 'snapshot') {
  | 
        
        
            | 
            | 
           49 | 
               print "<br/>If this Phorum installation is run on a production server, " .
  | 
        
        
            | 
            | 
           50 | 
                     "the Phorum team recommends upgrading to either a stable " .
  | 
        
        
            | 
            | 
           51 | 
                     "release or the latest development release. Snapshots should " .
  | 
        
        
            | 
            | 
           52 | 
                     "only be used for testing new bleeding edge features.<br/>";
  | 
        
        
            | 
            | 
           53 | 
           }
  | 
        
        
            | 
            | 
           54 | 
              | 
        
        
            | 
            | 
           55 | 
           // Notice: when running a stable release while a new stable is available.
  | 
        
        
            | 
            | 
           56 | 
           if ($running_type == 'stable' && $new_s) {
  | 
        
        
            | 
            | 
           57 | 
               print "<br/>A new stable release is available. The Phorum team " .
  | 
        
        
            | 
            | 
           58 | 
                     "recommends upgrading to this release as soon as possible.<br/>";
  | 
        
        
            | 
            | 
           59 | 
           }
  | 
        
        
            | 
            | 
           60 | 
              | 
        
        
            | 
            | 
           61 | 
           // Notice: when running a development release while a new stable
  | 
        
        
            | 
            | 
           62 | 
           // and development release are available.
  | 
        
        
            | 
            | 
           63 | 
           if ($running_type == 'development' && $new_s && $new_d) {
  | 
        
        
            | 
            | 
           64 | 
               print "<br/>There's both a new stable and a new development release " .
  | 
        
        
            | 
            | 
           65 | 
                     "available. If this Phorum installation " .
  | 
        
        
            | 
            | 
           66 | 
                     "is run on a production server, the Phorum team recommends " .
  | 
        
        
            | 
            | 
           67 | 
                     "upgrading to the stable version.<br/>";
  | 
        
        
            | 
            | 
           68 | 
           }
  | 
        
        
            | 
            | 
           69 | 
              | 
        
        
            | 
            | 
           70 | 
           // Notice: when running a development release while a new dev is available.
  | 
        
        
            | 
            | 
           71 | 
           if ($running_type == 'development' && $new_d && ! $new_s) {
  | 
        
        
            | 
            | 
           72 | 
               print "<br/>A new development release is available. If this Phorum " .
  | 
        
        
            | 
            | 
           73 | 
                     "installation is run on a production server, the Phorum team " .
  | 
        
        
            | 
            | 
           74 | 
                     "recommends only to upgrade in case new features are needed, " .
  | 
        
        
            | 
            | 
           75 | 
                     "bugs you are suffering from are fixed or security holes have been " .
  | 
        
        
            | 
            | 
           76 | 
                     "closed. Else wait until a stable release is available.<br/>";
  | 
        
        
            | 
            | 
           77 | 
           }
  | 
        
        
            | 
            | 
           78 | 
              | 
        
        
            | 
            | 
           79 | 
           // Display available upgrades.
  | 
        
        
            | 
            | 
           80 | 
           $found_upgrade = false;
  | 
        
        
            | 
            | 
           81 | 
           foreach (array("stable","development") as $type) {
  | 
        
        
            | 
            | 
           82 | 
               if (isset($releases[$type]) && $releases[$type]["upgrade"])
  | 
        
        
            | 
            | 
           83 | 
               {
  | 
        
        
            | 
            | 
           84 | 
                   $found_upgrade = true;
  | 
        
        
            | 
            | 
           85 | 
              | 
        
        
            | 
            | 
           86 | 
                   $ver = $releases[$type]["version"];
  | 
        
        
            | 
            | 
           87 | 
                   print "<br/><h3 class=\"input-form-th\">";
  | 
        
        
            | 
            | 
           88 | 
                   if ($running_type == 'snapshot') {
  | 
        
        
            | 
            | 
           89 | 
                       print "The current $type release is version $ver";
  | 
        
        
            | 
            | 
           90 | 
                   } else {
  | 
        
        
            | 
            | 
           91 | 
                       print "A new $type release (version $ver) is available";
  | 
        
        
            | 
            | 
           92 | 
                   }
  | 
        
        
            | 
            | 
           93 | 
                   print "</h3>";
  | 
        
        
            | 
            | 
           94 | 
              | 
        
        
            | 
            | 
           95 | 
                   print "This release can be downloaded from:<br/><ul>";
  | 
        
        
            | 
            | 
           96 | 
                   foreach ($releases["$type"]["locations"] as $url) {
  | 
        
        
            | 
            | 
           97 | 
                       print "<li><a href=\"". htmlspecialchars($url) . "\">" .
  | 
        
        
            | 
            | 
           98 | 
                             htmlspecialchars($url) . "</a></li>";
  | 
        
        
            | 
            | 
           99 | 
                   }
  | 
        
        
            | 
            | 
           100 | 
                   print "</ul>";
  | 
        
        
            | 
            | 
           101 | 
               }
  | 
        
        
            | 
            | 
           102 | 
           }
  | 
        
        
            | 
            | 
           103 | 
              | 
        
        
            | 
            | 
           104 | 
           if (! $found_upgrade) {
  | 
        
        
            | 
            | 
           105 | 
               print "<br/><h3 class=\"input-form-th\">" .
  | 
        
        
            | 
            | 
           106 | 
                     "Your Phorum installation is up to date</h3>";
  | 
        
        
            | 
            | 
           107 | 
           }
  | 
        
        
            | 
            | 
           108 | 
           ?>
  |