diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2007-05-19 12:04:22 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-05-19 12:04:22 +0000 |
| commit | 456586475b14cd70be9fee003006b1c149537857 (patch) | |
| tree | ad42ed380c553c38ee54db034bce407873d4b4b3 /phpBB/includes/functions_posting.php | |
| parent | e242a73a6f060ccb8378b1183b0d73af2e81c552 (diff) | |
| download | forums-456586475b14cd70be9fee003006b1c149537857.tar forums-456586475b14cd70be9fee003006b1c149537857.tar.gz forums-456586475b14cd70be9fee003006b1c149537857.tar.bz2 forums-456586475b14cd70be9fee003006b1c149537857.tar.xz forums-456586475b14cd70be9fee003006b1c149537857.zip | |
oh my god - what did he do? Adding attachment display to post/topic review, queue, reports, post details, mcp topic view... fixing other tiny things along the line.
git-svn-id: file:///svn/phpbb/trunk@7642 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
| -rw-r--r-- | phpBB/includes/functions_posting.php | 51 |
1 files changed, 49 insertions, 2 deletions
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&mode=post_details&f=' . $forum_id . '&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]); } |
