aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/feed/post_base.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-11 09:53:52 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-11 09:53:52 +0100
commit296af6c67910c74210354aec15eb04323f643acf (patch)
tree5882aada5351d7bb23bce1c7a32b953e4f99c2c6 /phpBB/phpbb/feed/post_base.php
parent65626d602e3f9d2eb6ddb1e8a2454024dd36a8be (diff)
parent99d312da2ac8a8b6d9d3ba7ff45cd7b59af00c85 (diff)
downloadforums-296af6c67910c74210354aec15eb04323f643acf.tar
forums-296af6c67910c74210354aec15eb04323f643acf.tar.gz
forums-296af6c67910c74210354aec15eb04323f643acf.tar.bz2
forums-296af6c67910c74210354aec15eb04323f643acf.tar.xz
forums-296af6c67910c74210354aec15eb04323f643acf.zip
Merge remote-tracking branch 'dhruvgoel92/ticket/11271-develop' into develop
* dhruvgoel92/ticket/11271-develop: (25 commits) [ticket/11271] Make path conversion more precise [ticket/11271] limit absolute path conversion to attachment links only [ticket/11271] Add docblock of feed_generate_content( ) [ticket/11271] Fix tabs and use !empty( ) instead of count( ) [ticket/11271] Remove unnecessary inclusion of functions_display [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. [ticket/11271] Add the inline images html to content [ticket/11271] Use class variable $db instead of global [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. ...
Diffstat (limited to 'phpBB/phpbb/feed/post_base.php')
-rw-r--r--phpBB/phpbb/feed/post_base.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php
index 42c5eea9e3..c797d6a8ca 100644
--- a/phpBB/phpbb/feed/post_base.php
+++ b/phpBB/phpbb/feed/post_base.php
@@ -17,6 +17,7 @@ namespace phpbb\feed;
abstract class post_base extends \phpbb\feed\base
{
var $num_items = 'feed_limit_post';
+ var $attachments = array();
function set_keys()
{
@@ -48,4 +49,41 @@ 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()
+ {
+ $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 = $this->db->sql_build_query('SELECT', $sql_array);
+ $result = $this->db->sql_query($sql);
+
+ // Set attachments in feed items
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $this->attachments[$row['post_msg_id']][] = $row;
+ }
+ $this->db->sql_freeresult($result);
+ }
}