@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | protected $link; |
51 | 51 | |
52 | 52 | /** |
53 | - * Constructor |
|
54 | - * |
|
55 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
56 | - * @param \phpbb\config\config $config Config object |
|
57 | - * @param \phpbb\language\language $language Language object |
|
58 | - * @param \phpbb\template\template $template Template object |
|
59 | - * @param \phpbb\user $user User object |
|
60 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
61 | - * @param \phpbb\request\request $request Request object |
|
62 | - * @param \phpbb\auth\auth $auth Auth object |
|
63 | - * @param \phpbb\pagination $pagination Pagination object |
|
64 | - * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
65 | - * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
66 | - */ |
|
53 | + * Constructor |
|
54 | + * |
|
55 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
56 | + * @param \phpbb\config\config $config Config object |
|
57 | + * @param \phpbb\language\language $language Language object |
|
58 | + * @param \phpbb\template\template $template Template object |
|
59 | + * @param \phpbb\user $user User object |
|
60 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
61 | + * @param \phpbb\request\request $request Request object |
|
62 | + * @param \phpbb\auth\auth $auth Auth object |
|
63 | + * @param \phpbb\pagination $pagination Pagination object |
|
64 | + * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
65 | + * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
66 | + */ |
|
67 | 67 | 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\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link) |
68 | 68 | { |
69 | 69 | $this->db = $db; |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * Base controller to be accessed with the URL /directory |
|
90 | - * |
|
91 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
92 | - */ |
|
89 | + * Base controller to be accessed with the URL /directory |
|
90 | + * |
|
91 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
92 | + */ |
|
93 | 93 | public function base() |
94 | 94 | { |
95 | 95 | $this->categorie->display(); |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | - * Legacy view controller for display a category |
|
103 | - * Used with /directory/categorie/{cat_id} |
|
104 | - * @deprecated 2.0.0 No longer used since dynamic routing. |
|
105 | - * |
|
106 | - * @param int $cat_id The category ID |
|
107 | - * @param int $page Page number taken from the URL |
|
108 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
109 | - * @throws \phpbb\exception\http_exception |
|
110 | - */ |
|
102 | + * Legacy view controller for display a category |
|
103 | + * Used with /directory/categorie/{cat_id} |
|
104 | + * @deprecated 2.0.0 No longer used since dynamic routing. |
|
105 | + * |
|
106 | + * @param int $cat_id The category ID |
|
107 | + * @param int $page Page number taken from the URL |
|
108 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
109 | + * @throws \phpbb\exception\http_exception |
|
110 | + */ |
|
111 | 111 | public function view($cat_id, $page) |
112 | 112 | { |
113 | 113 | if (false === $this->categorie->get($cat_id)) |
@@ -121,17 +121,17 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
124 | - * View controller for display a category |
|
125 | - * |
|
126 | - * @param int $cat_id The category ID |
|
127 | - * @param int $page Page number taken from the URL |
|
128 | - * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
129 | - * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
130 | - * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
131 | - * @param string $mode watch|unwatch |
|
132 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
133 | - * @throws \phpbb\exception\http_exception |
|
134 | - */ |
|
124 | + * View controller for display a category |
|
125 | + * |
|
126 | + * @param int $cat_id The category ID |
|
127 | + * @param int $page Page number taken from the URL |
|
128 | + * @param int $sort_days Specifies the maximum amount of days a link may be old |
|
129 | + * @param string $sort_key is the key of $sort_by_sql for the selected sorting: a|t|r|s|v|p |
|
130 | + * @param string $sort_dir is either a or d representing ASC and DESC (ascending|descending) |
|
131 | + * @param string $mode watch|unwatch |
|
132 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
133 | + * @throws \phpbb\exception\http_exception |
|
134 | + */ |
|
135 | 135 | public function view_route($cat_id, $page = 1, $sort_days = 0, $sort_key = '', $sort_dir = '', $mode = '') |
136 | 136 | { |
137 | 137 | if (false === $this->categorie->get($cat_id)) |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
389 | - * date controller for return a date |
|
390 | - * |
|
391 | - * @return \phpbb\json_response A Json Response |
|
392 | - * @throws \phpbb\exception\http_exception |
|
393 | - */ |
|
389 | + * date controller for return a date |
|
390 | + * |
|
391 | + * @return \phpbb\json_response A Json Response |
|
392 | + * @throws \phpbb\exception\http_exception |
|
393 | + */ |
|
394 | 394 | public function return_date() |
395 | 395 | { |
396 | 396 | if (!$this->request->is_ajax()) |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
410 | - * slug controller for return a slugify category name |
|
411 | - * |
|
412 | - * @return \phpbb\json_response A Json Response |
|
413 | - * @throws \phpbb\exception\http_exception |
|
414 | - */ |
|
410 | + * slug controller for return a slugify category name |
|
411 | + * |
|
412 | + * @return \phpbb\json_response A Json Response |
|
413 | + * @throws \phpbb\exception\http_exception |
|
414 | + */ |
|
415 | 415 | public function return_slug() |
416 | 416 | { |
417 | 417 | if (!$this->request->is_ajax()) |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | */ |
67 | 67 | 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\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link) |
68 | 68 | { |
69 | - $this->db = $db; |
|
70 | - $this->config = $config; |
|
69 | + $this->db = $db; |
|
70 | + $this->config = $config; |
|
71 | 71 | $this->language = $language; |
72 | 72 | $this->template = $template; |
73 | 73 | $this->user = $user; |
74 | - $this->helper = $helper; |
|
75 | - $this->request = $request; |
|
74 | + $this->helper = $helper; |
|
75 | + $this->request = $request; |
|
76 | 76 | $this->auth = $auth; |
77 | - $this->pagination = $pagination; |
|
78 | - $this->categorie = $categorie; |
|
77 | + $this->pagination = $pagination; |
|
78 | + $this->categorie = $categorie; |
|
79 | 79 | $this->link = $link; |
80 | 80 | |
81 | 81 | $template->assign_vars(array( |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_CATS'); |
114 | 114 | } |
115 | 115 | |
116 | - $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)); |
|
116 | + $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)); |
|
117 | 117 | |
118 | 118 | return new RedirectResponse($url, 301); |
119 | 119 | } |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | |
140 | 140 | $start = ($page - 1) * $this->config['dir_show']; |
141 | 141 | |
142 | - $default_sort_days = 0; |
|
142 | + $default_sort_days = 0; |
|
143 | 143 | $default_sort_key = (string) substr($this->config['dir_default_order'], 0, 1); |
144 | 144 | $default_sort_dir = (string) substr($this->config['dir_default_order'], 2); |
145 | 145 | |
146 | 146 | $sort_days = (!$sort_days) ? $this->request->variable('st', $default_sort_days) : $sort_days; |
147 | 147 | $sort_key = (!$sort_key) ? $this->request->variable('sk', $default_sort_key) : $sort_key; |
148 | - $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
148 | + $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
149 | 149 | $link_list = $rowset = array(); |
150 | 150 | |
151 | 151 | // Categorie ordering options |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | $min_post_time = time() - ($sort_days * 86400); |
184 | 184 | |
185 | 185 | $sql = 'SELECT COUNT(link_id) AS nb_links |
186 | - FROM ' . $this->links_table . ' |
|
187 | - WHERE link_cat = ' . (int) $cat_id . ' |
|
186 | + FROM ' . $this->links_table.' |
|
187 | + WHERE link_cat = ' . (int) $cat_id.' |
|
188 | 188 | AND link_time >= ' . (int) $min_post_time; |
189 | 189 | $result = $this->db->sql_query($sql); |
190 | 190 | $nb_links = (int) $this->db->sql_fetchfield('nb_links'); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | else |
200 | 200 | { |
201 | 201 | $sql_limit_time = ''; |
202 | - $nb_links = (int) $this->categorie->data['cat_links']; |
|
202 | + $nb_links = (int) $this->categorie->data['cat_links']; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // Make sure $start is set to the last page if it exceeds the amount |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $this->categorie->make_cat_jumpbox(); |
213 | 213 | |
214 | 214 | $base_url = array( |
215 | - 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, |
|
215 | + 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, |
|
216 | 216 | 'params' => array_merge(array('cat_id' => $cat_id), $u_sort_param), |
217 | 217 | ); |
218 | 218 | |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | 'S_SELECT_SORT_KEY' => $s_sort_key, |
226 | 226 | 'S_SELECT_SORT_DAYS' => $s_limit_days, |
227 | 227 | 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), |
228 | - 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)), |
|
228 | + 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)), |
|
229 | 229 | 'S_CAT_ID' => $cat_id, |
230 | 230 | |
231 | 231 | 'TOTAL_LINKS' => $this->language->lang('DIR_NB_LINKS', (int) $nb_links), |
232 | 232 | |
233 | 233 | 'U_NEW_SITE' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => $cat_id)), |
234 | 234 | |
235 | - 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id), |
|
235 | + 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id), |
|
236 | 236 | 'U_WATCH_CAT' => $s_watching_categorie['link'], |
237 | 237 | 'U_WATCH_CAT_TOGGLE' => $s_watching_categorie['link_toggle'], |
238 | 238 | 'S_WATCH_CAT_TITLE' => $s_watching_categorie['title'], |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | |
263 | 263 | if (is_array($sort_by_sql[$sort_key])) |
264 | 264 | { |
265 | - $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; |
|
265 | + $sql_sort_order = implode(' '.$direction.', ', $sort_by_sql[$sort_key]).' '.$direction; |
|
266 | 266 | } |
267 | 267 | else |
268 | 268 | { |
269 | - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; |
|
269 | + $sql_sort_order = $sort_by_sql[$sort_key].' '.$direction; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | // Grab just the sorted link ids |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | 'ON' => 'l.link_user_id = u.user_id' |
281 | 281 | ), |
282 | 282 | ), |
283 | - 'WHERE' => 'l.link_cat = ' . (int) $cat_id . " |
|
283 | + 'WHERE' => 'l.link_cat = '.(int) $cat_id." |
|
284 | 284 | AND l.link_active = 1 |
285 | 285 | $sql_limit_time", |
286 | 286 | 'ORDER_BY' => $sql_sort_order |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | ), |
310 | 310 | array( |
311 | 311 | 'FROM' => array($this->votes_table => 'v'), |
312 | - 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = ' . $this->user->data['user_id'] |
|
312 | + 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = '.$this->user->data['user_id'] |
|
313 | 313 | ) |
314 | 314 | ), |
315 | 315 | 'WHERE' => $this->db->sql_in_set('l.link_id', $link_list) |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | |
327 | 327 | $link_list = ($store_reverse) ? array_reverse($link_list) : $link_list; |
328 | 328 | |
329 | - $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
330 | - $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
329 | + $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
330 | + $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
331 | 331 | |
332 | 332 | foreach ($link_list as $link_id) |
333 | 333 | { |
@@ -337,10 +337,10 @@ discard block |
||
337 | 337 | $s_note = $this->link->display_note($site['link_note'], $site['link_vote'], $votes_status); |
338 | 338 | $s_thumb = $this->link->display_thumb($site); |
339 | 339 | $s_vote = $this->link->display_vote($site); |
340 | - $s_banner = $this->link->display_bann($site); |
|
341 | - $s_rss = $this->link->display_rss($site); |
|
340 | + $s_banner = $this->link->display_bann($site); |
|
341 | + $s_rss = $this->link->display_rss($site); |
|
342 | 342 | |
343 | - $edit_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir')))); |
|
343 | + $edit_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_edit_dir')))); |
|
344 | 344 | $delete_allowed = ($this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_dir') || ($this->user->data['user_id'] == $site['link_user_id'] && $this->auth->acl_get('u_delete_dir')))); |
345 | 345 | |
346 | 346 | $this->template->assign_block_vars('site', array( |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $this->template->assign_block_vars('no_draw_link', array()); |
377 | 377 | } |
378 | 378 | |
379 | - $page_title = $this->language->lang('DIRECTORY') . ' - ' . $this->categorie->data['cat_name']; |
|
379 | + $page_title = $this->language->lang('DIRECTORY').' - '.$this->categorie->data['cat_name']; |
|
380 | 380 | |
381 | 381 | $this->categorie->display(); |
382 | 382 |
@@ -69,22 +69,22 @@ discard block |
||
69 | 69 | protected $php_ext; |
70 | 70 | |
71 | 71 | /** |
72 | - * Constructor |
|
73 | - * |
|
74 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
75 | - * @param \phpbb\config\config $config Config object |
|
76 | - * @param \phpbb\language\language $language Language object |
|
77 | - * @param \phpbb\template\template $template Template object |
|
78 | - * @param \phpbb\user $user User object |
|
79 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
80 | - * @param \phpbb\request\request $request Request object |
|
81 | - * @param \phpbb\auth\auth $auth Auth object |
|
82 | - * @param \phpbb\captcha\factory $captcha_factory Captcha object |
|
83 | - * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
84 | - * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
85 | - * @param string $root_path phpBB root path |
|
86 | - * @param string $php_ext phpEx |
|
87 | - */ |
|
72 | + * Constructor |
|
73 | + * |
|
74 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
75 | + * @param \phpbb\config\config $config Config object |
|
76 | + * @param \phpbb\language\language $language Language object |
|
77 | + * @param \phpbb\template\template $template Template object |
|
78 | + * @param \phpbb\user $user User object |
|
79 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
80 | + * @param \phpbb\request\request $request Request object |
|
81 | + * @param \phpbb\auth\auth $auth Auth object |
|
82 | + * @param \phpbb\captcha\factory $captcha_factory Captcha object |
|
83 | + * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
84 | + * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
85 | + * @param string $root_path phpBB root path |
|
86 | + * @param string $php_ext phpEx |
|
87 | + */ |
|
88 | 88 | 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\captcha\factory $captcha_factory, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) |
89 | 89 | { |
90 | 90 | $this->db = $db; |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * Delete a link |
|
113 | - * |
|
114 | - * @param int $cat_id The category ID |
|
115 | - * @param int $link_id The link ID |
|
116 | - * @return null|\Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
117 | - */ |
|
112 | + * Delete a link |
|
113 | + * |
|
114 | + * @param int $cat_id The category ID |
|
115 | + * @param int $link_id The link ID |
|
116 | + * @return null|\Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
117 | + */ |
|
118 | 118 | public function delete_link($cat_id, $link_id) |
119 | 119 | { |
120 | 120 | if ($this->request->is_set_post('cancel')) |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | - * Edit a link |
|
161 | - * |
|
162 | - * @param int $cat_id The category ID |
|
163 | - * @param int $link_id The link ID |
|
164 | - * @return null|\Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
165 | - * @throws \phpbb\exception\http_exception |
|
166 | - */ |
|
160 | + * Edit a link |
|
161 | + * |
|
162 | + * @param int $cat_id The category ID |
|
163 | + * @param int $link_id The link ID |
|
164 | + * @return null|\Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
165 | + * @throws \phpbb\exception\http_exception |
|
166 | + */ |
|
167 | 167 | public function edit_link($cat_id, $link_id) |
168 | 168 | { |
169 | 169 | $sql = 'SELECT link_id, link_uid, link_user_id, link_flags, link_bitfield, link_cat, link_url, link_description, link_guest_email, link_name, link_rss, link_back, link_banner, link_flag, link_cat, link_time |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
233 | - * Display add form |
|
234 | - * |
|
235 | - * @param int $cat_id The category ID |
|
236 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
237 | - * @throws \phpbb\exception\http_exception |
|
238 | - */ |
|
233 | + * Display add form |
|
234 | + * |
|
235 | + * @param int $cat_id The category ID |
|
236 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
237 | + * @throws \phpbb\exception\http_exception |
|
238 | + */ |
|
239 | 239 | public function new_link($cat_id) |
240 | 240 | { |
241 | 241 | if (!$this->auth->acl_get('u_submit_dir')) |
@@ -277,23 +277,23 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | - * View link controller |
|
281 | - * |
|
282 | - * @param int $link_id The link ID |
|
283 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
284 | - */ |
|
280 | + * View link controller |
|
281 | + * |
|
282 | + * @param int $link_id The link ID |
|
283 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
284 | + */ |
|
285 | 285 | public function view_link($link_id) |
286 | 286 | { |
287 | 287 | return $this->link->view($link_id); |
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
291 | - * Vote for a link |
|
292 | - * |
|
293 | - * @param int $cat_id The category ID |
|
294 | - * @param int $link_id The link ID |
|
295 | - * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
296 | - */ |
|
291 | + * Vote for a link |
|
292 | + * |
|
293 | + * @param int $cat_id The category ID |
|
294 | + * @param int $link_id The link ID |
|
295 | + * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
296 | + */ |
|
297 | 297 | public function vote_link($cat_id, $link_id) |
298 | 298 | { |
299 | 299 | $this->categorie->get($cat_id); |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
332 | - * Routine |
|
333 | - * |
|
334 | - * @param int $cat_id The category ID |
|
335 | - * @param int $link_id The link ID |
|
336 | - * @param string $mode add|edit |
|
337 | - * @return null|\Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
338 | - * @throws \phpbb\exception\http_exception |
|
339 | - */ |
|
332 | + * Routine |
|
333 | + * |
|
334 | + * @param int $cat_id The category ID |
|
335 | + * @param int $link_id The link ID |
|
336 | + * @param string $mode add|edit |
|
337 | + * @return null|\Symfony\Component\HttpFoundation\Response A Symfony Response object |
|
338 | + * @throws \phpbb\exception\http_exception |
|
339 | + */ |
|
340 | 340 | private function _data_processing($cat_id, $link_id = 0, $mode = 'new') |
341 | 341 | { |
342 | 342 | if (($mode == 'edit' && !$this->auth->acl_get('m_edit_dir') && !$this->auth->acl_get('u_edit_dir')) || ($mode == 'new' && !$this->auth->acl_get('u_submit_dir'))) |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | if (!$error) |
427 | 427 | { |
428 | 428 | /** |
429 | - * No errrors, we execute heavy tasks wich need a valid url |
|
430 | - */ |
|
429 | + * No errrors, we execute heavy tasks wich need a valid url |
|
430 | + */ |
|
431 | 431 | |
432 | 432 | // Banner |
433 | 433 | $this->link->banner_process($this->banner, $error); |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | } |
509 | 509 | |
510 | 510 | /** |
511 | - * Display a banner |
|
512 | - * |
|
513 | - * @param string $banner_img Path to banner file |
|
514 | - * @return Response object |
|
515 | - */ |
|
511 | + * Display a banner |
|
512 | + * |
|
513 | + * @param string $banner_img Path to banner file |
|
514 | + * @return Response object |
|
515 | + */ |
|
516 | 516 | public function return_banner($banner_img) |
517 | 517 | { |
518 | 518 | if (!function_exists('file_gc')) |
@@ -546,13 +546,13 @@ discard block |
||
546 | 546 | } |
547 | 547 | |
548 | 548 | /** |
549 | - * Populate form when an error occurred |
|
550 | - * |
|
551 | - * @param int $cat_id The category ID |
|
552 | - * @param string $mode add|edit |
|
553 | - * @param string $title Page title (depends of $mode) |
|
554 | - * @return null |
|
555 | - */ |
|
549 | + * Populate form when an error occurred |
|
550 | + * |
|
551 | + * @param int $cat_id The category ID |
|
552 | + * @param string $mode add|edit |
|
553 | + * @param string $title Page title (depends of $mode) |
|
554 | + * @return null |
|
555 | + */ |
|
556 | 556 | private function _populate_form($cat_id, $mode, $title) |
557 | 557 | { |
558 | 558 | global $phpbb_extension_manager; |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | */ |
88 | 88 | 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\captcha\factory $captcha_factory, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) |
89 | 89 | { |
90 | - $this->db = $db; |
|
91 | - $this->config = $config; |
|
90 | + $this->db = $db; |
|
91 | + $this->config = $config; |
|
92 | 92 | $this->language = $language; |
93 | 93 | $this->template = $template; |
94 | 94 | $this->user = $user; |
95 | - $this->helper = $helper; |
|
96 | - $this->request = $request; |
|
95 | + $this->helper = $helper; |
|
96 | + $this->request = $request; |
|
97 | 97 | $this->auth = $auth; |
98 | - $this->captcha_factory = $captcha_factory; |
|
98 | + $this->captcha_factory = $captcha_factory; |
|
99 | 99 | $this->categorie = $categorie; |
100 | 100 | $this->link = $link; |
101 | 101 | $this->root_path = $root_path; |
102 | - $this->php_ext = $php_ext; |
|
102 | + $this->php_ext = $php_ext; |
|
103 | 103 | |
104 | 104 | $template->assign_vars(array( |
105 | 105 | 'S_PHPBB_DIRECTORY' => true, |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | { |
118 | 118 | if ($this->request->is_set_post('cancel')) |
119 | 119 | { |
120 | - $redirect = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
120 | + $redirect = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
121 | 121 | redirect($redirect); |
122 | 122 | } |
123 | 123 | |
124 | 124 | $sql = 'SELECT link_user_id |
125 | - FROM ' . $this->links_table . ' |
|
125 | + FROM ' . $this->links_table.' |
|
126 | 126 | WHERE link_id = ' . (int) $link_id; |
127 | 127 | $result = $this->db->sql_query($sql); |
128 | 128 | $link_data = $this->db->sql_fetchrow($result); |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | { |
144 | 144 | $this->link->del($cat_id, $link_id); |
145 | 145 | |
146 | - $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
146 | + $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
147 | 147 | meta_refresh(3, $meta_info); |
148 | - $message = $this->language->lang('DIR_DELETE_OK') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_base_controller') . '">', '</a>') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id) . '">', '</a>'); |
|
148 | + $message = $this->language->lang('DIR_DELETE_OK').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_base_controller').'">', '</a>').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id).'">', '</a>'); |
|
149 | 149 | return $this->helper->message($message); |
150 | 150 | } |
151 | 151 | else |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function edit_link($cat_id, $link_id) |
166 | 166 | { |
167 | 167 | $sql = 'SELECT link_id, link_uid, link_user_id, link_flags, link_bitfield, link_cat, link_url, link_description, link_guest_email, link_name, link_rss, link_back, link_banner, link_flag, link_cat, link_time |
168 | - FROM ' . $this->links_table . ' |
|
168 | + FROM ' . $this->links_table.' |
|
169 | 169 | WHERE link_id = ' . (int) $link_id; |
170 | 170 | $result = $this->db->sql_query($sql); |
171 | 171 | $link_data = $this->db->sql_fetchrow($result); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $cat_id = $this->request->variable('id', $cat_id); |
187 | 187 | $submit = $this->request->is_set_post('submit') ? true : false; |
188 | 188 | $refresh = $this->request->is_set_post('refresh_vc') ? true : false; |
189 | - $title = $this->language->lang('DIR_EDIT_SITE'); |
|
189 | + $title = $this->language->lang('DIR_EDIT_SITE'); |
|
190 | 190 | |
191 | 191 | $this->template->assign_block_vars('dir_navlinks', array( |
192 | 192 | 'FORUM_NAME' => $title, |
@@ -210,15 +210,15 @@ discard block |
||
210 | 210 | 'old_banner' => $link_data['link_banner'], |
211 | 211 | ); |
212 | 212 | |
213 | - $site_description = generate_text_for_edit($link_data['link_description'], $link_data['link_uid'], $link_data['link_flags']); |
|
214 | - $link_data['link_banner'] = (preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $link_data['link_banner'])) ? $link_data['link_banner'] : ''; |
|
213 | + $site_description = generate_text_for_edit($link_data['link_description'], $link_data['link_uid'], $link_data['link_flags']); |
|
214 | + $link_data['link_banner'] = (preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $link_data['link_banner'])) ? $link_data['link_banner'] : ''; |
|
215 | 215 | |
216 | - $this->url = $link_data['link_url']; |
|
217 | - $this->site_name = $link_data['link_name']; |
|
216 | + $this->url = $link_data['link_url']; |
|
217 | + $this->site_name = $link_data['link_name']; |
|
218 | 218 | $this->description = $site_description['text']; |
219 | 219 | $this->guest_email = $link_data['link_guest_email']; |
220 | - $this->rss = $link_data['link_rss']; |
|
221 | - $this->banner = $link_data['link_banner']; |
|
220 | + $this->rss = $link_data['link_rss']; |
|
221 | + $this->banner = $link_data['link_banner']; |
|
222 | 222 | $this->back = $link_data['link_back']; |
223 | 223 | $this->flag = $link_data['link_flag']; |
224 | 224 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $cat_id = $this->request->variable('id', $cat_id); |
246 | 246 | $submit = $this->request->is_set_post('submit') ? true : false; |
247 | 247 | $refresh = $this->request->is_set_post('refresh_vc') ? true : false; |
248 | - $title = $this->language->lang('DIR_NEW_SITE'); |
|
248 | + $title = $this->language->lang('DIR_NEW_SITE'); |
|
249 | 249 | |
250 | 250 | $this->template->assign_block_vars('dir_navlinks', array( |
251 | 251 | 'FORUM_NAME' => $title, |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | // We check if user had already vot for this website. |
311 | 311 | $sql = 'SELECT vote_link_id |
312 | - FROM ' . $this->votes_table . ' |
|
312 | + FROM ' . $this->votes_table.' |
|
313 | 313 | WHERE ' . $this->db->sql_build_array('SELECT', $data); |
314 | 314 | $result = $this->db->sql_query($sql); |
315 | 315 | $data = $this->db->sql_fetchrow($result); |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | |
322 | 322 | $this->link->add_vote($link_id, $this->request->variable('vote', 0)); |
323 | 323 | |
324 | - $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
324 | + $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
325 | 325 | meta_refresh(3, $meta_info); |
326 | - $message = $this->language->lang('DIR_VOTE_OK') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $meta_info . '">', '</a>'); |
|
326 | + $message = $this->language->lang('DIR_VOTE_OK').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$meta_info.'">', '</a>'); |
|
327 | 327 | return $this->helper->message($message); |
328 | 328 | } |
329 | 329 | |
@@ -348,18 +348,18 @@ discard block |
||
348 | 348 | return $this->helper->message('FORM_INVALID'); |
349 | 349 | } |
350 | 350 | |
351 | - $this->url = $this->request->variable('url', ''); |
|
352 | - $this->site_name = $this->request->variable('site_name', '', true); |
|
351 | + $this->url = $this->request->variable('url', ''); |
|
352 | + $this->site_name = $this->request->variable('site_name', '', true); |
|
353 | 353 | $this->description = $this->request->variable('description', '', true); |
354 | 354 | $this->guest_email = $this->request->variable('guest_email', ''); |
355 | - $this->rss = $this->request->variable('rss', ''); |
|
356 | - $this->banner = $this->request->variable('banner', ''); |
|
355 | + $this->rss = $this->request->variable('rss', ''); |
|
356 | + $this->banner = $this->request->variable('banner', ''); |
|
357 | 357 | $this->back = $this->request->variable('back', ''); |
358 | 358 | $this->flag = $this->request->variable('flag', ''); |
359 | 359 | |
360 | 360 | if (!function_exists('validate_data')) |
361 | 361 | { |
362 | - include($this->root_path . 'includes/functions_user.' . $this->php_ext); |
|
362 | + include($this->root_path.'includes/functions_user.'.$this->php_ext); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | // We define variables to check |
@@ -382,17 +382,17 @@ discard block |
||
382 | 382 | 'site_name' => array( |
383 | 383 | array('string', false, 1, 100)), |
384 | 384 | 'website' => array( |
385 | - array('string', false, 12, 255), |
|
386 | - array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
385 | + array('string', false, 12, 255), |
|
386 | + array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
387 | 387 | 'description' => array( |
388 | 388 | array('string', !$this->categorie->data['cat_must_describe'], 1, $this->config['dir_length_describe'])), |
389 | 389 | 'rss' => array( |
390 | 390 | array('string', true, 12, 255), |
391 | - array('match', empty($this->rss), '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
391 | + array('match', empty($this->rss), '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
392 | 392 | 'banner' => array( |
393 | 393 | array('string', true, 5, 255)), |
394 | 394 | 'back' => array( |
395 | - array('string', !$this->categorie->data['cat_link_back'], 12, 255), |
|
395 | + array('string', !$this->categorie->data['cat_link_back'], 12, 255), |
|
396 | 396 | array(array($this->link, 'link_back'), true)), |
397 | 397 | 'cat' => array( |
398 | 398 | array('num', '', 1)) |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | // Still no errors?? So let's go! |
439 | 439 | if (!$error) |
440 | 440 | { |
441 | - $this->banner = (!$this->banner && !$this->request->is_set_post('delete_banner')) ? $this->request->variable('old_banner', '') : $this->banner; |
|
442 | - $this->url = $this->link->clean_url($this->url); |
|
441 | + $this->banner = (!$this->banner && !$this->request->is_set_post('delete_banner')) ? $this->request->variable('old_banner', '') : $this->banner; |
|
442 | + $this->url = $this->link->clean_url($this->url); |
|
443 | 443 | |
444 | 444 | $data_edit = array( |
445 | 445 | 'link_user_id' => $this->link_user_id, |
@@ -484,10 +484,10 @@ discard block |
||
484 | 484 | $this->link->add($data_add, $need_approval); |
485 | 485 | } |
486 | 486 | |
487 | - $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
487 | + $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
488 | 488 | meta_refresh(3, $meta_info); |
489 | 489 | $message = ($need_approval) ? $this->language->lang('DIR_'.strtoupper($mode).'_SITE_ACTIVE') : $this->language->lang('DIR_'.strtoupper($mode).'_SITE_OK'); |
490 | - $message = $message . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_base_controller') . '">', '</a>') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id) . '">', '</a>'); |
|
490 | + $message = $message.'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_DIR', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_base_controller').'">', '</a>').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id).'">', '</a>'); |
|
491 | 491 | return $this->helper->message($message); |
492 | 492 | } |
493 | 493 | else |
@@ -516,10 +516,10 @@ discard block |
||
516 | 516 | { |
517 | 517 | if (!function_exists('file_gc')) |
518 | 518 | { |
519 | - include($this->root_path . 'includes/functions_download.' . $this->php_ext); |
|
519 | + include($this->root_path.'includes/functions_download.'.$this->php_ext); |
|
520 | 520 | } |
521 | 521 | |
522 | - $file_path = $this->root_path . $this->get_banner_path($banner_img); |
|
522 | + $file_path = $this->root_path.$this->get_banner_path($banner_img); |
|
523 | 523 | |
524 | 524 | if ((@file_exists($file_path) && @is_readable($file_path))) |
525 | 525 | { |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | |
572 | 572 | if (!function_exists('display_custom_bbcodes')) |
573 | 573 | { |
574 | - include($this->root_path . 'includes/functions_display.' . $this->php_ext); |
|
574 | + include($this->root_path.'includes/functions_display.'.$this->php_ext); |
|
575 | 575 | } |
576 | 576 | display_custom_bbcodes(); |
577 | 577 | add_form_key('dir_form'); |
@@ -580,17 +580,17 @@ discard block |
||
580 | 580 | $flag_path = $ext_path.'images/flags/'; |
581 | 581 | |
582 | 582 | $s_guest = (!$this->user->data['is_registered'] || !empty($this->guest_email)); |
583 | - $s_rss = $this->config['dir_activ_rss']; |
|
584 | - $s_banner = $this->config['dir_activ_banner']; |
|
583 | + $s_rss = $this->config['dir_activ_rss']; |
|
584 | + $s_banner = $this->config['dir_activ_banner']; |
|
585 | 585 | $s_back = $this->categorie->data['cat_link_back']; |
586 | 586 | $s_flag = $this->config['dir_activ_flag']; |
587 | 587 | |
588 | 588 | $this->template->assign_vars(array( |
589 | - 'BBCODE_STATUS' => ($this->config['allow_bbcode']) ? $this->language->lang('BBCODE_IS_ON', '<a href="' . append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode') . '">', '</a>') : $this->language->lang('BBCODE_IS_OFF', '<a href="' . append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode') . '">', '</a>'), |
|
590 | - 'IMG_STATUS' => ($this->config['allow_bbcode']) ? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), |
|
589 | + 'BBCODE_STATUS' => ($this->config['allow_bbcode']) ? $this->language->lang('BBCODE_IS_ON', '<a href="'.append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode').'">', '</a>') : $this->language->lang('BBCODE_IS_OFF', '<a href="'.append_sid($this->root_path."faq.$this->php_ext", 'mode=bbcode').'">', '</a>'), |
|
590 | + 'IMG_STATUS' => ($this->config['allow_bbcode']) ? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), |
|
591 | 591 | 'SMILIES_STATUS' => ($this->config['allow_smilies']) ? $this->language->lang('SMILIES_ARE_ON') : $this->language->lang('SMILIES_ARE_OFF'), |
592 | 592 | 'URL_STATUS' => ($this->config['allow_post_links']) ? $this->language->lang('URL_IS_ON') : $this->language->lang('URL_IS_OFF'), |
593 | - 'FLASH_STATUS' => ($this->config['allow_bbcode'] && $this->config['allow_post_flash']) ? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), |
|
593 | + 'FLASH_STATUS' => ($this->config['allow_bbcode'] && $this->config['allow_post_flash']) ? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), |
|
594 | 594 | |
595 | 595 | 'L_TITLE' => $title, |
596 | 596 | 'L_DIR_DESCRIPTION_EXP' => $this->language->lang('DIR_DESCRIPTION_EXP', $this->config['dir_length_describe']), |
@@ -57,23 +57,23 @@ discard block |
||
57 | 57 | protected $php_ext; |
58 | 58 | |
59 | 59 | /** |
60 | - * Constructor |
|
61 | - * |
|
62 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
63 | - * @param \phpbb\config\config $config Config object |
|
64 | - * @param \phpbb\language\language $language Language object |
|
65 | - * @param \phpbb\template\template $template Template object |
|
66 | - * @param \phpbb\user $user User object |
|
67 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
68 | - * @param \phpbb\request\request $request Request object |
|
69 | - * @param \phpbb\auth\auth $auth Auth object |
|
70 | - * @param \phpbb\notification\manager $notification Notification object |
|
71 | - * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper |
|
72 | - * @param \FastImageSize\FastImageSize $imagesize FastImageSize class |
|
73 | - * @param \phpbb\files\upload $files_upload Upload object |
|
74 | - * @param string $root_path phpBB root path |
|
75 | - * @param string $php_ext phpEx |
|
76 | - */ |
|
60 | + * Constructor |
|
61 | + * |
|
62 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
63 | + * @param \phpbb\config\config $config Config object |
|
64 | + * @param \phpbb\language\language $language Language object |
|
65 | + * @param \phpbb\template\template $template Template object |
|
66 | + * @param \phpbb\user $user User object |
|
67 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
68 | + * @param \phpbb\request\request $request Request object |
|
69 | + * @param \phpbb\auth\auth $auth Auth object |
|
70 | + * @param \phpbb\notification\manager $notification Notification object |
|
71 | + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper |
|
72 | + * @param \FastImageSize\FastImageSize $imagesize FastImageSize class |
|
73 | + * @param \phpbb\files\upload $files_upload Upload object |
|
74 | + * @param string $root_path phpBB root path |
|
75 | + * @param string $php_ext phpEx |
|
76 | + */ |
|
77 | 77 | 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\notification\manager $notification, \phpbb\filesystem\filesystem_interface $filesystem, \FastImageSize\FastImageSize $imagesize, \phpbb\files\upload $files_upload, $root_path, $php_ext) |
78 | 78 | { |
79 | 79 | $this->db = $db; |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | - * Add a link into db |
|
97 | - * |
|
98 | - * @param array $data Contains all data to insert in db |
|
99 | - * @param bool $need_approval Links needs to be approved? |
|
100 | - * @return null |
|
101 | - */ |
|
96 | + * Add a link into db |
|
97 | + * |
|
98 | + * @param array $data Contains all data to insert in db |
|
99 | + * @param bool $need_approval Links needs to be approved? |
|
100 | + * @return null |
|
101 | + */ |
|
102 | 102 | public function add($data, $need_approval) |
103 | 103 | { |
104 | 104 | $notification_data = array(); |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
146 | - * Edit a link of the db |
|
147 | - * |
|
148 | - * @param array $data Contains all data to edit in db |
|
149 | - * @param int $link_id is link's id, for WHERE clause |
|
150 | - * @param bool $need_approval Links needs to be approved? |
|
151 | - * @return null |
|
152 | - */ |
|
146 | + * Edit a link of the db |
|
147 | + * |
|
148 | + * @param array $data Contains all data to edit in db |
|
149 | + * @param int $link_id is link's id, for WHERE clause |
|
150 | + * @param bool $need_approval Links needs to be approved? |
|
151 | + * @return null |
|
152 | + */ |
|
153 | 153 | public function edit($data, $link_id, $need_approval) |
154 | 154 | { |
155 | 155 | $notification_data = array( |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
204 | - * Delete a link of the db |
|
205 | - * |
|
206 | - * @param int $cat_id The category ID |
|
207 | - * @param mixed $link_id Link's id, for WHERE clause |
|
208 | - * @return null |
|
209 | - */ |
|
204 | + * Delete a link of the db |
|
205 | + * |
|
206 | + * @param int $cat_id The category ID |
|
207 | + * @param mixed $link_id Link's id, for WHERE clause |
|
208 | + * @return null |
|
209 | + */ |
|
210 | 210 | public function del($cat_id, $link_id) |
211 | 211 | { |
212 | 212 | $this->db->sql_transaction('begin'); |
@@ -279,12 +279,12 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | - * Increments link view counter |
|
283 | - * |
|
284 | - * @param int $link_id Link's id, for WHERE clause |
|
285 | - * @return null |
|
286 | - * @throws \phpbb\exception\http_exception |
|
287 | - */ |
|
282 | + * Increments link view counter |
|
283 | + * |
|
284 | + * @param int $link_id Link's id, for WHERE clause |
|
285 | + * @return null |
|
286 | + * @throws \phpbb\exception\http_exception |
|
287 | + */ |
|
288 | 288 | public function view($link_id) |
289 | 289 | { |
290 | 290 | $sql = 'SELECT link_id, link_url |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * Verify that an URL exist before add into db |
|
312 | - * |
|
313 | - * @param string $url The URL to check |
|
314 | - * @return bool True if url is reachable, else false. |
|
315 | - */ |
|
311 | + * Verify that an URL exist before add into db |
|
312 | + * |
|
313 | + * @param string $url The URL to check |
|
314 | + * @return bool True if url is reachable, else false. |
|
315 | + */ |
|
316 | 316 | public function checkurl($url) |
317 | 317 | { |
318 | 318 | $details = parse_url($url); |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
354 | - * Delete the final '/', if no path |
|
355 | - * |
|
356 | - * @param string $url URL to clean |
|
357 | - * @return string $url The correct string. |
|
358 | - */ |
|
354 | + * Delete the final '/', if no path |
|
355 | + * |
|
356 | + * @param string $url URL to clean |
|
357 | + * @return string $url The correct string. |
|
358 | + */ |
|
359 | 359 | public function clean_url($url) |
360 | 360 | { |
361 | 361 | $details = parse_url($url); |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Display a flag |
|
372 | - * |
|
373 | - * @param array $data Link's data from db |
|
374 | - * @return string Flag path. |
|
375 | - */ |
|
371 | + * Display a flag |
|
372 | + * |
|
373 | + * @param array $data Link's data from db |
|
374 | + * @return string Flag path. |
|
375 | + */ |
|
376 | 376 | public function display_flag($data) |
377 | 377 | { |
378 | 378 | global $phpbb_extension_manager; |
@@ -390,13 +390,13 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
393 | - * Calculate the link's note |
|
394 | - * |
|
395 | - * @param int $total_note Sum of all link's notes |
|
396 | - * @param int $nb_vote Number of votes |
|
397 | - * @param bool $votes_status Votes are enable in this category? |
|
398 | - * @return string $note The calculated note. |
|
399 | - */ |
|
393 | + * Calculate the link's note |
|
394 | + * |
|
395 | + * @param int $total_note Sum of all link's notes |
|
396 | + * @param int $nb_vote Number of votes |
|
397 | + * @param bool $votes_status Votes are enable in this category? |
|
398 | + * @return string $note The calculated note. |
|
399 | + */ |
|
400 | 400 | public function display_note($total_note, $nb_vote, $votes_status) |
401 | 401 | { |
402 | 402 | if (!$votes_status) |
@@ -411,11 +411,11 @@ discard block |
||
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
414 | - * Display the vote form for auth users |
|
415 | - * |
|
416 | - * @param array $data Link's data from db |
|
417 | - * @return null|string Html combo list or nothing if votes are not available. |
|
418 | - */ |
|
414 | + * Display the vote form for auth users |
|
415 | + * |
|
416 | + * @param array $data Link's data from db |
|
417 | + * @return null|string Html combo list or nothing if votes are not available. |
|
418 | + */ |
|
419 | 419 | public function display_vote($data) |
420 | 420 | { |
421 | 421 | if ($this->user->data['is_registered'] && $this->auth->acl_get('u_vote_dir') && empty($data['vote_user_id'])) |
@@ -432,11 +432,11 @@ discard block |
||
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
435 | - * Display the RSS icon |
|
436 | - * |
|
437 | - * @param array $data Link's data from db |
|
438 | - * @return null|string RSS feed URL or nothing. |
|
439 | - */ |
|
435 | + * Display the RSS icon |
|
436 | + * |
|
437 | + * @param array $data Link's data from db |
|
438 | + * @return null|string RSS feed URL or nothing. |
|
439 | + */ |
|
440 | 440 | public function display_rss($data) |
441 | 441 | { |
442 | 442 | if ($this->config['dir_activ_rss'] && !empty($data['link_rss'])) |
@@ -446,13 +446,13 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
449 | - * Display link's thumb if thumb service enabled. |
|
450 | - * if thumb don't exists in db or if a new service was choosen in acp |
|
451 | - * thumb is research |
|
452 | - * |
|
453 | - * @param array $data Link's data from db |
|
454 | - * @return string|null Thumb or null. |
|
455 | - */ |
|
449 | + * Display link's thumb if thumb service enabled. |
|
450 | + * if thumb don't exists in db or if a new service was choosen in acp |
|
451 | + * thumb is research |
|
452 | + * |
|
453 | + * @param array $data Link's data from db |
|
454 | + * @return string|null Thumb or null. |
|
455 | + */ |
|
456 | 456 | public function display_thumb($data) |
457 | 457 | { |
458 | 458 | if ($this->config['dir_activ_thumb']) |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
476 | - * Display and resize a banner |
|
477 | - * |
|
478 | - * @param array $data link's data from db |
|
479 | - * @return string $s_banner html code. |
|
480 | - */ |
|
476 | + * Display and resize a banner |
|
477 | + * |
|
478 | + * @param array $data link's data from db |
|
479 | + * @return string $s_banner html code. |
|
480 | + */ |
|
481 | 481 | public function display_bann($data) |
482 | 482 | { |
483 | 483 | if (!empty($data['link_banner'])) |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
518 | - * Add a vote in db, for a specifi link |
|
519 | - * |
|
520 | - * @param int $link_id Link_id from db |
|
521 | - * @param int $note Note submeted |
|
522 | - * @return null |
|
523 | - */ |
|
518 | + * Add a vote in db, for a specifi link |
|
519 | + * |
|
520 | + * @param int $link_id Link_id from db |
|
521 | + * @param int $note Note submeted |
|
522 | + * @return null |
|
523 | + */ |
|
524 | 524 | public function add_vote($link_id, $note) |
525 | 525 | { |
526 | 526 | $data = array( |
@@ -564,11 +564,11 @@ discard block |
||
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
567 | - * Search an appropriate thumb for url |
|
568 | - * |
|
569 | - * @param string $url Link's url |
|
570 | - * @return string The thumb url |
|
571 | - */ |
|
567 | + * Search an appropriate thumb for url |
|
568 | + * |
|
569 | + * @param string $url Link's url |
|
570 | + * @return string The thumb url |
|
571 | + */ |
|
572 | 572 | public function thumb_process($url) |
573 | 573 | { |
574 | 574 | if (!$this->config['dir_activ_thumb']) |
@@ -589,12 +589,12 @@ discard block |
||
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
592 | - * Check if ascreen thumb exists |
|
593 | - * |
|
594 | - * @param string $protocol The protocol |
|
595 | - * @param string $host The hostname |
|
596 | - * @return bool True if ascreen file exixts, else false |
|
597 | - */ |
|
592 | + * Check if ascreen thumb exists |
|
593 | + * |
|
594 | + * @param string $protocol The protocol |
|
595 | + * @param string $host The hostname |
|
596 | + * @return bool True if ascreen file exixts, else false |
|
597 | + */ |
|
598 | 598 | private function _ascreen_exist($protocol, $host) |
599 | 599 | { |
600 | 600 | if (($thumb_info = $this->imagesize->getImageSize($protocol.'://'.$host.'/ascreen.jpg')) !== false) |
@@ -609,12 +609,12 @@ discard block |
||
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
612 | - * Primary work on banner, can edit, copy or check a banner |
|
613 | - * |
|
614 | - * @param string $banner The banner's remote url |
|
615 | - * @param array $error The array error, passed by reference |
|
616 | - * @return null |
|
617 | - */ |
|
612 | + * Primary work on banner, can edit, copy or check a banner |
|
613 | + * |
|
614 | + * @param string $banner The banner's remote url |
|
615 | + * @param array $error The array error, passed by reference |
|
616 | + * @return null |
|
617 | + */ |
|
618 | 618 | public function banner_process(&$banner, &$error) |
619 | 619 | { |
620 | 620 | $old_banner = $this->request->variable('old_banner', ''); |
@@ -650,13 +650,13 @@ discard block |
||
650 | 650 | } |
651 | 651 | |
652 | 652 | /** |
653 | - * Copy a remonte banner to server. |
|
654 | - * called by banner_process() |
|
655 | - * |
|
656 | - * @param string $banner The banner's remote url |
|
657 | - * @param array $error The array error, passed by reference |
|
658 | - * @return false|string String if no errors, else false |
|
659 | - */ |
|
653 | + * Copy a remonte banner to server. |
|
654 | + * called by banner_process() |
|
655 | + * |
|
656 | + * @param string $banner The banner's remote url |
|
657 | + * @param array $error The array error, passed by reference |
|
658 | + * @return false|string String if no errors, else false |
|
659 | + */ |
|
660 | 660 | private function _banner_upload($banner, &$error) |
661 | 661 | { |
662 | 662 | /** @var \phpbb\files\upload $upload */ |
@@ -688,13 +688,13 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | /** |
691 | - * Check than remote banner exists |
|
692 | - * called by banner_process() |
|
693 | - * |
|
694 | - * @param string $banner The banner's remote url |
|
695 | - * @param array $error The array error, passed by reference |
|
696 | - * @return false|string String if no errors, else false |
|
697 | - */ |
|
691 | + * Check than remote banner exists |
|
692 | + * called by banner_process() |
|
693 | + * |
|
694 | + * @param string $banner The banner's remote url |
|
695 | + * @param array $error The array error, passed by reference |
|
696 | + * @return false|string String if no errors, else false |
|
697 | + */ |
|
698 | 698 | private function _banner_remote($banner, &$error) |
699 | 699 | { |
700 | 700 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
@@ -802,11 +802,11 @@ discard block |
||
802 | 802 | } |
803 | 803 | |
804 | 804 | /** |
805 | - * Delete a banner from server |
|
806 | - * |
|
807 | - * @param string $file The file's name |
|
808 | - * @return bool True if delete success, else false |
|
809 | - */ |
|
805 | + * Delete a banner from server |
|
806 | + * |
|
807 | + * @param string $file The file's name |
|
808 | + * @return bool True if delete success, else false |
|
809 | + */ |
|
810 | 810 | private function _banner_delete($file) |
811 | 811 | { |
812 | 812 | $old_banner = $this->root_path . $this->get_banner_path($file); |
@@ -821,12 +821,12 @@ discard block |
||
821 | 821 | } |
822 | 822 | |
823 | 823 | /** |
824 | - * List flags |
|
825 | - * |
|
826 | - * @param string $flag_path The flag directory path |
|
827 | - * @param string $value Selected flag |
|
828 | - * @return string $list Html code |
|
829 | - */ |
|
824 | + * List flags |
|
825 | + * |
|
826 | + * @param string $flag_path The flag directory path |
|
827 | + * @param string $value Selected flag |
|
828 | + * @return string $list Html code |
|
829 | + */ |
|
830 | 830 | public function get_dir_flag_list($flag_path, $value) |
831 | 831 | { |
832 | 832 | $list = ''; |
@@ -861,10 +861,10 @@ discard block |
||
861 | 861 | } |
862 | 862 | |
863 | 863 | /** |
864 | - * Display recents links added |
|
865 | - * |
|
866 | - * @return null |
|
867 | - */ |
|
864 | + * Display recents links added |
|
865 | + * |
|
866 | + * @return null |
|
867 | + */ |
|
868 | 868 | public function recents() |
869 | 869 | { |
870 | 870 | if ($this->config['dir_recent_block']) |
@@ -941,13 +941,13 @@ discard block |
||
941 | 941 | } |
942 | 942 | |
943 | 943 | /** |
944 | - * Validate back link |
|
945 | - * |
|
946 | - * @param string $remote_url Page URL contains the backlink |
|
947 | - * @param bool $optional Link back is optional in this category? |
|
948 | - * @param bool $cron This methos is called by con process? |
|
949 | - * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) |
|
950 | - */ |
|
944 | + * Validate back link |
|
945 | + * |
|
946 | + * @param string $remote_url Page URL contains the backlink |
|
947 | + * @param bool $optional Link back is optional in this category? |
|
948 | + * @param bool $cron This methos is called by con process? |
|
949 | + * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) |
|
950 | + */ |
|
951 | 951 | public function validate_link_back($remote_url, $optional, $cron = false) |
952 | 952 | { |
953 | 953 | if (!$cron) |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | */ |
75 | 75 | 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\notification\manager $notification, \phpbb\filesystem\filesystem_interface $filesystem, \FastImageSize\FastImageSize $imagesize, \phpbb\files\upload $files_upload, $root_path, $php_ext) |
76 | 76 | { |
77 | - $this->db = $db; |
|
78 | - $this->config = $config; |
|
77 | + $this->db = $db; |
|
78 | + $this->config = $config; |
|
79 | 79 | $this->language = $language; |
80 | 80 | $this->template = $template; |
81 | 81 | $this->user = $user; |
82 | - $this->helper = $helper; |
|
83 | - $this->request = $request; |
|
82 | + $this->helper = $helper; |
|
83 | + $this->request = $request; |
|
84 | 84 | $this->auth = $auth; |
85 | 85 | $this->notification = $notification; |
86 | - $this->filesystem = $filesystem; |
|
86 | + $this->filesystem = $filesystem; |
|
87 | 87 | $this->imagesize = $imagesize; |
88 | 88 | $this->files_upload = $files_upload; |
89 | 89 | $this->root_path = $root_path; |
90 | - $this->php_ext = $php_ext; |
|
90 | + $this->php_ext = $php_ext; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | |
104 | 104 | $this->db->sql_transaction('begin'); |
105 | 105 | |
106 | - $sql = 'INSERT INTO ' . $this->links_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
106 | + $sql = 'INSERT INTO '.$this->links_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
107 | 107 | $this->db->sql_query($sql); |
108 | 108 | $notification_data['link_id'] = $this->db->sql_nextid(); |
109 | 109 | |
110 | 110 | if (!$need_approval || $this->auth->acl_get('a_') || $this->auth->acl_get('m_')) |
111 | 111 | { |
112 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
112 | + $sql = 'UPDATE '.$this->categories_table.' |
|
113 | 113 | SET cat_links = cat_links + 1 |
114 | 114 | WHERE cat_id = ' . (int) $data['link_cat']; |
115 | 115 | $this->db->sql_query($sql); |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | |
168 | 168 | $this->db->sql_transaction('begin'); |
169 | 169 | |
170 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
170 | + $sql = 'UPDATE '.$this->categories_table.' |
|
171 | 171 | SET cat_links = cat_links - 1 |
172 | 172 | WHERE cat_id = ' . (int) $old_cat; |
173 | 173 | $this->db->sql_query($sql); |
174 | 174 | |
175 | 175 | if (!$need_approval) |
176 | 176 | { |
177 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
177 | + $sql = 'UPDATE '.$this->categories_table.' |
|
178 | 178 | SET cat_links = cat_links + 1 |
179 | 179 | WHERE cat_id = ' . (int) $data['link_cat']; |
180 | 180 | $this->db->sql_query($sql); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | $this->notification->add_notifications($notification_type, $notification_data); |
193 | 193 | } |
194 | 194 | |
195 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
196 | - SET ' . $this->db->sql_build_array('UPDATE', $data) . ' |
|
195 | + $sql = 'UPDATE '.$this->links_table.' |
|
196 | + SET ' . $this->db->sql_build_array('UPDATE', $data).' |
|
197 | 197 | WHERE link_id = ' . (int) $link_id; |
198 | 198 | $this->db->sql_query($sql); |
199 | 199 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | ); |
220 | 220 | |
221 | 221 | $sql = 'SELECT link_banner |
222 | - FROM ' . $this->links_table . ' |
|
222 | + FROM ' . $this->links_table.' |
|
223 | 223 | WHERE '. $this->db->sql_in_set('link_id', $url_array); |
224 | 224 | $result = $this->db->sql_query($sql); |
225 | 225 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | if ($row['link_banner'] && !preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $row['link_banner'])) |
229 | 229 | { |
230 | - $banner_img = $this->root_path . $this->get_banner_path(basename($row['link_banner'])); |
|
230 | + $banner_img = $this->root_path.$this->get_banner_path(basename($row['link_banner'])); |
|
231 | 231 | |
232 | 232 | if (file_exists($banner_img)) |
233 | 233 | { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $this->db->sql_query("DELETE FROM $table WHERE ".$this->db->sql_in_set($field, $url_array)); |
242 | 242 | } |
243 | 243 | |
244 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
244 | + $sql = 'UPDATE '.$this->categories_table.' |
|
245 | 245 | SET cat_links = cat_links - '.sizeof($url_array).' |
246 | 246 | WHERE cat_id = ' . (int) $cat_id; |
247 | 247 | $this->db->sql_query($sql); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | if ($this->request->is_ajax()) |
260 | 260 | { |
261 | 261 | $sql = 'SELECT cat_links |
262 | - FROM ' . $this->categories_table . ' |
|
262 | + FROM ' . $this->categories_table.' |
|
263 | 263 | WHERE cat_id = ' . (int) $cat_id; |
264 | 264 | $result = $this->db->sql_query($sql); |
265 | 265 | $data = $this->db->sql_fetchrow($result); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public function view($link_id) |
287 | 287 | { |
288 | 288 | $sql = 'SELECT link_id, link_url |
289 | - FROM ' . $this->links_table . ' |
|
289 | + FROM ' . $this->links_table.' |
|
290 | 290 | WHERE link_id = ' . (int) $link_id; |
291 | 291 | $result = $this->db->sql_query($sql); |
292 | 292 | $data = $this->db->sql_fetchrow($result); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_LINKS'); |
297 | 297 | } |
298 | 298 | |
299 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
299 | + $sql = 'UPDATE '.$this->links_table.' |
|
300 | 300 | SET link_view = link_view + 1 |
301 | 301 | WHERE link_id = ' . (int) $link_id; |
302 | 302 | $this->db->sql_query($sql); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | if ($details['scheme'] == 'https') |
322 | 322 | { |
323 | 323 | $default_port = 443; |
324 | - $hostname = 'ssl://' . $details['host']; |
|
324 | + $hostname = 'ssl://'.$details['host']; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | if (!isset($details['path'])) |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $flag_path = $ext_path.'images/flags/'; |
380 | 380 | $img_flag = 'no_flag.png'; |
381 | 381 | |
382 | - if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path . $data['link_flag'])) |
|
382 | + if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path.$data['link_flag'])) |
|
383 | 383 | { |
384 | 384 | $img_flag = $data['link_flag']; |
385 | 385 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $list = '<select name="vote">'; |
422 | 422 | for ($i = 0; $i <= 10; $i++) |
423 | 423 | { |
424 | - $list .= '<option value="' . $i . '"' . (($i == 5) ? ' selected="selected"' : '') . '>' . $i . '</option>'; |
|
424 | + $list .= '<option value="'.$i.'"'.(($i == 5) ? ' selected="selected"' : '').'>'.$i.'</option>'; |
|
425 | 425 | } |
426 | 426 | $list .= '</select>'; |
427 | 427 | |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | { |
460 | 460 | $thumb = $this->thumb_process($data['link_url']); |
461 | 461 | |
462 | - $sql = 'UPDATE ' . $this->links_table . " |
|
463 | - SET link_thumb = '" . $this->db->sql_escape($thumb) . "' |
|
462 | + $sql = 'UPDATE '.$this->links_table." |
|
463 | + SET link_thumb = '" . $this->db->sql_escape($thumb)."' |
|
464 | 464 | WHERE link_id = " . (int) $data['link_id']; |
465 | 465 | $this->db->sql_query($sql); |
466 | 466 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | $height /= $coef_max; |
508 | 508 | } |
509 | 509 | |
510 | - return '<img src="' . $img_src . '" width="' . $width . '" height="' . $height . '" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
510 | + return '<img src="'.$img_src.'" width="'.$width.'" height="'.$height.'" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
511 | 511 | } |
512 | 512 | return ''; |
513 | 513 | } |
@@ -529,12 +529,12 @@ discard block |
||
529 | 529 | |
530 | 530 | $this->db->sql_transaction('begin'); |
531 | 531 | |
532 | - $sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
532 | + $sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
533 | 533 | $this->db->sql_query($sql); |
534 | 534 | |
535 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
535 | + $sql = 'UPDATE '.$this->links_table.' |
|
536 | 536 | SET link_vote = link_vote + 1, |
537 | - link_note = link_note + ' . (int) $data['vote_note'] . ' |
|
537 | + link_note = link_note + ' . (int) $data['vote_note'].' |
|
538 | 538 | WHERE link_id = ' . (int) $link_id; |
539 | 539 | $this->db->sql_query($sql); |
540 | 540 | |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | |
543 | 543 | if ($this->request->is_ajax()) |
544 | 544 | { |
545 | - $sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id; |
|
545 | + $sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id; |
|
546 | 546 | $result = $this->db->sql_query($sql); |
547 | 547 | $data = $this->db->sql_fetchrow($result); |
548 | 548 | |
@@ -576,8 +576,8 @@ discard block |
||
576 | 576 | |
577 | 577 | $details = parse_url($url); |
578 | 578 | |
579 | - $root_url = $details['scheme'].'://'.$details['host']; |
|
580 | - $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
579 | + $root_url = $details['scheme'].'://'.$details['host']; |
|
580 | + $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
581 | 581 | |
582 | 582 | if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host'])) |
583 | 583 | { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | { |
618 | 618 | $old_banner = $this->request->variable('old_banner', ''); |
619 | 619 | |
620 | - $destination = $this->root_path . $this->get_banner_path(); |
|
620 | + $destination = $this->root_path.$this->get_banner_path(); |
|
621 | 621 | |
622 | 622 | // Can we upload? |
623 | 623 | $can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($destination) && $this->filesystem->is_writable($destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | |
667 | 667 | $file = $upload->handle_upload('files.types.remote', $banner); |
668 | 668 | |
669 | - $prefix = unique_id() . '_'; |
|
669 | + $prefix = unique_id().'_'; |
|
670 | 670 | $file->clean_filename('real', $prefix); |
671 | 671 | |
672 | 672 | if (sizeof($file->error)) |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | { |
698 | 698 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
699 | 699 | { |
700 | - $banner = 'http://' . $banner; |
|
700 | + $banner = 'http://'.$banner; |
|
701 | 701 | } |
702 | 702 | if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $banner)) |
703 | 703 | { |
@@ -728,8 +728,8 @@ discard block |
||
728 | 728 | } |
729 | 729 | |
730 | 730 | // Check image type |
731 | - $types = \phpbb\files\upload::image_types(); |
|
732 | - $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
731 | + $types = \phpbb\files\upload::image_types(); |
|
732 | + $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
733 | 733 | |
734 | 734 | // Check if this is actually an image |
735 | 735 | if ($file_stream = @fopen($banner, 'r')) |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | */ |
808 | 808 | private function _banner_delete($file) |
809 | 809 | { |
810 | - $old_banner = $this->root_path . $this->get_banner_path($file); |
|
810 | + $old_banner = $this->root_path.$this->get_banner_path($file); |
|
811 | 811 | |
812 | 812 | if (file_exists($old_banner)) |
813 | 813 | { |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | |
852 | 852 | if (file_exists($flag_path.$img_file)) |
853 | 853 | { |
854 | - $list .= '<option value="' . $img_file . '" ' . (($img_file == $value) ? 'selected="selected"' : '') . '>' . $name . '</option>'; |
|
854 | + $list .= '<option value="'.$img_file.'" '.(($img_file == $value) ? 'selected="selected"' : '').'>'.$name.'</option>'; |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
@@ -867,8 +867,8 @@ discard block |
||
867 | 867 | { |
868 | 868 | if ($this->config['dir_recent_block']) |
869 | 869 | { |
870 | - $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
871 | - $exclude_array = array_filter(explode(',', str_replace(' ', '', $this->config['dir_recent_exclude']))); |
|
870 | + $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
871 | + $exclude_array = array_filter(explode(',', str_replace(' ', '', $this->config['dir_recent_exclude']))); |
|
872 | 872 | |
873 | 873 | $sql_array = array( |
874 | 874 | 'SELECT' => 'l.link_id, l.link_cat, l.link_url, l.link_user_id, l.link_comment, l. link_description, l.link_vote, l.link_note, l.link_view, l.link_time, l.link_name, l.link_thumb, u.user_id, u.username, u.user_colour, c.cat_name', |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | 'ON' => 'l.link_cat = c.cat_id' |
885 | 885 | ) |
886 | 886 | ), |
887 | - 'WHERE' => 'l.link_active = 1' . (sizeof($exclude_array) ? ' AND ' . $this->db->sql_in_set('l.link_cat', $exclude_array, true) : ''), |
|
887 | + 'WHERE' => 'l.link_active = 1'.(sizeof($exclude_array) ? ' AND '.$this->db->sql_in_set('l.link_cat', $exclude_array, true) : ''), |
|
888 | 888 | 'ORDER_BY' => 'l.link_time DESC, l.link_id DESC'); |
889 | 889 | |
890 | 890 | $sql = $this->db->sql_build_query('SELECT', $sql_array); |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | if (sizeof($rowset)) |
902 | 902 | { |
903 | 903 | $this->template->assign_block_vars('block', array( |
904 | - 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']) . '%', |
|
904 | + 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']).'%', |
|
905 | 905 | )); |
906 | 906 | |
907 | 907 | foreach ($rowset as $row) |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | 'COUNT' => $row['link_view'], |
920 | 920 | 'COMMENT' => $row['link_comment'], |
921 | 921 | |
922 | - 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['link_cat']), |
|
922 | + 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['link_cat']), |
|
923 | 923 | 'U_COMMENT' => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])), |
924 | 924 | 'U_LINK' => $row['link_url'], |
925 | 925 | 'U_THUMB' => $this->display_thumb($row), |
@@ -46,18 +46,18 @@ discard block |
||
46 | 46 | public $data = array(); |
47 | 47 | |
48 | 48 | /** |
49 | - * Constructor |
|
50 | - * |
|
51 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
52 | - * @param \phpbb\config\config $config Config object |
|
53 | - * @param \phpbb\language\language $language Language object |
|
54 | - * @param \phpbb\template\template $template Template object |
|
55 | - * @param \phpbb\user $user User object |
|
56 | - * @param \phpbb\controller\helper $helper Controller helper object |
|
57 | - * @param \phpbb\request\request $request Request object |
|
58 | - * @param \phpbb\auth\auth $auth Auth object |
|
59 | - * @param \phpbb\cron\manager $cron Cron object |
|
60 | - */ |
|
49 | + * Constructor |
|
50 | + * |
|
51 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
52 | + * @param \phpbb\config\config $config Config object |
|
53 | + * @param \phpbb\language\language $language Language object |
|
54 | + * @param \phpbb\template\template $template Template object |
|
55 | + * @param \phpbb\user $user User object |
|
56 | + * @param \phpbb\controller\helper $helper Controller helper object |
|
57 | + * @param \phpbb\request\request $request Request object |
|
58 | + * @param \phpbb\auth\auth $auth Auth object |
|
59 | + * @param \phpbb\cron\manager $cron Cron object |
|
60 | + */ |
|
61 | 61 | 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\cron\manager $cron) |
62 | 62 | { |
63 | 63 | $this->db = $db; |
@@ -72,21 +72,21 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | - * Function for get approval setting |
|
76 | - * used in edit mode for test the setting of new category's link |
|
77 | - * |
|
78 | - * @return bool |
|
79 | - */ |
|
75 | + * Function for get approval setting |
|
76 | + * used in edit mode for test the setting of new category's link |
|
77 | + * |
|
78 | + * @return bool |
|
79 | + */ |
|
80 | 80 | public function need_approval() |
81 | 81 | { |
82 | 82 | return (bool) $this->data['cat_validate']; |
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * Generate Jumpbox |
|
87 | - * |
|
88 | - * @return null |
|
89 | - */ |
|
86 | + * Generate Jumpbox |
|
87 | + * |
|
88 | + * @return null |
|
89 | + */ |
|
90 | 90 | public function make_cat_jumpbox() |
91 | 91 | { |
92 | 92 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * Generate a list of directory's categories |
|
143 | - * |
|
144 | - * @param int $select_id Selected category |
|
145 | - * @param array $ignore_id Array of ignored categories |
|
146 | - * @return string $cat_list html code |
|
147 | - */ |
|
142 | + * Generate a list of directory's categories |
|
143 | + * |
|
144 | + * @param int $select_id Selected category |
|
145 | + * @param array $ignore_id Array of ignored categories |
|
146 | + * @return string $cat_list html code |
|
147 | + */ |
|
148 | 148 | public function make_cat_select($select_id = 0, $ignore_id = array()) |
149 | 149 | { |
150 | 150 | $ignore_id = is_array($ignore_id) ? $ignore_id : array($ignore_id); |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
193 | - * Display cat or subcat |
|
194 | - * |
|
195 | - * @return null |
|
196 | - */ |
|
193 | + * Display cat or subcat |
|
194 | + * |
|
195 | + * @return null |
|
196 | + */ |
|
197 | 197 | public function display() |
198 | 198 | { |
199 | 199 | $cat_rows = $subcats = array(); |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
325 | - * Get informations about a cat or subcat |
|
326 | - * |
|
327 | - * @param int $cat_id The category ID |
|
328 | - * @return null|false |
|
329 | - */ |
|
325 | + * Get informations about a cat or subcat |
|
326 | + * |
|
327 | + * @param int $cat_id The category ID |
|
328 | + * @return null|false |
|
329 | + */ |
|
330 | 330 | public function get($cat_id = 0) |
331 | 331 | { |
332 | 332 | if ($cat_id) |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
357 | - * Create category navigation links for given category, create parent |
|
358 | - * list if currently null, assign basic category info to template |
|
359 | - * |
|
360 | - * @param array $dir_cat_data |
|
361 | - */ |
|
357 | + * Create category navigation links for given category, create parent |
|
358 | + * list if currently null, assign basic category info to template |
|
359 | + * |
|
360 | + * @param array $dir_cat_data |
|
361 | + */ |
|
362 | 362 | public function generate_dir_nav(&$dir_cat_data) |
363 | 363 | { |
364 | 364 | global $phpbb_container; |
@@ -395,12 +395,12 @@ discard block |
||
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
398 | - * Return good key language |
|
399 | - * |
|
400 | - * @param bool $validate True if approbation needed before publication |
|
401 | - * @return string Information about approval, depends on user auth level |
|
402 | - * @throws \phpbb\exception\runtime_exception |
|
403 | - */ |
|
398 | + * Return good key language |
|
399 | + * |
|
400 | + * @param bool $validate True if approbation needed before publication |
|
401 | + * @return string Information about approval, depends on user auth level |
|
402 | + * @throws \phpbb\exception\runtime_exception |
|
403 | + */ |
|
404 | 404 | public function dir_submit_type($validate) |
405 | 405 | { |
406 | 406 | if ($validate) |
@@ -421,15 +421,15 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | - * Category watching common code |
|
425 | - * |
|
426 | - * @param string $mode Watch or unwatch a category |
|
427 | - * @param array $s_watching An empty array, passed by reference |
|
428 | - * @param int $user_id The user ID |
|
429 | - * @param int $cat_id The category ID |
|
430 | - * @param string $notify_status User is watching the category? |
|
431 | - * @return null|string |
|
432 | - */ |
|
424 | + * Category watching common code |
|
425 | + * |
|
426 | + * @param string $mode Watch or unwatch a category |
|
427 | + * @param array $s_watching An empty array, passed by reference |
|
428 | + * @param int $user_id The user ID |
|
429 | + * @param int $cat_id The category ID |
|
430 | + * @param string $notify_status User is watching the category? |
|
431 | + * @return null|string |
|
432 | + */ |
|
433 | 433 | public function watch_categorie($mode, &$s_watching, $user_id, $cat_id, $notify_status) |
434 | 434 | { |
435 | 435 | // Is user watching this thread? |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
518 | - * Return Category name |
|
519 | - * |
|
520 | - * @param int $cat_id The category ID |
|
521 | - * @return string The category name |
|
522 | - */ |
|
518 | + * Return Category name |
|
519 | + * |
|
520 | + * @param int $cat_id The category ID |
|
521 | + * @return string The category name |
|
522 | + */ |
|
523 | 523 | static public function getname($cat_id) |
524 | 524 | { |
525 | 525 | global $db, $phpbb_container; |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | */ |
59 | 59 | 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\cron\manager $cron) |
60 | 60 | { |
61 | - $this->db = $db; |
|
62 | - $this->config = $config; |
|
61 | + $this->db = $db; |
|
62 | + $this->config = $config; |
|
63 | 63 | $this->language = $language; |
64 | 64 | $this->template = $template; |
65 | 65 | $this->user = $user; |
66 | - $this->helper = $helper; |
|
67 | - $this->request = $request; |
|
66 | + $this->helper = $helper; |
|
67 | + $this->request = $request; |
|
68 | 68 | $this->auth = $auth; |
69 | 69 | $this->cron = $cron; |
70 | 70 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function make_cat_jumpbox() |
89 | 89 | { |
90 | 90 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id |
91 | - FROM ' . $this->categories_table . ' |
|
91 | + FROM ' . $this->categories_table.' |
|
92 | 92 | ORDER BY left_id ASC'; |
93 | 93 | $result = $this->db->sql_query($sql); |
94 | 94 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'FORUM_ID' => $row['cat_id'], |
118 | 118 | 'FORUM_NAME' => $row['cat_name'], |
119 | 119 | 'S_FORUM_COUNT' => $iteration, |
120 | - 'LINK' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id']), |
|
120 | + 'LINK' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id']), |
|
121 | 121 | )); |
122 | 122 | |
123 | 123 | for ($i = 0; $i < $padding; $i++) |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // This query is identical to the jumpbox one |
151 | 151 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id |
152 | - FROM ' . $this->categories_table . ' |
|
152 | + FROM ' . $this->categories_table.' |
|
153 | 153 | ORDER BY left_id ASC'; |
154 | 154 | $result = $this->db->sql_query($sql); |
155 | 155 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | $selected = (($row['cat_id'] == $select_id) ? ' selected="selected"' : ''); |
182 | - $cat_list .= '<option value="' . $row['cat_id'] . '"' . (($disabled) ? ' disabled="disabled" class="disabled-option"' : $selected) . '>' . $padding . $row['cat_name'] . '</option>'; |
|
182 | + $cat_list .= '<option value="'.$row['cat_id'].'"'.(($disabled) ? ' disabled="disabled" class="disabled-option"' : $selected).'>'.$padding.$row['cat_name'].'</option>'; |
|
183 | 183 | } |
184 | 184 | $this->db->sql_freeresult($result); |
185 | 185 | unset($padding_store); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function display() |
196 | 196 | { |
197 | - $cat_rows = $subcats = array(); |
|
197 | + $cat_rows = $subcats = array(); |
|
198 | 198 | $parent_id = $visible_cats = 0; |
199 | 199 | |
200 | 200 | $sql_array = array( |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | else |
213 | 213 | { |
214 | 214 | $root_data = $this->data; |
215 | - $sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id']; |
|
215 | + $sql_where = 'left_id > '.$root_data['left_id'].' AND left_id < '.$root_data['right_id']; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $sql = $this->db->sql_build_query('SELECT', array( |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | { |
260 | 260 | foreach ($subcats[$dir_cat_id] as $subcat_id => $subcat_row) |
261 | 261 | { |
262 | - $row['cat_links'] = ($row['cat_count_all']) ? ($row['cat_links']+$subcat_row['links']) : $row['cat_links']; |
|
262 | + $row['cat_links'] = ($row['cat_count_all']) ? ($row['cat_links'] + $subcat_row['links']) : $row['cat_links']; |
|
263 | 263 | |
264 | 264 | if ($subcat_row['display'] && $subcat_row['parent_id'] == $dir_cat_id) |
265 | 265 | { |
266 | 266 | $subcats_list[] = array( |
267 | - 'link' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $subcat_id), |
|
267 | + 'link' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$subcat_id), |
|
268 | 268 | 'name' => $subcat_row['name'], |
269 | 269 | 'links' => $subcat_row['links'] |
270 | 270 | ); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | 'CAT_LINKS' => $row['cat_links'], |
283 | 283 | 'CAT_IMG' => $this->get_img_path('icons', $row['cat_icon']), |
284 | 284 | |
285 | - 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id']), |
|
285 | + 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id']), |
|
286 | 286 | )); |
287 | 287 | |
288 | 288 | // Assign subcats loop for style authors |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($task->is_ready()) |
315 | 315 | { |
316 | 316 | $url = $task->get_url(); |
317 | - $this->template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="" />'); |
|
317 | + $this->template->assign_var('RUN_CRON_TASK', '<img src="'.$url.'" width="1" height="1" alt="" />'); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | 'LEFT_JOIN' => array( |
337 | 337 | array( |
338 | 338 | 'FROM' => array($this->watch_table => 'w'), |
339 | - 'ON' => 'c.cat_id = w.cat_id AND w.user_id = ' . (int) $this->user->data['user_id'] |
|
339 | + 'ON' => 'c.cat_id = w.cat_id AND w.user_id = '.(int) $this->user->data['user_id'] |
|
340 | 340 | ), |
341 | 341 | ), |
342 | - 'WHERE' => 'c.cat_id = ' . (int) $cat_id |
|
342 | + 'WHERE' => 'c.cat_id = '.(int) $cat_id |
|
343 | 343 | ); |
344 | 344 | $sql = $this->db->sql_build_query('SELECT', $sql_array); |
345 | 345 | $result = $this->db->sql_query($sql); |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | $this->template->assign_block_vars('dir_navlinks', array( |
377 | 377 | 'FORUM_NAME' => $parent_data['cat_name'], |
378 | 378 | 'FORUM_ID' => $parent_cat_id, |
379 | - 'MICRODATA' => $microdata_attr . '="' . $parent_cat_id . '"', |
|
380 | - 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $parent_cat_id), |
|
379 | + 'MICRODATA' => $microdata_attr.'="'.$parent_cat_id.'"', |
|
380 | + 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$parent_cat_id), |
|
381 | 381 | )); |
382 | 382 | } |
383 | 383 | } |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | $this->template->assign_block_vars('dir_navlinks', array( |
386 | 386 | 'FORUM_NAME' => $dir_cat_data['cat_name'], |
387 | 387 | 'FORUM_ID' => $dir_cat_data['cat_id'], |
388 | - 'MICRODATA' => $microdata_attr . '="' . $dir_cat_data['cat_id'] . '"', |
|
389 | - 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $dir_cat_data['cat_id']), |
|
388 | + 'MICRODATA' => $microdata_attr.'="'.$dir_cat_data['cat_id'].'"', |
|
389 | + 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$dir_cat_data['cat_id']), |
|
390 | 390 | )); |
391 | 391 | |
392 | 392 | return; |
@@ -439,17 +439,17 @@ discard block |
||
439 | 439 | { |
440 | 440 | if ($mode == 'unwatch') |
441 | 441 | { |
442 | - $sql = 'DELETE FROM ' . $this->watch_table . ' |
|
443 | - WHERE cat_id = ' . (int) $cat_id . ' |
|
442 | + $sql = 'DELETE FROM '.$this->watch_table.' |
|
443 | + WHERE cat_id = ' . (int) $cat_id.' |
|
444 | 444 | AND user_id = ' . (int) $user_id; |
445 | 445 | $this->db->sql_query($sql); |
446 | 446 | |
447 | - $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
447 | + $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
448 | 448 | $message = $this->language->lang('DIR_NOT_WATCHING_CAT'); |
449 | 449 | |
450 | 450 | if (!$this->request->is_ajax()) |
451 | 451 | { |
452 | - $message .= '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $redirect_url . '">', '</a>'); |
|
452 | + $message .= '<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$redirect_url.'">', '</a>'); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | meta_refresh(3, $redirect_url); |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | |
462 | 462 | if ($notify_status != NOTIFY_YES) |
463 | 463 | { |
464 | - $sql = 'UPDATE ' . $this->watch_table . ' |
|
465 | - SET notify_status = ' . NOTIFY_YES . ' |
|
466 | - WHERE cat_id = '. (int) $cat_id . ' |
|
464 | + $sql = 'UPDATE '.$this->watch_table.' |
|
465 | + SET notify_status = ' . NOTIFY_YES.' |
|
466 | + WHERE cat_id = '. (int) $cat_id.' |
|
467 | 467 | AND user_id = ' . (int) $user_id; |
468 | 468 | $this->db->sql_query($sql); |
469 | 469 | } |
@@ -479,15 +479,15 @@ discard block |
||
479 | 479 | 'notify_status' => NOTIFY_YES |
480 | 480 | ); |
481 | 481 | |
482 | - $sql = 'INSERT INTO ' . $this->watch_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
482 | + $sql = 'INSERT INTO '.$this->watch_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
483 | 483 | $this->db->sql_query($sql); |
484 | 484 | |
485 | - $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
485 | + $redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
486 | 486 | $message = $this->language->lang('DIR_ARE_WATCHING_CAT'); |
487 | 487 | |
488 | 488 | if (!$this->request->is_ajax()) |
489 | 489 | { |
490 | - $message .= '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $redirect_url . '">', '</a>'); |
|
490 | + $message .= '<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$redirect_url.'">', '</a>'); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | meta_refresh(3, $redirect_url); |
@@ -507,10 +507,10 @@ discard block |
||
507 | 507 | |
508 | 508 | if ($can_watch) |
509 | 509 | { |
510 | - $s_watching['link'] = $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => (($is_watching) ? 'unwatch' : 'watch'))); |
|
510 | + $s_watching['link'] = $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => (($is_watching) ? 'unwatch' : 'watch'))); |
|
511 | 511 | $s_watching['link_toggle'] = $this->helper->route('ernadoo_phpbbdirectory_suscribe_controller', array('cat_id' => $cat_id, 'mode' => ((!$is_watching) ? 'unwatch' : 'watch'))); |
512 | - $s_watching['title'] = $this->language->lang((($is_watching) ? 'DIR_STOP' : 'DIR_START') . '_WATCHING_CAT'); |
|
513 | - $s_watching['title_toggle'] = $this->language->lang(((!$is_watching) ? 'DIR_STOP' : 'DIR_START') . '_WATCHING_CAT'); |
|
512 | + $s_watching['title'] = $this->language->lang((($is_watching) ? 'DIR_STOP' : 'DIR_START').'_WATCHING_CAT'); |
|
513 | + $s_watching['title_toggle'] = $this->language->lang(((!$is_watching) ? 'DIR_STOP' : 'DIR_START').'_WATCHING_CAT'); |
|
514 | 514 | $s_watching['is_watching'] = $is_watching; |
515 | 515 | } |
516 | 516 | |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $categories_table = $phpbb_container->getParameter('tables.dir.categories'); |
531 | 531 | |
532 | 532 | $sql = 'SELECT cat_name |
533 | - FROM ' . $categories_table . ' |
|
533 | + FROM ' . $categories_table.' |
|
534 | 534 | WHERE cat_id = ' . (int) $cat_id; |
535 | 535 | $result = $db->sql_query($sql); |
536 | 536 | $row = $db->sql_fetchrow($result); |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | protected $php_ext; |
38 | 38 | |
39 | 39 | /** |
40 | - * Constructor |
|
41 | - * |
|
42 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
43 | - * @param \phpbb\config\config $config Config object |
|
44 | - * @param \phpbb\log\log $phpbb_log Log object |
|
45 | - * @param \phpbb\user $user User object |
|
46 | - * @param \phpbb\notification\manager $notification Notification object |
|
47 | - * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
48 | - * @param string $root_path phpBB root path |
|
49 | - * @param string $php_ext phpEx |
|
50 | - */ |
|
40 | + * Constructor |
|
41 | + * |
|
42 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
43 | + * @param \phpbb\config\config $config Config object |
|
44 | + * @param \phpbb\log\log $phpbb_log Log object |
|
45 | + * @param \phpbb\user $user User object |
|
46 | + * @param \phpbb\notification\manager $notification Notification object |
|
47 | + * @param \ernadoo\phpbbdirectory\core\link $link PhpBB Directory extension link object |
|
48 | + * @param string $root_path phpBB root path |
|
49 | + * @param string $php_ext phpEx |
|
50 | + */ |
|
51 | 51 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\log\log $phpbb_log, \phpbb\user $user, \phpbb\notification\manager $notification, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) |
52 | 52 | { |
53 | 53 | $this->db = $db; |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * Method called by cron task. |
|
65 | - * |
|
66 | - * @param array $cat_data Information about category, from db |
|
67 | - * @return null |
|
68 | - */ |
|
64 | + * Method called by cron task. |
|
65 | + * |
|
66 | + * @param array $cat_data Information about category, from db |
|
67 | + * @return null |
|
68 | + */ |
|
69 | 69 | public function auto_check($cat_data) |
70 | 70 | { |
71 | 71 | $sql = 'SELECT cat_name |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * Check, for website with backlink specified, if backlink is always here. |
|
118 | - * After $nb_check verification, website is deleted, otherwise, a notification is send to poster |
|
119 | - * |
|
120 | - * @param int $cat_id The category ID |
|
121 | - * @param int $nb_check Number of check before delete a website |
|
122 | - * @param int $next_prune Date of next auto check |
|
123 | - * @return null |
|
124 | - */ |
|
117 | + * Check, for website with backlink specified, if backlink is always here. |
|
118 | + * After $nb_check verification, website is deleted, otherwise, a notification is send to poster |
|
119 | + * |
|
120 | + * @param int $cat_id The category ID |
|
121 | + * @param int $nb_check Number of check before delete a website |
|
122 | + * @param int $next_prune Date of next auto check |
|
123 | + * @return null |
|
124 | + */ |
|
125 | 125 | private function _check($cat_id, $nb_check, $next_prune) |
126 | 126 | { |
127 | 127 | $del_array = $update_array = array(); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | - * Update website verification number after a missing backlink, and send notificaton |
|
173 | - * |
|
174 | - * @param array $u_array Information about website |
|
175 | - * @param int $next_prune Date of next auto check |
|
176 | - * @return null |
|
177 | - */ |
|
172 | + * Update website verification number after a missing backlink, and send notificaton |
|
173 | + * |
|
174 | + * @param array $u_array Information about website |
|
175 | + * @param int $next_prune Date of next auto check |
|
176 | + * @return null |
|
177 | + */ |
|
178 | 178 | private function _update_check($u_array, $next_prune) |
179 | 179 | { |
180 | 180 | if (!class_exists('messenger')) |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\log\log $phpbb_log, \phpbb\user $user, \phpbb\notification\manager $notification, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext) |
52 | 52 | { |
53 | - $this->db = $db; |
|
54 | - $this->config = $config; |
|
55 | - $this->phpbb_log = $phpbb_log; |
|
53 | + $this->db = $db; |
|
54 | + $this->config = $config; |
|
55 | + $this->phpbb_log = $phpbb_log; |
|
56 | 56 | $this->user = $user; |
57 | - $this->notification = $notification; |
|
57 | + $this->notification = $notification; |
|
58 | 58 | $this->link = $link; |
59 | - $this->root_path = $root_path; |
|
60 | - $this->php_ext = $php_ext; |
|
59 | + $this->root_path = $root_path; |
|
60 | + $this->php_ext = $php_ext; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function auto_check($cat_data) |
70 | 70 | { |
71 | 71 | $sql = 'SELECT cat_name |
72 | - FROM ' . $this->categories_table . ' |
|
72 | + FROM ' . $this->categories_table.' |
|
73 | 73 | WHERE cat_id = ' . (int) $cat_data['cat_id']; |
74 | 74 | $result = $this->db->sql_query($sql); |
75 | 75 | $row = $this->db->sql_fetchrow($result); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | $this->_check($cat_data['cat_id'], $cat_data['cat_cron_nb_check'], $next_prune); |
83 | 83 | |
84 | - $sql = 'UPDATE ' . $this->categories_table . " |
|
84 | + $sql = 'UPDATE '.$this->categories_table." |
|
85 | 85 | SET cat_cron_next = $next_prune |
86 | - WHERE cat_id = " . (int) $cat_data['cat_id']; |
|
86 | + WHERE cat_id = ".(int) $cat_data['cat_id']; |
|
87 | 87 | $this->db->sql_query($sql); |
88 | 88 | |
89 | 89 | $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_AUTO_PRUNE', time(), array($row['cat_name'])); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function get_cat($cat_id) |
102 | 102 | { |
103 | 103 | $sql = 'SELECT cat_id, cat_cron_enable, cat_cron_next, cat_cron_freq, cat_cron_nb_check |
104 | - FROM ' . $this->categories_table . ' |
|
104 | + FROM ' . $this->categories_table.' |
|
105 | 105 | WHERE cat_id = ' . (int) $cat_id; |
106 | 106 | $result = $this->db->sql_query($sql); |
107 | 107 | $row = $this->db->sql_fetchrow($result); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'ON' => 'l.link_user_id = u.user_id' |
137 | 137 | ) |
138 | 138 | ), |
139 | - 'WHERE' => "l.link_back <> '' AND l.link_active = 1 AND l.link_cat = " . (int) $cat_id); |
|
139 | + 'WHERE' => "l.link_back <> '' AND l.link_active = 1 AND l.link_cat = ".(int) $cat_id); |
|
140 | 140 | |
141 | 141 | $sql = $this->db->sql_build_query('SELECT', $sql_array); |
142 | 142 | $result = $this->db->sql_query($sql); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | if ($this->link->validate_link_back($row['link_back'], false, true) !== false) |
147 | 147 | { |
148 | - if (!$nb_check || ($row['link_nb_check']+1) > $nb_check) |
|
148 | + if (!$nb_check || ($row['link_nb_check'] + 1) > $nb_check) |
|
149 | 149 | { |
150 | 150 | $del_array[] = $row['link_id']; |
151 | 151 | } |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | { |
180 | 180 | if (!class_exists('messenger')) |
181 | 181 | { |
182 | - include($this->root_path . 'includes/functions_messenger.' . $this->php_ext); |
|
182 | + include($this->root_path.'includes/functions_messenger.'.$this->php_ext); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | // cron.php don't call $user->setup(), so $this->timezone is unset. |
186 | 186 | // We need to define it, because we use user->format_date below |
187 | 187 | $this->user->timezone = new \DateTimeZone($this->config['board_timezone']); |
188 | 188 | |
189 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
189 | + $sql = 'UPDATE '.$this->links_table.' |
|
190 | 190 | SET link_nb_check = link_nb_check + 1 |
191 | 191 | WHERE ' . $this->db->sql_in_set('link_id', array_keys($u_array)); |
192 | 192 | $this->db->sql_query($sql); |