Exemple #1
0
// inform the admin about this.
if (!defined("PHORUM_ADMIN")) {
    return;
}
require_once "./include/version_functions.php";
// Put in a variable, for easy testing of other version numbers.
$phorum_ver = PHORUM;
print '<div class="PhorumAdminTitle">Check for new Phorum version</div>';
print '<br/>';
// Show the current software version.
list($running_type, $dummy) = phorum_parse_version($phorum_ver);
print "You are currently running the {$running_type} version {$phorum_ver} " . " of the Phorum software.<br/>";
// Find all available upgrades. If no releases can be found
// for some reason, we ignore this and simply pretend the installation
// is up-to-date.
$releases = phorum_find_upgrades($phorum_ver);
$new_s = isset($releases["stable"]) && $releases["stable"]["upgrade"];
$new_d = isset($releases["development"]) && $releases["development"]["upgrade"];
// Notice: when running a snapshot version.
if ($running_type == 'snapshot') {
    print "<br/>If this Phorum installation is run on a production server, " . "the Phorum team recommends upgrading to either a stable " . "release or the latest development release. Snapshots should " . "only be used for testing new bleeding edge features.<br/>";
}
// Notice: when running a stable release while a new stable is available.
if ($running_type == 'stable' && $new_s) {
    print "<br/>A new stable release is available. The Phorum team " . "recommends upgrading to this release as soon as possible.<br/>";
}
// Notice: when running a development release while a new stable
// and development release are available.
if ($running_type == 'development' && $new_s && $new_d) {
    print "<br/>There's both a new stable and a new development release " . "available. If this Phorum installation " . "is run on a production server, the Phorum team recommends " . "upgrading to the stable version.<br/>";
}
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','version_iframe');

// Check for new versions of the Phorum software. Only do this once by
// issuing a cookie which remembers whether we need to upgrade or not.
// This file is included within an <iframe> in the admin interface header,
// so downtime of the phorum.org website won't affect the performance of
// the admin interface for Phorum users.

require_once('./common.php');

if (isset($_COOKIE["phorum_upgrade_available"])) {
    $upgrade_available = $_COOKIE["phorum_upgrade_available"];
} else {
    require_once('./include/version_functions.php');
    $releases = phorum_find_upgrades();
    if (isset($releases["stable"]) && $releases["stable"]["upgrade"]) {
        $upgrade_available = $releases["stable"]["version"];
    } elseif (isset($releases["development"]) && $releases["development"]["upgrade"]) {
        $upgrade_available = $releases["development"]["version"];
    } else {
        $upgrade_available = 0;
    }
}
setcookie("phorum_upgrade_available", $upgrade_available, 0, 
          $PHORUM["session_path"], $PHORUM["session_domain"]);

?>
<html>
  <head>
    <title>Phorum upgrade notification</title>