diff options
Diffstat (limited to 'phpBB/includes/ucp/ucp_attachments.php')
| -rw-r--r-- | phpBB/includes/ucp/ucp_attachments.php | 16 | 
1 files changed, 9 insertions, 7 deletions
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index b011b4f75d..6a5b48a181 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -2,9 +2,8 @@  /**  *  * @package ucp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -27,7 +26,7 @@ class ucp_attachments  	function main($id, $mode)  	{ -		global $template, $user, $db, $config, $phpEx, $phpbb_root_path; +		global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container;  		$start		= request_var('start', 0);  		$sort_key	= request_var('sk', 'a'); @@ -120,6 +119,10 @@ class ucp_attachments  		$num_attachments = $db->sql_fetchfield('num_attachments');  		$db->sql_freeresult($result); +		// Ensure start is a valid value +		$pagination = $phpbb_container->get('pagination'); +		$start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments); +  		$sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title  			FROM ' . ATTACHMENTS_TABLE . ' a  				LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0) @@ -171,9 +174,10 @@ class ucp_attachments  		}  		$db->sql_freeresult($result); +		$base_url = $this->u_action . "&sk=$sort_key&sd=$sort_dir"; +		$pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); +  		$template->assign_vars(array( -			'PAGE_NUMBER'			=> on_page($num_attachments, $config['topics_per_page'], $start), -			'PAGINATION'			=> generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start),  			'TOTAL_ATTACHMENTS'		=> $num_attachments,  			'L_TITLE'				=> $user->lang['UCP_ATTACHMENTS'], @@ -197,5 +201,3 @@ class ucp_attachments  		$this->page_title = 'UCP_ATTACHMENTS';  	}  } - -?>
\ No newline at end of file  | 
