Completed
Push — master ( 3f52af...44cec3 )
by Erwan
03:07
created
controller/search.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
 	*/
64 64
 	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, \ernadoo\phpbbdirectory\search\fulltext_directory $search, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link)
65 65
 	{
66
-		$this->db			= $db;
66
+		$this->db = $db;
67 67
 		$this->config		= $config;
68
-		$this->template		= $template;
68
+		$this->template = $template;
69 69
 		$this->user			= $user;
70 70
 		$this->helper		= $helper;
71
-		$this->request		= $request;
71
+		$this->request = $request;
72 72
 		$this->auth			= $auth;
73
-		$this->pagination	= $pagination;
74
-		$this->search		= $search;
75
-		$this->categorie	= $categorie;
76
-		$this->link			= $link;
73
+		$this->pagination = $pagination;
74
+		$this->search = $search;
75
+		$this->categorie = $categorie;
76
+		$this->link = $link;
77 77
 
78 78
 		$this->user->add_lang_ext('ernadoo/phpbbdirectory', array('directory'));
79 79
 		$this->user->add_lang('search');
@@ -98,24 +98,24 @@  discard block
 block discarded – undo
98 98
 			throw new \phpbb\exception\http_exception(403, 'DIR_ERROR_NOT_AUTH');
99 99
 		}
100 100
 
101
-		$cat_id				= $this->request->variable('cat_id', 0);
102
-		$keywords			= $this->request->variable('keywords', '', true);
101
+		$cat_id = $this->request->variable('cat_id', 0);
102
+		$keywords = $this->request->variable('keywords', '', true);
103 103
 		$search_terms		= $this->request->variable('terms', 'all');
104
-		$search_category	= $this->request->variable('cid', array(0));
105
-		$search_fields		= $this->request->variable('sf', 'all');
104
+		$search_category = $this->request->variable('cid', array(0));
105
+		$search_fields = $this->request->variable('sf', 'all');
106 106
 		$search_child		= $this->request->variable('sc', true);
107
-		$sort_days			= $this->request->variable('st', 0);
107
+		$sort_days = $this->request->variable('st', 0);
108 108
 		$sort_key			= $this->request->variable('sk', 't');
109 109
 		$sort_dir			= $this->request->variable('sd', 'd');
110
-		$start				= ($page - 1) * (int) $this->config['dir_show'];
110
+		$start = ($page - 1) * (int) $this->config['dir_show'];
111 111
 
112
-		$default_sort_days	= 0;
112
+		$default_sort_days = 0;
113 113
 		$default_sort_key	= (string) substr($this->config['dir_default_order'], 0, 1);
114 114
 		$default_sort_dir	= (string) substr($this->config['dir_default_order'], 2);
115 115
 
116 116
 		// Categorie ordering options
117 117
 		$limit_days		= array(0 => $this->user->lang['ALL_RESULTS'], 1 => $this->user->lang['1_DAY'], 7 => $this->user->lang['7_DAYS'], 14 => $this->user->lang['2_WEEKS'], 30 => $this->user->lang['1_MONTH'], 90 => $this->user->lang['3_MONTHS'], 180 => $this->user->lang['6_MONTHS'], 365 => $this->user->lang['1_YEAR']);
118
-		$sort_by_text	= array('a' => $this->user->lang['AUTHOR'], 't' => $this->user->lang['POST_TIME'], 'r' => $this->user->lang['DIR_COMMENTS_ORDER'], 's' =>  $this->user->lang['DIR_NAME_ORDER'], 'v' => $this->user->lang['DIR_NB_CLICKS_ORDER']);
118
+		$sort_by_text = array('a' => $this->user->lang['AUTHOR'], 't' => $this->user->lang['POST_TIME'], 'r' => $this->user->lang['DIR_COMMENTS_ORDER'], 's' =>  $this->user->lang['DIR_NAME_ORDER'], 'v' => $this->user->lang['DIR_NB_CLICKS_ORDER']);
119 119
 		$sort_by_sql	= array('a' => 'u.username_clean', 't' => array('l.link_time', 'l.link_id'), 'r' => 'l.link_comment', 's' => 'LOWER(l.link_name)', 'v' => 'l.link_view');
120 120
 
121 121
 		if ($this->config['dir_activ_pagerank'])
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 
165 165
 			$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));
166 166
 
167
-			($u_hilit) 					? $u_search['keywords']		= urlencode(htmlspecialchars_decode($keywords)) : '';
168
-			($search_terms != 'all') 	? $u_search['terms']		= $search_terms : '';
169
-			($cat_id)					? $u_search['cat_id']		= $cat_id : '';
170
-			($search_category)			? $u_search['cid']			= $search_category : '';
171
-			(!$search_child)			? $u_search['sc']			= 0 : '';
172
-			($search_fields != 'all')	? $u_search['sf'] 			= $search_fields : '';
167
+			($u_hilit) ? $u_search['keywords'] = urlencode(htmlspecialchars_decode($keywords)) : '';
168
+			($search_terms != 'all') ? $u_search['terms'] = $search_terms : '';
169
+			($cat_id) ? $u_search['cat_id'] = $cat_id : '';
170
+			($search_category) ? $u_search['cid'] = $search_category : '';
171
+			(!$search_child) ? $u_search['sc'] = 0 : '';
172
+			($search_fields != 'all') ? $u_search['sf'] = $search_fields : '';
173 173
 
174 174
 			$base_url = array(
175 175
 				'routes'	=> 'ernadoo_phpbbdirectory_search_controller',
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
 					foreach ($rowset as $data)
245 245
 					{
246
-						$s_banner	= $this->link->display_bann($data);
246
+						$s_banner = $this->link->display_bann($data);
247 247
 						$s_thumb	= $this->link->display_thumb($data);
248 248
 						$s_flag		= $this->link->display_flag($data);
249 249
 
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
 
252 252
 						if ($hilit)
253 253
 						{
254
-							$data['link_name'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_name']);
255
-							$data['link_description'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_description']);
254
+							$data['link_name'] = preg_replace('#(?!<.*)(?<!\w)('.$hilit.')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_name']);
255
+							$data['link_description'] = preg_replace('#(?!<.*)(?<!\w)('.$hilit.')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_description']);
256 256
 						}
257 257
 
258 258
 						$this->template->assign_block_vars('results', array(
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	private function _get_exclude_categories(&$search_category, $search_child)
323 323
 	{
324 324
 		$sql = 'SELECT cat_id, parent_id, right_id
325
-				FROM ' . DIR_CAT_TABLE . '
325
+				FROM ' . DIR_CAT_TABLE.'
326 326
 				ORDER BY left_id';
327 327
 		$result = $this->db->sql_query($sql);
328 328
 
Please login to merge, or discard this patch.