diff options
Diffstat (limited to 'modules/forum.module')
-rw-r--r-- | modules/forum.module | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/modules/forum.module b/modules/forum.module index 87cd82db3..f1d507e3f 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -46,7 +46,7 @@ function forum_conf_options() { $output .= form_select("Topics per page", "forum_per_page", variable_get("forum_per_page", 25), $number, "The default number of topics displayed per page; links to browse older messages are automatically being displayed."); $forder = array(1 => "Date - newest first", 2 => "Date - oldest first", 3 => "Posts - most active first", 4=> "Posts - least active first"); $output .= form_select("Default order", "forum_order", variable_get("forum_order", 1), $forder, "The default display order for topics."); - $output .= form_textfield("Number of topics in block", "forum_block_num", variable_get("forum_block_num", "5"), 5, 5, "The number of topics in the <b>Forum topics</b>-block. To enable the block, click ". la("here", array("mod" => "block")) ."."); + $output .= form_textfield("Number of topics in block", "forum_block_num", variable_get("forum_block_num", "5"), 5, 5, "The number of topics in the <b>Forum topics</b>-block. To enable the block, click ". l("here", "admin/block") ."."); } else { $output .= _forum_message_taxonomy(); @@ -109,7 +109,7 @@ function forum_block($op = "list", $delta = 0) { $content .= node_title_list(db_query("SELECT n.nid, n.title, u.uid, u.name FROM node n LEFT JOIN forum f ON n.nid = f.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' ORDER BY n.nid DESC LIMIT ". variable_get("forum_block_num", "5")), t("New forum topics:")); if ($content) { - $content .= "<div id=\"forum_more\" align=\"right\">". lm(t("more"), array("mod" => "forum")) ."</div>"; + $content .= "<div id=\"forum_more\" align=\"right\">". l(t("more"), "forum") ."</div>"; } cache_set("forum:block", $content, time() + variable_get("cache_clear", 120)); @@ -129,7 +129,7 @@ function forum_block($op = "list", $delta = 0) { function forum_link($type, $node = 0, $main = 0) { if ($type == "page" && user_access("access content")) { - $links[] = lm(t("forum"), array("mod" => "forum")); + $links[] = l(t("forum"), "forum"); } if (!$main && $type == "node" && $node->type == "forum") { @@ -158,11 +158,11 @@ function forum_link($type, $node = 0, $main = 0) { } if ($prev) { - $links[] = l(t("previous forum topic"), array("id" => $prev->nid), "node", "", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."...")); + $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100)."...")); } if ($next) { - $links[] = l(t("next forum topic"), array("id" => $next->nid), "node", "", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."...")); + $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100)."...")); } } @@ -181,7 +181,7 @@ function forum_view($node, $main = 0) { /* TODO: find out what this code was ment to do and either use it or not. - $output .= "<p>". _forum_get_icon($node) ." ". lm($voc->name, array("mod" => "forum")) ." : ". lm($term_data->name, array("mod" => "forum", "tid" => $term_data->tid)); + $output .= "<p>". _forum_get_icon($node) ." ". l($voc->name, "forum") ." : ". l($term_data->name, "forum/$term_data->tid"); $output .= " / <b>$node->title</b><br>".t("%a by %b", array("%a" => format_date($node->created), "%b" => format_name($node)))."</p><p>". check_output($node->body) ."</p>"; $output .= "<p>". $theme->links(link_node($node, $main)) ."</p>"; @@ -190,7 +190,7 @@ function forum_view($node, $main = 0) { */ if (!$main) { - $node->title = _forum_get_icon($node) ." ". lm($voc->name, array("mod" => "forum")) ." : ". lm($term_data->name, array("mod" => "forum", "tid" => $term_data->tid)) ." / <b>$node->title</b>"; + $node->title = _forum_get_icon($node) ." ". l($voc->name, "forum") ." : ". l($term_data->name, "forum/$term_data->tid") ." / <b>$node->title</b>"; } $theme->node($node, $main); @@ -479,20 +479,16 @@ function _forum_message_taxonomy() { } function forum_page() { - global $theme, $tid, $sortby, $forum_per_page, $offset, $op, $user; + global $theme, $sortby, $forum_per_page, $offset, $op, $user; if (user_access("access content")) { if (module_exist("taxonomy")) { + $tid = arg(1); + if ($op == "Update settings" && $user->uid) { $user = user_save($user, array("sortby" => $sortby, "forum_per_page" => $forum_per_page)); } - if ($op == "first_new") { - if ($nid = _forum_first_new($tid)) { - drupal_goto(drupal_url(array("id" => $nid), "node")); - } - } - if (empty($sortby)) { $sortby = isset($user->sortby) ? $user->sortby : variable_get("forum_order",1); } @@ -526,9 +522,9 @@ function forum_page() { } } -/** -*** render functions -**/ +/* +** Render functions. +*/ function forum_render($forums, $topics, $topic_num, $parents, $tid, $sortby, $forum_per_page, $offset) { // forum list, topics list, topic browser and "add new topic" link @@ -552,14 +548,14 @@ function forum_forum_list($forums, $parents, $tid) { if ($parents) { foreach($parents as $p) { if ($tid != $p->tid) { - $t[] = lm($p->name, array("mod" => "forum", "tid" => $p->tid)); + $t[] = l($p->name, "forum/$p->tid"); } else { $t[] = $p->name; } } } - $t[] = lm(t("Discussion forum"), array("mod" => "forum")); + $t[] = l(t("Discussion forum"), "forum"); $output .= "<table border=\"0\" cellpadding=\"5\" width=\"100%\">\n"; $output .= " <tr><th colspan=\"3\" align=\"left\">".implode(" : ", array_reverse($t)) ."</th>"; @@ -569,24 +565,24 @@ function forum_forum_list($forums, $parents, $tid) { foreach ($forums as $forum) { if ($forum->container) { - $output .= " <tr><td colspan=\"5\">". lm($forum->name, array("mod" => "forum", "tid" => $forum->tid)) ."<br /><small>". ($forum->description ? check_output($forum->description) : "") ."</small></td></tr>"; + $output .= " <tr><td colspan=\"5\">". l($forum->name, "forum/$forum->tid") ."<br /><small>". ($forum->description ? check_output($forum->description) : "") ."</small></td></tr>"; } else { if ($user->uid) $new_topics = $forum->num_topics - $forum->old_topics; $icon = _forum_get_folder_icon($new_topics); $output .= " <tr><td> </td><td>$icon</td>"; - $output .= "<td><table border=\"0\"><tr><td width=\"". ($forum->depth * 20) ."\"> </td><td>". lm($forum->name, array("mod" => "forum", "tid" => $forum->tid))."<div style=\"padding-top: 5px;\">". check_output($forum->description); + $output .= "<td><table border=\"0\"><tr><td width=\"". ($forum->depth * 20) ."\"> </td><td>". l($forum->name, "forum/$forum->tid") ."<div style=\"padding-top: 5px;\">". check_output($forum->description); $links = array(); if ($forum->last_post) { - $links[] = l(t("the most recent topic"), array("id" => $forum->last_post->nid)); + $links[] = l(t("the most recent topic"), "node/view/". $forum->last_post->nid); } if ($new_topics) { - $links[] = lm(t("the first new topic"), array("mod" => "forum", "op" => "first_new", "tid" => $forum->tid)); + $links[] = l(t("the first new topic"), "forum/$forum->tid#new"); } if ($links) { - $output .= "<br />Jump to: ". implode(", ", $links); + $output .= "<br />". t("Jump to") .": ". implode(", ", $links); } $output .= "</div></td></tr></table></td>"; @@ -645,7 +641,7 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse <td>"._forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode)."</td> <td>"._forum_get_icon($topic)."</td> <td valign=\"top\">$topic->title</td> - <td align=\"center\" valign=\"top\" colspan=\"3\">".lm(t("This topic has been moved"), array("mod" => "forum", "tid" => $topic->shadow))."</td> + <td align=\"center\" valign=\"top\" colspan=\"3\">". l(t("This topic has been moved"), "forum/$topic->shadow")."</td> </tr>"; } else { @@ -653,7 +649,7 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse <tr> <td>"._forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode)."</td> <td>"._forum_get_icon($topic)."</td> - <td valign=\"top\">". l($topic->title, array("id" => $topic->nid))."</td> + <td valign=\"top\">". l($topic->title, "node/view/$topic->nid") ."</td> <td align=\"center\" valign=\"top\" nowrap=\"nowrap\">".$topic->num_comments.($topic->new_replies ? " (".t("%a new", array("%a" => $topic->new_replies)).")" : "")."</td> <td align=\"center\">"._forum_format($topic)."</td> <td align=\"center\">"._forum_format($topic->last_reply)."</td> @@ -667,18 +663,18 @@ function forum_topic_list($topics, $num_topics, $sortby, $forum_per_page, $offse $output .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>"; if ($offset > 0) { - $output .= "<td width=\"33%\"><div align=\"left\" style=\"font-style: bold;\">". lm(t("previous topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset-$forum_per_page))) ."</div></td>"; + $output .= "<td width=\"33%\"><div align=\"left\" style=\"font-style: bold;\">". l(t("previous topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset-$forum_per_page))) ."</div></td>"; } else { $output .= "<td width=\"33%\"> </td>"; } if (user_access("create forum topics")) { - $output .= "<td width=\"33%\"><div align=\"center\" style=\"font-style: bold;\">". lm(t("create new forum topic"), array("mod" => "node", "op" => "add", "type" => "forum", "tid" => $tid)) ."</div></td>"; + $output .= "<td width=\"33%\"><div align=\"center\" style=\"font-style: bold;\">". l(t("create new forum topic"), array("mod" => "node", "op" => "add", "type" => "forum", "tid" => $tid)) ."</div></td>"; } if (count($topics) >= $forum_per_page) { - $output .= "<td width=\"33%\"><div align=\"right\" style=\"font-style: bold;\">". lm(t("next topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset+$forum_per_page))) ."</div></td>"; + $output .= "<td width=\"33%\"><div align=\"right\" style=\"font-style: bold;\">". l(t("next topics"), array("mod" => "forum", "tid" => $tid, "offset" => ($offset+$forum_per_page))) ."</div></td>"; } else { $output .= "<td width=\"33%\"> </td>"; |