diff options
author | erangamapa <erangamapa@gmail.com> | 2013-03-14 01:11:36 +0530 |
---|---|---|
committer | Dhruv <dhruv.goel92@gmail.com> | 2013-09-15 15:41:36 +0530 |
commit | 72b92f70f1d06dbd26d8aff9738eb6bd74cdf6a5 (patch) | |
tree | 9f3ee3d9e307f4dfdfa8987808c4831a7af36053 /phpBB/feed.php | |
parent | Merge remote-tracking branch 'remotes/cyberalien/ticket/11811' into develop-o... (diff) | |
download | phpbb-72b92f70f1d06dbd26d8aff9738eb6bd74cdf6a5.tar.gz phpbb-72b92f70f1d06dbd26d8aff9738eb6bd74cdf6a5.tar.bz2 phpbb-72b92f70f1d06dbd26d8aff9738eb6bd74cdf6a5.zip |
[ticket/11271] Displaying in-line attached images in ATOM feed.
In-line attached images are not displaying as they are not parsing.
Included 'parse_attachments' column name for data fetching queries
in feed.php. Checked weather feeds have in-line attachments and
parsed them by using parse_attachments() method.
PHPBB3-11271
Diffstat (limited to 'phpBB/feed.php')
-rw-r--r-- | phpBB/feed.php | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/phpBB/feed.php b/phpBB/feed.php index 9816f0f303..9f0f0b2294 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -19,6 +19,7 @@ define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); if (!$config['feed_enable']) { @@ -106,7 +107,7 @@ while ($row = $feed->get_item()) 'title' => censor_text($title), 'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '', 'category_name' => ($config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '', - 'description' => censor_text(feed_generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options)), + 'description' => censor_text(feed_generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], $row['post_id'], $row['post_attachment'])), 'statistics' => '', ); @@ -273,9 +274,9 @@ function feed_format_date($time) /** * Generate text content **/ -function feed_generate_content($content, $uid, $bitfield, $options) +function feed_generate_content($content, $uid, $bitfield, $options, $forum_id, $post_id, $post_attachment) { - global $user, $config, $phpbb_root_path, $phpEx, $board_url; + global $user, $db, $config, $phpbb_root_path, $phpEx, $board_url; if (empty($content)) { @@ -322,6 +323,25 @@ function feed_generate_content($content, $uid, $bitfield, $options) // Remove some specials html tag, because somewhere there are a mod to allow html tags ;) $content = preg_replace( '#<(script|iframe)([^[]+)\1>#siU', ' <strong>$1</strong> ', $content); + // Parse inline images to display with the feed + if ($post_attachment) + { + $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['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + $update_count = array(); + parse_attachments($forum_id, $content, $attachments[$post_id], $update_count); + } + // Remove Comments from inline attachments [ia] $content = preg_replace('#<div class="(inline-attachment|attachtitle)">(.*?)<!-- ia(.*?) -->(.*?)<!-- ia(.*?) -->(.*?)</div>#si','$4',$content); @@ -795,7 +815,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . - 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . 'u.username, u.user_id', 'FROM' => array( USERS_TABLE => 'u', @@ -927,7 +947,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base } $this->sql = array( - 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', @@ -1092,7 +1112,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base global $auth, $db; $this->sql = array( - 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', @@ -1257,7 +1277,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time, - p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment', 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p', @@ -1330,7 +1350,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time, - p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment', 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p', @@ -1427,7 +1447,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time, - p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment', 'FROM' => array( TOPICS_TABLE => 't', POSTS_TABLE => 'p', |