diff options
| author | Dhruv <dhruv.goel92@gmail.com> | 2013-10-05 16:54:09 +0530 |
|---|---|---|
| committer | Dhruv <dhruv.goel92@gmail.com> | 2013-10-05 16:54:09 +0530 |
| commit | 7a971f896d9a09037959d26794b8efe09aa1258e (patch) | |
| tree | 6ffccdcc3270368b8b56982c4f50beb7e4b9596d /phpBB/phpbb/feed/post_base.php | |
| parent | e8c7f8134df38708e1af27325d2c8a7b9f28052e (diff) | |
| parent | c73801242d5c1abc3efb4ac75b4cc1a5d01ce514 (diff) | |
| download | forums-7a971f896d9a09037959d26794b8efe09aa1258e.tar forums-7a971f896d9a09037959d26794b8efe09aa1258e.tar.gz forums-7a971f896d9a09037959d26794b8efe09aa1258e.tar.bz2 forums-7a971f896d9a09037959d26794b8efe09aa1258e.tar.xz forums-7a971f896d9a09037959d26794b8efe09aa1258e.zip | |
Merge branch 'ticket/11271' into ticket/11271-develop
# By erangamapa (7) and Dhruv (2)
* ticket/11271:
[ticket/11271] Typecast forum and topic id to integer
[ticket/11271] Use absolute path for displaying inline attachments in feeds
[ticket/11271] Changed executable bit.
[ticket/11271] Formatting code and removing null assignment.
[ticket/11271] Removing unnecessary database object
[ticket/11271] Separated attachment fetching query
[ticket/11271] Fetched feed attachments before loop.
[ticket/11271] Removed in-line attachment comments properly.
[ticket/11271] Displaying in-line attached images in ATOM feed.
Conflicts:
phpBB/feed.php
Diffstat (limited to 'phpBB/phpbb/feed/post_base.php')
| -rw-r--r-- | phpBB/phpbb/feed/post_base.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index 5588ecadb0..b126ad0e4a 100644 --- a/phpBB/phpbb/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php @@ -25,6 +25,7 @@ if (!defined('IN_PHPBB')) abstract class post_base extends \phpbb\feed\base { var $num_items = 'feed_limit_post'; + var $attachments = array(); function set_keys() { @@ -56,4 +57,43 @@ abstract class post_base extends \phpbb\feed\base . (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : ''); } } + + function fetch_attachments() + { + global $db; + + $sql_array = array( + 'SELECT' => 'a.*', + 'FROM' => array( + ATTACHMENTS_TABLE => 'a' + ), + 'WHERE' => 'a.in_message = 0 ', + 'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC' + ); + + if (isset($this->topic_id)) + { + $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id; + } + else if (isset($this->forum_id)) + { + $sql_array['LEFT_JOIN'] = array( + array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'a.topic_id = t.topic_id' + ) + ); + $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id; + } + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + // Set attachments in feed items + while ($row = $db->sql_fetchrow($result)) + { + $this->attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } } |
