Esempio n. 1
0
         return 1;
     }
     $data = decrypt_data($data, $_POST['decrypt_password']);
 }
 if (stristr($data, "<m0n0wall>")) {
     log_error(gettext("Upgrading m0n0wall configuration to pfsense."));
     /* m0n0wall was found in config.  convert it. */
     $data = str_replace("m0n0wall", "pfsense", $data);
     $m0n0wall_upgrade = true;
 }
 if ($_POST['restorearea']) {
     /* restore a specific area of the configuration */
     if (!stristr($data, "<" . $_POST['restorearea'] . ">")) {
         $input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
     } else {
         if (!restore_config_section($_POST['restorearea'], $data)) {
             $input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
         } else {
             if ($config['rrddata']) {
                 restore_rrddata();
                 unset($config['rrddata']);
                 unlink_if_exists("{$g['tmp_path']}/config.cache");
                 write_config();
                 add_base_packages_menu_items();
                 convert_config();
                 conf_mount_ro();
             }
             filter_configure();
             $savemsg = gettext("The configuration area has been restored.  You may need to reboot the firewall.");
         }
     }
Esempio n. 2
0
 if (stristr($tmp, "m0n0wall") == true) {
     log_error("m0n0wall ayarlarını çevir.");
     /* m0n0wall was found in config.  convert it. */
     $upgradedconfig = str_replace("m0n0wall", "pfsense", $tmp);
     $fd = fopen($_FILES['conffile']['tmp_name'], "w");
     fwrite($fd, $upgradedconfig);
     fclose($fd);
     $m0n0wall_upgrade = true;
 }
 if ($_POST['restorearea'] != "") {
     /* restore a specific area of the configuration */
     $rules = file_get_contents($_FILES['conffile']['tmp_name']);
     if (stristr($rules, $_POST['restorearea']) == false) {
         $input_errors[] = "You have selected to restore a area but we could not locate the correct xml tag.";
     } else {
         restore_config_section($_POST['restorearea'], $rules);
         filter_configure();
         $savemsg = "The configuration area has been restored.  The firewall may need to be rebooted.";
     }
 } else {
     $rules = file_get_contents($_FILES['conffile']['tmp_name']);
     if (stristr($rules, "pfsense") == false) {
         $input_errors[] = "You have selected to restore the full configuration but we could not locate a pfsense tag.";
     } else {
         /* restore the entire configuration */
         if (config_install($_FILES['conffile']['tmp_name']) == 0) {
             /* this will be picked up by /index.php */
             conf_mount_rw();
             if ($g['platform'] != "cdrom") {
                 touch("/needs_package_sync");
             }