Beispiel #1
0
if (get_magic_quotes_gpc() == true) {
    stripSlashesRec($_POST);
}
// Workaround, convert array $_POST["val"] to "plain" array $val
// Same with output-array ans misc-array
$val =& $_POST["val"];
$output =& $_POST["output"];
$misc =& $_POST["misc"];
// Save current setup (array $val)
if (isset($_POST["action"]) && $_POST["action"] == "save_setup") {
    // Convert the setup-coment
    $misc["comment"] = htmlentities($misc["comment"], ENT_QUOTES);
    $setuparray_combined["setup"] =& $val;
    $setuparray_combined["output"] =& $output;
    $setuparray_combined["misc"] =& $misc;
    $rw_error_message = save_setup($cfg_setupSaveDir, $_POST["save_setup_filename"], $setuparray_combined);
    if (!$rw_error_message) {
        $rw_message = "Setup was saved.";
    }
}
// Load a setup
if (isset($_POST["action"]) && $_POST["action"] == "load_setup") {
    $setuparray_combined =& load_setup($cfg_setupSaveDir, $_POST["selected_setup_filename"], $rw_error_message);
    if (!$rw_error_message) {
        $val =& $setuparray_combined["setup"];
        $output =& $setuparray_combined["output"];
        $misc =& $setuparray_combined["misc"];
        $rw_message = "Setup was loaded.";
        $_POST["save_setup_filename"] = $_POST["selected_setup_filename"];
    }
}
Beispiel #2
0
function append_to_uploads($entry, $tmp_file)
{
    // add system information
    $entry['uploaded'] = time();
    $entry['request'] = $_SERVER;
    $entry['original_name'] = $entry['name'];
    $entry['session'] = get_session_id();
    $safe_name = safe_file_name($entry['name']);
    $entry['name'] = $safe_name;
    $n = 1;
    while (file_exists($entry['name'])) {
        // make filename unique
        $entry['name'] = $n . '_' . $safe_name;
        $n++;
    }
    rename($tmp_file, get_storage_folder() . '/' . $entry['name']);
    if (lock(get_storage_folder() . '/.lock', true)) {
        $setup = get_setup();
        $setup['uploads'][md5(microtime())] = $entry;
        save_setup($setup);
        lock(get_storage_folder() . '/.lock', false);
    }
}