Beispiel #1
0
                }
            }
        }
        if ($mode == "reinstallpackages") {
            header("Location: pkg_mgr_install.php?mode=reinstallall");
            exit;
        } else {
            if ($mode == "clearpackagelock") {
                clear_subsystem_dirty('packagelock');
                $savemsg = "Package Lock Cleared";
            } else {
                if ($mode == "restore_ver") {
                    $input_errors[] = gettext("XXX - this feature may hose your config (do NOT backrev configs!) - billm");
                    if ($ver2restore != "") {
                        $conf_file = "{$g['cf_conf_path']}/bak/config-" . strtotime($ver2restore) . ".xml";
                        if (config_install($conf_file) == 0) {
                            mark_subsystem_dirty("restore");
                        } else {
                            $input_errors[] = gettext("The configuration could not be restored.");
                        }
                    } else {
                        $input_errors[] = gettext("No version selected.");
                    }
                }
            }
        }
    }
}
$id = rand() . '.' . time();
$mth = ini_get('upload_progress_meter.store_method');
$dir = ini_get('upload_progress_meter.file.filename_template');
Beispiel #2
0
            header("Content-Type: application/octet-stream");
            header("Content-Disposition: attachment; filename={$fn}");
            header("Content-Length: {$fs}");
            header("Pragma: hack");
            readfile("{$g['conf_path']}/config.xml");
            config_unlock();
            exit;
        } else {
            if ($mode === "restore") {
                if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
                    // Validate configuration backup
                    if (!validate_xml_config($_FILES['conffile']['tmp_name'], $g['xml_rootobj'])) {
                        $errormsg = sprintf(gettext("The configuration could not be restored. %s"), gettext("Invalid file format."));
                    } else {
                        // Install configuration backup
                        if (config_install($_FILES['conffile']['tmp_name']) == 0) {
                            system_reboot();
                            $savemsg = sprintf(gettext("The configuration has been restored. The server is now rebooting."));
                        } else {
                            $errormsg = gettext("The configuration could not be restored.");
                        }
                    }
                } else {
                    $errormsg = sprintf(gettext("The configuration could not be restored. No file was uploaded!"), $g_file_upload_error[$_FILES['conffile']['error']]);
                }
            }
        }
    }
}
include "fbegin.inc";
?>
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
##|+PRIV
##|*IDENT=page-hidden-uploadconfiguration
##|*NAME=Hidden: Upload Configuration
##|*DESCR=Allow access to the 'Hidden: Upload Configuration' page.
##|*MATCH=uploadconfig.php*
##|-PRIV
require_once "guiconfig.inc";
header("Content-Type: text/plain");
/* get config.xml in POST variable "config" */
if ($_POST['config']) {
    $fd = @fopen("{$g['tmp_path']}/config.xml", "w");
    if (!$fd) {
        echo gettext("ERR Could not save configuration.") . "\n";
        exit(0);
    }
    fwrite($fd, $_POST['config']);
    fclose($fd);
    if (config_install("{$g['tmp_path']}/config.xml") == 0) {
        echo gettext("OK") . "\n";
        system_reboot();
    } else {
        echo gettext("ERR Could not install configuration.") . "\n";
    }
} else {
    echo gettext("ERR Invalid configuration received.") . "\n";
}
exit(0);
Beispiel #4
0
                            if (!$validate) {
                                unlink($tempfile);
                            }
                        }
                    } else {
                        $validate = validate_xml_config($_FILES['conffile']['tmp_name'], $g['xml_rootobj']);
                    }
                    if (!$validate) {
                        $errormsg = sprintf(gettext("The configuration could not be restored. %s"), $encrypted ? gettext("Invalid file format or incorrect password.") : gettext("Invalid file format."));
                    } else {
                        // Install configuration backup
                        if ($encrypted) {
                            $ret = config_install($tempfile);
                            unlink($tempfile);
                        } else {
                            $ret = config_install($_FILES['conffile']['tmp_name']);
                        }
                        if ($ret == 0) {
                            system_reboot();
                            $savemsg = sprintf(gettext("The configuration has been restored. The server is now rebooting."));
                        } else {
                            $errormsg = gettext("The configuration could not be restored.");
                        }
                    }
                } else {
                    $errormsg = sprintf(gettext("The configuration could not be restored. No file was uploaded!"), $g_file_upload_error[$_FILES['conffile']['error']]);
                }
            }
        }
    }
}