aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2007-01-27 16:04:58 +0000
committerNils Adermann <naderman@naderman.de>2007-01-27 16:04:58 +0000
commitaa8ebc7bf3126e21b07fffffb50ac49fc7215fad (patch)
tree76680ebd31a4163a77a09319b71d91f048bc2c00 /phpBB/includes
parent14e209a487abc134812147907ef4e03d2850a767 (diff)
downloadforums-aa8ebc7bf3126e21b07fffffb50ac49fc7215fad.tar
forums-aa8ebc7bf3126e21b07fffffb50ac49fc7215fad.tar.gz
forums-aa8ebc7bf3126e21b07fffffb50ac49fc7215fad.tar.bz2
forums-aa8ebc7bf3126e21b07fffffb50ac49fc7215fad.tar.xz
forums-aa8ebc7bf3126e21b07fffffb50ac49fc7215fad.zip
- introducing read/unread images in the MCP, if you view something through the MCP it will not update the "read" status of a post/topic/forum [includes Bug #6796]
git-svn-id: file:///svn/phpbb/trunk@6936 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/mcp/mcp_forum.php42
-rw-r--r--phpBB/includes/mcp/mcp_main.php2
-rw-r--r--phpBB/includes/mcp/mcp_post.php21
-rw-r--r--phpBB/includes/mcp/mcp_queue.php19
-rwxr-xr-xphpBB/includes/mcp/mcp_reports.php19
-rw-r--r--phpBB/includes/mcp/mcp_topic.php20
6 files changed, 110 insertions, 13 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 4b8961bf38..cf41df646d 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -99,8 +99,18 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$topic_rows = array();
- $sql = 'SELECT t.*
- FROM ' . TOPICS_TABLE . " t
+ if ($config['load_db_lastread'])
+ {
+ $read_tracking_join = ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')';
+ $read_tracking_select = ', tt.mark_time';
+ }
+ else
+ {
+ $read_tracking_join = $read_tracking_select = '';
+ }
+
+ $sql = "SELECT t.*$read_tracking_select
+ FROM " . TOPICS_TABLE . " t $read_tracking_join
WHERE (t.forum_id = $forum_id OR t.forum_id = 0)
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
$limit_time_sql
@@ -109,19 +119,40 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
while ($row = $db->sql_fetchrow($result))
{
- $topic_rows[] = $row;
+ $topic_rows[$row['topic_id']] = $row;
+ $topic_list[] = $row['topic_id'];
}
$db->sql_freeresult($result);
- foreach ($topic_rows as $row)
+ $topic_tracking_info = array();
+ // Get topic tracking info
+ if ($config['load_db_lastread'])
+ {
+ $topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']), array());
+ }
+ else
+ {
+ $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, array());
+ }
+
+ foreach ($topic_rows as $topic_id => $row)
{
$topic_title = '';
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
+ if ($row['topic_status'] == ITEM_MOVED)
+ {
+ $unread_topic = false;
+ }
+ else
+ {
+ $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
+ }
+
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
- topic_status($row, $replies, false, $folder_img, $folder_alt, $topic_type);
+ topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
$topic_title = censor_text($row['topic_title']);
@@ -159,6 +190,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
+ 'S_UNREAD_TOPIC' => $unread_topic,
);
if ($row['topic_status'] == ITEM_MOVED)
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index a53430f1bd..e10a2f7990 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -145,7 +145,7 @@ class mcp_main
$forum_id = request_var('f', 0);
- $forum_info = get_forum_data($forum_id, 'm_');
+ $forum_info = get_forum_data($forum_id, 'm_', true);
if (!sizeof($forum_info))
{
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 3717c8df90..67f5472134 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -22,7 +22,7 @@ function mcp_post_details($id, $mode, $action)
$start = request_var('start', 0);
// Get post data
- $post_info = get_post_data(array($post_id));
+ $post_info = get_post_data(array($post_id), false, true);
if (!sizeof($post_info))
{
@@ -91,6 +91,21 @@ function mcp_post_details($id, $mode, $action)
// Set some vars
$users_ary = $usernames_ary = array();
$post_id = $post_info['post_id'];
+ $topic_tracking_info = array();
+
+ // Get topic tracking info
+ if ($config['load_db_lastread'])
+ {
+ $tmp_topic_data = array($post_info['topic_id'] => $post_info);
+ $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
+ unset($tmp_topic_data);
+ }
+ else
+ {
+ $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
+ }
+
+ $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
// Process message, leave it uncensored
$message = $post_info['post_text'];
@@ -127,7 +142,9 @@ function mcp_post_details($id, $mode, $action)
'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user&amp;u=' . $post_info['user_id']) : '',
'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']),
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']),
-
+
+ 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
+
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_info['forum_id']}&amp;p=$post_id") . "#p$post_id\">", '</a>'),
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$post_info['forum_id']}&amp;start={$start}") . '">', '</a>'),
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index b8619e6f84..6378295191 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -82,7 +82,7 @@ class mcp_queue
}
}
- $post_info = get_post_data(array($post_id), 'm_approve');
+ $post_info = get_post_data(array($post_id), 'm_approve', true);
if (!sizeof($post_info))
{
@@ -99,6 +99,21 @@ class mcp_queue
);
}
+ $topic_tracking_info = array();
+ // Get topic tracking info
+ if ($config['load_db_lastread'])
+ {
+ $tmp_topic_data = array($post_info['topic_id'] => $post_info);
+ $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
+ unset($tmp_topic_data);
+ }
+ else
+ {
+ $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
+ }
+
+ $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
+
// Process message, leave it uncensored
$message = $post_info['post_text'];
$message = str_replace("\n", '<br />', $message);
@@ -130,6 +145,8 @@ class mcp_queue
'U_VIEW_POST' => $post_url,
'U_VIEW_TOPIC' => $topic_url,
+ 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
+
'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start=$start\">", '</a>'),
'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'),
'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'),
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 8484b8fb70..78fa02cccc 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -83,7 +83,7 @@ class mcp_reports
$post_id = $report['post_id'];
}
- $post_info = get_post_data(array($post_id), 'm_report');
+ $post_info = get_post_data(array($post_id), 'm_report', true);
if (!sizeof($post_info))
{
@@ -107,13 +107,27 @@ class mcp_reports
);
}
+ $topic_tracking_info = array();
+ // Get topic tracking info
+ if ($config['load_db_lastread'])
+ {
+ $tmp_topic_data = array($post_info['topic_id'] => $post_info);
+ $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
+ unset($tmp_topic_data);
+ }
+ else
+ {
+ $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
+ }
+
+ $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
+
// Process message, leave it uncensored
$message = $post_info['post_text'];
$message = str_replace("\n", '<br />', $message);
if ($post_info['bbcode_bitfield'])
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
-
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
@@ -139,6 +153,7 @@ class mcp_reports
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']),
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
+ 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&amp;mode=reports' : '&amp;mode=reports_closed') . '&amp;start=' . $start . '&amp;f=' . $post_info['forum_id']) . '">', '</a>'),
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 09b3f6f314..716b7a1529 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -21,7 +21,7 @@ function mcp_topic_view($id, $mode, $action)
$user->add_lang('viewtopic');
$topic_id = request_var('t', 0);
- $topic_info = get_topic_data(array($topic_id));
+ $topic_info = get_topic_data(array($topic_id), false, true);
if (!sizeof($topic_info))
{
@@ -118,6 +118,20 @@ function mcp_topic_view($id, $mode, $action)
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
+ $topic_tracking_info = array();
+
+ // Get topic tracking info
+ if ($config['load_db_lastread'])
+ {
+ $tmp_topic_data = array($topic_id => $topic_info);
+ $topic_tracking_info = get_topic_tracking($topic_info['forum_id'], $topic_id, $tmp_topic_data, array($topic_info['forum_id'] => $topic_info['forum_mark_time']));
+ unset($tmp_topic_data);
+ }
+ else
+ {
+ $topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);
+ }
+
foreach ($rowset as $i => $row)
{
$has_unapproved_posts = false;
@@ -138,6 +152,8 @@ function mcp_topic_view($id, $mode, $action)
$has_unapproved_posts = true;
}
+ $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
+
$template->assign_block_vars('postrow', array(
'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
@@ -150,7 +166,7 @@ function mcp_topic_view($id, $mode, $action)
'POST_ID' => $row['post_id'],
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id) . '">', '</a>'),
- 'MINI_POST_IMG' => ($row['post_time'] > $user->data['user_lastvisit'] && $user->data['is_registered']) ? $user->img('icon_post_target_unread', $user->lang['NEW_POST']) : $user->img('icon_post_target', $user->lang['POST']),
+ 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
'S_POST_REPORTED' => ($row['post_reported']) ? true : false,
'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,