From 8e94fe162587c3285554cd3f0eb87a43ffc079b0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 18 Apr 2001 20:40:21 +0000 Subject: - 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) --- includes/structure.inc | 17 +++++++++++++++++ themes/example/example.theme | 4 +--- themes/goofy/goofy.theme | 2 +- themes/jeroen/jeroen.theme | 11 ++++------- themes/marvin/marvin.theme | 2 +- updates/2.00-to-x.xx.sql | 8 ++++++++ 6 files changed, 32 insertions(+), 12 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) ? "cid\">$category->name" : ""; +} + 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 ? "tid\">$topic->name - $name" : "tid\">$topic->name"; + 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) { diff --git a/themes/example/example.theme b/themes/example/example.theme index 8b7d608c8..32b7376de 100644 --- a/themes/example/example.theme +++ b/themes/example/example.theme @@ -60,15 +60,13 @@ format_username($story->userid), "%b" => format_date($story->timestamp, "small"))); ?> cid\">". check_output($story->category) ." / tid\">". check_output($story->topic) .""; - + echo category_name($story->cid) ." / ". topic_name($story->tid); ?> diff --git a/themes/goofy/goofy.theme b/themes/goofy/goofy.theme index 69b988730..f60fbfb92 100644 --- a/themes/goofy/goofy.theme +++ b/themes/goofy/goofy.theme @@ -117,7 +117,7 @@ format_username($story->userid), "%b" => format_date($story->timestamp, "large"))); ?> -
cid\">". check_output($story->category) ." / tid\">". check_output($story->topic) .""; ?>
+
cid) ." / ". topic_name($story->tid); ?>
diff --git a/themes/jeroen/jeroen.theme b/themes/jeroen/jeroen.theme index 003ae3560..c93b8f4bc 100644 --- a/themes/jeroen/jeroen.theme +++ b/themes/jeroen/jeroen.theme @@ -103,9 +103,7 @@ - ". strtr(t("$how by %a on %b"), array("%a" => format_username($story->userid), "%b" => format_date($story->timestamp), "large")) ." + echo "". strtr(t("$how by %a on %b"), array("%a" => format_username($story->userid), "%b" => format_date($story->timestamp), "large")) .""; +?> - - cid\">". check_output($story->category) ." / tid\">". check_output($story->topic) .""; - +". category_name($story->cid) ." / ". topic_name($story->tid) .""; ?> - diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 584720919..5a7e33545 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -51,7 +51,7 @@ print " \"\"\n"; print " \n"; print " \n"; - print " ". strtr(t("Submitted by %a on %b"), array("%a" => format_username($story->userid), "%b" => format_date($story->timestamp, "large"))); ?>cid\">". check_output($story->category) ." / tid\">". check_output($story->topic) ."\n"; + print " ". strtr(t("Submitted by %a on %b"), array("%a" => format_username($story->userid), "%b" => format_date($story->timestamp, "large"))); ?>". category_name($story->cid) ." / ". topic_name($story->tid) ."\n"; print " \n"; print " \n"; print "  \n"; diff --git a/updates/2.00-to-x.xx.sql b/updates/2.00-to-x.xx.sql index f5e3f0817..5688d6f5b 100644 --- a/updates/2.00-to-x.xx.sql +++ b/updates/2.00-to-x.xx.sql @@ -4,6 +4,14 @@ ALTER TABLE node ADD tid int(10) unsigned DEFAULT '0' NOT NULL; ALTER TABLE story DROP section; ALTER TABLE comments ADD KEY(lid); +CREATE TABLE cvs ( + user varchar(32) DEFAULT '' NOT NULL, + files text, + status int(2) DEFAULT '0' NOT NULL, + message text, + timestamp int(11) DEFAULT '0' NOT NULL +); + CREATE TABLE category ( cid int(10) unsigned DEFAULT '0' NOT NULL auto_increment, name varchar(32) DEFAULT '' NOT NULL, -- cgit v1.2.3