mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/12413] Fix: coding style
PHPBB3-12413
This commit is contained in:
parent
ac59b6a199
commit
7d8d8394fc
3 changed files with 18 additions and 54 deletions
|
@ -26,8 +26,6 @@ abstract class attachments_base extends \phpbb\feed\base
|
||||||
*/
|
*/
|
||||||
protected function fetch_attachments()
|
protected function fetch_attachments()
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
$sql_array = array(
|
$sql_array = array(
|
||||||
'SELECT' => 'a.*',
|
'SELECT' => 'a.*',
|
||||||
'FROM' => array(
|
'FROM' => array(
|
||||||
|
@ -39,7 +37,7 @@ abstract class attachments_base extends \phpbb\feed\base
|
||||||
|
|
||||||
if (isset($this->topic_id))
|
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))
|
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',
|
'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);
|
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
// Set attachments in feed items
|
// 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;
|
$this->attachments[$row['post_msg_id']][] = $row;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
public function open()
|
public function open()
|
||||||
{
|
{
|
||||||
|
parent::open();
|
||||||
$this->fetch_attachments();
|
$this->fetch_attachments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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'] : '');
|
. (($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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package testing
|
* @package testing
|
||||||
* @copyright (c) 2014 phpBB Group
|
* @copyright (c) 2014 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @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
|
class phpbb_functional_feed_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
protected $data = array();
|
protected $data = array();
|
||||||
|
|
Loading…
Add table
Reference in a new issue