}
    }
}
/* launch external upgrade helper */
$external_upgrade_helper_text = "/etc/rc.firmware ";
if ($g['platform'] == "nanobsd") {
    $external_upgrade_helper_text .= "pfSenseNanoBSDupgrade ";
} else {
    $external_upgrade_helper_text .= "pfSenseupgrade ";
}
$external_upgrade_helper_text .= "{$g['upload_path']}/latest.tgz";
$downloaded_latest_tgz_sha256 = str_replace("\n", "", `/sbin/sha256 -q {$g['upload_path']}/latest.tgz`);
$upgrade_latest_tgz_sha256 = str_replace("\n", "", `/bin/cat {$g['upload_path']}/latest.tgz.sha256 | awk '{ print \$4 }'`);
$sigchk = 0;
if (!isset($curcfg['alturl']['enable'])) {
    $sigchk = verify_digital_signature("{$g['upload_path']}/latest.tgz");
}
$exitstatus = 0;
if ($sigchk == 1) {
    $sig_warning = gettext("The digital signature on this image is invalid.");
    $exitstatus = 1;
} else {
    if ($sigchk == 2) {
        $sig_warning = gettext("This image is not digitally signed.");
        if (!isset($config['system']['firmware']['allowinvalidsig'])) {
            $exitstatus = 1;
        }
    } else {
        if ($sigchk >= 3) {
            $sig_warning = gettext("There has been an error verifying the signature on this image.");
            $exitstatus = 1;
 /* verify firmware image(s) */
 if (file_is_for_platform($_FILES['ulfile']['tmp_name'], $_FILES['ulfile']['name']) == false && !$_POST['sig_override']) {
     $input_errors[] = "Yüklenen imaj dosyası bu platforma ait değil! ({$g['platform']}).";
 } else {
     if (!file_exists($_FILES['ulfile']['tmp_name'])) {
         /* probably out of memory for the MFS */
         $input_errors[] = "Imaj yükleme hatası (Hafıza kaynaklı?)";
         exec_rc_script("/etc/rc.firmware disable");
         if (file_exists($d_fwupenabled_path)) {
             unlink($d_fwupenabled_path);
         }
     } else {
         /* move the image so PHP won't delete it */
         rename($_FILES['ulfile']['tmp_name'], "{$g['upload_path']}/firmware.tgz");
         /* check digital signature */
         $sigchk = verify_digital_signature("{$g['upload_path']}/firmware.tgz");
         if ($sigchk == 1) {
             $sig_warning = "Imaj ait dijital imza hatalı!";
         } else {
             if ($sigchk == 2) {
                 $sig_warning = "Imaj dijital olarak imzalanmamış!";
             } else {
                 if ($sigchk == 3 || $sigchk == 4) {
                     $sig_warning = "Imaj imza belirlemede hata ile karşılaşıldı!";
                 }
             }
         }
         if (!verify_gzip_file("{$g['upload_path']}/firmware.tgz")) {
             $input_errors[] = "Imaj dosyası bozuk!";
             unlink("{$g['upload_path']}/firmware.tgz");
         }