コード例 #1
0
ファイル: admin.php プロジェクト: taqsuqs/drydock
    // Don't bother checking if the id actually
    // refers to something that exists - the way our SQL
    // queries work, it won't make a difference because in
    // that case there will be nothing matching the "WHERE ID=___"
    // clause.
    // Clean up the incoming parameters
    $id = intval($_POST['id']);
    $name = trim($_POST['name']);
    $title = trim($_POST['title']);
    $content = $_POST['content'];
    $publish = intval($_POST['publish']);
    // Check name/title aren't empty
    if ($name == "" || $title == "") {
        THdie("Invalid name and/or title parameter provided.");
    }
    // Now we check if it exists (we check with ID because we don't
    // want to match the current page we're editing)
    if ($db->checkstaticpagename($name, $id) == true) {
        THdie("Another static page already has name '" . $name . "'.");
    }
    // Check publish parameter
    if ($publish < 0 || $publish > 3) {
        THdie("Invalid publish option specified!");
    }
    // Everything checked out, so let's clear the cache and update
    // the info
    smclearpagecache($id);
    $db->editstaticpage($id, $name, $title, $content, $publish);
    // Redirect!
    header("Location: " . THurl . "admin.php?a=spe&id=" . $id);
}