This commit is contained in:
Shish 2012-03-19 18:57:33 +00:00
parent e3f00166a7
commit 1a711eca83

View file

@ -48,6 +48,7 @@ class Blocks extends Extension {
INSERT INTO blocks (pages, title, area, priority, content) INSERT INTO blocks (pages, title, area, priority, content)
VALUES (?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?)
", array($_POST['pages'], $_POST['title'], $_POST['area'], (int)$_POST['priority'], $_POST['content'])); ", array($_POST['pages'], $_POST['title'], $_POST['area'], (int)$_POST['priority'], $_POST['content']));
log_info("blocks", "Added Block #".($database->get_last_insert_id('blocks_id_seq'))." (".$_POST['title'].")");
$page->set_mode("redirect"); $page->set_mode("redirect");
$page->set_redirect(make_link("blocks/list")); $page->set_redirect(make_link("blocks/list"));
} }
@ -59,26 +60,19 @@ class Blocks extends Extension {
DELETE FROM blocks DELETE FROM blocks
WHERE id=? WHERE id=?
", array($_POST['id'])); ", array($_POST['id']));
log_info("blocks", "Deleted Block #".$_POST['id']);
} }
else { else {
$database->execute(" $database->execute("
UPDATE blocks SET pages=?, title=?, area=?, priority=?, content=? UPDATE blocks SET pages=?, title=?, area=?, priority=?, content=?
WHERE id=? WHERE id=?
", array($_POST['pages'], $_POST['title'], $_POST['area'], (int)$_POST['priority'], $_POST['content'], $_POST['id'])); ", array($_POST['pages'], $_POST['title'], $_POST['area'], (int)$_POST['priority'], $_POST['content'], $_POST['id']));
log_info("blocks", "Updated Block #".$_POST['id']." (".$_POST['title'].")");
} }
$page->set_mode("redirect"); $page->set_mode("redirect");
$page->set_redirect(make_link("blocks/list")); $page->set_redirect(make_link("blocks/list"));
} }
} }
else if($event->get_arg(0) == "remove") {
if($user->check_auth_token()) {
$database->execute("DELETE FROM blocks WHERE id=:id", array("id" => $_POST['id']));
log_info("alias_editor", "Deleted Block #".$_POST['id']);
$page->set_mode("redirect");
$page->set_redirect(make_link("blocks/list"));
}
}
else if($event->get_arg(0) == "list") { else if($event->get_arg(0) == "list") {
$this->theme->display_blocks($database->get_all("SELECT * FROM blocks")); $this->theme->display_blocks($database->get_all("SELECT * FROM blocks"));
} }