summaryrefslogtreecommitdiff
path: root/includes/structure.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-06-10 15:01:20 +0000
committerDries Buytaert <dries@buytaert.net>2001-06-10 15:01:20 +0000
commitd397bbe93587f015cd8db0dbf16ef6d1c1aef78b (patch)
tree82b3b8dc63b04c11aeadd5b18cee796e4da43144 /includes/structure.inc
parent6b34310626b960a18646259d8d7caa1b6b2da1da (diff)
downloadbrdo-d397bbe93587f015cd8db0dbf16ef6d1c1aef78b.tar.gz
brdo-d397bbe93587f015cd8db0dbf16ef6d1c1aef78b.tar.bz2
This a rather large commit that needs a lot of fine-tuning. If you
update, you'll break your site as you need switching from structure to index.module: so this can be considered an intermediate commit. If you upgrade, and you are welcome to, just create a collection called "section" (for now) and assign your nodes some attributes in the described format. Feedback and bugreports are welcomed. Questions will be answered. CHANGES: - comment system: + when replying to a node (rather then to a comment), that node is displayed above the reply form. + when replying to a comment (rather then to a node), that comment is displayd above the reply form. - removed structure.inc, removed structure.module. - node.inc: + added 2 new node functions called 'node_attribute_edit()' and 'node_attribute_save()' used to 'hook in' any indexing system including your home-brewed stuff if you'd want to. Currently, index.module is the facto default index system. See story.module for usage. - book.module, story.module, poll.module, page.module, forum.module: + added preview functionality to administration section (via node module). + removed all references to structure.inc (category, topic). - moderate.module: + removed all references to structure.inc (category, topic). - book.module, story.module, page.module, forum.module: + increased the sizes of some textareas. - submit.php: + removed all references to structure.inc (category, topic). - marvin.theme: + removed dead code: function story() was depricated. - unconed.theme: + removed hardcoded references to drop.org. - marvin.theme, unconed.theme, jeroen.theme, yaroon.theme, example.theme: + removed all references to structure.inc (category, topic). TODO: - file.module, trip_link.module: + update preview functionality: see story.module for example. + remove references to 'cid' and 'tid', use 'attribute' instead: see story.module for example. - extend and build upon index.module as well as making it configurable
Diffstat (limited to 'includes/structure.inc')
-rw-r--r--includes/structure.inc157
1 files changed, 0 insertions, 157 deletions
diff --git a/includes/structure.inc b/includes/structure.inc
deleted file mode 100644
index fdac8e811..000000000
--- a/includes/structure.inc
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-
-// ----- category -----
-
-function _category_get($field, $value) {
- return db_query("SELECT * FROM category WHERE $field = '$value'");
-}
-
-// returns the category object where $field = $value:
-function category_get_object($field, $value) {
- return db_fetch_object(_category_get($field, $value));
-}
-
-// returns the category array where $field = $value:
-function category_get_array($field, $value) {
- return db_fetch_array(_category_get($field, $value));
-}
-
-// save a category:
-function category_save($edit) {
- if (!$edit[cid]) $edit[cid] = db_insert_id(db_query("INSERT INTO category (name) VALUES ('". check_query($edit[name])."')"));
- foreach ($edit as $key=>$value) db_query("UPDATE category SET $key = '". check_query($value) ."' WHERE cid = '$edit[cid]'");
-}
-
-
-// delete category $cid:
-function category_del($cid) {
- db_query("DELETE FROM category WHERE cid = '". check_query($cid) ."'");
- db_query("UPDATE node SET cid = 0 WHERE cid = '". check_query($cid) ."'");
-}
-
-// return post threshold:
-function category_post_threshold($cid) {
- $category = db_fetch_object(db_query("SELECT post AS threshold FROM category WHERE cid = '". check_query($cid) ."'"));
- return $category->threshold;
-}
-
-// return dump threshold:
-function category_dump_threshold($cid) {
- $category = db_fetch_object(db_query("SELECT dump AS threshold FROM category WHERE cid = '". check_query($cid) ."'"));
- return $category->threshold;
-}
-
-// return expiration threshold:
-function category_expire_threshold($cid) {
- $category = db_fetch_object(db_query("SELECT expire AS threshold FROM category WHERE cid = '". check_query($cid) ."'"));
- return $category->threshold;
-}
-
-// return default comment status of category $cid:
-function category_comment($cid) {
- $category = category_get_object("cid", $cid);
- return $category->comment ? $category->comment : 0;
-}
-
-// return default promote status of category $cid:
-function category_promote($cid) {
- $category = category_get_object("cid", $cid);
- return $category->promote ? $category->promote : 0;
-}
-
-// return default submission status of category $cid:
-function category_submission($cid) {
- $category = category_get_object("cid", $cid);
- return $category->submission ? $category->submission : 0;
-}
-
-// return linked string with name of category $cid:
-function category_name($cid) {
- $category = category_get_object("cid", $cid);
- return ($category) ? "<A HREF=\"index.php?category=$category->cid\">$category->name</A>" : "";
-}
-
-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[cid] == $category->cid ? "SELECTED" : "") .">". check_form($category->name) ."</OPTION>";
- }
- return "<SELECT NAME=\"edit[cid]\" SIZE=\"$size\"". ($size > 1 ? "MULTIPLE" : "") .">$options</SELECT>\n";
-}
-
-// ----- topic -----
-
-function _topic_get($field, $value) {
- return db_query("SELECT * FROM topic WHERE $field = '$value'");
-}
-
-// returns the topic object where $field = $value:
-function topic_get_object($field, $value) {
- return db_fetch_object(_topic_get($field, $value));
-}
-
-// returns the topic array where $field = $value:
-function topic_get_array($field, $value) {
- return db_fetch_array(_topic_get($field, $value));
-}
-
-// save a topic:
-function topic_save($edit) {
- if (!$edit[tid]) $edit[tid] = db_insert_id(db_query("INSERT INTO topic (name) VALUES ('". check_query($edit[name])."')"));
- foreach ($edit as $key=>$value) db_query("UPDATE topic SET $key = '". check_query($value) ."' WHERE tid = '$edit[tid]'");
-}
-
-// returns a sorted tree-representation of all topics:
-function topic_tree($parent = 0, $name = "", $tree = array()) {
- $result = db_query("SELECT * FROM topic WHERE pid = '$parent' ORDER BY name");
- while ($topic = db_fetch_object($result)) {
- $tree[$topic->tid] = ($name ? "$name - $topic->name" : $topic->name);
- $tree = topic_tree($topic->tid, $tree[$topic->tid], $tree);
- }
- return $tree;
-}
-
-// delete topic $tid:
-function topic_del($tid) {
- db_query("DELETE FROM topic WHERE tid = '". check_query($tid) ."'");
- db_query("UPDATE node SET tid = 0 WHERE tid = '". check_query($tid) ."'");
-}
-
-// return linked string with name of topic $tid:
-function topic_name($tid, $name = 0) {
- $topic = topic_get_object("tid", $tid);
- $name = $name ? "<A HREF=\"index.php?topic=$topic->tid\">$topic->name</A> - $name" : "<A HREF=\"index.php?topic=$topic->tid\">$topic->name</A>";
- return ($topic->pid) ? topic_name($topic->pid, $name) : $name;
-}
-
-// return moderators for topic $tid:
-function topic_moderate($tid) {
- $topic = topic_get_object("tid", $tid);
- return $topic->moderate;
-}
-
-// 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] == $tid ? "SELECTED" : "") .">". check_form($name) ."</OPTION>";
- }
- return "<SELECT NAME=\"edit[tid]\" SIZE=\"$size\"". ($size > 1 ? "MULTIPLE" : "") .">$options</SELECT>\n";
-}
-
-// ----- structure -----
-
-// add node $nid to category $cid and topic $tid:
-function structure_save($nid, $cid, $tid) {
- category_node($nid, $cid);
- topic_node($nid, $tid);
-}
-
-// render a HMTL selection form:
-function structure_form($type, $edit = array(), $size = 1) {
- $output .= "<B>Category and topic:</B><BR>\n";
- $output .= category_form_select($type, $edit, $size) ." ". topic_form_select($edit, $size) ."<BR>";
- $output .= "<SMALL><I>". t("Select the category and the topic this submission belongs in.") ."</I></SMALL><P>";
- return $output;
-}
-
-?> \ No newline at end of file