diff --git a/includes/theme.inc b/includes/theme.inc index b7e996342e6ca7a309166d3c55f2ca800017c2a9..2be12b414ffacf327bdfea5cad303fe539ba809f 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 f8c5a547d6d52db216db2a48bef5f26048fc311e..eef129d57b27c294b6f4f86db4b7714dfc954b99 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 @@ } $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 b37c8fb89d6f2dda5e6639efe3fa9dcf958b89f3..284ba2247122f8725a959d7a6d0ea40e439b88a1 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 b37c8fb89d6f2dda5e6639efe3fa9dcf958b89f3..284ba2247122f8725a959d7a6d0ea40e439b88a1 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 261008a971313b11afd1dfe62aa98aa1fa1f75c2..dfb6c6cefc3d8d3aff74a62eed7cf959c48a9e7e 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 261008a971313b11afd1dfe62aa98aa1fa1f75c2..dfb6c6cefc3d8d3aff74a62eed7cf959c48a9e7e 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 {