diff --git a/phpBB/styles/subSilver/template/viewtopic_print.html b/phpBB/styles/subSilver/template/viewtopic_print.html
index c286fcf660..69a51f42c8 100644
--- a/phpBB/styles/subSilver/template/viewtopic_print.html
+++ b/phpBB/styles/subSilver/template/viewtopic_print.html
@@ -60,13 +60,13 @@ hr.sep {
- {SITENAME} {U_FORUM} |
+ {SITENAME} {U_FORUM} |
|
- {TOPIC_TITLE} {U_TOPIC} |
+ {TOPIC_TITLE} {U_TOPIC} |
{PAGE_NUMBER} |
diff --git a/phpBB/styles/subSilver/theme/stylesheet.css b/phpBB/styles/subSilver/theme/stylesheet.css
index 14daf52432..239ed7570d 100644
--- a/phpBB/styles/subSilver/theme/stylesheet.css
+++ b/phpBB/styles/subSilver/theme/stylesheet.css
@@ -215,7 +215,7 @@ p.topicdetails {
font-family: "Lucida Grande", "Trebuchet MS", Helvetica, Arial, sans-serif;
}
-.postbody li, ul {
+.postbody li, ol, ul {
margin-left: 1.5em;
}
@@ -609,6 +609,11 @@ input.radio {
color: #006699;
}
+.sep {
+ color: black;
+ background-color: #FFA34F;
+}
+
table.colortable td {
padding: 0;
}
diff --git a/phpBB/ucp.php b/phpBB/ucp.php
index cf75233172..bf0d562dcb 100755
--- a/phpBB/ucp.php
+++ b/phpBB/ucp.php
@@ -32,6 +32,9 @@ $user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
+// Setting a variable to let the style designer know where he is...
+$template->assign_var('S_IN_UCP', true);
+
$module = new p_master();
// Basic "global" modes
@@ -280,9 +283,9 @@ while ($row = $db->sql_fetchrow($result))
$db->sql_freeresult($result);
// Output PM_TO box if message composing
-if ($mode == 'compose' && request_var('action', '') != 'edit')
+if ($mode == 'compose' && $auth->acl_get('u_sendpm') && request_var('action', '') != 'edit')
{
- if ($config['allow_mass_pm'])
+ if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm'))
{
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . '
@@ -301,8 +304,8 @@ if ($mode == 'compose' && request_var('action', '') != 'edit')
$template->assign_vars(array(
'S_SHOW_PM_BOX' => true,
- 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm']),
- 'S_GROUP_OPTIONS' => ($config['allow_mass_pm']) ? $group_options : '',
+ 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false,
+ 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? $group_options : '',
'U_SEARCH_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=post&field=username_list'))
);
}
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 13774c1732..36f740e210 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -38,17 +38,14 @@ if (!$forum_id)
}
$sql_from = FORUMS_TABLE . ' f';
+$lastread_select = '';
// Grab appropriate forum data
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
$sql_from .= ' 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
-{
- $lastread_select = '';
+ $lastread_select .= ', ft.mark_time';
}
if ($user->data['is_registered'])
@@ -240,23 +237,23 @@ $template->assign_vars(array(
'TOTAL_TOPICS' => ($s_display_active) ? false : (($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count)),
'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '',
- 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('btn_locked', $post_alt) : $user->img('btn_post', $post_alt),
- 'NEWEST_POST_IMG' => $user->img('icon_post_newest', 'VIEW_NEWEST_POST'),
- 'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
- 'FOLDER_IMG' => $user->img('folder', 'NO_NEW_POSTS'),
- 'FOLDER_NEW_IMG' => $user->img('folder_new', 'NEW_POSTS'),
- 'FOLDER_HOT_IMG' => $user->img('folder_hot', 'NO_NEW_POSTS_HOT'),
- 'FOLDER_HOT_NEW_IMG' => $user->img('folder_hot_new', 'NEW_POSTS_HOT'),
- 'FOLDER_LOCKED_IMG' => $user->img('folder_locked', 'NO_NEW_POSTS_LOCKED'),
- 'FOLDER_LOCKED_NEW_IMG' => $user->img('folder_locked_new', 'NEW_POSTS_LOCKED'),
- 'FOLDER_STICKY_IMG' => $user->img('folder_sticky', 'POST_STICKY'),
- 'FOLDER_STICKY_NEW_IMG' => $user->img('folder_sticky_new', 'POST_STICKY'),
- 'FOLDER_ANNOUNCE_IMG' => $user->img('folder_announce', 'POST_ANNOUNCEMENT'),
- 'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('folder_announce_new', 'POST_ANNOUNCEMENT'),
- 'FOLDER_MOVED_IMG' => $user->img('folder_moved', 'TOPIC_MOVED'),
- 'REPORTED_IMG' => $user->img('icon_reported', 'TOPIC_REPORTED'),
- 'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'TOPIC_UNAPPROVED'),
- 'GOTO_PAGE_IMG' => $user->img('icon_post', 'GOTO_PAGE'),
+ 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', $post_alt) : $user->img('button_topic_new', $post_alt),
+ 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
+ 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
+ 'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'),
+ 'FOLDER_NEW_IMG' => $user->img('topic_unread', 'NEW_POSTS'),
+ 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_NEW_POSTS_HOT'),
+ 'FOLDER_HOT_NEW_IMG' => $user->img('topic_unread_hot', 'NEW_POSTS_HOT'),
+ 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_NEW_POSTS_LOCKED'),
+ 'FOLDER_LOCKED_NEW_IMG' => $user->img('topic_unread_locked', 'NEW_POSTS_LOCKED'),
+ 'FOLDER_STICKY_IMG' => $user->img('sticky_read', 'POST_STICKY'),
+ 'FOLDER_STICKY_NEW_IMG' => $user->img('sticky_unread', 'POST_STICKY'),
+ 'FOLDER_ANNOUNCE_IMG' => $user->img('announce_read', 'POST_ANNOUNCEMENT'),
+ 'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('announce_unread', 'POST_ANNOUNCEMENT'),
+ 'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'),
+ 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'),
+ 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'),
+ 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'],
@@ -374,7 +371,7 @@ $sql_array = array(
'FROM' => $sql_array['FROM'],
'LEFT_JOIN' => $sql_array['LEFT_JOIN'],
- 'WHERE' => (($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary)) ? 't.forum_id = ' . $forum_id : 't.forum_id IN (' . implode(', ', $active_forum_ary['forum_id']) . ')') . '
+ 'WHERE' => (($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary)) ? 't.forum_id = ' . $forum_id : $db->sql_in_set('t.forum_id', $active_forum_ary['forum_id'])) . '
AND t.topic_type NOT IN (' . POST_ANNOUNCE . ', ' . POST_GLOBAL . ")
$sql_approved
$sql_limit_time",
@@ -384,13 +381,43 @@ $sql_array = array(
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
+$shadow_topic_list = array();
while ($row = $db->sql_fetchrow($result))
{
+ if ($row['topic_status'] == ITEM_MOVED)
+ {
+ $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id'];
+ }
+
$rowset[$row['topic_id']] = $row;
$topic_list[] = $row['topic_id'];
}
$db->sql_freeresult($result);
+// If we have some shadow topics, update the rowset to reflect their topic informations
+if (sizeof($shadow_topic_list))
+{
+ $sql = 'SELECT *
+ FROM ' . TOPICS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list));
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $orig_topic_id = $shadow_topic_list[$row['topic_id']];
+
+ // We want to retain some values
+ $row = array_merge($row, array(
+ 'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'],
+ 'topic_status' => $rowset[$orig_topic_id]['topic_status'])
+ );
+
+ $rowset[$orig_topic_id] = $row;
+ }
+ $db->sql_freeresult($result);
+}
+unset($shadow_topic_list);
+
$topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list);
$topic_tracking_info = $tracking_topics = array();
@@ -398,6 +425,7 @@ $topic_tracking_info = $tracking_topics = array();
if (sizeof($topic_list))
{
$mark_forum_read = true;
+ $mark_time_forum = 0;
// Active topics?
if ($s_display_active && sizeof($active_forum_ary))
@@ -406,7 +434,7 @@ if (sizeof($topic_list))
$topic_forum_list = array();
foreach ($rowset as $t_id => $row)
{
- $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0;
+ $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered']) ? $row['forum_mark_time'] : 0;
$topic_forum_list[$row['forum_id']]['topics'][] = $t_id;
}
@@ -417,7 +445,7 @@ if (sizeof($topic_list))
$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), false);
}
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
foreach ($topic_forum_list as $f_id => $topic_row)
{
@@ -434,7 +462,7 @@ if (sizeof($topic_list))
$topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $rowset, array($forum_id => $forum_data['mark_time']), $global_announce_list);
$mark_time_forum = (!empty($forum_data['mark_time'])) ? $forum_data['mark_time'] : $user->data['user_lastmark'];
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, $global_announce_list);
@@ -499,8 +527,8 @@ if (sizeof($topic_list))
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
- 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
- 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
+ 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
+ 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
'S_TOPIC_TYPE' => $row['topic_type'],
'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
@@ -512,6 +540,7 @@ if (sizeof($topic_list))
'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false,
'S_POST_STICKY' => ($row['topic_type'] == POST_STICKY) ? true : false,
+ 'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false,
'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false,
'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread',
@@ -541,65 +570,7 @@ if (sizeof($topic_list))
// after reading a topic
if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read)
{
- // Make sure there are not additional topics unread
- if ($config['load_db_lastread'] && $user->data['is_registered'])
- {
- if ($mark_time_forum >= $forum_data['forum_last_post_time'])
- {
- $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($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- }
- }
- else
- {
- // Get information from cookie
- $row = false;
-
- if (!isset($tracking_topics['tf'][$forum_id]))
- {
- // We do not need to mark read, this has 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;
- }
- }
-
- if (!$row)
- {
- markread('topics', $forum_id);
- }
+ update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum);
}
page_footer();
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 71a97c3d43..e296f80438 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -118,7 +118,7 @@ if ($view && !$post_id)
else
{
$topic_id = $row['topic_id'];
-
+
// Check for global announcement correctness?
if (!$row['forum_id'] && !$forum_id)
{
@@ -175,7 +175,7 @@ if ($user->data['is_registered'])
if ($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'
@@ -198,7 +198,21 @@ else
$sql_array['FROM'][POSTS_TABLE] = 'p';
}
-$sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id ' . ((!$forum_id) ? 'OR t.topic_type = ' . POST_GLOBAL : 'OR (t.topic_type = ' . POST_GLOBAL . " AND f.forum_id = $forum_id)") . ')';
+$sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id';
+
+if (!$forum_id)
+{
+ // If it is a global announcement make sure to set the forum id to a postable forum
+ $sql_array['WHERE'] .= ' OR (t.topic_type = ' . POST_GLOBAL . '
+ AND f.forum_type = ' . FORUM_POST . ')';
+}
+else
+{
+ $sql_array['WHERE'] .= ' OR (t.topic_type = ' . POST_GLOBAL . "
+ AND f.forum_id = $forum_id)";
+}
+
+$sql_array['WHERE'] .= ')';
$sql_array['FROM'][TOPICS_TABLE] = 't';
// Join to forum table on topic forum_id unless topic forum_id is zero
@@ -224,6 +238,9 @@ if (!$topic_data)
// This is for determining where we are (page)
if ($post_id)
{
+ /**
+ * @todo adjust for using post_time? Generally adjust query... it is not called very often though
+ */
$sql = 'SELECT COUNT(post_id) AS prev_posts
FROM ' . POSTS_TABLE . "
WHERE topic_id = {$topic_data['topic_id']}
@@ -308,6 +325,8 @@ if ($post_id)
// Get topic tracking info
if (!isset($topic_tracking_info))
{
+ $topic_tracking_info = array();
+
// Get topic tracking info
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
@@ -315,7 +334,7 @@ if (!isset($topic_tracking_info))
$topic_tracking_info = get_topic_tracking($forum_id, $topic_id, $tmp_topic_data, array($forum_id => $topic_data['forum_mark_time']));
unset($tmp_topic_data);
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
}
@@ -325,7 +344,7 @@ if (!isset($topic_tracking_info))
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
-$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
+$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_time', 's' => 'p.post_subject');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
@@ -373,6 +392,12 @@ if ($hilit_words)
$highlight = urlencode($hilit_words);
}
+// Make sure $start is set to the last page if it exceeds the amount
+if ($start < 0 || $start > $total_posts)
+{
+ $start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page'];
+}
+
// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : ''));
@@ -444,7 +469,7 @@ $s_forum_rules = '';
gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']);
// Quick mod tools
-$allow_change_type = ($auth->acl_get('m_') || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false;
+$allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false;
$topic_mod = '';
$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '' : '') : '';
@@ -482,7 +507,7 @@ $topic_data['topic_title'] = censor_text($topic_data['topic_title']);
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $topic_data['forum_name'],
- 'FORUM_DESC' => generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield']),
+ 'FORUM_DESC' => generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield'], $topic_data['forum_desc_options']),
'TOPIC_ID' => $topic_id,
'TOPIC_TITLE' => $topic_data['topic_title'],
'PAGINATION' => $pagination,
@@ -491,30 +516,31 @@ $template->assign_vars(array(
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id&start=$start&$u_sort_param", true, $user->session_id) : '',
'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '',
- 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('btn_locked', 'FORUM_LOCKED') : $user->img('btn_post', 'POST_NEW_TOPIC'),
- 'QUOTE_IMG' => $user->img('btn_quote', 'REPLY_WITH_QUOTE'),
- 'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? $user->img('btn_locked', 'TOPIC_LOCKED') : $user->img('btn_reply', 'REPLY_TO_TOPIC'),
- 'EDIT_IMG' => $user->img('btn_edit', 'EDIT_POST'),
- 'DELETE_IMG' => $user->img('btn_delete', 'DELETE_POST'),
- 'INFO_IMG' => $user->img('btn_info', 'VIEW_INFO'),
- 'PROFILE_IMG' => $user->img('btn_profile', 'READ_PROFILE'),
- 'SEARCH_IMG' => $user->img('btn_search', 'SEARCH_USER_POSTS'),
- 'PM_IMG' => $user->img('btn_pm', 'SEND_PRIVATE_MESSAGE'),
- 'EMAIL_IMG' => $user->img('btn_email', 'SEND_EMAIL'),
- 'WWW_IMG' => $user->img('btn_www', 'VISIT_WEBSITE'),
- 'ICQ_IMG' => $user->img('btn_icq', 'ICQ'),
- 'AIM_IMG' => $user->img('btn_aim', 'AIM'),
- 'MSN_IMG' => $user->img('btn_msnm', 'MSNM'),
- 'YIM_IMG' => $user->img('btn_yim', 'YIM'),
- 'JABBER_IMG' => $user->img('btn_jabber', 'JABBER') ,
- 'REPORT_IMG' => $user->img('btn_report', 'REPORT_POST'),
- 'REPORTED_IMG' => $user->img('icon_reported', 'POST_REPORTED'),
- 'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'POST_UNAPPROVED'),
- 'WARN_IMG' => $user->img('btn_report', 'WARN_USER'),
+ 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'),
+ 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'),
+ 'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'),
+ 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'),
+ 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'),
+ 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'),
+ 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'),
+ 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'),
+ 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'),
+ 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'),
+ 'WWW_IMG' => $user->img('icon_contact_www', 'VISIT_WEBSITE'),
+ 'ICQ_IMG' => $user->img('icon_contact_icq', 'ICQ'),
+ 'AIM_IMG' => $user->img('icon_contact_aim', 'AIM'),
+ 'MSN_IMG' => $user->img('icon_contact_msnm', 'MSNM'),
+ 'YIM_IMG' => $user->img('icon_contact_yahoo', 'YIM'),
+ 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER') ,
+ 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'),
+ 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'),
+ 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
+ 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'),
'S_SELECT_SORT_DIR' => $s_sort_dir,
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS' => $s_limit_days,
+ 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true,
'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"),
'S_TOPIC_MOD' => ($topic_mod != '') ? '' : '',
'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "t=$topic_id&f=$forum_id&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id),
@@ -629,7 +655,7 @@ if (!empty($topic_data['poll_start']))
'vote_user_id' => (int) $user->data['user_id'],
'vote_user_ip' => (string) $user->ip,
);
-
+
$sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
}
@@ -691,20 +717,25 @@ if (!empty($topic_data['poll_start']))
for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++)
{
+ $poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']);
+
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']);
}
+
$poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']);
- $poll_info[$i]['poll_option_text'] = str_replace("\n", ' ', censor_text($poll_info[$i]['poll_option_text']));
+ $poll_info[$i]['poll_option_text'] = str_replace("\n", ' ', $poll_info[$i]['poll_option_text']);
}
+ $topic_data['poll_title'] = censor_text($topic_data['poll_title']);
+
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']);
}
$topic_data['poll_title'] = smiley_text($topic_data['poll_title']);
- $topic_data['poll_title'] = str_replace("\n", ' ', censor_text($topic_data['poll_title']));
+ $topic_data['poll_title'] = str_replace("\n", ' ', $topic_data['poll_title']);
unset($poll_bbcode);
@@ -772,8 +803,8 @@ else
// Container for user details, only process once
$post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array();
$has_attachments = $display_notice = false;
-$force_encoding = '';
-$bbcode_bitfield = $i = $i_total = 0;
+$bbcode_bitfield = $force_encoding = '';
+$i = $i_total = 0;
// Go ahead and pull all data for this topic
$sql = 'SELECT p.post_id
@@ -817,12 +848,15 @@ $sql = $db->sql_build_query('SELECT', array(
)
),
- 'WHERE' => 'p.post_id IN (' . implode(', ', $post_list) . ')
+ 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
AND u.user_id = p.poster_id'
));
$result = $db->sql_query($sql);
+$today = explode('-', date('j-n-Y', time() + $user->timezone + $user->dst));
+$today = array('day' => (int) $today[0], 'month' => (int) $today[1], 'year' => (int) $today[2]);
+
// Posts are stored in the $rowset array while $attach_list, $user_cache
// and the global bbcode_bitfield are built
while ($row = $db->sql_fetchrow($result))
@@ -874,7 +908,9 @@ while ($row = $db->sql_fetchrow($result))
'post_edit_time' => $row['post_edit_time'],
'post_edit_reason' => $row['post_edit_reason'],
'post_edit_user' => $row['post_edit_user'],
- 'icon_id' => $row['icon_id'],
+
+ // Make sure the icon actually exists
+ 'icon_id' => (isset($icons[$row['icon_id']]['img'], $icons[$row['icon_id']]['height'], $icons[$row['icon_id']]['width'])) ? $row['icon_id'] : 0,
'post_attachment' => $row['post_attachment'],
'post_approved' => $row['post_approved'],
'post_reported' => $row['post_reported'],
@@ -888,12 +924,12 @@ while ($row = $db->sql_fetchrow($result))
);
// Define the global bbcode bitfield, will be used to load bbcodes
- $bbcode_bitfield |= $row['bbcode_bitfield'];
+ $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
// Is a signature attached? Are we going to display it?
if ($row['enable_sig'] && $config['allow_sig'] && $user->optionget('viewsigs'))
{
- $bbcode_bitfield |= $row['user_sig_bbcode_bitfield'];
+ $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['user_sig_bbcode_bitfield']);
}
// Cache various user specific data ... so we don't have to recompute
@@ -930,7 +966,8 @@ while ($row = $db->sql_fetchrow($result))
'jabber' => '',
'search' => '',
'username' => ($row['user_colour']) ? '' . $poster . '' : $poster,
-
+ 'age' => '',
+
'warnings' => 0,
);
}
@@ -958,6 +995,11 @@ while ($row = $db->sql_fetchrow($result))
'viewonline' => $row['user_allow_viewonline'],
'avatar' => '',
+ 'age' => '',
+
+ 'rank_title' => '',
+ 'rank_image' => '',
+ 'rank_image_src' => '',
'online' => false,
'profile' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$poster_id"),
@@ -1009,12 +1051,6 @@ while ($row = $db->sql_fetchrow($result))
}
}
}
- else
- {
- $user_cache[$poster_id]['rank_title'] = '';
- $user_cache[$poster_id]['rank_image'] = '';
- $user_cache[$poster_id]['rank_image_src'] = '';
- }
}
if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email'))
@@ -1028,7 +1064,7 @@ while ($row = $db->sql_fetchrow($result))
if (!empty($row['user_icq']))
{
- $user_cache[$poster_id]['icq'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=icq&u=$poster_id");
+ $user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq'];
$user_cache[$poster_id]['icq_status_img'] = ' ';
}
else
@@ -1036,10 +1072,31 @@ while ($row = $db->sql_fetchrow($result))
$user_cache[$poster_id]['icq_status_img'] = '';
$user_cache[$poster_id]['icq'] = '';
}
+
+ if (!empty($row['user_birthday']))
+ {
+ list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday']));
+
+ if ($bday_year)
+ {
+ $diff = $today['month'] - $bday_month;
+ if ($diff == 0)
+ {
+ $diff = ($today['day'] - $bday_day < 0) ? 1 : 0;
+ }
+ else
+ {
+ $diff = ($diff < 0) ? 1 : 0;
+ }
+
+ $user_cache[$poster_id]['age'] = (int) ($today['year'] - $bday_year - $diff);
+ }
+ }
}
}
}
$db->sql_freeresult($result);
+unset($today);
// Load custom profile fields
if ($config['load_cpf_viewtopic'])
@@ -1056,7 +1113,7 @@ if ($config['load_onlinetrack'] && sizeof($id_cache))
{
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
- WHERE session_user_id IN (' . implode(', ', $id_cache) . ')
+ WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
@@ -1076,7 +1133,7 @@ if (sizeof($attach_list))
{
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
- WHERE post_msg_id IN (' . implode(', ', $attach_list) . ')
+ WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . '
AND in_message = 0
ORDER BY filetime ' . ((!$config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC';
$result = $db->sql_query($sql);
@@ -1092,7 +1149,7 @@ if (sizeof($attach_list))
{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_attachment = 0
- WHERE post_id IN (' . implode(', ', $attach_list) . ')';
+ WHERE ' . $db->sql_in_set('post_id', $attach_list);
$db->sql_query($sql);
// We need to update the topic indicator too if the complete topic is now without an attachment
@@ -1142,10 +1199,10 @@ if (sizeof($attach_list))
}
// Instantiate BBCode if need be
-if ($bbcode_bitfield)
+if ($bbcode_bitfield !== '')
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
- $bbcode = new bbcode($bbcode_bitfield);
+ $bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
$i_total = sizeof($rowset) - 1;
@@ -1165,7 +1222,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// Two situations can prevent a post being display:
// i) The poster is on the users ignore list
// ii) The post was made in a codepage different from the users
- if (isset($row['foe']) && $row['foe'])
+ if (!empty($row['foe']))
{
$template->assign_block_vars('postrow', array(
'S_IGNORE_POST' => true,
@@ -1174,38 +1231,28 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
continue;
}
- else if ($row['post_encoding'] != $user->lang['ENCODING'])
+ else if ($row['post_encoding'] != $user->lang['ENCODING'] && $view == 'encoding' && $post_id == $row['post_id'])
{
- if ($view == 'encoding' && $post_id == $row['post_id'])
- {
- $force_encoding = $row['post_encoding'];
- }
- else
- {
- $template->assign_block_vars('postrow', array(
- 'S_IGNORE_POST' => true,
- 'L_IGNORE_POST' => sprintf($user->lang['POST_ENCODING'], $row['poster'], '', ''))
- );
-
- continue;
- }
+ $force_encoding = $row['post_encoding'];
}
// End signature parsing, only if needed
if ($user_cache[$poster_id]['sig'] && empty($user_cache[$poster_id]['sig_parsed']))
{
+ $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']);
+
if ($user_cache[$poster_id]['sig_bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']);
}
$user_cache[$poster_id]['sig'] = smiley_text($user_cache[$poster_id]['sig']);
- $user_cache[$poster_id]['sig'] = str_replace("\n", ' ', censor_text($user_cache[$poster_id]['sig']));
+ $user_cache[$poster_id]['sig'] = str_replace("\n", ' ', $user_cache[$poster_id]['sig']);
$user_cache[$poster_id]['sig_parsed'] = true;
}
// Parse the message and subject
- $message = $row['post_text'];
+ $message = censor_text($row['post_text']);
// Second parse bbcode here
if ($row['bbcode_bitfield'])
@@ -1235,27 +1282,27 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// Replace naughty words such as farty pants
$row['post_subject'] = censor_text($row['post_subject']);
- $message = str_replace("\n", ' ', censor_text($message));
+ $message = str_replace("\n", ' ', $message);
// Editing information
if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason'])
{
// Get usernames for all following posts if not already stored
- if (!sizeof($post_edit_list) && $row['post_edit_reason'])
+ if (!sizeof($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']]))))
{
// Remove all post_ids already parsed (we do not have to check them)
$post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i);
$sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
- WHERE p.post_id IN (' . implode(', ', $post_storage_list) . ")
+ WHERE ' . $db->sql_in_set('p.post_id', $post_storage_list) . '
AND p.post_edit_count <> 0
AND p.post_edit_user <> 0
- AND p.post_edit_reason <> ''
- AND p.post_edit_user = u.user_id";
+ AND p.post_edit_user = u.user_id';
$result2 = $db->sql_query($sql);
while ($user_edit_row = $db->sql_fetchrow($result2))
{
+ $user_edit_row['username'] = ($user_edit_row['user_colour']) ? '' . $user_edit_row['username'] . '' : $user_edit_row['username'];
$post_edit_list[$user_edit_row['user_id']] = $user_edit_row;
}
$db->sql_freeresult($result2);
@@ -1268,10 +1315,16 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
if ($row['post_edit_reason'])
{
$user_edit_row = $post_edit_list[$row['post_edit_user']];
- $l_edited_by = sprintf($l_edit_time_total, (!$row['post_edit_user']) ? $row['poster'] : (($user_edit_row['user_colour']) ? '' . $user_edit_row['username'] . '' : $user_edit_row['username']), $user->format_date($row['post_edit_time']), $row['post_edit_count']);
+
+ $l_edited_by = sprintf($l_edit_time_total, (!$row['post_edit_user']) ? $row['poster'] : $user_edit_row['username'], $user->format_date($row['post_edit_time']), $row['post_edit_count']);
}
else
{
+ if ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']]))
+ {
+ $user_cache[$row['post_edit_user']] = $post_edit_list[$row['post_edit_user']];
+ }
+
$l_edited_by = sprintf($l_edit_time_total, (!$row['post_edit_user']) ? $row['poster'] : $user_cache[$row['post_edit_user']]['username'], $user->format_date($row['post_edit_time']), $row['post_edit_count']);
}
}
@@ -1284,7 +1337,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
if ($topic_data['topic_bumped'] && $row['post_id'] == $topic_data['topic_last_post_id'] && isset($user_cache[$topic_data['topic_bumper']]) )
{
// It is safe to grab the username from the user cache array, we are at the last
- // post and only the topic poster and last poster are allowed to bump. However, a
+ // post and only the topic poster and last poster are allowed to bump. However, a
// check is still needed incase an admin bumped the topic (but didn't post in the topic)
$l_bumped_by = '
' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time']));
}
@@ -1302,7 +1355,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
}
$post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
-
+
$s_first_unread = false;
if (!$first_unread && $post_unread)
{
@@ -1320,6 +1373,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'POSTER_FROM' => $user_cache[$poster_id]['from'],
'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'],
'POSTER_WARNINGS' => $user_cache[$poster_id]['warnings'],
+ 'POSTER_AGE' => $user_cache[$poster_id]['age'],
'POST_DATE' => $user->format_date($row['post_time']),
'POST_SUBJECT' => $row['post_subject'],
@@ -1329,22 +1383,24 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'EDIT_REASON' => $row['post_edit_reason'],
'BUMPED_MESSAGE' => $l_bumped_by,
- 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_new', 'NEW_POST') : $user->img('icon_post', 'POST'),
+ 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
'POST_ICON_IMG' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '',
'POST_ICON_IMG_WIDTH' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '',
'POST_ICON_IMG_HEIGHT' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '',
'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'],
- 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('btn_online', 'ONLINE') : $user->img('btn_offline', 'OFFLINE')),
+ 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')),
'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false),
- 'U_EDIT' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - $config['edit_time'] || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '',
+ 'FORCE_ENCODING' => ($row['post_encoding'] != $user->lang['ENCODING']) ? sprintf($user->lang['POST_ENCODING'], $row['poster'], '', '') : '',
+
+ 'U_EDIT' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '',
'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '',
'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '',
- 'U_DELETE' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - $config['edit_time'] || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '',
+ 'U_DELETE' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '',
'U_PROFILE' => $user_cache[$poster_id]['profile'],
'U_SEARCH' => $user_cache[$poster_id]['search'],
- 'U_PM' => ($poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '',
+ 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '',
'U_EMAIL' => $user_cache[$poster_id]['email'],
'U_WWW' => $user_cache[$poster_id]['www'],
'U_ICQ' => $user_cache[$poster_id]['icq'],
@@ -1356,11 +1412,11 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
- 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],
+ 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '') . '#p' . $row['post_id'],
'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '',
'U_PREV_POST_ID' => $prev_post_id,
'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '',
- 'U_WARN' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
+ 'U_WARN' => ($auth->acl_getf_global('m_warn') && $poster_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
'POST_ID' => $row['post_id'],
@@ -1421,7 +1477,7 @@ if (isset($user->data['session_page']) && strpos($user->data['session_page'], '&
{
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
SET download_count = download_count + 1
- WHERE attach_id IN (' . implode(', ', array_unique($update_count)) . ')';
+ WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count));
$db->sql_query($sql);
}
}
@@ -1430,6 +1486,9 @@ if (isset($user->data['session_page']) && strpos($user->data['session_page'], '&
if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id])
{
markread('topic', $forum_id, $topic_id, $max_post_time);
+
+ // Update forum info
+ update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false);
}
// Change encoding if appropriate
|