Completed
Push — master ( 3b4e89...55fb45 )
by Stanislav
16s queued 13s
created
core/controller/search.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
 
142 142
 	public function base($page = 1)
143 143
 	{
144
-		$search_id		= $this->request->variable('search_id', '');
144
+		$search_id = $this->request->variable('search_id', '');
145 145
 		$image_id		= $this->request->variable('image_id', 0);
146 146
 
147
-		$submit			= $this->request->variable('submit', false);
147
+		$submit = $this->request->variable('submit', false);
148 148
 		$keywords		= utf8_normalize_nfc($this->request->variable('keywords', '', true));
149 149
 		$add_keywords	= utf8_normalize_nfc($this->request->variable('add_keywords', '', true));
150 150
 		$username		= $this->request->variable('username', '', true);
151
-		$user_id		= $this->request->variable('user_id', array(0));
151
+		$user_id = $this->request->variable('user_id', array(0));
152 152
 		$search_terms	= $this->request->variable('terms', 'all');
153 153
 		$search_album	= $this->request->variable('aid', array(0));
154 154
 		$search_child	= $this->request->variable('sc', true);
155
-		$search_fields	= $this->request->variable('sf', 'all');
156
-		$sort_days		= $this->request->variable('st', 0);
155
+		$search_fields = $this->request->variable('sf', 'all');
156
+		$sort_days = $this->request->variable('st', 0);
157 157
 		$sort_key		= $this->request->variable('sk', 't');
158 158
 		$sort_dir		= $this->request->variable('sd', 'd');
159 159
 
160
-		$start 			= ($page - 1) * $this->gallery_config->get('items_per_page');
161
-		if ($keywords != '' && $add_keywords ='' )
160
+		$start = ($page - 1) * $this->gallery_config->get('items_per_page');
161
+		if ($keywords != '' && $add_keywords = '')
162 162
 		{
163 163
 			$submit = true;
164 164
 		}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		if ($this->gallery_config->get('allow_rates'))
175 175
 		{
176 176
 			$sort_by_text['ra'] = $this->language->lang('RATING');
177
-			$sort_by_sql['ra'] = 'image_rate_points';//@todo: (phpbb_gallery_contest::$mode == phpbb_gallery_contest::MODE_SUM) ? 'image_rate_points' : 'image_rate_avg';
177
+			$sort_by_sql['ra'] = 'image_rate_points'; //@todo: (phpbb_gallery_contest::$mode == phpbb_gallery_contest::MODE_SUM) ? 'image_rate_points' : 'image_rate_avg';
178 178
 			$sort_by_text['r'] = $this->language->lang('RATES_COUNT');
179 179
 			$sort_by_sql['r'] = 'image_rates';
180 180
 		}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				{
206 206
 					trigger_error(sprintf($this->language->lang('TOO_FEW_AUTHOR_CHARS'), $this->config['min_search_author_chars']));
207 207
 				}
208
-				$username_parsed = (strpos($username, '*') !== false) ? ' username_clean ' . $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), utf8_clean_string($this->db->sql_escape($username)))) : ' username_clean = \'' . $this->db->sql_escape(utf8_clean_string($username)) .'\'';
208
+				$username_parsed = (strpos($username, '*') !== false) ? ' username_clean ' . $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), utf8_clean_string($this->db->sql_escape($username)))) : ' username_clean = \'' . $this->db->sql_escape(utf8_clean_string($username)) . '\'';
209 209
 				$sql = 'SELECT user_id
210 210
 					FROM ' . USERS_TABLE . '
211 211
 					WHERE ' . $username_parsed . '
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 			if (!empty($user_id))
225 225
 			{
226
-				$sql_where[] =  $this->db->sql_in_set('i.image_user_id', $user_id);
226
+				$sql_where[] = $this->db->sql_in_set('i.image_user_id', $user_id);
227 227
 			}
228 228
 			// if we search in an existing search result just add the additional keywords. But we need to use "all search terms"-mode
229 229
 			// so we can keep the old keywords in their old mode, but add the new ones as required words
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 				else
237 237
 				{
238 238
 					$search_terms = 'all';
239
-					$keywords = preg_replace('#\s+#u', ' |', $keywords) . ' ' .$add_keywords;
239
+					$keywords = preg_replace('#\s+#u', ' |', $keywords) . ' ' . $add_keywords;
240 240
 				}
241 241
 			}
242 242
 			$keywords_ary = ($keywords) ? explode(' ', $keywords) : array();
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 				$match_search_query = '';
262 262
 				foreach ($matches as $match)
263 263
 				{
264
-					$match_search_query .= (($match_search_query) ? ' OR ' : '') . 'LOWER('. $match . ') ';
264
+					$match_search_query .= (($match_search_query) ? ' OR ' : '') . 'LOWER(' . $match . ') ';
265 265
 					$match_search_query .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $this->db->get_any_char() . mb_strtolower($word) . $this->db->get_any_char()));
266 266
 				}
267 267
 				$search_query .= ((!$search_query) ? '' : (($search_terms == 'all') ? ' AND ' : ' OR ')) . '(' . $match_search_query . ')';
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 				trigger_error('NO_SEARCH_RESULTS');
291 291
 			}
292 292
 			$sql_array['SELECT'] = '*, a.album_name, a.album_status, a.album_user_id, a.album_id';
293
-			$sql_array['LEFT_JOIN']	= array(
293
+			$sql_array['LEFT_JOIN'] = array(
294 294
 				array(
295 295
 					'FROM'		=> array($this->albums_table => 'a'),
296 296
 					'ON'		=> 'a.album_id = i.image_album_id',
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			{
319 319
 				$this->image->assign_block('imageblock.image', $row, $show_options, $thumbnail_link, $imagename_link);
320 320
 			}
321
-			$current_page = $page*$this->gallery_config->get('items_per_page');
321
+			$current_page = $page * $this->gallery_config->get('items_per_page');
322 322
 			$this->pagination->generate_template_pagination(array(
323 323
 				'routes' => array(
324 324
 					'phpbbgallery_core_search',
Please login to merge, or discard this patch.