aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/db/dbal.php6
-rw-r--r--phpBB/includes/functions_posting.php51
-rw-r--r--phpBB/includes/mcp/mcp_post.php43
-rw-r--r--phpBB/includes/mcp/mcp_queue.php50
-rwxr-xr-xphpBB/includes/mcp/mcp_reports.php51
-rw-r--r--phpBB/includes/mcp/mcp_topic.php47
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewmessage.php2
7 files changed, 229 insertions, 21 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 8e4cbda0e7..8ecb7627e5 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -504,7 +504,7 @@ class dbal
if (!$this->return_on_error)
{
- $message = '<u>SQL ERROR</u> [ ' . $this->sql_layer . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']';
+ $message = 'SQL ERROR [ ' . $this->sql_layer . ' ]<br /><br />' . $error['message'] . ' [' . $error['code'] . ']';
// Show complete SQL error and path to administrators only
// Additionally show complete error on installation or if extended debug mode is enabled
@@ -514,8 +514,8 @@ class dbal
// Print out a nice backtrace...
$backtrace = get_backtrace();
- $message .= ($sql) ? '<br /><br /><u>SQL</u><br /><br />' . htmlspecialchars($sql) : '';
- $message .= ($backtrace) ? '<br /><br /><u>BACKTRACE</u><br />' . $backtrace : '';
+ $message .= ($sql) ? '<br /><br />SQL<br /><br />' . htmlspecialchars($sql) : '';
+ $message .= ($backtrace) ? '<br /><br />BACKTRACE<br />' . $backtrace : '';
$message .= '<br />';
}
else
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index d75a548d1b..69318212ea 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -899,7 +899,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
*/
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
- global $user, $auth, $db, $template, $bbcode;
+ global $user, $auth, $db, $template, $bbcode, $cache;
global $config, $phpbb_root_path, $phpEx;
// Go ahead and pull all data for this topic
@@ -941,10 +941,16 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$bbcode_bitfield = '';
$rowset = array();
+ $has_attachments = false;
while ($row = $db->sql_fetchrow($result))
{
$rowset[$row['post_id']] = $row;
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
+
+ if ($row['post_attachment'])
+ {
+ $has_attachments = true;
+ }
}
$db->sql_freeresult($result);
@@ -955,6 +961,27 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
+ // Grab extensions
+ $extensions = $attachments = array();
+ if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id))
+ {
+ $extensions = $cache->obtain_attach_extensions($forum_id);
+
+ // Get attachments...
+ $sql = 'SELECT *
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . '
+ AND in_message = 0
+ ORDER BY filetime DESC, post_msg_id ASC';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $attachments[$row['post_msg_id']][] = $row;
+ }
+ $db->sql_freeresult($result);
+ }
+
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
{
// A non-existing rowset only happens if there was no user present for the entered poster_id
@@ -990,6 +1017,12 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$message = smiley_text($message, !$row['enable_smilies']);
+ if (!empty($attachments[$row['post_id']]))
+ {
+ $update_count = array();
+ parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
+ }
+
$post_subject = censor_text($post_subject);
$template->assign_block_vars($mode . '_row', array(
@@ -998,16 +1031,30 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
+ 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
+
'POST_SUBJECT' => $post_subject,
'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']),
'POST_DATE' => $user->format_date($row['post_time']),
'MESSAGE' => $message,
'DECODED_MESSAGE' => $decoded_message,
- 'U_POST_ID' => $row['post_id'],
+ 'POST_ID' => $row['post_id'],
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],
'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=post_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '')
);
+
+ // Display not already displayed Attachments for this post, we already parsed them. ;)
+ if (!empty($attachments[$row['post_id']]))
+ {
+ foreach ($attachments[$row['post_id']] as $attachment)
+ {
+ $template->assign_block_vars($mode . '_row.attachment', array(
+ 'DISPLAY_ATTACHMENT' => $attachment)
+ );
+ }
+ }
+
unset($rowset[$i]);
}
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index ea2e2fafd7..8dbbdba92e 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -14,7 +14,7 @@
function mcp_post_details($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ global $template, $db, $user, $auth, $cache;
$user->add_lang('posting');
@@ -92,6 +92,7 @@ function mcp_post_details($id, $mode, $action)
// Set some vars
$users_ary = $usernames_ary = array();
+ $attachments = $extensions = array();
$post_id = $post_info['post_id'];
$topic_tracking_info = array();
@@ -120,6 +121,43 @@ function mcp_post_details($id, $mode, $action)
}
$message = smiley_text($message);
+ if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
+ {
+ $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
+
+ $sql = 'SELECT *
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE post_msg_id = ' . $post_id . '
+ AND in_message = 0
+ ORDER BY filetime DESC, post_msg_id ASC';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $attachments[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ if (sizeof($attachments))
+ {
+ $update_count = array();
+ parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
+ }
+
+ // Display not already displayed Attachments for this post, we already parsed them. ;)
+ if (!empty($attachments))
+ {
+ $template->assign_var('S_HAS_ATTACHMENTS', true);
+
+ foreach ($attachments as $attachment)
+ {
+ $template->assign_block_vars('attachment', array(
+ 'DISPLAY_ATTACHMENT' => $attachment)
+ );
+ }
+ }
+ }
+
$template->assign_vars(array(
'U_MCP_ACTION' => "$url&amp;i=main&amp;quickmod=1", // Use this for mode paramaters
'U_POST_ACTION' => "$url&amp;i=$id&amp;mode=post_details", // Use this for action parameters
@@ -163,9 +201,10 @@ function mcp_post_details($id, $mode, $action)
'POST_SUBJECT' => $post_info['post_subject'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']),
+ 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
+ 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&amp;i=$id&amp;mode=$mode&amp;lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;action=whois&amp;p=$post_id&amp;ip={$post_info['poster_ip']}") : '',
));
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index d5b4f8d422..1492f64c43 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -25,7 +25,7 @@ class mcp_queue
function main($id, $mode)
{
- global $auth, $db, $user, $template;
+ global $auth, $db, $user, $template, $cache;
global $config, $phpbb_root_path, $phpEx, $action;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -101,7 +101,8 @@ class mcp_queue
);
}
- $topic_tracking_info = array();
+ $extensions = $attachments = $topic_tracking_info = array();
+
// Get topic tracking info
if ($config['load_db_lastread'])
{
@@ -127,6 +128,43 @@ class mcp_queue
}
$message = smiley_text($message);
+ if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
+ {
+ $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
+
+ $sql = 'SELECT *
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE post_msg_id = ' . $post_id . '
+ AND in_message = 0
+ ORDER BY filetime DESC, post_msg_id ASC';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $attachments[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ if (sizeof($attachments))
+ {
+ $update_count = array();
+ parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
+ }
+
+ // Display not already displayed Attachments for this post, we already parsed them. ;)
+ if (!empty($attachments))
+ {
+ $template->assign_var('S_HAS_ATTACHMENTS', true);
+
+ foreach ($attachments as $attachment)
+ {
+ $template->assign_block_vars('attachment', array(
+ 'DISPLAY_ATTACHMENT' => $attachment)
+ );
+ }
+ }
+ }
+
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
@@ -165,9 +203,11 @@ class mcp_queue
'POST_SUBJECT' => $post_info['post_subject'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']),
- 'POST_ID' => $post_info['post_id'])
- );
+ 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
+ 'POST_ID' => $post_info['post_id'],
+
+ 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id . '&amp;lookup=' . $post_info['poster_ip']) . '#ip' : '',
+ ));
break;
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 15ce7af689..c318472b7d 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -25,7 +25,7 @@ class mcp_reports
function main($id, $mode)
{
- global $auth, $db, $user, $template;
+ global $auth, $db, $user, $template, $cache;
global $config, $phpbb_root_path, $phpEx, $action;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -111,7 +111,7 @@ class mcp_reports
);
}
- $topic_tracking_info = array();
+ $topic_tracking_info = $extensions = $attachments = array();
// Get topic tracking info
if ($config['load_db_lastread'])
{
@@ -137,9 +137,46 @@ class mcp_reports
}
$message = smiley_text($message);
+ if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
+ {
+ $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
+
+ $sql = 'SELECT *
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE post_msg_id = ' . $post_id . '
+ AND in_message = 0
+ ORDER BY filetime DESC, post_msg_id ASC';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $attachments[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ if (sizeof($attachments))
+ {
+ $update_count = array();
+ parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
+ }
+
+ // Display not already displayed Attachments for this post, we already parsed them. ;)
+ if (!empty($attachments))
+ {
+ $template->assign_var('S_HAS_ATTACHMENTS', true);
+
+ foreach ($attachments as $attachment)
+ {
+ $template->assign_block_vars('attachment', array(
+ 'DISPLAY_ATTACHMENT' => $attachment)
+ );
+ }
+ }
+ }
+
$template->assign_vars(array(
'S_MCP_REPORT' => true,
- 'S_CLOSE_ACTION' => $this->u_action . '&amp;p=' . $post_id . 'f=' . $forum_id,
+ 'S_CLOSE_ACTION' => $this->u_action . '&amp;p=' . $post_id . '&amp;f=' . $forum_id,
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
@@ -182,9 +219,11 @@ class mcp_reports
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']),
- 'POST_ID' => $post_info['post_id'])
- );
+ 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
+ 'POST_ID' => $post_info['post_id'],
+
+ 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&amp;r=' . $report_id . '&amp;p=' . $post_id . '&amp;f=' . $forum_id . '&amp;lookup=' . $post_info['poster_ip'] . '#ip' : '',
+ ));
$this->tpl_name = 'mcp_post';
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 3c49477ca2..95f8d6c71b 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -14,7 +14,7 @@
function mcp_topic_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ global $template, $db, $user, $auth, $cache;
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
@@ -104,11 +104,12 @@ function mcp_topic_view($id, $mode, $action)
ORDER BY ' . $sort_order_sql;
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
- $rowset = array();
+ $rowset = $post_id_list = array();
$bbcode_bitfield = '';
while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
+ $post_id_list[] = $row['post_id'];
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
}
$db->sql_freeresult($result);
@@ -135,6 +136,30 @@ function mcp_topic_view($id, $mode, $action)
$has_unapproved_posts = false;
+ // Grab extensions
+ $extensions = $attachments = array();
+ if ($topic_info['topic_attachment'] && sizeof($post_id_list))
+ {
+ $extensions = $cache->obtain_attach_extensions($topic_info['forum_id']);
+
+ // Get attachments...
+ if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
+ {
+ $sql = 'SELECT *
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE ' . $db->sql_in_set('post_msg_id', $post_id_list) . '
+ AND in_message = 0
+ ORDER BY filetime DESC, post_msg_id ASC';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $attachments[$row['post_msg_id']][] = $row;
+ }
+ $db->sql_freeresult($result);
+ }
+ }
+
foreach ($rowset as $i => $row)
{
$message = $row['post_text'];
@@ -148,6 +173,12 @@ function mcp_topic_view($id, $mode, $action)
$message = smiley_text($message);
+ if (!empty($attachments[$row['post_id']]))
+ {
+ $update_count = array();
+ parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count);
+ }
+
if (!$row['post_approved'])
{
$has_unapproved_posts = true;
@@ -172,12 +203,24 @@ function mcp_topic_view($id, $mode, $action)
'S_POST_REPORTED' => ($row['post_reported']) ? true : false,
'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true,
'S_CHECKED' => ($post_id_list && in_array(intval($row['post_id']), $post_id_list)) ? true : false,
+ 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
'U_POST_DETAILS' => "$url&amp;i=$id&amp;p={$row['post_id']}&amp;mode=post_details",
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '')
);
+ // Display not already displayed Attachments for this post, we already parsed them. ;)
+ if (!empty($attachments[$row['post_id']]))
+ {
+ foreach ($attachments[$row['post_id']] as $attachment)
+ {
+ $template->assign_block_vars('postrow.attachment', array(
+ 'DISPLAY_ATTACHMENT' => $attachment)
+ );
+ }
+ }
+
unset($rowset[$i]);
}
diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php
index 06908eea91..aa88bfe65f 100644
--- a/phpBB/includes/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php
@@ -345,7 +345,7 @@ function message_history($msg_id, $user_id, $message_row, $folder)
'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id),
'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false,
- 'U_MSG_ID' => $row['msg_id'],
+ 'MSG_ID' => $row['msg_id'],
'U_VIEW_MESSAGE' => "$url&amp;f=$folder_id&amp;p=" . $row['msg_id'],
'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&amp;mode=compose&amp;action=quote&amp;f=" . $folder_id . "&amp;p=" . $row['msg_id'] : '',
'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&amp;mode=compose&amp;action=reply&amp;f=$folder_id&amp;p=" . $row['msg_id'] : '')