mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
- 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
This commit is contained in:
101
phpBB/mcp.php
101
phpBB/mcp.php
@@ -262,9 +262,9 @@ function extra_url()
|
||||
/**
|
||||
* Get simple topic data
|
||||
*/
|
||||
function get_topic_data($topic_ids, $acl_list = false)
|
||||
function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false)
|
||||
{
|
||||
global $auth, $db;
|
||||
global $auth, $db, $config, $user;
|
||||
static $rowset = array();
|
||||
|
||||
$topics = array();
|
||||
@@ -274,15 +274,53 @@ function get_topic_data($topic_ids, $acl_list = false)
|
||||
return array();
|
||||
}
|
||||
|
||||
$cache_topic_ids = array_intersect($topic_ids, array_keys($rowset));
|
||||
$topic_ids = array_diff($topic_ids, array_keys($rowset));
|
||||
// cache might not contain read tracking info, so we can't use it if read
|
||||
// tracking information is requested
|
||||
if (!$read_tracking)
|
||||
{
|
||||
$cache_topic_ids = array_intersect($topic_ids, array_keys($rowset));
|
||||
$topic_ids = array_diff($topic_ids, array_keys($rowset));
|
||||
}
|
||||
else
|
||||
{
|
||||
$cache_topic_ids = array();
|
||||
}
|
||||
|
||||
if (sizeof($topic_ids))
|
||||
{
|
||||
$sql = 'SELECT f.*, t.*
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f ON t.forum_id = f.forum_id
|
||||
WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids);
|
||||
$sql_array = array(
|
||||
'SELECT' => 't.*, f.*',
|
||||
|
||||
'FROM' => array(
|
||||
TOPICS_TABLE => 't',
|
||||
),
|
||||
|
||||
'LEFT_JOIN' => array(
|
||||
array(
|
||||
'FROM' => array(FORUMS_TABLE => 'f'),
|
||||
'ON' => 'f.forum_id = t.forum_id'
|
||||
)
|
||||
),
|
||||
|
||||
'WHERE' => $db->sql_in_set('t.topic_id', $topic_ids)
|
||||
);
|
||||
|
||||
if ($read_tracking && $config['load_db_lastread'])
|
||||
{
|
||||
$sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time';
|
||||
|
||||
$sql_array['LEFT_JOIN'][] = array(
|
||||
'FROM' => array(TOPICS_TRACK_TABLE => 'tt'),
|
||||
'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id'
|
||||
);
|
||||
|
||||
$sql_array['LEFT_JOIN'][] = array(
|
||||
'FROM' => array(FORUMS_TRACK_TABLE => 'ft'),
|
||||
'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id'
|
||||
);
|
||||
}
|
||||
|
||||
$sql = $db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
@@ -319,9 +357,9 @@ function get_topic_data($topic_ids, $acl_list = false)
|
||||
/**
|
||||
* Get simple post data
|
||||
*/
|
||||
function get_post_data($post_ids, $acl_list = false)
|
||||
function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
|
||||
{
|
||||
global $db, $auth;
|
||||
global $db, $auth, $config, $user;
|
||||
|
||||
$rowset = array();
|
||||
|
||||
@@ -330,7 +368,7 @@ function get_post_data($post_ids, $acl_list = false)
|
||||
return array();
|
||||
}
|
||||
|
||||
$sql = $db->sql_build_query('SELECT', array(
|
||||
$sql_array = array(
|
||||
'SELECT' => 'p.*, u.*, t.*, f.*',
|
||||
|
||||
'FROM' => array(
|
||||
@@ -349,8 +387,26 @@ function get_post_data($post_ids, $acl_list = false)
|
||||
'WHERE' => $db->sql_in_set('p.post_id', $post_ids) . '
|
||||
AND u.user_id = p.poster_id
|
||||
AND t.topic_id = p.topic_id',
|
||||
));
|
||||
);
|
||||
|
||||
if ($read_tracking && $config['load_db_lastread'])
|
||||
{
|
||||
$sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time';
|
||||
|
||||
$sql_array['LEFT_JOIN'][] = array(
|
||||
'FROM' => array(TOPICS_TRACK_TABLE => 'tt'),
|
||||
'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id'
|
||||
);
|
||||
|
||||
$sql_array['LEFT_JOIN'][] = array(
|
||||
'FROM' => array(FORUMS_TRACK_TABLE => 'ft'),
|
||||
'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id'
|
||||
);
|
||||
}
|
||||
|
||||
$sql = $db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $db->sql_query($sql);
|
||||
unset($sql_array);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
@@ -381,9 +437,9 @@ function get_post_data($post_ids, $acl_list = false)
|
||||
/**
|
||||
* Get simple forum data
|
||||
*/
|
||||
function get_forum_data($forum_id, $acl_list = 'f_list')
|
||||
function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
|
||||
{
|
||||
global $auth, $db;
|
||||
global $auth, $db, $user, $config;
|
||||
|
||||
$rowset = array();
|
||||
|
||||
@@ -397,9 +453,20 @@ function get_forum_data($forum_id, $acl_list = 'f_list')
|
||||
return array();
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('forum_id', $forum_id);
|
||||
if ($read_tracking && $config['load_db_lastread'])
|
||||
{
|
||||
$read_tracking_join = ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . '
|
||||
AND ft.forum_id = f.forum_id)';
|
||||
$read_tracking_select = ', ft.mark_time';
|
||||
}
|
||||
else
|
||||
{
|
||||
$read_tracking_join = $read_tracking_select = '';
|
||||
}
|
||||
|
||||
$sql = "SELECT * $read_tracking_select
|
||||
FROM " . FORUMS_TABLE . " f$read_tracking_join
|
||||
WHERE " . $db->sql_in_set('f.forum_id', $forum_id);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
|
Reference in New Issue
Block a user