From b87d482b38dd68dfcaf97bc94a6b7ea833117240 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 13 Apr 2001 08:27:32 +0000 Subject: Last nights updates (under construction): - added _type() hook so each module can return the content types he/she implements --- includes/section.inc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'includes/section.inc') diff --git a/includes/section.inc b/includes/section.inc index b5e825b05..6ed1d4030 100644 --- a/includes/section.inc +++ b/includes/section.inc @@ -13,12 +13,13 @@ function section_get_array($field, $value) { } function section_save($edit) { - if ($edit["sid"]) { // ? - db_query("UPDATE section SET name = '". check_input($edit[name]) ."', pid = '". check_input($edit[pid]) ."' WHERE sid = $edit[sid]", 1); - } - else { - db_query("INSERT INTO section (name, pid) VALUES ('". check_input($edit[name])."', '". check_input($edit[pid]) ."')", 1); - } + if ($edit["sid"]) db_query("UPDATE section SET name = '". check_input($edit[name]) ."', pid = '". check_input($edit[pid]) ."' WHERE sid = $edit[sid]", 1); + else db_query("INSERT INTO section (name, pid) VALUES ('". check_input($edit[name])."', '". check_input($edit[pid]) ."')", 1); + + $sid = ($edit[sid] ? $edit[sid] : db_insert_id()); + + db_query("DELETE FROM section_type WHERE sid = '$sid'", 1); + foreach ($edit[type] as $key=>$type) db_query("INSERT INTO section_type (sid, type) VALUES ('". check_input($sid) ."', '". check_input($type) ."')", 1); } function section_tree($parent = 0, $name = "", $tree = array()) { -- cgit v1.2.3