Completed
Push — master ( a1bb43...5bb186 )
by Erwan
02:51
created
search/fulltext_attribute.php 4 patches
Doc Comments   -12 removed lines patch added patch discarded remove patch
@@ -33,18 +33,6 @@
 block discarded – undo
33 33
 	/**
34 34
 	* Performs a search on keywords depending on display specific params. You have to run split_keywords() first
35 35
 	*
36
-	* @param	array		$keywords_ary		contains each words to search
37
-	* @param	string		$terms				is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words)
38
-	* @param	array		$sort_by_sql		contains SQL code for the ORDER BY part of a query
39
-	* @param	string		$sort_key			is the key of $sort_by_sql for the selected sorting
40
-	* @param	string		$sort_dir			is either a or d representing ASC and DESC
41
-	* @param	string		$sort_days			specifies the maximum amount of days a post may be old
42
-	* @param	array		$ex_cid_ary			specifies an array of category ids which should not be searched
43
-	* @param	int			$cat_id				is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
44
-	* @param	array		&$id_ary			passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
45
-	* @param	int			$start				indicates the first index of the page
46
-	* @param	int			$per_page			number of ids each page is supposed to contain
47
-	* @return	int								total number of results
48 36
 	*/
49 37
 	public function attribute_search($attribute_id, $type, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
50 38
 	{
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 	protected $db;
20 20
 
21 21
 	/**
22
-	* Constructor
23
-	*
24
-	* @param \phpbb\config\config				$config Config object
25
-	* @param \phpbb\db\driver\driver_interface	$db		Database object
26
-	*/
22
+	 * Constructor
23
+	 *
24
+	 * @param \phpbb\config\config				$config Config object
25
+	 * @param \phpbb\db\driver\driver_interface	$db		Database object
26
+	 */
27 27
 	public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db)
28 28
 	{
29 29
 		$this->config	= $config;
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 
33 33
 	/**
34
-	* Performs a search on keywords depending on display specific params. You have to run split_keywords() first
35
-	*
36
-	* @param	array		$keywords_ary		contains each words to search
37
-	* @param	string		$terms				is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words)
38
-	* @param	array		$sort_by_sql		contains SQL code for the ORDER BY part of a query
39
-	* @param	string		$sort_key			is the key of $sort_by_sql for the selected sorting
40
-	* @param	string		$sort_dir			is either a or d representing ASC and DESC
41
-	* @param	string		$sort_days			specifies the maximum amount of days a post may be old
42
-	* @param	array		$ex_cid_ary			specifies an array of category ids which should not be searched
43
-	* @param	int			$cat_id				is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
44
-	* @param	array		&$id_ary			passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
45
-	* @param	int			$start				indicates the first index of the page
46
-	* @param	int			$per_page			number of ids each page is supposed to contain
47
-	* @return	int								total number of results
48
-	*/
34
+	 * Performs a search on keywords depending on display specific params. You have to run split_keywords() first
35
+	 *
36
+	 * @param	array		$keywords_ary		contains each words to search
37
+	 * @param	string		$terms				is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words)
38
+	 * @param	array		$sort_by_sql		contains SQL code for the ORDER BY part of a query
39
+	 * @param	string		$sort_key			is the key of $sort_by_sql for the selected sorting
40
+	 * @param	string		$sort_dir			is either a or d representing ASC and DESC
41
+	 * @param	string		$sort_days			specifies the maximum amount of days a post may be old
42
+	 * @param	array		$ex_cid_ary			specifies an array of category ids which should not be searched
43
+	 * @param	int			$cat_id				is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
44
+	 * @param	array		&$id_ary			passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
45
+	 * @param	int			$start				indicates the first index of the page
46
+	 * @param	int			$per_page			number of ids each page is supposed to contain
47
+	 * @return	int								total number of results
48
+	 */
49 49
 	public function attribute_search($attribute_id, $type, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
50 50
 	{
51 51
 		// generate a search_key from all the options to identify the results
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	*/
27 27
 	public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db)
28 28
 	{
29
-		$this->config	= $config;
30
-		$this->db		= $db;
29
+		$this->config = $config;
30
+		$this->db = $db;
31 31
 	}
32 32
 
33 33
 	/**
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 		$id_ary = array();
82 82
 
83 83
 		// Create some display specific sql strings
84
-		$sql_attribute	= 't.topic_attr_id = ' . (int) $attribute_id;
84
+		$sql_attribute = 't.topic_attr_id = ' . (int) $attribute_id;
85 85
 		$sql_fora		= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
86
-		$sql_topic_id	= ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
86
+		$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
87 87
 		$sql_time		= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
88
-		$sql_firstpost	= ' AND p.post_id = t.topic_first_post_id';
88
+		$sql_firstpost = ' AND p.post_id = t.topic_first_post_id';
89 89
 
90 90
 		// Build sql strings for sorting
91 91
 		$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 		switch ($sql_sort[0])
94 94
 		{
95 95
 			case 'u':
96
-				$sql_sort_table	= USERS_TABLE . ' u, ';
97
-				$sql_sort_join	= ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster ';
96
+				$sql_sort_table = USERS_TABLE . ' u, ';
97
+				$sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster ';
98 98
 			break;
99 99
 
100 100
 			case 'f':
101
-				$sql_sort_table	= FORUMS_TABLE . ' f, ';
102
-				$sql_sort_join	= ' AND f.forum_id = p.forum_id ';
101
+				$sql_sort_table = FORUMS_TABLE . ' f, ';
102
+				$sql_sort_join = ' AND f.forum_id = p.forum_id ';
103 103
 			break;
104 104
 		}
105 105
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			// Build the query for really selecting the post_ids
112 112
 		if ($type == 'posts')
113 113
 		{
114
-			$sql = "SELECT {$calc_results}p.post_id
114
+			$sql = "select {$calc_results}p.post_id
115 115
 				FROM " . $sql_sort_table . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t ' . "
116 116
 				WHERE $sql_attribute
117 117
 					$sql_topic_id
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		}
126 126
 		else
127 127
 		{
128
-			$sql = "SELECT {$calc_results}t.topic_id
128
+			$sql = "select {$calc_results}t.topic_id
129 129
 				FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
130 130
 				WHERE $sql_attribute
131 131
 					$sql_topic_id
Please login to merge, or discard this patch.
event/search_listener.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function __construct(\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \ernadoo\qte\qte $qte, \ernadoo\qte\search\fulltext_attribute $qte_search)
38 38
 	{
39
-		$this->request		= $request;
40
-		$this->template		= $template;
41
-		$this->user			= $user;
42
-		$this->qte			= $qte;
43
-		$this->qte_search	= $qte_search;
39
+		$this->request = $request;
40
+		$this->template = $template;
41
+		$this->user = $user;
42
+		$this->qte = $qte;
43
+		$this->qte_search = $qte_search;
44 44
 	}
45 45
 
46 46
 	static public function getSubscribedEvents()
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	{
73 73
 		if (!empty($event['row']['topic_attr_id']))
74 74
 		{
75
-			$this->qte->get_users_by_topic_id((array)$event['row']['topic_id']);
75
+			$this->qte->get_users_by_topic_id((array) $event['row']['topic_id']);
76 76
 			$tpl_ary = $event['tpl_ary'];
77 77
 			$tpl_ary['TOPIC_ATTRIBUTE'] = $this->qte->attr_display($event['row']['topic_attr_id'], $event['row']['topic_attr_user'], $event['row']['topic_attr_time']);
78 78
 			$event['tpl_ary'] = $tpl_ary;
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 	{
128 128
 		if ($this->searc_attr)
129 129
 		{
130
-			$keywords	= utf8_normalize_nfc($this->request->variable('keywords', '', true));
131
-			$author		= $this->request->variable('author', '', true);
130
+			$keywords = utf8_normalize_nfc($this->request->variable('keywords', '', true));
131
+			$author = $this->request->variable('author', '', true);
132 132
 
133 133
 			if (!$keywords && !$author)
134 134
 			{
Please login to merge, or discard this patch.