summaryrefslogtreecommitdiff
path: root/includes/structure.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-04-16 11:38:12 +0000
committerDries Buytaert <dries@buytaert.net>2001-04-16 11:38:12 +0000
commitb9952f537d5f1a102e145b0529c78bc31a1509af (patch)
tree51f6a0ab5c46bd4643c5b2ac0579a4a411e45977 /includes/structure.inc
parent49a7dccb64a239097d44e235b525708c6a39d29e (diff)
downloadbrdo-b9952f537d5f1a102e145b0529c78bc31a1509af.tar.gz
brdo-b9952f537d5f1a102e145b0529c78bc31a1509af.tar.bz2
Large commit, read it carefully, and make the required changes to
your theme: - corrected some missing translations in story.module. Oops! - grealty simplified the "moderation threshold mechanism"(tm) so that module writers don't have to worry about this. As a result story.module and book.module became a bit smaller and easier to grasp. - greatly simplified new "category" and "topic" code which is soon going to replace the "section" code. Needs more work though so hang on thight. - includes/section.inc and modules/section.module are replaced by includes/structure.module and modules/structure.module. - beautified example.theme a bit without adding HTML complexity: it is a good example but still useful as a theme - made theme example use "categories" and "topics" --> TAKE A LOOK AT IT AND UPDATE YOUR THEME - made theme marvin use "categories" and "topics" --> TAKE A LOOK AT IT AND UPDATE YOUR THEME - added 2 new "story listings" to administrator interface of story.module to verify story integrity. - optimized comment table a bit (work in progress)
Diffstat (limited to 'includes/structure.inc')
-rw-r--r--includes/structure.inc32
1 files changed, 19 insertions, 13 deletions
diff --git a/includes/structure.inc b/includes/structure.inc
index 838d0e351..4326e092e 100644
--- a/includes/structure.inc
+++ b/includes/structure.inc
@@ -25,19 +25,30 @@ function category_save($edit) {
// delete category $cid:
function category_del($cid) {
db_query("DELETE FROM category WHERE cid = '". check_input($cid) ."'");
- db_query("DELETE FROM node_category WHERE cid = '". check_input($cid) ."'");
+ db_query("UPDATE node SET cid = 0 WHERE cid = '". check_input($cid) ."'");
}
-function category_node($nid, $cid) {
- db_query("INSERT INTO node_category (nid, cid) VALUES ('". check_input($nid) ."', '". check_input($cid) ."')", 1);
+function category_post_threshold($cid, $default) {
+ $category = db_fetch_object(db_query("SELECT post AS threshold FROM category WHERE cid = '". check_input($cid) ."'"));
+ return $category->threshold ? $category->threshold : $default;
+}
+
+function category_dump_threshold($cid, $default) {
+ $category = db_fetch_object(db_query("SELECT dump AS threshold FROM category WHERE cid = '". check_input($cid) ."'"));
+ return $category->threshold ? $category->threshold : $default;
+}
+
+function category_expire_threshold($cid, $default) {
+ $category = db_fetch_object(db_query("SELECT expire AS threshold FROM category WHERE cid = '". check_input($cid) ."'"));
+ return $category->threshold ? $category->threshold : $default;
}
function category_form_select($type, $edit = array(), $size = 1) {
$result = db_query("SELECT * FROM category WHERE type = '$type'");
while ($category = db_fetch_object($result)) {
- $options .= "<OPTION VALUE=\"$category->cid\"". ($edit[$category->cid] ? "SELECTED" : "") .">". check_select($category->name) ."</OPTION>";
+ $options .= "<OPTION VALUE=\"$category->cid\"". ($edit[cid] == $category->cid ? "SELECTED" : "") .">". check_select($category->name) ."</OPTION>";
}
- return "<SELECT NAME=\"category[]\" SIZE=\"$size\"". ($size > 1 ? "MULTIPLE" : "") .">$options</SELECT>\n";
+ return "<SELECT NAME=\"edit[cid]\" SIZE=\"$size\"". ($size > 1 ? "MULTIPLE" : "") .">$options</SELECT>\n";
}
// ----- topic -----
@@ -75,20 +86,15 @@ function topic_tree($parent = 0, $name = "", $tree = array()) {
// delete topic $tid:
function topic_del($tid) {
db_query("DELETE FROM topic WHERE tid = '". check_input($tid) ."'");
- db_query("DELETE FROM node_topic WHERE tid = '". check_input($tid) ."'");
-}
-
-// add node $nid to topic $tid:
-function topic_node($nid, $tid) {
- db_query("INSERT INTO node_topic (nid, tid) VALUES ('". check_input($nid) ."', '". check_input($tid) ."')", 1);
+ db_query("UPDATE node SET tid = 0 WHERE tid = '". check_input($tid) ."'");
}
// renders a HTML form to select one or more topics:
function topic_form_select($edit = array(), $size = 1) {
foreach (topic_tree() as $tid=>$name) {
- $options .= "<OPTION VALUE=\"$tid\"". ($edit[$tid] ? "SELECTED" : "") .">". check_select($name) ."</OPTION>";
+ $options .= "<OPTION VALUE=\"$tid\"". ($edit[tid] == $tid ? "SELECTED" : "") .">". check_select($name) ."</OPTION>";
}
- return "<SELECT NAME=\"topic[]\" SIZE=\"$size\"". ($size > 1 ? "MULTIPLE" : "") .">$options</SELECT>\n";
+ return "<SELECT NAME=\"edit[tid]\" SIZE=\"$size\"". ($size > 1 ? "MULTIPLE" : "") .">$options</SELECT>\n";
}
// ----- structure -----