mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
- load tracking updates. Need to be tested on a clean installation too - at the moment only tiny quirks are noticed at area51.
- reported bugs fixed git-svn-id: file:///svn/phpbb/trunk@6256 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -38,7 +38,7 @@ class acp_bbcodes
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting, bbcode_helpline, bbcode_helpline
|
||||
$sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting, bbcode_helpline
|
||||
FROM ' . BBCODES_TABLE . '
|
||||
WHERE bbcode_id = ' . $bbcode_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
@@ -239,16 +239,17 @@ class acp_board
|
||||
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'type' => 'text:4:3', 'explain' => true),
|
||||
|
||||
'legend2' => 'GENERAL_OPTIONS',
|
||||
'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY','type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
|
||||
'legend3' => 'CUSTOM_PROFILE_FIELDS',
|
||||
'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
|
@@ -554,6 +554,9 @@ class acp_icons
|
||||
|
||||
$notice = $user->lang[$lang . '_DELETED'];
|
||||
|
||||
$cache->destroy('icons');
|
||||
$cache->destroy('sql', $table);
|
||||
|
||||
break;
|
||||
|
||||
case 'move_up':
|
||||
|
@@ -539,7 +539,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||
$db->sql_query('DELETE FROM ' . FORUMS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']}");
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . time() . " WHERE user_id = {$user->data['user_id']}");
|
||||
}
|
||||
else
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
|
||||
$tracking_topics = ($tracking_topics) ? unserialize($tracking_topics) : array();
|
||||
@@ -633,7 +633,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
$tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
|
||||
$tracking = ($tracking) ? unserialize($tracking) : array();
|
||||
@@ -698,7 +698,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||
$db->sql_return_on_error(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
$tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
|
||||
$tracking = ($tracking) ? unserialize($tracking) : array();
|
||||
@@ -745,7 +745,8 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . intval(base_convert(max($time_keys) + $config['board_startdate'], 36, 10)) . " WHERE user_id = {$user->data['user_id']}");
|
||||
$user->data['user_lastmark'] = intval(base_convert(max($time_keys) + $config['board_startdate'], 36, 10));
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . $user->data['user_lastmark'] . " WHERE user_id = {$user->data['user_id']}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -929,7 +930,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
global $tracking_topics;
|
||||
|
||||
@@ -995,6 +996,111 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
|
||||
return $last_read;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for read forums and update topic tracking info accordingly
|
||||
*
|
||||
* @param int $forum_id the forum id to check
|
||||
* @param int $forum_last_post_time the forums last post time
|
||||
* @param int $f_mark_time the forums last mark time if user is registered and load_db_lastread enabled
|
||||
* @param int $mark_time_forum false if the mark time needs to be obtained, else the last users forum mark time
|
||||
*
|
||||
*/
|
||||
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
|
||||
{
|
||||
global $db, $tracking_topics, $user, $config;
|
||||
|
||||
// Determine the users last forum mark time if not given.
|
||||
if ($mark_time_forum === false)
|
||||
{
|
||||
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
||||
{
|
||||
$mark_time_forum = (!empty($f_mark_time)) ? $f_mark_time : $user->data['user_lastmark'];
|
||||
}
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
if (!isset($tracking_topics) || !sizeof($tracking_topics))
|
||||
{
|
||||
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
|
||||
$tracking_topics = ($tracking_topics) ? unserialize($tracking_topics) : array();
|
||||
}
|
||||
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
$user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
|
||||
}
|
||||
|
||||
$mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark'];
|
||||
}
|
||||
}
|
||||
|
||||
// Check the forum for any left unread topics.
|
||||
// If there are none, we mark the forum as read.
|
||||
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
||||
{
|
||||
if ($mark_time_forum >= $forum_last_post_time)
|
||||
{
|
||||
// We do not need to mark read, this happened before. Therefore setting this to true
|
||||
$row = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT t.forum_id FROM ' . TOPICS_TABLE . ' t
|
||||
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')
|
||||
WHERE t.forum_id = ' . $forum_id . '
|
||||
AND t.topic_last_post_time > ' . $mark_time_forum . '
|
||||
AND t.topic_moved_id = 0
|
||||
AND tt.topic_id IS NULL
|
||||
GROUP BY t.forum_id';
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
// Get information from cookie
|
||||
$row = false;
|
||||
|
||||
if (!isset($tracking_topics['tf'][$forum_id]))
|
||||
{
|
||||
// We do not need to mark read, this happened before. Therefore setting this to true
|
||||
$row = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT topic_id
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE forum_id = ' . $forum_id . '
|
||||
AND topic_last_post_time > ' . $mark_time_forum . '
|
||||
AND topic_moved_id = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$check_forum = $tracking_topics['tf'][$forum_id];
|
||||
$unread = false;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!in_array(base_convert($row['topic_id'], 10, 36), array_keys($check_forum)))
|
||||
{
|
||||
$unread = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$row = $unread;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = true;
|
||||
}
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
markread('topics', $forum_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Pagination functions
|
||||
|
||||
/**
|
||||
|
@@ -46,16 +46,16 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
// Display list of active topics for this category?
|
||||
$show_active = (isset($root_data['forum_flags']) && $root_data['forum_flags'] & 16) ? true : false;
|
||||
|
||||
$sql_from = FORUMS_TABLE . ' f ';
|
||||
$lastread_select = $sql_lastread = '';
|
||||
|
||||
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
||||
{
|
||||
$sql_from = FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)';
|
||||
$lastread_select = ', ft.mark_time ';
|
||||
}
|
||||
else
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
$sql_from = FORUMS_TABLE . ' f ';
|
||||
$lastread_select = $sql_lastread = '';
|
||||
|
||||
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
|
||||
$tracking_topics = ($tracking_topics) ? unserialize($tracking_topics) : array();
|
||||
|
||||
@@ -116,7 +116,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
{
|
||||
$forum_tracking_info[$forum_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark'];
|
||||
}
|
||||
else
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
|
@@ -1905,6 +1905,35 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
// We do not use post_time here, this is intended (post_time can have a date in the past if editing a message)
|
||||
markread('topic', $data['forum_id'], $data['topic_id'], time());
|
||||
|
||||
//
|
||||
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
||||
{
|
||||
$sql = 'SELECT mark_time
|
||||
FROM ' . FORUMS_TRACK_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'] . '
|
||||
AND forum_id = ' . $data['forum_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$f_mark_time = (int) $db->sql_fetchfield('mark_time');
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
$f_mark_time = false;
|
||||
}
|
||||
|
||||
if ($config['load_db_lastread'] || $config['load_anon_lastread'] || $user->data['is_registered'])
|
||||
{
|
||||
// Update forum info
|
||||
$sql = 'SELECT forum_last_post_time
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id = ' . $data['forum_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
|
||||
}
|
||||
|
||||
// Send Notifications
|
||||
if ($mode != 'edit' && $mode != 'delete' && ($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id'])))
|
||||
{
|
||||
|
@@ -809,6 +809,12 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
|
||||
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
|
||||
$sql_where";
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($mode == 'user')
|
||||
{
|
||||
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' ' . ((in_array('*', $banlist_ary)) ? '' : 'WHERE user_id IN (' . implode(', ', $banlist_ary) . ')');
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -93,7 +93,7 @@ class ucp_attachments
|
||||
LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id AND a.in_message = 1)
|
||||
WHERE a.poster_id = ' . $user->data['user_id'] . "
|
||||
ORDER BY $order_by";
|
||||
$result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);
|
||||
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||
|
||||
$row_count = 0;
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
@@ -138,8 +138,8 @@ class ucp_attachments
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => on_page($num_attachments, $config['posts_per_page'], $start),
|
||||
'PAGINATION' => generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['posts_per_page'], $start),
|
||||
'PAGE_NUMBER' => on_page($num_attachments, $config['topics_per_page'], $start),
|
||||
'PAGINATION' => generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start),
|
||||
'TOTAL_ATTACHMENTS' => $num_attachments,
|
||||
|
||||
'L_TITLE' => $user->lang['UCP_ATTACHMENTS'],
|
||||
|
@@ -723,7 +723,7 @@ class ucp_groups
|
||||
'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start, true),
|
||||
|
||||
'U_ACTION' => $this->u_action . "&g=$group_id",
|
||||
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames'))
|
||||
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames'))
|
||||
);
|
||||
|
||||
break;
|
||||
|
Reference in New Issue
Block a user