diff options
author | Nicofuma <github@nicofuma.fr> | 2014-04-25 17:00:24 +0200 |
---|---|---|
committer | Nicofuma <github@nicofuma.fr> | 2014-05-02 13:25:44 +0200 |
commit | 7d8d8394fc36b1564ea083447329ab9f54a3db01 (patch) | |
tree | 4aff38eea04bf35f4f82fddd4e91c1f95c9fc73e | |
parent | ac59b6a19914a86bc434fd8ac6aae4f901c72f98 (diff) | |
download | forums-7d8d8394fc36b1564ea083447329ab9f54a3db01.tar forums-7d8d8394fc36b1564ea083447329ab9f54a3db01.tar.gz forums-7d8d8394fc36b1564ea083447329ab9f54a3db01.tar.bz2 forums-7d8d8394fc36b1564ea083447329ab9f54a3db01.tar.xz forums-7d8d8394fc36b1564ea083447329ab9f54a3db01.zip |
[ticket/12413] Fix: coding style
PHPBB3-12413
-rw-r--r-- | phpBB/phpbb/feed/attachments_base.php | 19 | ||||
-rw-r--r-- | phpBB/phpbb/feed/post_base.php | 37 | ||||
-rw-r--r-- | tests/functional/feed_test.php | 16 |
3 files changed, 18 insertions, 54 deletions
diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php index b8c72a7fb1..e61d637afa 100644 --- a/phpBB/phpbb/feed/attachments_base.php +++ b/phpBB/phpbb/feed/attachments_base.php @@ -26,8 +26,6 @@ abstract class attachments_base extends \phpbb\feed\base */ protected function fetch_attachments() { - global $db; - $sql_array = array( 'SELECT' => 'a.*', 'FROM' => array( @@ -39,7 +37,7 @@ abstract class attachments_base extends \phpbb\feed\base if (isset($this->topic_id)) { - $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int)$this->topic_id; + $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id; } else if (isset($this->forum_id)) { @@ -49,22 +47,25 @@ abstract class attachments_base extends \phpbb\feed\base 'ON' => 'a.topic_id = t.topic_id', ) ); - $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int)$this->forum_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); + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query($sql); // Set attachments in feed items - while ($row = $db->sql_fetchrow($result)) + while ($row = $this->db->sql_fetchrow($result)) { $this->attachments[$row['post_msg_id']][] = $row; } - $db->sql_freeresult($result); + $this->db->sql_freeresult($result); } - + /** + * {@inheritDoc} + */ public function open() { + parent::open(); $this->fetch_attachments(); } diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index 57eb70ea12..de98f446f3 100644 --- a/phpBB/phpbb/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php @@ -49,41 +49,4 @@ abstract class post_base extends \phpbb\feed\attachments_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); - } } diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 98a3bf2aa4..17847422b3 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -1,15 +1,15 @@ <?php /** - * - * @package testing - * @copyright (c) 2014 phpBB Group - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 - * - */ +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ /** - * @group functional - */ +* @group functional +*/ class phpbb_functional_feed_test extends phpbb_functional_test_case { protected $data = array(); |