Line 146 | Line 146 |
---|
if (!$row) {
|
if (!$row) {
|
$user->setup('viewtopic');
| $sql = 'SELECT forum_style FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; $result = $db->sql_query($sql); $forum_style = (int) $db->sql_fetchfield('forum_style'); $db->sql_freeresult($result);
$user->setup('viewtopic', $forum_style);
|
trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); } else
| trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); } else
|
Line 196 | Line 203 |
---|
// The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) {
|
// The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) {
|
$sql_array['SELECT'] .= ', p.post_approved';
| $sql_array['SELECT'] .= ', p.post_approved, p.post_time, p.post_id';
|
$sql_array['FROM'][POSTS_TABLE] = 'p'; }
| $sql_array['FROM'][POSTS_TABLE] = 'p'; }
|
Line 314 | Line 321 |
---|
} else {
|
} else {
|
$sql = 'SELECT COUNT(p1.post_id) AS prev_posts FROM ' . POSTS_TABLE . ' p1, ' . POSTS_TABLE . " p2 WHERE p1.topic_id = {$topic_data['topic_id']} AND p2.post_id = {$post_id} " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p1.post_approved = 1' : '') . ' AND ' . (($sort_dir == 'd') ? 'p1.post_time >= p2.post_time' : 'p1.post_time <= p2.post_time');
| $sql = 'SELECT COUNT(p.post_id) AS prev_posts FROM ' . POSTS_TABLE . " p WHERE p.topic_id = {$topic_data['topic_id']} " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '');
if ($sort_dir == 'd') { $sql .= " AND (p.post_time > {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id >= {$topic_data['post_id']}))"; } else { $sql .= " AND (p.post_time < {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id <= {$topic_data['post_id']}))"; }
|
$result = $db->sql_query($sql); $row = $db->sql_fetchrow($result);
| $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result);
|
Line 457 | Line 471 |
---|
$highlight_match = $highlight = ''; if ($hilit_words) {
|
$highlight_match = $highlight = ''; if ($hilit_words) {
|
foreach (explode(' ', trim($hilit_words)) as $word) { if (trim($word)) { $word = str_replace('\*', '\w+?', preg_quote($word, '#')); $word = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $word); $highlight_match .= (($highlight_match != '') ? '|' : '') . $word; } }
$highlight = urlencode($hilit_words);
| $highlight_match = phpbb_clean_search_string($hilit_words); $highlight = urlencode($highlight_match); $highlight_match = str_replace('\*', '\w+?', preg_quote($highlight_match, '#')); $highlight_match = preg_replace('#(?<=^|\s)\\\\w\*\?(?=\s|$)#', '\w+?', $highlight_match); $highlight_match = str_replace(' ', '|', $highlight_match);
|
}
// Make sure $start is set to the last page if it exceeds the amount
| }
// Make sure $start is set to the last page if it exceeds the amount
|
Line 486 | Line 494 |
---|
'is_watching' => false, );
|
'is_watching' => false, );
|
if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered'])
| if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'])
|
{
|
{
|
watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start);
| $notify_status = (isset($topic_data['notify_status'])) ? $topic_data['notify_status'] : null; watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']);
|
// Reset forum notification if forum notify is set if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id))
| // Reset forum notification if forum notify is set if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id))
|
Line 584 | Line 593 |
---|
// Replace naughty words in title $topic_data['topic_title'] = censor_text($topic_data['topic_title']);
|
// Replace naughty words in title $topic_data['topic_title'] = censor_text($topic_data['topic_title']);
|
| $s_search_hidden_fields = array( 't' => $topic_id, 'sf' => 'msgonly', ); if ($_SID) { $s_search_hidden_fields['sid'] = $_SID; }
if (!empty($_EXTRA_URL)) { foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } }
|
// Send vars to template $template->assign_vars(array(
| // Send vars to template $template->assign_vars(array(
|
Line 636 | Line 663 |
---|
'S_VIEWTOPIC' => true, 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
|
'S_VIEWTOPIC' => true, 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
|
'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 't=' . $topic_id),
| 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
|
'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
| 'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
|
Line 985 | Line 1013 |
---|
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
| $now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
|
// Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built
| // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built
|
Line 1157 | Line 1185 |
---|
if (!empty($row['user_icq'])) {
|
if (!empty($row['user_icq'])) {
|
$user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq'];
| $user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/' . urlencode($row['user_icq']) . '/';
|
$user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />'; } else
| $user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />'; } else
|
Line 1475 | Line 1503 |
---|
$edit_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( $user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) &&
|
$edit_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( $user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) &&
|
| $topic_data['topic_status'] != ITEM_LOCKED &&
|
!$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']) )));
|
!$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']) )));
|
| $quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id)) );
|
$delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ( $user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) &&
|
$delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ( $user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) &&
|
| $topic_data['topic_status'] != ITEM_LOCKED &&
|
$topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) && // we do not want to allow removal of the last post if a moderator locked it!
| $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) && // we do not want to allow removal of the last post if a moderator locked it!
|
Line 1522 | Line 1556 |
---|
'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false),
'U_EDIT' => ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '',
|
'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false),
'U_EDIT' => ($edit_allowed) ? 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_QUOTE' => ($quote_allowed) ? 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' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&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' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '',
|
Line 1547 | Line 1581 |
---|
'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? 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'],
|
'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? 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'],
|
| 'POST_NUMBER' => $i + $start + 1,
|
'POSTER_ID' => $poster_id,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
| 'POSTER_ID' => $poster_id,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
|