Commit 86bb9a10 authored by Dries's avatar Dries

- 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.
parent dda4e903
......@@ -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);
}
......
......@@ -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();
}
?>
......@@ -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) ."'");
......
......@@ -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) ."'");
......
......@@ -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 {
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment