Пример #1
0
if ($session_status == 'on') {
    if (isset($_POST['draft'], $_POST['id'], $_POST['bin_mod']) && intval($_POST['draft']) == 0) {
        $id = $_POST['id'];
        $bin_mod = $_POST['bin_mod'];
        $sql = 'UPDATE ' . $info_table . " SET `draft` = '0', `bin_mod` = '" . $bin_mod . "' WHERE `id` = '" . $id . "'";
        $res = mysql_query($sql) or die("<h2>MySQL error</h2> " . mysql_errno() . " : " . mysql_error());
        if ($res) {
            $contents = '<div class="section">' . "\n" . '<h2 class="archive-title">' . $lang['file_published'] . "</h2>\n" . "</div>\n";
        }
        // Next, pull out the data and display the preview.
        $sql = 'SELECT ' . "`id`, `bin_title`, `bintype`, `binname`, `binsize`, `bindate`, " . "DATE_FORMAT(`bin_mod`, '%Y-%m-%d %T') as `bin_mod`, `bin_category`, `bincomment`, `bin_count`, `draft`" . ' FROM ' . $info_table . " WHERE `id` = '{$id}'";
        $res = mysql_query($sql);
        $row = mysql_fetch_array($res);
        // Generate XHTML
        $row = convert_to_utf8($row);
        format_date($row_name = 'bindate');
        $title_date = $formatted_date;
        $contents .= '<div class="section">' . "\n" . '<h2 class="date-title">' . $title_date . "</h2>\n";
        $contents .= display_binary_box($row);
        $contents .= file_uploaded();
        $contents .= "</div><!-- End .section -->\n";
        xhtml_output('');
    } else {
        // if user auth failed...
        header('Location: ' . $http . '://' . $_SERVER['HTTP_HOST'] . $cfg['root_path'] . 'index.php');
        exit;
    }
} else {
    header('Location: ' . $http . '://' . $_SERVER['HTTP_HOST'] . $cfg['root_path'] . 'index.php');
    exit;
}
Пример #2
0
                        }
                    }
                }
            }
        }
        if ($user) {
            if (!save_grades($user, $pset, null, $line, true)) {
                $Conf->errorMsg("no grades set for “" . htmlspecialchars($who) . "”");
            }
        } else {
            $Conf->errorMsg(htmlspecialchars($fname) . ":" . $csv->lineno() . ": unknown user “" . htmlspecialchars($who) . "”");
        }
    }
    return true;
}
if ($Me->isPC && check_post() && isset($_REQUEST["uploadgrades"]) && file_uploaded($_FILES["file"])) {
    if (($text = file_get_contents($_FILES["file"]["tmp_name"])) === false) {
        $Conf->errorMsg("Internal error: cannot read file.");
    } else {
        if (upload_grades($Pset, $text, $_FILES["file"]["name"])) {
            redirectSelf();
        }
    }
}
// save tab width, wdiff
if (isset($_REQUEST["tab"]) && ctype_digit($_REQUEST["tab"]) && $_REQUEST["tab"] >= 1 && $_REQUEST["tab"] <= 16) {
    $tab = (int) $_REQUEST["tab"];
    $tab = $tab == 4 ? null : $tab;
    $Info->update_commit_info(array("tabwidth" => $tab));
} else {
    if (isset($_REQUEST["tab"]) && ($_REQUEST["tab"] == "" || $_REQUEST["tab"] == "none")) {