summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-05-12 21:06:13 +0000
committerDries Buytaert <dries@buytaert.net>2001-05-12 21:06:13 +0000
commit86bb9a10cbe39216290a634a5e35581046c98458 (patch)
tree0d0af7c081ac1a798a8ac903d3397f3f7f84ab6f
parentdda4e903a4c7d9374e7f8d4c53df860b7346ea2b (diff)
downloadbrdo-86bb9a10cbe39216290a634a5e35581046c98458.tar.gz
brdo-86bb9a10cbe39216290a634a5e35581046c98458.tar.bz2
- Made the main page display sub-topics when a specific topic
is selected. - Made theme_link() less "hard coded", we still have to make it fully configurable though. - Fixed glitch in story submission: the warning messages were not displayed. - Tidied up block.module a bit.
-rw-r--r--includes/theme.inc11
-rw-r--r--index.php19
-rw-r--r--modules/block.module20
-rw-r--r--modules/block/block.module20
-rw-r--r--modules/story.module4
-rw-r--r--modules/story/story.module4
6 files changed, 28 insertions, 50 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index b7e996342..2be12b414 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -17,9 +17,14 @@ function theme_link($separator = " | ") {
$links[] = "<A HREF=\"search.php\">". t("search") ."</A>";
$links[] = "<A HREF=\"submit.php\">". t("submit") ."</A>";
$links[] = "<A HREF=\"account.php\">". t("account") ."</A>";
- if (module_exist("forum")) $links[] = "<A HREF=\"module.php?mod=forum\">".t("forum") ."</A>";
- if (module_exist("diary")) $links[] = "<A HREF=\"module.php?mod=diary\">". t("diary") ."</A>";
- if (module_exist("book")) $links[] = "<A HREF=\"module.php?mod=book\">". t("handbook") ."</A>";
+
+ foreach (module_list() as $name) {
+ if (module_hook($name, "page")) $links[] = "<A HREF=\"module.php?mod=$name\">".t($name) ."</A>";
+ }
+
+// if (module_exist("forum")) $links[] = "<A HREF=\"module.php?mod=forum\">".t("forum") ."</A>";
+// if (module_exist("diary")) $links[] = "<A HREF=\"module.php?mod=diary\">". t("diary") ."</A>";
+// if (module_exist("book")) $links[] = "<A HREF=\"module.php?mod=book\">". t("handbook") ."</A>";
return implode($separator, $links);
}
diff --git a/index.php b/index.php
index f8c5a547d..eef129d57 100644
--- a/index.php
+++ b/index.php
@@ -2,9 +2,20 @@
include_once "includes/common.inc";
-if (variable_get("dev_timing", 0)) timer_start();
+if (variable_get("dev_timing", 0)) {
+ timer_start();
+}
+
+if ($category) {
+ $c = "AND cid = '". check_input($category) ."'";
+}
-$result = db_query("SELECT nid FROM node WHERE promote = '1' AND status = '$status[posted]' AND timestamp <= ". ($date > 0 ? $date : time()) ." ". ($category ? "AND cid = '$category'" : "") ." ". ($topic ? "AND tid = '$topic'" : "") ." ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get(default_nodes_main, 10)));
+if ($topic) {
+ foreach (topic_tree($topic) as $key=>$value) $t .= "tid = '$key' OR ";
+ $t = "AND ($t tid = '". check_input($topic) ."')";
+}
+
+$result = db_query("SELECT nid FROM node WHERE promote = '1' AND status = '$status[posted]' AND timestamp <= '". ($date > 0 ? check_input($date) : time()) ."' $c $t ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get(default_nodes_main, 10)));
$theme->header();
while ($node = db_fetch_object($result)) {
@@ -12,6 +23,8 @@ while ($node = db_fetch_object($result)) {
}
$theme->footer();
-if (variable_get("dev_timing", 0)) timer_print();
+if (variable_get("dev_timing", 0)) {
+ timer_print();
+}
?>
diff --git a/modules/block.module b/modules/block.module
index b37c8fb89..284ba2247 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -9,26 +9,6 @@ function block_help() {
<?php
}
-function block_page() {
- global $theme;
-
- $result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module");
-
- $theme->header();
- print "<TABLE BORDER=\"0\">\n";
- while ($block = db_fetch_object($result)) {
- if ($state % 3 == 0) print " <TR>\n";
- print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
- $blocks = module_invoke($block->module, "block");
- $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
- print " </TD>\n";
- if ($state % 3 == 2) print " </TR>\n";
- $state += 1;
- }
- print "</TABLE>\n";
- $theme->footer();
-}
-
function block_admin_save($edit) {
foreach ($edit as $key=>$value) {
db_query("UPDATE blocks SET region = '". check_input($value[region]) ."', status = '". check_input($value[status]) ."', weight = '". check_input($value[weight]) ."' WHERE name = '". check_input($key) ."'");
diff --git a/modules/block/block.module b/modules/block/block.module
index b37c8fb89..284ba2247 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -9,26 +9,6 @@ function block_help() {
<?php
}
-function block_page() {
- global $theme;
-
- $result = db_query("SELECT * FROM blocks WHERE status = 1 ORDER BY module");
-
- $theme->header();
- print "<TABLE BORDER=\"0\">\n";
- while ($block = db_fetch_object($result)) {
- if ($state % 3 == 0) print " <TR>\n";
- print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
- $blocks = module_invoke($block->module, "block");
- $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
- print " </TD>\n";
- if ($state % 3 == 2) print " </TR>\n";
- $state += 1;
- }
- print "</TABLE>\n";
- $theme->footer();
-}
-
function block_admin_save($edit) {
foreach ($edit as $key=>$value) {
db_query("UPDATE blocks SET region = '". check_input($value[region]) ."', status = '". check_input($value[status]) ."', weight = '". check_input($value[weight]) ."' WHERE name = '". check_input($key) ."'");
diff --git a/modules/story.module b/modules/story.module
index 261008a97..dfb6c6cef 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -52,11 +52,11 @@ function story_form($edit = array()) {
$form .= form_submit(t("Preview"));
}
else if (!$edit[title]) {
- $output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
+ $form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
else if (!$edit[abstract]) {
- $output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."</FONT><P>\n";
+ $form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
else {
diff --git a/modules/story/story.module b/modules/story/story.module
index 261008a97..dfb6c6cef 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -52,11 +52,11 @@ function story_form($edit = array()) {
$form .= form_submit(t("Preview"));
}
else if (!$edit[title]) {
- $output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
+ $form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
else if (!$edit[abstract]) {
- $output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."</FONT><P>\n";
+ $form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
else {