aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/index.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-05-16 21:59:57 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-05-16 21:59:57 +0000
commitcf492d3748b8b65aa7e14b0fad667dc5447b1239 (patch)
treeaa3f3314fa3a45520d14121328ff57e33db9831a /phpBB/index.php
parent36cb30de909891b538a3998628bf69089b70f9e7 (diff)
downloadforums-cf492d3748b8b65aa7e14b0fad667dc5447b1239.tar
forums-cf492d3748b8b65aa7e14b0fad667dc5447b1239.tar.gz
forums-cf492d3748b8b65aa7e14b0fad667dc5447b1239.tar.bz2
forums-cf492d3748b8b65aa7e14b0fad667dc5447b1239.tar.xz
forums-cf492d3748b8b65aa7e14b0fad667dc5447b1239.zip
Upgraded last post feature
git-svn-id: file:///svn/phpbb/trunk@306 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/index.php')
-rw-r--r--phpBB/index.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/phpBB/index.php b/phpBB/index.php
index ddbc6fc668..e508a42ac7 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -74,14 +74,14 @@ if($total_categories)
{
case 'postgresql':
$limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : "";
- $sql = "SELECT f.*, t.topic_id, p.post_time, u.username, u.user_id
+ $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, p.post_time, u.username, u.user_id
FROM ".FORUMS_TABLE." f, ".TOPICS_TABLE." t, ".POSTS_TABLE." p, ".USERS_TABLE." u
WHERE f.forum_last_post_id = p.post_id
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
$limit_forums
UNION (
- SELECT f.*, NULL, NULL, NULL, NULL
+ SELECT f.*, NULL, NULL, NULL, NULL, NULL, NULL
FROM ".FORUMS_TABLE." f
WHERE NOT EXISTS (
SELECT p.post_time
@@ -95,7 +95,7 @@ if($total_categories)
case 'oracle':
$limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : "";
- $sql = "SELECT f.*, t.topic_id, u.username, u.user_id, p.post_time
+ $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
FROM ".FORUMS_TABLE." f, ".POSTS_TABLE." p, ".TOPICS_TABLE." t, ".USERS_TABLE." u
WHERE f.forum_last_post_id = p.post_id(+)
AND p.post_id = t.topic_last_post_id(+)
@@ -107,7 +107,7 @@ if($total_categories)
default:
// This works on: MySQL, MSSQL and ODBC (Access)
$limit_forums = ($viewcat != -1) ? "WHERE f.cat_id = $viewcat " : "";
- $sql = "SELECT f.*, t.topic_id, u.username, u.user_id, p.post_time
+ echo $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
FROM (( ".FORUMS_TABLE." f
LEFT JOIN ".POSTS_TABLE." p ON f.forum_last_post_id = p.post_id )
LEFT JOIN ".TOPICS_TABLE." t ON p.post_id = t.topic_last_post_id )
@@ -165,9 +165,15 @@ if($total_categories)
if($forum_rows[$j]['username'] != "" && $forum_rows[$j]['post_time'] > 0)
{
$last_post_time = create_date($board_config['default_dateformat'], $forum_rows[$j]['post_time'], $board_config['default_timezone']);
+
+ $topic_last_post_start = (int)(($forum_rows[$j]['topic_replies']+1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
+ $last_post_get = ($topic_last_post_start) ? "&start=".$topic_last_post_start : "";
+ $last_post_get .= "#".$forum_rows[$j]['topic_last_post_id'];
+
$last_post = $last_post_time."<br>by ";
- $last_post .= "<a href=\"".append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$forum_rows[$j]['user_id']);
- $last_post .= "\">".$forum_rows[$j]['username']."</a>&nbsp;<a href=\"".append_sid("viewtopic.".$phpEx."?t=".$forum_rows[$j]['topic_id'])."\"><img src=\"".$images['latest_reply']."\" width=\"20\" height=\"11\" border=\"0\" alt=\"View Latest Post\"></a>";
+ $last_post .= "<a href=\"".append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$forum_rows[$j]['user_id']) ."\">".$forum_rows[$j]['username']."</a>&nbsp;";
+
+ $last_post .= "<a href=\"".append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$forum_rows[$j]['topic_id']).$last_post_get."\"><img src=\"".$images['latest_reply']."\" width=\"20\" height=\"11\" border=\"0\" alt=\"View Latest Post\"></a>";
}
else
{