Completed
Branch 3.2.x (9c8dfb)
by Erwan
02:35
created
controller/search.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
 	*/
68 68
 	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\language\language $language, \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)
69 69
 	{
70
-		$this->db			= $db;
71
-		$this->config		= $config;
70
+		$this->db = $db;
71
+		$this->config = $config;
72 72
 		$this->language		= $language;
73 73
 		$this->template		= $template;
74 74
 		$this->user			= $user;
75
-		$this->helper		= $helper;
76
-		$this->request		= $request;
75
+		$this->helper = $helper;
76
+		$this->request = $request;
77 77
 		$this->auth			= $auth;
78
-		$this->pagination	= $pagination;
79
-		$this->search		= $search;
80
-		$this->categorie	= $categorie;
81
-		$this->link			= $link;
78
+		$this->pagination = $pagination;
79
+		$this->search = $search;
80
+		$this->categorie = $categorie;
81
+		$this->link = $link;
82 82
 
83 83
 		$language->add_lang('directory', 'ernadoo/phpbbdirectory');
84 84
 		$language->add_lang('search');
@@ -102,24 +102,24 @@  discard block
 block discarded – undo
102 102
 			throw new \phpbb\exception\http_exception(403, 'DIR_ERROR_NOT_AUTH');
103 103
 		}
104 104
 
105
-		$cat_id				= $this->request->variable('cat_id', 0);
106
-		$keywords			= $this->request->variable('keywords', '', true);
105
+		$cat_id = $this->request->variable('cat_id', 0);
106
+		$keywords = $this->request->variable('keywords', '', true);
107 107
 		$search_terms		= $this->request->variable('terms', 'all');
108
-		$search_category	= $this->request->variable('cid', array(0));
109
-		$search_fields		= $this->request->variable('sf', 'all');
108
+		$search_category = $this->request->variable('cid', array(0));
109
+		$search_fields = $this->request->variable('sf', 'all');
110 110
 		$search_child		= $this->request->variable('sc', true);
111
-		$sort_days			= $this->request->variable('st', 0);
111
+		$sort_days = $this->request->variable('st', 0);
112 112
 		$sort_key			= $this->request->variable('sk', 't');
113 113
 		$sort_dir			= $this->request->variable('sd', 'd');
114
-		$start				= ($page - 1) * (int) $this->config['dir_show'];
114
+		$start = ($page - 1) * (int) $this->config['dir_show'];
115 115
 
116
-		$default_sort_days	= 0;
116
+		$default_sort_days = 0;
117 117
 		$default_sort_key	= (string) substr($this->config['dir_default_order'], 0, 1);
118 118
 		$default_sort_dir	= (string) substr($this->config['dir_default_order'], 2);
119 119
 
120 120
 		// Categorie ordering options
121 121
 		$limit_days		= array(0 => $this->language->lang('ALL_RESULTS'), 1 => $this->language->lang('1_DAY'), 7 => $this->language->lang('7_DAYS'), 14 => $this->language->lang('2_WEEKS'), 30 => $this->language->lang('1_MONTH'), 90 => $this->language->lang('3_MONTHS'), 180 => $this->language->lang('6_MONTHS'), 365 => $this->language->lang('1_YEAR'));
122
-		$sort_by_text	= array('a' => $this->language->lang('AUTHOR'), 't' => $this->language->lang('POST_TIME'), 'r' => $this->language->lang('DIR_COMMENTS_ORDER'), 's' =>  $this->language->lang('DIR_NAME_ORDER'), 'v' => $this->language->lang('DIR_NB_CLICKS_ORDER'));
122
+		$sort_by_text = array('a' => $this->language->lang('AUTHOR'), 't' => $this->language->lang('POST_TIME'), 'r' => $this->language->lang('DIR_COMMENTS_ORDER'), 's' =>  $this->language->lang('DIR_NAME_ORDER'), 'v' => $this->language->lang('DIR_NB_CLICKS_ORDER'));
123 123
 		$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');
124 124
 
125 125
 		if ($this->config['dir_activ_pagerank'])
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 
169 169
 			$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));
170 170
 
171
-			($u_hilit) 					? $u_search['keywords']		= urlencode(htmlspecialchars_decode($keywords)) : '';
172
-			($search_terms != 'all') 	? $u_search['terms']		= $search_terms : '';
173
-			($cat_id)					? $u_search['cat_id']		= $cat_id : '';
174
-			($search_category)			? $u_search['cid']			= $search_category : '';
175
-			(!$search_child)			? $u_search['sc']			= 0 : '';
176
-			($search_fields != 'all')	? $u_search['sf'] 			= $search_fields : '';
171
+			($u_hilit) ? $u_search['keywords'] = urlencode(htmlspecialchars_decode($keywords)) : '';
172
+			($search_terms != 'all') ? $u_search['terms'] = $search_terms : '';
173
+			($cat_id) ? $u_search['cat_id'] = $cat_id : '';
174
+			($search_category) ? $u_search['cid'] = $search_category : '';
175
+			(!$search_child) ? $u_search['sc'] = 0 : '';
176
+			($search_fields != 'all') ? $u_search['sf'] = $search_fields : '';
177 177
 
178 178
 			$base_url = array(
179 179
 				'routes'	=> 'ernadoo_phpbbdirectory_search_controller',
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
 					foreach ($rowset as $data)
249 249
 					{
250
-						$s_banner	= $this->link->display_bann($data);
250
+						$s_banner = $this->link->display_bann($data);
251 251
 						$s_thumb	= $this->link->display_thumb($data);
252 252
 						$s_flag		= $this->link->display_flag($data);
253 253
 
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 
256 256
 						if ($hilit)
257 257
 						{
258
-							$data['link_name'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_name']);
259
-							$data['link_description'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_description']);
258
+							$data['link_name'] = preg_replace('#(?!<.*)(?<!\w)('.$hilit.')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_name']);
259
+							$data['link_description'] = preg_replace('#(?!<.*)(?<!\w)('.$hilit.')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#isu', '<span class="posthilit">$1</span>', $data['link_description']);
260 260
 						}
261 261
 
262 262
 						$this->template->assign_block_vars('results', array(
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	private function _get_exclude_categories(&$search_category, $search_child)
327 327
 	{
328 328
 		$sql = 'SELECT cat_id, parent_id, right_id
329
-				FROM ' . DIR_CAT_TABLE . '
329
+				FROM ' . DIR_CAT_TABLE.'
330 330
 				ORDER BY left_id';
331 331
 		$result = $this->db->sql_query($sql);
332 332
 
Please login to merge, or discard this patch.