download_file_with_progress_bar("{$updater_url}/version{$nanosize}", "/tmp/{$g['product_name']}_version");
$latest_version = str_replace("\n", "", @file_get_contents("/tmp/{$g['product_name']}_version"));
if (!$latest_version) {
    update_output_window(gettext("Unable to check for updates."));
    require "fend.inc";
    exit;
} else {
    $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime"));
    $latest_version = trim(@file_get_contents("/tmp/{$g['product_name']}_version"));
    $latest_version_pfsense = strtotime($latest_version);
    if (!$latest_version) {
        update_output_window(gettext("Unable to check for updates."));
        require "fend.inc";
        exit;
    } else {
        if (pfs_version_compare($current_installed_buildtime, $g['product_version'], $latest_version) == -1) {
            update_status(gettext("Downloading updates") . "...");
            conf_mount_rw();
            if ($g['platform'] == "nanobsd") {
                $update_filename = "latest{$nanosize}.img.gz";
            } else {
                $update_filename = "latest.tgz";
            }
            $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}", "{$g['upload_path']}/latest.tgz", "read_body_firmware");
            $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}.sha256", "{$g['upload_path']}/latest.tgz.sha256");
            conf_mount_ro();
            update_output_window("{$g['product_name']} " . gettext("download complete."));
        } else {
            update_output_window(gettext("You are on the latest version."));
            require "fend.inc";
            exit;
        $nanosize = "-nanobsd-" . strtolower(trim(file_get_contents("/etc/nanosize.txt")));
    }
    @unlink("/tmp/{$g['product_name']}_version");
    if (download_file_with_progress_bar("{$updater_url}/version{$nanosize}", "/tmp/{$g['product_name']}_version", 'read_body', 5, 5) === true) {
        $remote_version = trim(@file_get_contents("/tmp/{$g['product_name']}_version"));
    }
    if (empty($remote_version)) {
        echo "<br /><br />Unable to check for updates.";
    } else {
        $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime"));
        $current_installed_version = trim(file_get_contents("/etc/version"));
        if (!$remote_version) {
            echo "<br /><br />Unable to check for updates.";
        } else {
            $needs_system_upgrade = false;
            if (pfs_version_compare($current_installed_buildtime, $current_installed_version, $remote_version) == -1) {
                echo "<br/><span class=\"red\" id=\"updatealert\"><b>Update available. </b></span><a href=\"/system_firmware_check.php\">Click Here</a> to view update.";
                echo "<script type=\"text/javascript\">";
                echo "jQuery('#updatealert').effect('pulsate',{times: 30},10000);";
                echo "</script>";
            } else {
                echo "<br />You are on the latest version.";
            }
        }
    }
    exit;
}
$curcfg = $config['system']['firmware'];
?>
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
Пример #3
0
$latest_version = str_replace("\n", "", @file_get_contents("/tmp/{$g['product_name']}_version"));
if (!$latest_version) {
    update_output_window(gettext("Unable to check for updates."));
    require "fend.inc";
    exit;
} else {
    $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime"));
    $current_installed_version = trim(file_get_contents("/etc/version"));
    $latest_version = trim(@file_get_contents("/tmp/{$g['product_name']}_version"));
    $latest_version_pfsense = strtotime($latest_version);
    if (!$latest_version) {
        update_output_window(gettext("Unable to check for updates."));
        require "fend.inc";
        exit;
    } else {
        if (pfs_version_compare($current_installed_buildtime, $current_installed_version, $latest_version) == -1) {
            update_status(gettext("Downloading updates") . "...");
            conf_mount_rw();
            if ($g['platform'] == "nanobsd") {
                $update_filename = "latest{$nanosize}.img.gz";
            } else {
                $update_filename = "latest.tgz";
            }
            $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}", "{$g['upload_path']}/latest.tgz", "read_body_firmware");
            $status = download_file_with_progress_bar("{$updater_url}/{$update_filename}.sha256", "{$g['upload_path']}/latest.tgz.sha256");
            conf_mount_ro();
            update_output_window("{$g['product_name']} " . gettext("download complete."));
        } else {
            update_output_window(gettext("You are on the latest version."));
            require "fend.inc";
            exit;
Пример #4
0
            }
            /* If there is no required version, and the requested package 
            			version is not 'none', then skip */
            if (empty($index['required_version']) && $requested_version != "none") {
                continue;
            }
            /* If the requested version is not 'other', and the required version is newer than what we have, skip. */
            if ($requested_version != "other" && pfs_version_compare("", $version, $index['required_version']) < 0) {
                continue;
            }
            /* If the requestion version is 'other' and we are on the version requested, skip. */
            if ($requested_version == "other" && pfs_version_compare("", $version, $index['required_version']) == 0) {
                continue;
            }
            /* Package is only for an older version, lets skip */
            if ($index['maximum_version'] && pfs_version_compare("", $version, $index['maximum_version']) > 0) {
                continue;
            }
            ?>
					<tr valign="top">
						<td class="listlr">
							<A target="_blank" href="<?php 
            echo $index['website'];
            ?>
"><?php 
            echo $index['name'];
            ?>
</a>
						</td>
						<td class="listr">
							<?php 
     }
     $nanosize .= strtolower(trim(file_get_contents("/etc/nanosize.txt")));
 }
 @unlink("/tmp/{$g['product_name']}_version");
 if (download_file_with_progress_bar("{$updater_url}/version{$nanosize}", "/tmp/{$g['product_name']}_version", 'read_body', 5, 5) === true) {
     $remote_version = trim(@file_get_contents("/tmp/{$g['product_name']}_version"));
 }
 if (empty($remote_version)) {
     echo "<br /><br />Unable to check for updates.";
 } else {
     $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime"));
     if (!$remote_version) {
         echo "<br /><br />Unable to check for updates.";
     } else {
         $needs_system_upgrade = false;
         $version_compare = pfs_version_compare($current_installed_buildtime, $g['product_version'], $remote_version);
         if ($version_compare == -1) {
             echo "<br /><span class=\"red\" id=\"updatealert\"><b>Update available. </b></span><a href=\"/system_firmware_check.php\">Click Here</a> to view update.";
             echo "\n<script type=\"text/javascript\">\n";
             echo "//<![CDATA[\n";
             echo "jQuery('#updatealert').effect('pulsate',{times: 30},10000);\n";
             echo "//]]>\n";
             echo "</script>\n";
         } elseif ($version_compare == 1) {
             echo "<br />You are on a later version than the official release.";
         } else {
             echo "<br />You are on the latest version.";
         }
     }
 }
 exit;