events.push(function(){ $('#invokeupgrade').css('visibility','visible'); $('#backupdiv').css('visibility','visible'); }); </script> <?php $txt = gettext("A new version is now available") . "<br />"; $txt .= gettext("Current version") . ": " . $current_installed_version . "<br />"; if ($g['platform'] == "nanobsd") { $txt .= " " . gettext("NanoBSD Size") . " : " . trim(file_get_contents("/etc/nanosize.txt")) . "<br />"; } $txt .= "\t " . gettext("Built On") . ": " . $current_installed_buildtime . "<br />"; $txt .= "\t" . gettext("New version") . ": " . htmlspecialchars($remote_version, ENT_QUOTES | ENT_HTML401) . "<br /><br />"; $txt .= " " . gettext("Update source") . ": " . $updater_url . "<br />"; panel_text($txt); panel_heading_class('info'); ?> </form> <?php // Update the class of the message panel so that it's color changes // Use danger, success, info, warning, default etc function panel_heading_class($newclass = 'default') { ?> <script> events.push(function(){ $('#statusheading').removeClass().addClass('panel panel-' + '<?php echo $newclass; ?> ');
} if (!verify_gzip_file("{$g['upload_path']}/latest.tgz")) { panel_heading_text(gettext("The image file is corrupt.")); panel_heading_class('danger'); update_output_window(gettext("Update cannot continue")); if (file_exists("{$g['upload_path']}/latest.tgz")) { conf_mount_rw(); unlink("{$g['upload_path']}/latest.tgz"); conf_mount_ro(); } require "foot.inc"; exit; } if ($downloaded_latest_tgz_sha256 != $upgrade_latest_tgz_sha256) { panel_heading_text(gettext("Downloading complete but sha256 does not match.")); panel_heading_class('danger'); update_output_window(gettext("Auto upgrade aborted.") . " \n\n" . gettext("Downloaded SHA256") . ": " . $downloaded_latest_tgz_sha256 . "\n\n" . gettext("Needed SHA256") . ": " . $upgrade_latest_tgz_sha256); } else { update_output_window($g['product_name'] . " " . gettext("is now upgrading.") . "\\n\\n" . gettext("The firewall will reboot once the operation is completed.")); mwexec_bg($external_upgrade_helper_text); } /* Helper functions */ function read_body_firmware($ch, $string) { global $g, $fout, $file_size, $downloaded, $counter, $version, $latest_version; $length = strlen($string); $downloaded += intval($length); $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); $downloadProgress = 100 - $downloadProgress;