diff options
-rw-r--r-- | misc/drupal.css | 5 | ||||
-rw-r--r-- | misc/forum-default.gif | bin | 0 -> 899 bytes | |||
-rw-r--r-- | misc/forum-hot-new.gif | bin | 0 -> 943 bytes | |||
-rw-r--r-- | misc/forum-hot.gif | bin | 0 -> 942 bytes | |||
-rw-r--r-- | misc/forum-new.gif | bin | 0 -> 893 bytes | |||
-rw-r--r-- | modules/aggregator.module | 16 | ||||
-rw-r--r-- | modules/aggregator/aggregator.module | 16 | ||||
-rw-r--r-- | modules/blog.module | 2 | ||||
-rw-r--r-- | modules/blog/blog.module | 2 | ||||
-rw-r--r-- | modules/cloud.module | 2 | ||||
-rw-r--r-- | modules/forum.module | 109 | ||||
-rw-r--r-- | modules/forum/forum.module | 109 | ||||
-rw-r--r-- | modules/import.module | 16 | ||||
-rw-r--r-- | update.php | 7 |
14 files changed, 77 insertions, 207 deletions
diff --git a/misc/drupal.css b/misc/drupal.css index 67f4817a7..5989f964e 100644 --- a/misc/drupal.css +++ b/misc/drupal.css @@ -127,7 +127,7 @@ th { font-size: 0.9em; margin: 0.5em; } -#forum td.posts, #forum td.topics, #forum td.last-post, #forum td.posted, #forum td.replies, #forum td.statistics, #forum td.settings, #forum td.pager { +#forum td.created, #forum td.posts, #forum td.topics, #forum td.last-reply, #forum td.replies, #forum td.statistics, #forum td.settings, #forum td.pager { text-align: center; white-space: nowrap; } @@ -197,6 +197,9 @@ th { margin: 0 auto; display: table; } +.more-link { + text-align: right; +} .node-form .form-text { display: block; width: 95%; diff --git a/misc/forum-default.gif b/misc/forum-default.gif Binary files differnew file mode 100644 index 000000000..af2b79abd --- /dev/null +++ b/misc/forum-default.gif diff --git a/misc/forum-hot-new.gif b/misc/forum-hot-new.gif Binary files differnew file mode 100644 index 000000000..1be4c2eb4 --- /dev/null +++ b/misc/forum-hot-new.gif diff --git a/misc/forum-hot.gif b/misc/forum-hot.gif Binary files differnew file mode 100644 index 000000000..2de61e58f --- /dev/null +++ b/misc/forum-hot.gif diff --git a/misc/forum-new.gif b/misc/forum-new.gif Binary files differnew file mode 100644 index 000000000..4afbc3752 --- /dev/null +++ b/misc/forum-new.gif diff --git a/modules/aggregator.module b/modules/aggregator.module index 1ed5dd648..4ae74fd54 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -108,7 +108,7 @@ function import_update() { } } -function import_format_item($item, $feed = 0) { +function import_theme_format_item($item, $feed = 0) { global $user; if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) { @@ -132,7 +132,7 @@ function import_bundle_block($attributes) { $items = array(); while ($item = db_fetch_object($result)) { - $items[] = theme("import_theme_format_item",$item); + $items[] = theme("import_theme_format_item", $item); } $output = "<div class=\"import-block\"><div class=\"bundle\">"; @@ -177,13 +177,13 @@ function import_block($op, $delta) { case "feed": $feed = db_fetch_object(db_query("SELECT * FROM {feed} WHERE fid = %d", $id)); $block["subject"] = $feed->title; - $block["content"] .= import_feed_block($feed) ."<div style=\"text-align: right;\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; + $block["content"] .= import_feed_block($feed) ."<div class=\"more-link\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; break; case "bundle": $bundle = db_fetch_object(db_query("SELECT * FROM {bundle} WHERE bid = %d", $id)); $block["subject"] = $bundle->title; - $block["content"] .= import_bundle_block($bundle->attributes) ."<div style=\"text-align: right;\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; + $block["content"] .= import_bundle_block($bundle->attributes) ."<div class=\"more-link\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; break; } @@ -198,9 +198,7 @@ function import_get_bundles($attributes = 0) { $result = db_query("SELECT * FROM {bundle} ORDER BY title"); while ($bundle = db_fetch_object($result)) { $block["bundle:$bundle->bid"]["subject"] = $bundle->title; - $block["bundle:$bundle->bid"]["content"] = import_bundle_block($bundle->attributes) ."<div style=\"text-align: right;\">". - l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) - ."</div>"; + $block["bundle:$bundle->bid"]["content"] = import_bundle_block($bundle->attributes) ."<div class=\"more-link\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle"; } @@ -214,9 +212,7 @@ function import_get_feeds($attributes = 0) { $result = db_query("SELECT * FROM {feed} ORDER BY fid"); while ($feed = db_fetch_object($result)) { $block["feed:$feed->fid"]["subject"] = $feed->title; - $block["feed:$feed->fid"]["content"] = import_feed_block($feed) ."<div style=\"text-align: right;\">". - l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) - ."</div>"; + $block["feed:$feed->fid"]["content"] = import_feed_block($feed) ."<div class=\"more-link\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; $block["feed:$feed->fid"]["info"] = "$feed->title feed"; } diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 1ed5dd648..4ae74fd54 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -108,7 +108,7 @@ function import_update() { } } -function import_format_item($item, $feed = 0) { +function import_theme_format_item($item, $feed = 0) { global $user; if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) { @@ -132,7 +132,7 @@ function import_bundle_block($attributes) { $items = array(); while ($item = db_fetch_object($result)) { - $items[] = theme("import_theme_format_item",$item); + $items[] = theme("import_theme_format_item", $item); } $output = "<div class=\"import-block\"><div class=\"bundle\">"; @@ -177,13 +177,13 @@ function import_block($op, $delta) { case "feed": $feed = db_fetch_object(db_query("SELECT * FROM {feed} WHERE fid = %d", $id)); $block["subject"] = $feed->title; - $block["content"] .= import_feed_block($feed) ."<div style=\"text-align: right;\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; + $block["content"] .= import_feed_block($feed) ."<div class=\"more-link\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; break; case "bundle": $bundle = db_fetch_object(db_query("SELECT * FROM {bundle} WHERE bid = %d", $id)); $block["subject"] = $bundle->title; - $block["content"] .= import_bundle_block($bundle->attributes) ."<div style=\"text-align: right;\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; + $block["content"] .= import_bundle_block($bundle->attributes) ."<div class=\"more-link\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; break; } @@ -198,9 +198,7 @@ function import_get_bundles($attributes = 0) { $result = db_query("SELECT * FROM {bundle} ORDER BY title"); while ($bundle = db_fetch_object($result)) { $block["bundle:$bundle->bid"]["subject"] = $bundle->title; - $block["bundle:$bundle->bid"]["content"] = import_bundle_block($bundle->attributes) ."<div style=\"text-align: right;\">". - l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) - ."</div>"; + $block["bundle:$bundle->bid"]["content"] = import_bundle_block($bundle->attributes) ."<div class=\"more-link\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle"; } @@ -214,9 +212,7 @@ function import_get_feeds($attributes = 0) { $result = db_query("SELECT * FROM {feed} ORDER BY fid"); while ($feed = db_fetch_object($result)) { $block["feed:$feed->fid"]["subject"] = $feed->title; - $block["feed:$feed->fid"]["content"] = import_feed_block($feed) ."<div style=\"text-align: right;\">". - l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) - ."</div>"; + $block["feed:$feed->fid"]["content"] = import_feed_block($feed) ."<div class=\"more-link\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; $block["feed:$feed->fid"]["info"] = "$feed->title feed"; } diff --git a/modules/blog.module b/modules/blog.module index 1f3d1ed20..773e42283 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -266,7 +266,7 @@ function blog_block($op = "list", $delta = 0) { else { if (user_access("access content")) { $block["content"] = node_title_list(db_query_range("SELECT n.title, n.nid FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC", 0, 10)); - $block["content"] .= "<div align=\"right\" id=\"blog_more\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>"; + $block["content"] .= "<div class=\"more-link\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>"; $block["subject"] = t("Blogs"); } return $block; diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 1f3d1ed20..773e42283 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -266,7 +266,7 @@ function blog_block($op = "list", $delta = 0) { else { if (user_access("access content")) { $block["content"] = node_title_list(db_query_range("SELECT n.title, n.nid FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC", 0, 10)); - $block["content"] .= "<div align=\"right\" id=\"blog_more\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>"; + $block["content"] .= "<div class=\"more-link\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>"; $block["subject"] = t("Blogs"); } return $block; diff --git a/modules/cloud.module b/modules/cloud.module index 6cd0b8290..64a8781b6 100644 --- a/modules/cloud.module +++ b/modules/cloud.module @@ -212,7 +212,7 @@ function cloud_block($op = "list", $delta = 0) { } else { $block["subject"] = t("Site cloud"); - $block["content"] = cloud_list(20) ."<div style=\"text-align: right;\">". l(t("more"), "cloud", array("title" => t("Monitor other sites in the cloud."))) ."</div>"; + $block["content"] = cloud_list(20) ."<div class=\"more-link\">". l(t("more"), "cloud", array("title" => t("Monitor other sites in the cloud."))) ."</div>"; return $block; } } diff --git a/modules/forum.module b/modules/forum.module index 3b855574b..e1ce357af 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -41,8 +41,7 @@ function forum_settings() { if ($voc) { $output .= form_textarea(t("Explanation or submission guidelines"), "forum_help", variable_get("forum_help", ""), 70, 5, t("This text will be displayed at the top of the forum submission form. Useful for helping or instructing your users.")); $output .= form_select(t("Forum vocabulary"), "forum_nav_vocabulary", variable_get("forum_nav_vocabulary", ""), $vocs, t("The taxonomy vocabulary that will be used as the navigation tree.")); - $output .= form_textfield(t("Topic icons path"), "forum_topic_icon_path", variable_get("forum_topic_icon_path", ""), 30, 255, t("The path to the topic icons. Leave blank to disable icons.")); - $output .= form_textfield(t("Folder icons path"), "forum_folder_icon_path", variable_get("forum_folder_icon_path", ""), 30, 255,t( "The path to the <b>default</b>, <b>hot</b>, <b>new</b>, <b>hot & new</b>, and <b>closed</b> folder icons. Leave blank to disable icons.")); + $output .= form_textfield(t("Forum icon path"), "forum_icon_path", variable_get("forum_icon_path", ""), 30, 255, t("The path to the forum icons. Leave blank to disable icons. Don't add a trailing slash. Default icons are available in the 'misc' directory.")); $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 50 => 50, 60 => 60, 80 => 80, 100 => 100, 10000=>10000); $output .= form_select(t("Hot topic threshold"), "forum_hot_topic", variable_get("forum_hot_topic", 15), $number, t("The number of posts a topic must have to be considered <b>hot</b>.")); $number = array(10 => 10, 25 => 25, 50 => 50, 75 => 75, 100 => 100); @@ -88,7 +87,7 @@ function forum_block($op = "list", $delta = 0) { $content .= node_title_list(db_query_range("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER 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", 0, variable_get("forum_block_num", "5")), t("New forum topics:")); if ($content) { - $content .= "<div id=\"forum_more\" style=\"text-align: right;\">". l(t("more"), "forum", array("title" => t("Read the latest forum topics."))) ."</div>"; + $content .= "<div class=\"more-link\">". l(t("more"), "forum", array("title" => t("Read the latest forum topics."))) ."</div>"; } $blocks["subject"] = t("Forum topics"); @@ -198,63 +197,17 @@ function forum_form(&$node, &$help, &$error) { $output .= form_checkbox(t("Leave shadow copy"), "shadow", 1, $node->shadow, t("If you move this topic, you can leave a link in the old forum to the new forum.")); } - if ($icon_path = variable_get("forum_topic_icon_path", "")) { - if ($node->icon) { - // we are editing post - if ($dir = @opendir($icon_path)) { - $icon_num = 0; - while($icon = readdir($dir)) { - if ($icon == '.' || $icon == '..') {continue;} - if ($node->icon == $icon) {$checked = "checked";} else {$checked = "";} - $radio .= "<input type=\"radio\" name=\"edit[icon_num]\" value=\"$icon_num\" $checked /><img src=\"$icon_path$icon\" alt=\"\" title=\"\" /> \n"; - $icon_num++; - } - closedir($dir); - } - } - else { - if ($dir = @opendir($icon_path)) { - $icon_num = 0; - while($icon = readdir($dir)) { - if ($icon == '.' || $icon == '..') {continue;} - if ($node->icon_num == $icon_num) {$checked = "checked";} else {$checked = "";} - $radio .= "<input type=\"radio\" name=\"edit[icon_num]\" value=\"$icon_num\" $checked /><img src=\"$icon_path$icon\" alt=\"\" title=\"\" /> \n"; - $icon_num++; - } - closedir($dir); - } - } - $output .= form_item(t("Topic icon"), $radio); - } $output .= form_textarea(t("Body"), "body", $node->body, 60, 10); return $output; } function forum_insert($node) { - $node->icon = _forum_decode_icon($node); - db_query("INSERT INTO {forum} (nid, icon, shadow, tid) VALUES (%d, '%s', %d, %d)", $node->nid, $node->icon, $node->shadow, $node->tid[0]); + db_query("INSERT INTO {forum} (nid, shadow, tid) VALUES (%d, %d, %d)", $node->nid, $node->shadow, $node->tid[0]); } function forum_update($node) { - $node->icon = _forum_decode_icon($node); - db_query("UPDATE {forum} SET icon = '%s', shadow = %d, tid = %d WHERE nid = %d", $node->icon, $node->shadow, $node->tid[0], $node->nid); -} - -function _forum_decode_icon($node) { - // to prevent malicious users - if ($icon_path = variable_get("forum_topic_icon_path", "")) { - if ($dir = @opendir($icon_path)) { - $icon_num = 0; - while($icon = readdir($dir)) { - if ($icon == '.' || $icon == '..') {continue;} - if ($icon_num == $node->icon_num) {$myicon = $icon;} - $icon_num++; - } - closedir($dir); - } - } - return $myicon; + db_query("UPDATE {forum} SET shadow = %d, tid = %d WHERE nid = %d", $node->shadow, $node->tid[0], $node->nid); } function forum_delete(&$node) { @@ -374,7 +327,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $sql_sortby = _forum_get_topic_order($sortby); // show topics with the correct tid, or in the forum but with shadow = 1 - $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, f.icon, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid LEFT JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid, f.icon ORDER BY $sql_sortby"; + $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid LEFT JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid ORDER BY $sql_sortby"; $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum'"; @@ -533,7 +486,7 @@ function forum_theme_list($forums, $parents, $tid) { if ($forums) { - $header = array(array("data" => t("Forum"), "colspan" => "2"), t("Topics"), t("Posts"), t("Last post")); + $header = array(t("Forum"), t("Topics"), t("Posts"), t("Last post")); foreach ($forums as $forum) { if ($user->uid) { @@ -561,13 +514,11 @@ function forum_theme_list($forums, $parents, $tid) { } $description .="</div>\n"; - //if ($icon = _forum_get_folder_icon($new_topics)) { $rows[] = array( - array("data" => $icon, "class" => "icon"), array("data" => $description, "class" => "description"), array("data" => $forum->num_topics . ($new_topics ? "<br />(".t("%a new", array("%a" => $new_topics)).")" : ""), "class" => "topics"), array("data" => $forum->num_posts, "class" => "posts"), - array("data" => _forum_format($forum->last_post), "class" => "last-post") + array("data" => _forum_format($forum->last_post), "class" => "last-reply") ); } @@ -610,35 +561,33 @@ function forum_theme_topic_list($tid, $topics, $sortby, $forum_per_page, $offset if ($topics) { - $header = array(array("data" => t("Topic"), "colspan" => "3"), t("Replies"), t("Posted"), t("Last post")); + $header = array(array("data" => t("Topic"), "colspan" => "2"), t("Replies"), t("Created"), t("Last reply")); foreach ($topics as $topic) { // folder is new if topic is new or there are new comments since last visit if ($topic->tid != $tid) { $rows[] = array( - array("data" => _forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), - array("data" =>_forum_get_icon($topic), "class" => "icon"), + array("data" => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), array("data" => $topic->title, "class" => "title"), - array("data" => l(t("This topic has been moved"), "forum/$topic->tid"), "colspan" => 3) + array("data" => l(t("This topic has been moved"), "forum/$topic->tid"), "colspan" => "3") ); } else { $rows[] = array( - array("data" => _forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), - array("data" => _forum_get_icon($topic), "class" => "icon"), + array("data" => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), array("data" => l($topic->title, "node/view/$topic->nid"), "class" => "topic"), array("data" => $topic->num_comments . ($topic->new_replies ? "<br />(".t("%a new", array("%a" => $topic->new_replies)).")" : ""), "class" => "replies"), - array("data" => _forum_format($topic), "class" => "posted"), - array("data" => _forum_format($topic->last_reply), "class" => "last-post") + array("data" => _forum_format($topic), "class" => "created"), + array("data" => _forum_format($topic->last_reply), "class" => "last-reply") ); } } - $rows[] = array(array("data" => t("%a topics, %b topics per page, page %c of %d", array("%a" => $pager_total[0], "%b" => $forum_per_page, "%c" => $offset, "%d" => ceil($pager_total[0]/$forum_per_page))), "colspan" => "6", "class" => "statistics")); - $rows[] = array(array("data" => theme("forum_theme_topic_browser", $sortby, $forum_per_page, $offset), "colspan" => "6", "class" => "settings")); + $rows[] = array(array("data" => t("%a topics, %b topics per page, page %c of %d", array("%a" => $pager_total[0], "%b" => $forum_per_page, "%c" => $offset, "%d" => ceil($pager_total[0]/$forum_per_page))), "colspan" => "5", "class" => "statistics")); + $rows[] = array(array("data" => theme("forum_theme_topic_browser", $sortby, $forum_per_page, $offset), "colspan" => "5", "class" => "settings")); if ($pager = pager_display(NULL, $forum_per_page, 0, "default")) { - $rows[] = array(array("data" => $pager, "colspan" => "6", "class" => "pager")); + $rows[] = array(array("data" => $pager, "colspan" => "5", "class" => "pager")); } } @@ -647,29 +596,17 @@ function forum_theme_topic_list($tid, $topics, $sortby, $forum_per_page, $offset $output = l(t("create new forum topic"), "node/add/forum/$tid") ."<br /><br />"; } - $output .= table($header, $rows); + $output .= table($header, $rows); return $output; } +function _forum_icon($new_posts, $num_posts = 0, $comment_mode = 0) { -function _forum_get_icon($node) { - if (variable_get("forum_topic_icon_path", "") && $node->icon) { - return "<img src=\"". variable_get("forum_topic_icon_path", "") ."$node->icon\" />"; - } - else { - return " "; - } -} - -function _forum_get_folder_icon($new_posts, $num_posts = 0, $comment_mode = 0) { - // "folder" icon because it's generally rendered as a folder - - - $base_path = variable_get("forum_folder_icon_path", ""); + $base_path = variable_get("forum_icon_path", ""); if ($base_path) { if ($num_posts > variable_get("forum_hot_topic", 15)) { - $icon = $new_posts ? "hot_new" : "hot"; + $icon = $new_posts ? "hot-new" : "hot"; } else { $icon = $new_posts ? "new" : "default"; @@ -680,7 +617,7 @@ function _forum_get_folder_icon($new_posts, $num_posts = 0, $comment_mode = 0) { } // default - $file = $base_path."/".$icon.".gif"; + $file = $base_path."/forum-$icon.gif"; return "<img src=\"$file\" alt=\"\" title=\"\" />"; } @@ -728,8 +665,8 @@ function forum_help($section = "admin/forum/help") { $output .= strtr("<p>The forum module uses taxonomy to organize itself. To create a forum you first have to create a %taxonomy. When doing this, choose a sensible name for it (such as \"fora\") and make sure under \"Types\" that \"forum\" is selected. Once you have done this, %taxo-terms to it. Each term will become a forum. If you fill in the description field, users will be given additonal information about the forum on the main forum page. For example: \"troubleshooting\" - \"Please ask your questions here.\"</p>", array("%taxonomy" => l(t("taxonomy vocabulary"), "admin/taxonomy/add/vocabulary"), "%taxo-terms" => l(t("add some terms"), "admin/taxonomy" ) )); $output .= strtr("<p>When you are happy with your vocabulary, go to ". l("site configuration » modules » forum","admin/system/modules/forum") ." and set <b>Forum vocabulary</b> to the one you have just created. There will now be fora active on the site. For users to access them they must have the \"access content\" %permission and to create a topic they must have the \"create forum topics\" %permission. These permissions can be set in the %permission pages.</p>", array("%forums" => l(t("site configutation » modules » forum"), "admin/system/modules/forum"), "%permission" => l(t("permission"), "admin/user/permission") )); $output .= "<h4>Icons</h4>"; - $output .= strtr("<p>To disable icons, set the icon path as blank in %forums-icon.</p>",array("%forums-icon" => l(t("site configuration » modules » forums"), "admin/system/module/forum") )); - $output .= "<p>All files in the icon directory are assumed to be images. You may use images of whatever size you wish, but it is customary to use 15x15 or 16x16.</p>"; + $output .= strtr("<p>To disable icons, set the icon path as blank in %forums-icon.</p>", array("%forums-icon" => l(t("site configuration » modules » forums"), "admin/system/module/forum") )); + $output .= "<p>All files in the icon directory are assumed to be images. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16.</p>"; break; case 'admin/system/modules': $output = "Enable threaded discussions about general topics."; diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 3b855574b..e1ce357af 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -41,8 +41,7 @@ function forum_settings() { if ($voc) { $output .= form_textarea(t("Explanation or submission guidelines"), "forum_help", variable_get("forum_help", ""), 70, 5, t("This text will be displayed at the top of the forum submission form. Useful for helping or instructing your users.")); $output .= form_select(t("Forum vocabulary"), "forum_nav_vocabulary", variable_get("forum_nav_vocabulary", ""), $vocs, t("The taxonomy vocabulary that will be used as the navigation tree.")); - $output .= form_textfield(t("Topic icons path"), "forum_topic_icon_path", variable_get("forum_topic_icon_path", ""), 30, 255, t("The path to the topic icons. Leave blank to disable icons.")); - $output .= form_textfield(t("Folder icons path"), "forum_folder_icon_path", variable_get("forum_folder_icon_path", ""), 30, 255,t( "The path to the <b>default</b>, <b>hot</b>, <b>new</b>, <b>hot & new</b>, and <b>closed</b> folder icons. Leave blank to disable icons.")); + $output .= form_textfield(t("Forum icon path"), "forum_icon_path", variable_get("forum_icon_path", ""), 30, 255, t("The path to the forum icons. Leave blank to disable icons. Don't add a trailing slash. Default icons are available in the 'misc' directory.")); $number = array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 50 => 50, 60 => 60, 80 => 80, 100 => 100, 10000=>10000); $output .= form_select(t("Hot topic threshold"), "forum_hot_topic", variable_get("forum_hot_topic", 15), $number, t("The number of posts a topic must have to be considered <b>hot</b>.")); $number = array(10 => 10, 25 => 25, 50 => 50, 75 => 75, 100 => 100); @@ -88,7 +87,7 @@ function forum_block($op = "list", $delta = 0) { $content .= node_title_list(db_query_range("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER 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", 0, variable_get("forum_block_num", "5")), t("New forum topics:")); if ($content) { - $content .= "<div id=\"forum_more\" style=\"text-align: right;\">". l(t("more"), "forum", array("title" => t("Read the latest forum topics."))) ."</div>"; + $content .= "<div class=\"more-link\">". l(t("more"), "forum", array("title" => t("Read the latest forum topics."))) ."</div>"; } $blocks["subject"] = t("Forum topics"); @@ -198,63 +197,17 @@ function forum_form(&$node, &$help, &$error) { $output .= form_checkbox(t("Leave shadow copy"), "shadow", 1, $node->shadow, t("If you move this topic, you can leave a link in the old forum to the new forum.")); } - if ($icon_path = variable_get("forum_topic_icon_path", "")) { - if ($node->icon) { - // we are editing post - if ($dir = @opendir($icon_path)) { - $icon_num = 0; - while($icon = readdir($dir)) { - if ($icon == '.' || $icon == '..') {continue;} - if ($node->icon == $icon) {$checked = "checked";} else {$checked = "";} - $radio .= "<input type=\"radio\" name=\"edit[icon_num]\" value=\"$icon_num\" $checked /><img src=\"$icon_path$icon\" alt=\"\" title=\"\" /> \n"; - $icon_num++; - } - closedir($dir); - } - } - else { - if ($dir = @opendir($icon_path)) { - $icon_num = 0; - while($icon = readdir($dir)) { - if ($icon == '.' || $icon == '..') {continue;} - if ($node->icon_num == $icon_num) {$checked = "checked";} else {$checked = "";} - $radio .= "<input type=\"radio\" name=\"edit[icon_num]\" value=\"$icon_num\" $checked /><img src=\"$icon_path$icon\" alt=\"\" title=\"\" /> \n"; - $icon_num++; - } - closedir($dir); - } - } - $output .= form_item(t("Topic icon"), $radio); - } $output .= form_textarea(t("Body"), "body", $node->body, 60, 10); return $output; } function forum_insert($node) { - $node->icon = _forum_decode_icon($node); - db_query("INSERT INTO {forum} (nid, icon, shadow, tid) VALUES (%d, '%s', %d, %d)", $node->nid, $node->icon, $node->shadow, $node->tid[0]); + db_query("INSERT INTO {forum} (nid, shadow, tid) VALUES (%d, %d, %d)", $node->nid, $node->shadow, $node->tid[0]); } function forum_update($node) { - $node->icon = _forum_decode_icon($node); - db_query("UPDATE {forum} SET icon = '%s', shadow = %d, tid = %d WHERE nid = %d", $node->icon, $node->shadow, $node->tid[0], $node->nid); -} - -function _forum_decode_icon($node) { - // to prevent malicious users - if ($icon_path = variable_get("forum_topic_icon_path", "")) { - if ($dir = @opendir($icon_path)) { - $icon_num = 0; - while($icon = readdir($dir)) { - if ($icon == '.' || $icon == '..') {continue;} - if ($icon_num == $node->icon_num) {$myicon = $icon;} - $icon_num++; - } - closedir($dir); - } - } - return $myicon; + db_query("UPDATE {forum} SET shadow = %d, tid = %d WHERE nid = %d", $node->shadow, $node->tid[0], $node->nid); } function forum_delete(&$node) { @@ -374,7 +327,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $sql_sortby = _forum_get_topic_order($sortby); // show topics with the correct tid, or in the forum but with shadow = 1 - $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, f.icon, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid LEFT JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid, f.icon ORDER BY $sql_sortby"; + $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid LEFT JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid ORDER BY $sql_sortby"; $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum'"; @@ -533,7 +486,7 @@ function forum_theme_list($forums, $parents, $tid) { if ($forums) { - $header = array(array("data" => t("Forum"), "colspan" => "2"), t("Topics"), t("Posts"), t("Last post")); + $header = array(t("Forum"), t("Topics"), t("Posts"), t("Last post")); foreach ($forums as $forum) { if ($user->uid) { @@ -561,13 +514,11 @@ function forum_theme_list($forums, $parents, $tid) { } $description .="</div>\n"; - //if ($icon = _forum_get_folder_icon($new_topics)) { $rows[] = array( - array("data" => $icon, "class" => "icon"), array("data" => $description, "class" => "description"), array("data" => $forum->num_topics . ($new_topics ? "<br />(".t("%a new", array("%a" => $new_topics)).")" : ""), "class" => "topics"), array("data" => $forum->num_posts, "class" => "posts"), - array("data" => _forum_format($forum->last_post), "class" => "last-post") + array("data" => _forum_format($forum->last_post), "class" => "last-reply") ); } @@ -610,35 +561,33 @@ function forum_theme_topic_list($tid, $topics, $sortby, $forum_per_page, $offset if ($topics) { - $header = array(array("data" => t("Topic"), "colspan" => "3"), t("Replies"), t("Posted"), t("Last post")); + $header = array(array("data" => t("Topic"), "colspan" => "2"), t("Replies"), t("Created"), t("Last reply")); foreach ($topics as $topic) { // folder is new if topic is new or there are new comments since last visit if ($topic->tid != $tid) { $rows[] = array( - array("data" => _forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), - array("data" =>_forum_get_icon($topic), "class" => "icon"), + array("data" => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), array("data" => $topic->title, "class" => "title"), - array("data" => l(t("This topic has been moved"), "forum/$topic->tid"), "colspan" => 3) + array("data" => l(t("This topic has been moved"), "forum/$topic->tid"), "colspan" => "3") ); } else { $rows[] = array( - array("data" => _forum_get_folder_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), - array("data" => _forum_get_icon($topic), "class" => "icon"), + array("data" => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode), "class" => "icon"), array("data" => l($topic->title, "node/view/$topic->nid"), "class" => "topic"), array("data" => $topic->num_comments . ($topic->new_replies ? "<br />(".t("%a new", array("%a" => $topic->new_replies)).")" : ""), "class" => "replies"), - array("data" => _forum_format($topic), "class" => "posted"), - array("data" => _forum_format($topic->last_reply), "class" => "last-post") + array("data" => _forum_format($topic), "class" => "created"), + array("data" => _forum_format($topic->last_reply), "class" => "last-reply") ); } } - $rows[] = array(array("data" => t("%a topics, %b topics per page, page %c of %d", array("%a" => $pager_total[0], "%b" => $forum_per_page, "%c" => $offset, "%d" => ceil($pager_total[0]/$forum_per_page))), "colspan" => "6", "class" => "statistics")); - $rows[] = array(array("data" => theme("forum_theme_topic_browser", $sortby, $forum_per_page, $offset), "colspan" => "6", "class" => "settings")); + $rows[] = array(array("data" => t("%a topics, %b topics per page, page %c of %d", array("%a" => $pager_total[0], "%b" => $forum_per_page, "%c" => $offset, "%d" => ceil($pager_total[0]/$forum_per_page))), "colspan" => "5", "class" => "statistics")); + $rows[] = array(array("data" => theme("forum_theme_topic_browser", $sortby, $forum_per_page, $offset), "colspan" => "5", "class" => "settings")); if ($pager = pager_display(NULL, $forum_per_page, 0, "default")) { - $rows[] = array(array("data" => $pager, "colspan" => "6", "class" => "pager")); + $rows[] = array(array("data" => $pager, "colspan" => "5", "class" => "pager")); } } @@ -647,29 +596,17 @@ function forum_theme_topic_list($tid, $topics, $sortby, $forum_per_page, $offset $output = l(t("create new forum topic"), "node/add/forum/$tid") ."<br /><br />"; } - $output .= table($header, $rows); + $output .= table($header, $rows); return $output; } +function _forum_icon($new_posts, $num_posts = 0, $comment_mode = 0) { -function _forum_get_icon($node) { - if (variable_get("forum_topic_icon_path", "") && $node->icon) { - return "<img src=\"". variable_get("forum_topic_icon_path", "") ."$node->icon\" />"; - } - else { - return " "; - } -} - -function _forum_get_folder_icon($new_posts, $num_posts = 0, $comment_mode = 0) { - // "folder" icon because it's generally rendered as a folder - - - $base_path = variable_get("forum_folder_icon_path", ""); + $base_path = variable_get("forum_icon_path", ""); if ($base_path) { if ($num_posts > variable_get("forum_hot_topic", 15)) { - $icon = $new_posts ? "hot_new" : "hot"; + $icon = $new_posts ? "hot-new" : "hot"; } else { $icon = $new_posts ? "new" : "default"; @@ -680,7 +617,7 @@ function _forum_get_folder_icon($new_posts, $num_posts = 0, $comment_mode = 0) { } // default - $file = $base_path."/".$icon.".gif"; + $file = $base_path."/forum-$icon.gif"; return "<img src=\"$file\" alt=\"\" title=\"\" />"; } @@ -728,8 +665,8 @@ function forum_help($section = "admin/forum/help") { $output .= strtr("<p>The forum module uses taxonomy to organize itself. To create a forum you first have to create a %taxonomy. When doing this, choose a sensible name for it (such as \"fora\") and make sure under \"Types\" that \"forum\" is selected. Once you have done this, %taxo-terms to it. Each term will become a forum. If you fill in the description field, users will be given additonal information about the forum on the main forum page. For example: \"troubleshooting\" - \"Please ask your questions here.\"</p>", array("%taxonomy" => l(t("taxonomy vocabulary"), "admin/taxonomy/add/vocabulary"), "%taxo-terms" => l(t("add some terms"), "admin/taxonomy" ) )); $output .= strtr("<p>When you are happy with your vocabulary, go to ". l("site configuration » modules » forum","admin/system/modules/forum") ." and set <b>Forum vocabulary</b> to the one you have just created. There will now be fora active on the site. For users to access them they must have the \"access content\" %permission and to create a topic they must have the \"create forum topics\" %permission. These permissions can be set in the %permission pages.</p>", array("%forums" => l(t("site configutation » modules » forum"), "admin/system/modules/forum"), "%permission" => l(t("permission"), "admin/user/permission") )); $output .= "<h4>Icons</h4>"; - $output .= strtr("<p>To disable icons, set the icon path as blank in %forums-icon.</p>",array("%forums-icon" => l(t("site configuration » modules » forums"), "admin/system/module/forum") )); - $output .= "<p>All files in the icon directory are assumed to be images. You may use images of whatever size you wish, but it is customary to use 15x15 or 16x16.</p>"; + $output .= strtr("<p>To disable icons, set the icon path as blank in %forums-icon.</p>", array("%forums-icon" => l(t("site configuration » modules » forums"), "admin/system/module/forum") )); + $output .= "<p>All files in the icon directory are assumed to be images. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16.</p>"; break; case 'admin/system/modules': $output = "Enable threaded discussions about general topics."; diff --git a/modules/import.module b/modules/import.module index 1ed5dd648..4ae74fd54 100644 --- a/modules/import.module +++ b/modules/import.module @@ -108,7 +108,7 @@ function import_update() { } } -function import_format_item($item, $feed = 0) { +function import_theme_format_item($item, $feed = 0) { global $user; if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) { @@ -132,7 +132,7 @@ function import_bundle_block($attributes) { $items = array(); while ($item = db_fetch_object($result)) { - $items[] = theme("import_theme_format_item",$item); + $items[] = theme("import_theme_format_item", $item); } $output = "<div class=\"import-block\"><div class=\"bundle\">"; @@ -177,13 +177,13 @@ function import_block($op, $delta) { case "feed": $feed = db_fetch_object(db_query("SELECT * FROM {feed} WHERE fid = %d", $id)); $block["subject"] = $feed->title; - $block["content"] .= import_feed_block($feed) ."<div style=\"text-align: right;\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; + $block["content"] .= import_feed_block($feed) ."<div class=\"more-link\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; break; case "bundle": $bundle = db_fetch_object(db_query("SELECT * FROM {bundle} WHERE bid = %d", $id)); $block["subject"] = $bundle->title; - $block["content"] .= import_bundle_block($bundle->attributes) ."<div style=\"text-align: right;\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; + $block["content"] .= import_bundle_block($bundle->attributes) ."<div class=\"more-link\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; break; } @@ -198,9 +198,7 @@ function import_get_bundles($attributes = 0) { $result = db_query("SELECT * FROM {bundle} ORDER BY title"); while ($bundle = db_fetch_object($result)) { $block["bundle:$bundle->bid"]["subject"] = $bundle->title; - $block["bundle:$bundle->bid"]["content"] = import_bundle_block($bundle->attributes) ."<div style=\"text-align: right;\">". - l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) - ."</div>"; + $block["bundle:$bundle->bid"]["content"] = import_bundle_block($bundle->attributes) ."<div class=\"more-link\">". l(t("more"), "import/bundle/$bundle->bid", array("title" => t("View this bundle's recent news."))) ."</div>"; $block["bundle:$bundle->bid"]["info"] = "$bundle->title bundle"; } @@ -214,9 +212,7 @@ function import_get_feeds($attributes = 0) { $result = db_query("SELECT * FROM {feed} ORDER BY fid"); while ($feed = db_fetch_object($result)) { $block["feed:$feed->fid"]["subject"] = $feed->title; - $block["feed:$feed->fid"]["content"] = import_feed_block($feed) ."<div style=\"text-align: right;\">". - l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) - ."</div>"; + $block["feed:$feed->fid"]["content"] = import_feed_block($feed) ."<div class=\"more-link\">". l(t("more"), "import/feed/$feed->fid", array("title" => t("View this feed's recent news."))) ."</div>"; $block["feed:$feed->fid"]["info"] = "$feed->title feed"; } diff --git a/update.php b/update.php index 5fd84c5db..a382668e1 100644 --- a/update.php +++ b/update.php @@ -40,7 +40,8 @@ $mysql_updates = array( "2003-06-04" => "update_56", "2003-06-08" => "update_57", "2003-06-08: first update since Drupal 4.2.0 release" => "update_58", - "2003-08-05" => "update_59" + "2003-08-05" => "update_59", + "2003-08-15" => "update_60" ); function update_32() { @@ -326,6 +327,10 @@ function _update_thread_structure($comments, $pid, $depth, $structure) { return $structure; } +function update_60() { + update_sql("ALTER TABLE forum DROP icon"); +} + function _update_next_thread($structure, $parent) { do { $val++; |