summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-04-18 20:40:21 +0000
committerDries Buytaert <dries@buytaert.net>2001-04-18 20:40:21 +0000
commit8e94fe162587c3285554cd3f0eb87a43ffc079b0 (patch)
tree110ac86e2979b80e709f672b3efe88d5d272ca4d /includes
parent73ad4c765889050c1bf91b93b50b5b3cac5ecd40 (diff)
downloadbrdo-8e94fe162587c3285554cd3f0eb87a43ffc079b0.tar.gz
brdo-8e94fe162587c3285554cd3f0eb87a43ffc079b0.tar.bz2
- structure.inc: added category_name($cid) and topic_name($tid).
They both return a linked string with the respective category, or topic name. Updated all themes to use these new functions. - (stripped tabs from emsa files, nevermind)
Diffstat (limited to 'includes')
-rw-r--r--includes/structure.inc17
1 files changed, 17 insertions, 0 deletions
diff --git a/includes/structure.inc b/includes/structure.inc
index ff05b36d2..6d6655a3e 100644
--- a/includes/structure.inc
+++ b/includes/structure.inc
@@ -22,27 +22,37 @@ function category_save($edit) {
foreach ($edit as $key=>$value) db_query("UPDATE category SET $key = '". check_input($value) ."' WHERE cid = '$edit[cid]'");
}
+
// delete category $cid:
function category_del($cid) {
db_query("DELETE FROM category WHERE cid = '". check_input($cid) ."'");
db_query("UPDATE node SET cid = 0 WHERE cid = '". check_input($cid) ."'");
}
+// return post threshold:
function category_post_threshold($cid) {
$category = db_fetch_object(db_query("SELECT post AS threshold FROM category WHERE cid = '". check_input($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_input($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_input($cid) ."'"));
return $category->threshold;
}
+// 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)) {
@@ -89,6 +99,13 @@ function topic_del($tid) {
db_query("UPDATE node SET tid = 0 WHERE tid = '". check_input($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;
+}
+
// renders a HTML form to select one or more topics:
function topic_form_select($edit = array(), $size = 1) {
foreach (topic_tree() as $tid=>$name) {