diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/block.module | 27 | ||||
-rw-r--r-- | modules/block/block.module | 27 | ||||
-rw-r--r-- | modules/calendar.module | 4 | ||||
-rw-r--r-- | modules/diary.module | 8 | ||||
-rw-r--r-- | modules/story.module | 27 | ||||
-rw-r--r-- | modules/story/story.module | 27 |
6 files changed, 104 insertions, 16 deletions
diff --git a/modules/block.module b/modules/block.module index b3b9be774..f36deb810 100644 --- a/modules/block.module +++ b/modules/block.module @@ -1,6 +1,27 @@ <? -$module = array("admin" => "block_admin"); +$module = array("page" => "block_page", + "admin" => "block_admin"); + +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_execute($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) { @@ -11,7 +32,7 @@ function block_admin_save($edit) { function block_admin_display() { global $repository; - $result = db_query("SELECT * FROM blocks"); + $result = db_query("SELECT * FROM blocks ORDER BY module"); // Generate output: $output .= "<FORM ACTION=\"admin.php?mod=block\" METHOD=\"post\">\n"; @@ -26,7 +47,7 @@ function block_admin_display() { $status .= " <OPTION VALUE=\"0\"". (($block->status == 0) ? " SELECTED" : "") .">disabled</OPTION>\n"; $status .= "</SELECT>\n"; - $output .= " <TR><TD>". $block->name ."</TD><TD>$module</TD><TD>$status</TD></TR>\n"; + $output .= " <TR><TD>". $block->name ."</TD><TD ALIGN=\"center\">$module</TD><TD>$status</TD></TR>\n"; unset($status); } diff --git a/modules/block/block.module b/modules/block/block.module index b3b9be774..f36deb810 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -1,6 +1,27 @@ <? -$module = array("admin" => "block_admin"); +$module = array("page" => "block_page", + "admin" => "block_admin"); + +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_execute($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) { @@ -11,7 +32,7 @@ function block_admin_save($edit) { function block_admin_display() { global $repository; - $result = db_query("SELECT * FROM blocks"); + $result = db_query("SELECT * FROM blocks ORDER BY module"); // Generate output: $output .= "<FORM ACTION=\"admin.php?mod=block\" METHOD=\"post\">\n"; @@ -26,7 +47,7 @@ function block_admin_display() { $status .= " <OPTION VALUE=\"0\"". (($block->status == 0) ? " SELECTED" : "") .">disabled</OPTION>\n"; $status .= "</SELECT>\n"; - $output .= " <TR><TD>". $block->name ."</TD><TD>$module</TD><TD>$status</TD></TR>\n"; + $output .= " <TR><TD>". $block->name ."</TD><TD ALIGN=\"center\">$module</TD><TD>$status</TD></TR>\n"; unset($status); } diff --git a/modules/calendar.module b/modules/calendar.module index fe79beea5..0f4e2868c 100644 --- a/modules/calendar.module +++ b/modules/calendar.module @@ -5,13 +5,13 @@ $module = array("block" => "calendar_block"); function calendar_block() { global $date; - include "modules/calendar.class"; + include_once "modules/calendar.class"; $calendar = new Calendar($date); $block[0]["subject"] = "Browse archives"; $block[0]["content"] = $calendar->display(); - $block[0]["info"] = "calendar"; + $block[0]["info"] = "Calendar to browse archives"; return $block; } diff --git a/modules/diary.module b/modules/diary.module index 29d8af1f2..90981b3bd 100644 --- a/modules/diary.module +++ b/modules/diary.module @@ -85,7 +85,7 @@ function diary_page_add() { $output .= "</FORM>\n"; $theme->header(); - $theme->box("Online diary", $output); + $theme->box("Edit you diary", $output); $theme->footer(); } @@ -114,7 +114,7 @@ function diary_page_edit($id) { $output .= "</FORM>\n"; $theme->header(); - $theme->box("Online diary", $output); + $theme->box("Edit your diary", $output); $theme->footer(); } @@ -140,7 +140,7 @@ function diary_page_preview($text, $timestamp, $id = 0) { $output .= "</FORM>\n"; $theme->header(); - $theme->box("Online diary", $output); + $theme->box("Edit your diary", $output); $theme->footer(); } @@ -204,7 +204,7 @@ function diary_block() { $block[0]["subject"] = "Recent diary entries"; $block[0]["content"] = $content; - $block[0]["info"] = "recent diary entries"; + $block[0]["info"] = "Recent diary entries"; $block[0]["link"] = "module.php?mod=diary"; return $block; diff --git a/modules/story.module b/modules/story.module index 42707168c..27317440e 100644 --- a/modules/story.module +++ b/modules/story.module @@ -1,6 +1,29 @@ <? -$module = array("admin" => "story_admin"); +$module = array("block" => "story_block", + "admin" => "story_admin"); + +function story_block() { + $result = db_query("select s.id, COUNT(s.id) as comments, s.subject from stories s left join comments c on s.id = c.sid WHERE s.status = 2 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + while ($story = db_fetch_object($result)) { + $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + } + + $blocks[0]["subject"] = "Top 10:<BR>all stories"; + $blocks[0]["content"] = $content; + $blocks[0]["info"] = "Top 10: all stories"; + + $result = db_query("select s.id, COUNT(s.id) as comments, s.subject from stories s left join comments c on s.id = c.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + while ($story = db_fetch_object($result)) { + $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + } + + $blocks[1]["subject"] = "Top 10:<BR>recent stories"; + $blocks[1]["content"] = $content; + $blocks[1]["info"] = "Top 10: recent stories"; + + return $blocks; +} function story_edit($id) { global $categories; @@ -124,4 +147,4 @@ function story_admin() { } } -?>
\ No newline at end of file +?> diff --git a/modules/story/story.module b/modules/story/story.module index 42707168c..27317440e 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -1,6 +1,29 @@ <? -$module = array("admin" => "story_admin"); +$module = array("block" => "story_block", + "admin" => "story_admin"); + +function story_block() { + $result = db_query("select s.id, COUNT(s.id) as comments, s.subject from stories s left join comments c on s.id = c.sid WHERE s.status = 2 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + while ($story = db_fetch_object($result)) { + $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + } + + $blocks[0]["subject"] = "Top 10:<BR>all stories"; + $blocks[0]["content"] = $content; + $blocks[0]["info"] = "Top 10: all stories"; + + $result = db_query("select s.id, COUNT(s.id) as comments, s.subject from stories s left join comments c on s.id = c.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + while ($story = db_fetch_object($result)) { + $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + } + + $blocks[1]["subject"] = "Top 10:<BR>recent stories"; + $blocks[1]["content"] = $content; + $blocks[1]["info"] = "Top 10: recent stories"; + + return $blocks; +} function story_edit($id) { global $categories; @@ -124,4 +147,4 @@ function story_admin() { } } -?>
\ No newline at end of file +?> |