phpBB

Code Changes

File: phpbb/feed/attachments_base.php

  Unmodified   Added   Modified   Removed
Line 16Line 16
/**
* Abstract class for feeds displaying attachments
*/

/**
* Abstract class for feeds displaying attachments
*/

abstract class attachments_base extends \phpbb\feed\base

abstract class attachments_base extends base

{
/**
* Attachments that may be displayed

{
/**
* Attachments that may be displayed

Line 25Line 25

/**
* Retrieve the list of attachments that may be displayed


/**
* Retrieve the list of attachments that may be displayed

 
	*
* @param array $post_ids Specify for which post IDs to fetch the attachments (optional)
* @param array $topic_ids Specify for which topic IDs to fetch the attachments (optional)

	*/

	*/

	protected function fetch_attachments()

	protected function fetch_attachments($post_ids = array(), $topic_ids = array())

	{
$sql_array = array(
'SELECT' => 'a.*',

	{
$sql_array = array(
'SELECT' => 'a.*',

Line 37Line 40
			'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC',
);


			'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC',
);


 
		if (!empty($post_ids))
{
$sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.post_msg_id', $post_ids);
}
else if (!empty($topic_ids))
{

		if (isset($this->topic_id))

		if (isset($this->topic_id))

 
			{
$topic_ids[] = $this->topic_id;
}

$sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.topic_id', $topic_ids);
}
else 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;
}

Line 50Line 66
				)
);
$sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id;

				)
);
$sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id;

 
		}
else
{
// Do not allow querying the full attachments table
throw new \RuntimeException($this->user->lang('INVALID_FEED_ATTACHMENTS'));

		}

$sql = $this->db->sql_build_query('SELECT', $sql_array);

		}

$sql = $this->db->sql_build_query('SELECT', $sql_array);

Line 61Line 82
			$this->attachments[$row['post_msg_id']][] = $row;
}
$this->db->sql_freeresult($result);

			$this->attachments[$row['post_msg_id']][] = $row;
}
$this->db->sql_freeresult($result);

	}

/**
* {@inheritDoc}
*/
public function open()
{
parent::open();
$this->fetch_attachments();

 
	}

/**

	}

/**