Example #1
0
} elseif ($_GET['t'] == "spa") {
    // verify parameters
    if (!isset($_POST['name']) || !isset($_POST['title'])) {
        THdie("Name and/or title parameter not specified!");
    }
    $name = trim($_POST['name']);
    $title = trim($_POST['title']);
    if ($title == "" || $name == "") {
        THdie("Invalid name and/or title parameter provided.");
    }
    // Now we check if it exists
    if ($db->checkstaticpagename($name) == true) {
        THdie("Another static page already has name '" . $name . "'.");
    }
    // I guess this is OK. Add it.
    $pageid = $db->addstaticpage($name, $title);
    // Redirect!
    header("Location: " . THurl . "admin.php?a=spe&id=" . $pageid);
} elseif ($_GET['t'] == "spx") {
    // verify parameters
    if (!isset($_GET['id'])) {
        THdie("ID parameter not specified!");
    }
    $id = intval($_GET['id']);
    // Clear the cache
    smclearpagecache($id);
    // Delete it from the DB
    $db->delstaticpage($id);
    // Redirect to the static pages list
    header("Location: " . THurl . "admin.php?a=sp");
} elseif ($_GET['t'] == "spe") {