diff options
38 files changed, 254 insertions, 97 deletions
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 4f39e71c3c..d0fd596913 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -434,6 +434,38 @@ memberlist_view_user_statistics_before  * Since: 3.1.0-a1  * Purpose: Add entries before the user statistics part of any user profile +mcp_warn_post_add_warning_field_after +=== +* Locations: +    + styles/prosilver/template/mcp_warn_post.html +    + styles/subsilver2/template/mcp_warn_post.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning for a post - after add warning field. + +mcp_warn_post_add_warning_field_before +=== +* Locations: +    + styles/prosilver/template/mcp_warn_post.html +    + styles/subsilver2/template/mcp_warn_post.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning for a post - before add warning field. + +mcp_warn_user_add_warning_field_after +=== +* Locations: +    + styles/prosilver/template/mcp_warn_user.html +    + styles/subsilver2/template/mcp_warn_user.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning a user - after add warning field. + +mcp_warn_user_add_warning_field_before +=== +* Locations: +    + styles/prosilver/template/mcp_warn_user.html +    + styles/subsilver2/template/mcp_warn_user.html +* Since: 3.1.0-RC4 +* Purpose: Add content during warning a user - before add warning field. +  navbar_header_logged_out_content  ===  * Locations: @@ -1227,6 +1259,14 @@ viewtopic_body_postrow_post_before  * Since: 3.1.0-a4  * Purpose: Add data before posts +viewtopic_body_postrow_post_content_footer +=== +* Locations: +    + styles/prosilver/template/viewtopic_body.html +    + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-RC4 +* Purpose: Add data at the end of the posts. +  viewtopic_body_postrow_post_notices_after  ===  * Locations: diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index af27ec1818..df613682a7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1636,7 +1636,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s  	if (empty($sql_sort))  	{ -		$sql_sort = 'ORDER BY t.topic_last_post_time DESC'; +		$sql_sort = 'ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC';  	}  	if ($config['load_db_lastread'] && $user->data['is_registered']) diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php index 7593f08f4d..811d49f1de 100644 --- a/phpBB/includes/functions_mcp.php +++ b/phpBB/includes/functions_mcp.php @@ -521,21 +521,21 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by  			$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);  			$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); -			$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views'); +			$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');  			$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';  			break;  		case 'posts':  			$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);  			$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); -			$sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject'); +			$sort_by_sql = array('a' => 'u.username_clean', 't' => array('p.post_time', 'p.post_id'), 's' => 'p.post_subject');  			$limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : '';  			break;  		case 'reports':  			$limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);  			$sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); -			$sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject'); +			$sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => array('p.post_time', 'p.post_id'), 't' => 'r.report_time', 's' => 'p.post_subject');  			break;  		case 'pm_reports': @@ -558,7 +558,16 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by  		$sort_key = $default_key;  	} -	$sort_order_sql = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); +	$direction = ($sort_dir == 'd') ? 'DESC' : 'ASC'; + +	if (is_array($sort_by_sql[$sort_key])) +	{ +		$sort_order_sql = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +	} +	else +	{ +		$sort_order_sql = $sort_by_sql[$sort_key] . ' ' . $direction; +	}  	$s_limit_days = $s_sort_key = $s_sort_dir = $sort_url = '';  	gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index acfd8d779a..768011fa5b 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1040,6 +1040,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id  	global $config, $phpbb_root_path, $phpEx, $phpbb_container;  	$phpbb_content_visibility = $phpbb_container->get('content.visibility'); +	$sql_sort = ($mode == 'post_review') ? 'ASC' : 'DESC';  	// Go ahead and pull all data for this topic  	$sql = 'SELECT p.post_id @@ -1048,8 +1049,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id  			AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . '  			' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . '  			' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . ' -		ORDER BY p.post_time '; -	$sql .= ($mode == 'post_review') ? 'ASC' : 'DESC'; +		ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort;  	$result = $db->sql_query_limit($sql, $config['posts_per_page']);  	$post_list = array(); @@ -1342,7 +1342,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $  				WHERE p.topic_id = $topic_id  					AND p.poster_id = u.user_id  					AND p.post_visibility = " . ITEM_APPROVED . ' -				ORDER BY p.post_time ASC'; +				ORDER BY p.post_time ASC, p.post_id ASC';  			$result = $db->sql_query_limit($sql, 1);  			$row = $db->sql_fetchrow($result);  			$db->sql_freeresult($result); @@ -1354,7 +1354,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $  					FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u  					WHERE p.topic_id = $topic_id  						AND p.poster_id = u.user_id -					ORDER BY p.post_time ASC"; +					ORDER BY p.post_time ASC, p.post_id ASC";  				$result = $db->sql_query_limit($sql, 1);  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); @@ -1409,7 +1409,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $  				WHERE topic_id = $topic_id  					AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . '  					AND post_time > ' . $data['post_time'] . ' -				ORDER BY post_time ASC'; +				ORDER BY post_time ASC, post_id ASC';  			$result = $db->sql_query_limit($sql, 1);  			$next_post_id = (int) $db->sql_fetchfield('post_id');  			$db->sql_freeresult($result); diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index b4ec0092e7..ebcf7ce643 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -66,7 +66,7 @@ function mcp_front_view($id, $mode, $action)  					FROM ' . POSTS_TABLE . '  					WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '  						AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . ' -					ORDER BY post_time DESC'; +					ORDER BY post_time DESC, post_id DESC';  				$result = $db->sql_query_limit($sql, 5);  				while ($row = $db->sql_fetchrow($result)) @@ -101,7 +101,7 @@ function mcp_front_view($id, $mode, $action)  					WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '  						AND t.topic_id = p.topic_id  						AND p.poster_id = u.user_id -					ORDER BY p.post_time DESC'; +					ORDER BY p.post_time DESC, p.post_id DESC';  				$result = $db->sql_query($sql);  				while ($row = $db->sql_fetchrow($result)) @@ -190,7 +190,7 @@ function mcp_front_view($id, $mode, $action)  						AND p.poster_id = u2.user_id  						AND ' . $db->sql_in_set('p.forum_id', $forum_list), -					'ORDER_BY'	=> 'p.post_time DESC', +					'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',  				);  				/** diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 92000c6ceb..f03bc034e4 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1265,7 +1265,7 @@ function mcp_fork_topic($topic_ids)  			$sql = 'SELECT *  				FROM ' . POSTS_TABLE . "  				WHERE topic_id = $topic_id -				ORDER BY post_time ASC"; +				ORDER BY post_time ASC, post_id ASC";  			$result = $db->sql_query($sql);  			$post_rows = array(); diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index ba118e5db8..247b9d1651 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -364,6 +364,27 @@ class mcp_reports  						AND r.pm_id = 0  						$limit_time_sql  					ORDER BY $sort_order_sql"; + +				/** +				* Alter sql query to get report id of all reports for requested forum and topic or just forum +				* +				* @event core.mcp_reports_get_reports_query_before +				* @var	string	sql						String with the query to be executed +				* @var	array	forum_list				List of forums that contain the posts +				* @var	int		topic_id				topic_id in the page request +				* @var	string	limit_time_sql			String with the SQL code to limit the time interval of the post (Note: May be empty string) +				* @var	string	sort_order_sql			String with the ORDER BY SQL code used in this query +				* @since 3.1.0-RC4 +				*/ +				$vars = array( +					'sql', +					'forum_list', +					'topic_id', +					'limit_time_sql', +					'sort_order_sql', +				); +				extract($phpbb_dispatcher->trigger_event('core.mcp_reports_get_reports_query_before', compact($vars))); +  				$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);  				$i = 0; diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 304c04eb3d..a1624e78ec 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -81,7 +81,7 @@ class ucp_main  						FROM $sql_from  						WHERE t.topic_type = " . POST_GLOBAL . '  							AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . ' -						ORDER BY t.topic_last_post_time DESC'; +						ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC';  					$result = $db->sql_query($sql);  					while ($row = $db->sql_fetchrow($result)) @@ -693,7 +693,7 @@ class ucp_main  					AND t.topic_id = tw.topic_id  					AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), -				'ORDER_BY'	=> 't.topic_last_post_time DESC' +				'ORDER_BY'	=> 't.topic_last_post_time DESC, t.topic_last_post_id DESC'  			);  			$sql_array['LEFT_JOIN'] = array(); @@ -710,7 +710,7 @@ class ucp_main  				'WHERE'		=> 'b.user_id = ' . $user->data['user_id'] . '  					AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true), -				'ORDER_BY'	=> 't.topic_last_post_time DESC' +				'ORDER_BY'	=> 't.topic_last_post_time DESC, t.topic_last_post_id DESC'  			);  			$sql_array['LEFT_JOIN'] = array(); diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index a8c8920a7d..b0a8e8d374 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -320,7 +320,7 @@ class ucp_prefs  				$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);  				$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); -				$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views'); +				$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => 't.topic_posts_approved', 's' => 't.topic_title', 'v' => 't.topic_views');  				// Post ordering options  				$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php index fffd4f0428..7e26848290 100644 --- a/phpBB/phpbb/controller/provider.php +++ b/phpBB/phpbb/controller/provider.php @@ -73,7 +73,7 @@ class provider  		$this->routes = new RouteCollection;  		foreach ($this->routing_files as $file_path)  		{ -			$loader = new YamlFileLoader(new FileLocator($base_path)); +			$loader = new YamlFileLoader(new FileLocator(phpbb_realpath($base_path)));  			$this->routes->addCollection($loader->load($file_path));  		} diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 8bc63e564a..44bea3c5d2 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -715,60 +715,6 @@ class migrator  	}  	/** -	* Load migration data files from a directory -	* -	* @param \phpbb\finder $finder -	* @param string $path Path to migration data files -	* @param bool $check_fulfillable If TRUE (default), we will check -	* 	if all of the migrations are fulfillable after loading them. -	* 	If FALSE, we will not check. You SHOULD check at least once -	* 	to prevent errors (if including multiple directories, check -	* 	with the last call to prevent throwing errors unnecessarily). -	* @return array Array of migration names -	* @throws \phpbb\db\migration\exception -	*/ -	public function load_migrations(\phpbb\finder $finder, $path, $check_fulfillable = true) -	{ -		if (!is_dir($path)) -		{ -			throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path); -		} - -		$migrations = array(); - -		$files = $finder -			->extension_directory("/") -			->find_from_paths(array('/' => $path)); -		foreach ($files as $file) -		{ -			$migrations[$file['path'] . $file['filename']] = ''; -		} -		$migrations = $finder->get_classes_from_files($migrations); - -		foreach ($migrations as $migration) -		{ -			if (!in_array($migration, $this->migrations)) -			{ -				$this->migrations[] = $migration; -			} -		} - -		if ($check_fulfillable) -		{ -			foreach ($this->migrations as $name) -			{ -				$unfulfillable = $this->unfulfillable($name); -				if ($unfulfillable !== false) -				{ -					throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable); -				} -			} -		} - -		return $this->migrations; -	} - -	/**  	* Creates the migrations table if it does not exist.  	* @return null  	*/ diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 610b755af3..7a2087c1cd 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -94,7 +94,7 @@ class forum extends \phpbb\feed\post_base  			WHERE forum_id = ' . $this->forum_id . '  				AND topic_moved_id = 0  				AND ' . $this->content_visibility->get_visibility_sql('topic', $this->forum_id) . ' -			ORDER BY topic_last_post_time DESC'; +			ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';  		$result = $this->db->sql_query_limit($sql, $this->num_items);  		$topic_ids = array(); @@ -123,7 +123,7 @@ class forum extends \phpbb\feed\post_base  							AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '  							AND p.post_time >= ' . $min_post_time . '  							AND p.poster_id = u.user_id', -			'ORDER_BY'	=> 'p.post_time DESC', +			'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',  		);  		return true; diff --git a/phpBB/phpbb/feed/news.php b/phpBB/phpbb/feed/news.php index ea5f4febf5..a02c199d85 100644 --- a/phpBB/phpbb/feed/news.php +++ b/phpBB/phpbb/feed/news.php @@ -99,7 +99,7 @@ class news extends \phpbb\feed\topic_base  			),  			'WHERE'		=> 'p.topic_id = t.topic_id  							AND ' . $this->db->sql_in_set('p.post_id', $post_ids), -			'ORDER_BY'	=> 'p.post_time DESC', +			'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',  		);  		return true; diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php index f6847c041e..ab452f5386 100644 --- a/phpBB/phpbb/feed/overall.php +++ b/phpBB/phpbb/feed/overall.php @@ -34,7 +34,7 @@ class overall extends \phpbb\feed\post_base  			FROM ' . TOPICS_TABLE . '  			WHERE topic_moved_id = 0  				AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . ' -			ORDER BY topic_last_post_time DESC'; +			ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';  		$result = $this->db->sql_query_limit($sql, $this->num_items);  		$topic_ids = array(); @@ -71,7 +71,7 @@ class overall extends \phpbb\feed\post_base  							AND ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . '  							AND p.post_time >= ' . $min_post_time . '  							AND u.user_id = p.poster_id', -			'ORDER_BY'	=> 'p.post_time DESC', +			'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',  		);  		return true; diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 78e0b4b8ab..66c49e55cf 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -101,7 +101,7 @@ class topic extends \phpbb\feed\post_base  			'WHERE'		=> 'p.topic_id = ' . $this->topic_id . '  								AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '  								AND p.poster_id = u.user_id', -			'ORDER_BY'	=> 'p.post_time DESC', +			'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',  		);  		return true; diff --git a/phpBB/phpbb/feed/topics.php b/phpBB/phpbb/feed/topics.php index 88ca7c33f3..2b9cb3501a 100644 --- a/phpBB/phpbb/feed/topics.php +++ b/phpBB/phpbb/feed/topics.php @@ -71,7 +71,7 @@ class topics extends \phpbb\feed\topic_base  			),  			'WHERE'		=> 'p.topic_id = t.topic_id  							AND ' . $this->db->sql_in_set('p.post_id', $post_ids), -			'ORDER_BY'	=> 'p.post_time DESC', +			'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',  		);  		return true; diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php index cde6d36f45..6d5eddfc16 100644 --- a/phpBB/phpbb/feed/topics_active.php +++ b/phpBB/phpbb/feed/topics_active.php @@ -56,7 +56,7 @@ class topics_active extends \phpbb\feed\topic_base  			WHERE topic_moved_id = 0  				AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . '  				' . $last_post_time_sql . ' -			ORDER BY topic_last_post_time DESC'; +			ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';  		$result = $this->db->sql_query_limit($sql, $this->num_items);  		$post_ids = array(); @@ -88,7 +88,7 @@ class topics_active extends \phpbb\feed\topic_base  			),  			'WHERE'		=> 'p.topic_id = t.topic_id  							AND ' . $this->db->sql_in_set('p.post_id', $post_ids), -			'ORDER_BY'	=> 'p.post_time DESC', +			'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',  		);  		return true; diff --git a/phpBB/styles/prosilver/template/mcp_warn_post.html b/phpBB/styles/prosilver/template/mcp_warn_post.html index 0dd2e14d92..59c7d0d495 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_post.html +++ b/phpBB/styles/prosilver/template/mcp_warn_post.html @@ -44,6 +44,8 @@  	</div>  </div> +<!-- EVENT mcp_warn_post_add_warning_field_before --> +  <div class="panel">  	<div class="inner"> @@ -64,6 +66,8 @@  	</div>  </div> +<!-- EVENT mcp_warn_post_add_warning_field_after --> +  <fieldset class="submit-buttons">  	<input type="reset" value="{L_RESET}" name="reset" class="button2" />    	<input type="submit" name="action[add_warning]" value="{L_SUBMIT}" class="button1" /> diff --git a/phpBB/styles/prosilver/template/mcp_warn_user.html b/phpBB/styles/prosilver/template/mcp_warn_user.html index 1541f2e5f6..1ad6df7ade 100644 --- a/phpBB/styles/prosilver/template/mcp_warn_user.html +++ b/phpBB/styles/prosilver/template/mcp_warn_user.html @@ -28,6 +28,8 @@  	</div>  </div> +<!-- EVENT mcp_warn_user_add_warning_field_before --> +  <div class="panel">  	<div class="inner"> @@ -48,6 +50,8 @@  	</div>  </div> +<!-- EVENT mcp_warn_user_add_warning_field_after --> +  <fieldset class="submit-buttons">  	<input type="reset" value="{L_RESET}" name="reset" class="button2" />    	<input type="submit" name="action[add_warning]" value="{L_SUBMIT}" class="button1" /> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index 1d0b7916d9..ddd95780d7 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -14,7 +14,7 @@  <!-- ENDIF --> -<div id="post-{MESSAGE_ID}" class="post pm<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->"> +<div id="post-{MESSAGE_ID}" class="post pm has-profile<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->">  <div class="inner">  	<dl class="postprofile" id="profile{MESSAGE_ID}"> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 04529096c9..7ed8569798 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -120,7 +120,7 @@  	<!-- IF postrow.S_FIRST_UNREAD -->  		<a id="unread" class="anchor"<!-- IF S_UNREAD_VIEW --> data-url="{postrow.U_MINI_POST}"<!-- ENDIF -->></a>  	<!-- ENDIF --> -	<div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->"> +	<div id="p{postrow.POST_ID}" class="post has-profile <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->">  		<div class="inner">  		<dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->> @@ -302,6 +302,8 @@  			<!-- IF postrow.BUMPED_MESSAGE --><div class="notice"><br /><br />{postrow.BUMPED_MESSAGE}</div><!-- ENDIF -->  			<!-- EVENT viewtopic_body_postrow_post_notices_after -->  			<!-- IF postrow.SIGNATURE --><div id="sig{postrow.POST_ID}" class="signature">{postrow.SIGNATURE}</div><!-- ENDIF --> + +			<!-- EVENT viewtopic_body_postrow_post_content_footer -->  			</div>  		</div> diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 0d98fe7a66..46fbbadef7 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -464,6 +464,11 @@ li.breadcrumbs span:first-child > a {  	float: right;  } +.rtl .has-profile .postbody h3 { +	margin-right: 0; +	margin-left: 180px; +} +  .rtl p.post-notice {  	padding-left: 5px;  	padding-right: 26px; @@ -655,6 +660,11 @@ li.breadcrumbs span:first-child > a {  	float: left;  } +.rtl .has-profile .post-buttons { +	left: 0; +	right: auto; +} +  .rtl .post-buttons li {  	float: right;  } @@ -1090,4 +1100,8 @@ li.breadcrumbs span:first-child > a {  		margin-left: 5px;  		margin-right: 0;  	} + +	.rtl .has-profile .post-buttons { +		left: 20px; +	}  } diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css index b45aae5672..a08b49a81c 100644 --- a/phpBB/styles/prosilver/theme/buttons.css +++ b/phpBB/styles/prosilver/theme/buttons.css @@ -177,6 +177,14 @@ ul.linklist.bulletin > li.small-icon:before {  	margin-top: 2px;  } +.has-profile .post-buttons { +	float: none; +	position: absolute; +	margin: 0; +	right: 0; +	top: 5px; +} +  .post-buttons > li {  	float: left;  	margin-right: 3px; diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 84701cc061..a3a4157704 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -299,6 +299,7 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul {  	background-repeat: no-repeat;  	background-position: 100% 0;  	border-radius: 7px; +	position: relative;  }  .rowbg { diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index d00c544050..fa23a665f1 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -233,6 +233,7 @@ dd.option {  	line-height: 1.48em;  	width: 76%;  	float: left; +	position: relative;  }  .postbody .ignore { @@ -249,7 +250,8 @@ dd.option {  	float: left;  	font-size: 1.5em;  	padding: 2px 0 0 0; -	margin: 0 0 0.3em 0 !important; +	margin-top: 0 !important; +	margin-bottom: 0.3em !important;  	text-transform: none;  	border: none;  	font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; @@ -261,6 +263,12 @@ dd.option {  	vertical-align: bottom;  } +.has-profile .postbody h3 { +	/* If there is a post-profile, we position the post-buttons differently */ +	float: none !important; +	margin-right: 180px; +} +  .postbody .content {  	font-size: 1.3em;  	overflow-x: auto; diff --git a/phpBB/styles/prosilver/theme/responsive.css b/phpBB/styles/prosilver/theme/responsive.css index 3ef0044621..fc39e03da7 100644 --- a/phpBB/styles/prosilver/theme/responsive.css +++ b/phpBB/styles/prosilver/theme/responsive.css @@ -398,6 +398,10 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {  /* Post  ----------------------------------------*/ +.postbody { +	position: inherit; +} +  .postprofile, .postbody, .search .postbody {  	display: block;  	width: auto; @@ -412,6 +416,7 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {  	padding-bottom: 5px;  	margin: 0;  	margin-bottom: 5px; +	min-height: 40px;  	overflow: hidden;  } @@ -443,12 +448,18 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {  	max-height: 32px;  } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 1.5dppx) -{ -	/* Scale online image for HD displays */ -	.online { -		background-size: 40px; -	} +.has-profile .postbody h3 { +	margin-left: 0 !important; +	margin-right: 0 !important; +} + +.has-profile .post-buttons { +	right: 20px; +	top: 15px; +} + +.online { +	background-size: 40px;  }  /* Misc stuff diff --git a/phpBB/styles/subsilver2/template/mcp_warn_post.html b/phpBB/styles/subsilver2/template/mcp_warn_post.html index 223457d158..68715eff2d 100644 --- a/phpBB/styles/subsilver2/template/mcp_warn_post.html +++ b/phpBB/styles/subsilver2/template/mcp_warn_post.html @@ -35,6 +35,8 @@  <form method="post" name="mcp" action="{U_POST_ACTION}"> +<!-- EVENT mcp_warn_post_add_warning_field_before --> +  <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg">  <tr>  	<th align="center">{L_ADD_WARNING}</th> @@ -54,6 +56,9 @@  	<td class="cat" align="center"><input class="btnmain" type="submit" name="action[add_warning]" value="{L_SUBMIT}" />  <input class="btnlite" type="reset" value="{L_RESET}" /></td>  </tr>  </table> + +<!-- EVENT mcp_warn_post_add_warning_field_after --> +  {S_FORM_TOKEN}  </form> diff --git a/phpBB/styles/subsilver2/template/mcp_warn_user.html b/phpBB/styles/subsilver2/template/mcp_warn_user.html index 6b78c71557..20b57c6837 100644 --- a/phpBB/styles/subsilver2/template/mcp_warn_user.html +++ b/phpBB/styles/subsilver2/template/mcp_warn_user.html @@ -48,6 +48,8 @@  <form method="post" name="mcp" action="{U_POST_ACTION}"> +<!-- EVENT mcp_warn_user_add_warning_field_before --> +  <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg">  <tr>  	<th align="center">{L_ADD_WARNING}</th> @@ -67,6 +69,9 @@  	<td class="cat" align="center"><input class="btnmain" type="submit" name="action[add_warning]" value="{L_SUBMIT}" />  <input class="btnlite" type="reset" value="{L_RESET}" /></td>  </tr>  </table> + +<!-- EVENT mcp_warn_user_add_warning_field_after --> +  {S_FORM_TOKEN}  </form> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 0f34b50950..838f6c5f03 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -308,6 +308,8 @@  					<!-- ENDIF -->  					<!-- EVENT viewtopic_body_postrow_post_notices_after --> +					<!-- EVENT viewtopic_body_postrow_post_content_footer --> +  					<!-- IF not postrow.S_HAS_ATTACHMENTS --><br clear="all" /><br /><!-- ENDIF -->  						<table width="100%" cellspacing="0"> diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 9086feb390..9ecbdea77a 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -264,7 +264,7 @@ gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']);  $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);  $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); -$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views'); +$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');  $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';  gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); @@ -497,7 +497,7 @@ if ($start > $topics_count / 2)  	$store_reverse = true;  	// Select the sort order -	$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); +	$direction = (($sort_dir == 'd') ? 'ASC' : 'DESC');  	$sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count);  	$sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count); @@ -505,10 +505,19 @@ if ($start > $topics_count / 2)  else  {  	// Select the sort order -	$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); +	$direction = (($sort_dir == 'd') ? 'DESC' : 'ASC');  	$sql_start = $start;  } +if (is_array($sort_by_sql[$sort_key])) +{ +	$sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ +	$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} +  if ($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary))  {  	$sql_where = 't.forum_id = ' . $forum_id; diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index c2faffca85..20fea19f7c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -94,7 +94,7 @@ if ($view && !$post_id)  				AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . "  				AND post_time > $topic_last_read  				AND forum_id = $forum_id -			ORDER BY post_time ASC"; +			ORDER BY post_time ASC, post_id ASC";  		$result = $db->sql_query_limit($sql, 1);  		$row = $db->sql_fetchrow($result);  		$db->sql_freeresult($result); @@ -146,7 +146,7 @@ if ($view && !$post_id)  					AND topic_moved_id = 0  					AND topic_last_post_time $sql_condition {$row['topic_last_post_time']}  					AND " . $phpbb_content_visibility->get_visibility_sql('topic', $row['forum_id']) . " -				ORDER BY topic_last_post_time $sql_ordering"; +				ORDER BY topic_last_post_time $sql_ordering, topic_last_post_id $sql_ordering";  			$result = $db->sql_query_limit($sql, 1);  			$row = $db->sql_fetchrow($result);  			$db->sql_freeresult($result); @@ -388,7 +388,7 @@ if (!isset($topic_tracking_info))  $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);  $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); -$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => 'p.post_time', 's' => array('p.post_subject', 'p.post_id')); +$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => array('p.post_time', 'p.post_id'), 's' => array('p.post_subject', 'p.post_id'));  $join_user_sql = array('a' => true, 't' => false, 's' => false);  $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 532a160a47..18eb9ad4c6 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -26,6 +26,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c  		'foo/bar/event/',  		'foo/bar/language/en/',  		'foo/bar/styles/prosilver/template/', +		'foo/foo/config/', +		'foo/foo/controller/',  	);  	static public function setUpBeforeClass() @@ -65,6 +67,18 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c  	}  	/** +	* Check a controller for extension foo/bar. +	*/ +	public function test_routing_resources() +	{ +		$this->phpbb_extension_manager->enable('foo/foo'); +		$crawler = self::request('GET', 'app.php/foo/foo', array(), false); +		self::assert_response_status_code(); +		$this->assertContains("foo/foo controller handle() method", $crawler->filter('body')->text()); +		$this->phpbb_extension_manager->purge('foo/foo'); +	} + +	/**  	* Check the output of a controller using the template system  	*/  	public function test_controller_with_template() diff --git a/tests/functional/fixtures/ext/foo/foo/composer.json b/tests/functional/fixtures/ext/foo/foo/composer.json new file mode 100644 index 0000000000..d85c76a6a2 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/composer.json @@ -0,0 +1,24 @@ +{ +	"name": "foo/foo", +	"type": "phpbb-extension", +	"description": "Testing extensions", +	"homepage": "", +	"version": "1.0.0", +	"time": "2013-03-21 01:01:01", +	"license": "GPL-2.0", +	"authors": [{ +		"name": "Tristan Darricau", +		"email": "nicofuma@phpbb.com", +		"homepage": "http://www.phpbb.com", +		"role": "Developer" +	}], +	"require": { +		"php": ">=5.3" +	}, +	"extra": { +		"display-name": "phpBB 3.1 Extension Testing", +		"soft-require": { +			"phpbb/phpbb": "3.1.*@dev" +		} +	} +} diff --git a/tests/functional/fixtures/ext/foo/foo/config/resource.yml b/tests/functional/fixtures/ext/foo/foo/config/resource.yml new file mode 100644 index 0000000000..ed1d018016 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/config/resource.yml @@ -0,0 +1,3 @@ +foo_foo_controller: +    pattern: /foo +    defaults: { _controller: foo_foo.controller:handle } diff --git a/tests/functional/fixtures/ext/foo/foo/config/routing.yml b/tests/functional/fixtures/ext/foo/foo/config/routing.yml new file mode 100644 index 0000000000..c2c401687d --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/config/routing.yml @@ -0,0 +1,3 @@ +foo_foo.general: +    resource: "resource.yml" +    prefix: /foo diff --git a/tests/functional/fixtures/ext/foo/foo/config/services.yml b/tests/functional/fixtures/ext/foo/foo/config/services.yml new file mode 100644 index 0000000000..b3c7719715 --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/config/services.yml @@ -0,0 +1,3 @@ +services: +    foo_foo.controller: +        class: foo\foo\controller\controller diff --git a/tests/functional/fixtures/ext/foo/foo/controller/controller.php b/tests/functional/fixtures/ext/foo/foo/controller/controller.php new file mode 100644 index 0000000000..771eaeacfc --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/controller/controller.php @@ -0,0 +1,13 @@ +<?php + +namespace foo\foo\controller; + +use Symfony\Component\HttpFoundation\Response; + +class controller +{ +	public function handle() +	{ +		return new Response('foo/foo controller handle() method', 200); +	} +} diff --git a/tests/functional/fixtures/ext/foo/foo/ext.php b/tests/functional/fixtures/ext/foo/foo/ext.php new file mode 100644 index 0000000000..80acda74fe --- /dev/null +++ b/tests/functional/fixtures/ext/foo/foo/ext.php @@ -0,0 +1,8 @@ +<?php + +namespace foo\foo; + +class ext extends \phpbb\extension\base +{ + +}  | 
