@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function __construct(\phpbb\cache\service $cache, \phpbb\db\driver\driver_interface $db, \phpbb\controller\helper $helper, \phpbb\language\language $language, \phpbb\log\log $log, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category) |
86 | 86 | { |
87 | - $this->cache = $cache; |
|
88 | - $this->db = $db; |
|
89 | - $this->helper = $helper; |
|
87 | + $this->cache = $cache; |
|
88 | + $this->db = $db; |
|
89 | + $this->helper = $helper; |
|
90 | 90 | $this->language = $language; |
91 | 91 | $this->phpbb_log = $log; |
92 | - $this->request = $request; |
|
92 | + $this->request = $request; |
|
93 | 93 | $this->template = $template; |
94 | - $this->user = $user; |
|
94 | + $this->user = $user; |
|
95 | 95 | $this->categorie = $categorie; |
96 | - $this->nestedset_category = $nestedset_category; |
|
96 | + $this->nestedset_category = $nestedset_category; |
|
97 | 97 | |
98 | 98 | $this->form_key = 'acp_dir_cat'; |
99 | 99 | add_form_key($this->form_key); |
100 | 100 | |
101 | 101 | $this->action = $this->request->variable('action', ''); |
102 | 102 | $this->cat_id = $request->variable('c', 0); |
103 | - $this->parent_id = $request->variable('parent_id', 0); |
|
103 | + $this->parent_id = $request->variable('parent_id', 0); |
|
104 | 104 | $this->update = ($this->request->is_set_post('update')) ? true : false; |
105 | 105 | } |
106 | 106 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | { |
152 | 152 | if (!$this->cat_id) |
153 | 153 | { |
154 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
154 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | $this->cat_data = $this->_get_cat_info($this->cat_id); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $cat_list = $this->categorie->make_cat_select((int) $this->cat_data['parent_id'], $subcats_id); |
168 | 168 | |
169 | 169 | $sql = 'SELECT cat_id |
170 | - FROM ' . $this->categories_table . ' |
|
170 | + FROM ' . $this->categories_table.' |
|
171 | 171 | WHERE cat_id <> ' . (int) $this->cat_id; |
172 | 172 | $result = $this->db->sql_query_limit($sql, 1); |
173 | 173 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | |
184 | 184 | $this->template->assign_vars(array( |
185 | 185 | 'S_DELETE_DIR_CAT' => true, |
186 | - 'U_ACTION' => $this->u_action . "&parent_id={$parent_id}&action=delete&c=$this->cat_id", |
|
187 | - 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
186 | + 'U_ACTION' => $this->u_action."&parent_id={$parent_id}&action=delete&c=$this->cat_id", |
|
187 | + 'U_BACK' => $this->u_action.'&parent_id='.$this->parent_id, |
|
188 | 188 | |
189 | 189 | 'DIR_CAT_NAME' => $this->cat_data['cat_name'], |
190 | 190 | 'S_HAS_SUBCATS' => ($this->cat_data['right_id'] - $this->cat_data['left_id'] > 1) ? true : false, |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | { |
236 | 236 | if (!$this->cat_id) |
237 | 237 | { |
238 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
238 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | $sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id |
242 | - FROM ' . $this->categories_table . ' |
|
242 | + FROM ' . $this->categories_table.' |
|
243 | 243 | WHERE cat_id = ' . (int) $this->cat_id; |
244 | 244 | $result = $this->db->sql_query($sql); |
245 | 245 | $row = $this->db->sql_fetchrow($result); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | if (!$row) |
249 | 249 | { |
250 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
250 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | try |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | if ($move_cat_name !== false) |
263 | 263 | { |
264 | - $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_CAT_' . strtoupper($this->action), time(), array($row['cat_name'], $move_cat_name)); |
|
264 | + $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_CAT_'.strtoupper($this->action), time(), array($row['cat_name'], $move_cat_name)); |
|
265 | 265 | $this->cache->destroy('sql', $this->categories_table); |
266 | 266 | } |
267 | 267 | |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | { |
306 | 306 | if (!$this->cat_id) |
307 | 307 | { |
308 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
308 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | @set_time_limit(0); |
312 | 312 | |
313 | 313 | $sql = 'SELECT cat_name, cat_links |
314 | - FROM ' . $this->categories_table . ' |
|
314 | + FROM ' . $this->categories_table.' |
|
315 | 315 | WHERE cat_id = ' . (int) $this->cat_id; |
316 | 316 | $result = $this->db->sql_query($sql); |
317 | 317 | $row = $this->db->sql_fetchrow($result); |
@@ -319,12 +319,12 @@ discard block |
||
319 | 319 | |
320 | 320 | if (!$row) |
321 | 321 | { |
322 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
322 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | $sql = 'SELECT MIN(link_id) as min_link_id, MAX(link_id) as max_link_id |
326 | - FROM ' . $this->links_table . ' |
|
327 | - WHERE link_cat = ' . (int) $this->cat_id . ' |
|
326 | + FROM ' . $this->links_table.' |
|
327 | + WHERE link_cat = ' . (int) $this->cat_id.' |
|
328 | 328 | AND link_active = 1'; |
329 | 329 | $result = $this->db->sql_query($sql); |
330 | 330 | $row2 = $this->db->sql_fetchrow($result); |
@@ -346,22 +346,22 @@ discard block |
||
346 | 346 | { |
347 | 347 | // We really need to find a way of showing statistics... no progress here |
348 | 348 | $sql = 'SELECT COUNT(link_id) as num_links |
349 | - FROM ' . $this->links_table . ' |
|
350 | - WHERE link_cat = ' . (int) $this->cat_id . ' |
|
349 | + FROM ' . $this->links_table.' |
|
350 | + WHERE link_cat = ' . (int) $this->cat_id.' |
|
351 | 351 | AND link_active = 1 |
352 | - AND link_id BETWEEN ' . $start . ' AND ' . $end; |
|
352 | + AND link_id BETWEEN ' . $start.' AND '.$end; |
|
353 | 353 | $result = $this->db->sql_query($sql); |
354 | 354 | $links_done = $this->request->variable('links_done', 0) + (int) $this->db->sql_fetchfield('num_links'); |
355 | 355 | $this->db->sql_freeresult($result); |
356 | 356 | |
357 | 357 | $start += $batch_size; |
358 | 358 | |
359 | - $url = $this->u_action . "&parent_id={$this->parent_id}&c=$this->cat_id&action=sync&start=$start&links_done=$links_done&total={$row['cat_links']}"; |
|
359 | + $url = $this->u_action."&parent_id={$this->parent_id}&c=$this->cat_id&action=sync&start=$start&links_done=$links_done&total={$row['cat_links']}"; |
|
360 | 360 | |
361 | 361 | meta_refresh(0, $url); |
362 | 362 | |
363 | 363 | $this->template->assign_vars(array( |
364 | - 'UA_PROGRESS_BAR' => $this->u_action . "&action=progress_bar&start=$links_done&total={$row['cat_links']}", |
|
364 | + 'UA_PROGRESS_BAR' => $this->u_action."&action=progress_bar&start=$links_done&total={$row['cat_links']}", |
|
365 | 365 | 'S_CONTINUE_SYNC' => true, |
366 | 366 | 'L_PROGRESS_EXPLAIN' => $this->language->lang('SYNC_IN_PROGRESS_EXPLAIN', $links_done, $row['cat_links'])) |
367 | 367 | ); |
@@ -369,11 +369,11 @@ discard block |
||
369 | 369 | return; |
370 | 370 | } |
371 | 371 | |
372 | - $url = $this->u_action . "&parent_id={$this->parent_id}&c=$this->cat_id&action=sync_cat"; |
|
372 | + $url = $this->u_action."&parent_id={$this->parent_id}&c=$this->cat_id&action=sync_cat"; |
|
373 | 373 | meta_refresh(0, $url); |
374 | 374 | |
375 | 375 | $this->template->assign_vars(array( |
376 | - 'UA_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', |
|
376 | + 'UA_PROGRESS_BAR' => $this->u_action.'&action=progress_bar', |
|
377 | 377 | 'S_CONTINUE_SYNC' => true, |
378 | 378 | 'L_PROGRESS_EXPLAIN' => $this->language->lang('SYNC_IN_PROGRESS_EXPLAIN', 0, $row['cat_links'])) |
379 | 379 | ); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | public function action_sync_cat() |
390 | 390 | { |
391 | 391 | $sql = 'SELECT cat_name |
392 | - FROM ' . $this->categories_table . ' |
|
392 | + FROM ' . $this->categories_table.' |
|
393 | 393 | WHERE cat_id = ' . (int) $this->cat_id; |
394 | 394 | $result = $this->db->sql_query($sql); |
395 | 395 | $row = $this->db->sql_fetchrow($result); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | if (!$row) |
399 | 399 | { |
400 | - trigger_error($this->language->lang('DIR_NO_CAT') . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); |
|
400 | + trigger_error($this->language->lang('DIR_NO_CAT').adm_back_link($this->u_action.'&parent_id='.$this->parent_id), E_USER_WARNING); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $this->_sync_dir_cat($this->cat_id); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | } |
423 | 423 | else |
424 | 424 | { |
425 | - $navigation = '<a href="' . $this->u_action . '">' . $this->language->lang('DIR_INDEX') . '</a>'; |
|
425 | + $navigation = '<a href="'.$this->u_action.'">'.$this->language->lang('DIR_INDEX').'</a>'; |
|
426 | 426 | |
427 | 427 | $cats_nav = $this->nestedset_category->get_path_data($this->parent_id); |
428 | 428 | |
@@ -430,11 +430,11 @@ discard block |
||
430 | 430 | { |
431 | 431 | if ($row['cat_id'] == $this->parent_id) |
432 | 432 | { |
433 | - $navigation .= ' -> ' . $row['cat_name']; |
|
433 | + $navigation .= ' -> '.$row['cat_name']; |
|
434 | 434 | } |
435 | 435 | else |
436 | 436 | { |
437 | - $navigation .= ' -> <a href="' . $this->u_action . '&parent_id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a>'; |
|
437 | + $navigation .= ' -> <a href="'.$this->u_action.'&parent_id='.$row['cat_id'].'">'.$row['cat_name'].'</a>'; |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | } |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | } |
449 | 449 | |
450 | 450 | $sql = 'SELECT cat_id, parent_id, right_id, left_id, cat_name, cat_icon, cat_desc_uid, cat_desc_bitfield, cat_desc, cat_desc_options, cat_links |
451 | - FROM ' . $this->categories_table . ' |
|
452 | - WHERE parent_id = ' . (int) $this->parent_id . ' |
|
451 | + FROM ' . $this->categories_table.' |
|
452 | + WHERE parent_id = ' . (int) $this->parent_id.' |
|
453 | 453 | ORDER BY left_id'; |
454 | 454 | $result = $this->db->sql_query($sql); |
455 | 455 | |
@@ -457,23 +457,23 @@ discard block |
||
457 | 457 | { |
458 | 458 | do |
459 | 459 | { |
460 | - $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $this->language->lang('DIR_SUBCAT') . '" />' : '<img src="images/icon_folder.gif" alt="' . $this->language->lang('FOLDER') . '" />'; |
|
460 | + $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="'.$this->language->lang('DIR_SUBCAT').'" />' : '<img src="images/icon_folder.gif" alt="'.$this->language->lang('FOLDER').'" />'; |
|
461 | 461 | |
462 | - $url = $this->u_action . "&parent_id=$this->parent_id&c={$row['cat_id']}"; |
|
462 | + $url = $this->u_action."&parent_id=$this->parent_id&c={$row['cat_id']}"; |
|
463 | 463 | |
464 | 464 | $this->template->assign_block_vars('cats', array( |
465 | 465 | 'FOLDER_IMAGE' => $folder_image, |
466 | - 'CAT_IMAGE' => ($row['cat_icon']) ? '<img src="' . $this->get_img_path('icons', $row['cat_icon']) . '" alt="" />' : '', |
|
466 | + 'CAT_IMAGE' => ($row['cat_icon']) ? '<img src="'.$this->get_img_path('icons', $row['cat_icon']).'" alt="" />' : '', |
|
467 | 467 | 'CAT_NAME' => $row['cat_name'], |
468 | 468 | 'CAT_DESCRIPTION' => generate_text_for_display($row['cat_desc'], $row['cat_desc_uid'], $row['cat_desc_bitfield'], $row['cat_desc_options']), |
469 | 469 | 'CAT_LINKS' => $row['cat_links'], |
470 | 470 | |
471 | - 'U_CAT' => $this->u_action . '&parent_id=' . $row['cat_id'], |
|
472 | - 'U_MOVE_UP' => $url . '&action=move_up', |
|
473 | - 'U_MOVE_DOWN' => $url . '&action=move_down', |
|
474 | - 'U_EDIT' => $url . '&action=edit', |
|
475 | - 'U_DELETE' => $url . '&action=delete', |
|
476 | - 'U_SYNC' => $url . '&action=sync') |
|
471 | + 'U_CAT' => $this->u_action.'&parent_id='.$row['cat_id'], |
|
472 | + 'U_MOVE_UP' => $url.'&action=move_up', |
|
473 | + 'U_MOVE_DOWN' => $url.'&action=move_down', |
|
474 | + 'U_EDIT' => $url.'&action=edit', |
|
475 | + 'U_DELETE' => $url.'&action=delete', |
|
476 | + 'U_SYNC' => $url.'&action=sync') |
|
477 | 477 | ); |
478 | 478 | } |
479 | 479 | while ($row = $this->db->sql_fetchrow($result)); |
@@ -482,14 +482,14 @@ discard block |
||
482 | 482 | { |
483 | 483 | $row = $this->_get_cat_info($this->parent_id); |
484 | 484 | |
485 | - $url = $this->u_action . '&parent_id=' . $this->parent_id . '&c=' . $row['cat_id']; |
|
485 | + $url = $this->u_action.'&parent_id='.$this->parent_id.'&c='.$row['cat_id']; |
|
486 | 486 | |
487 | 487 | $this->template->assign_vars(array( |
488 | 488 | 'S_NO_CATS' => true, |
489 | 489 | |
490 | - 'U_EDIT' => $url . '&action=edit', |
|
491 | - 'U_DELETE' => $url . '&action=delete', |
|
492 | - 'U_SYNC' => $url . '&action=sync') |
|
490 | + 'U_EDIT' => $url.'&action=edit', |
|
491 | + 'U_DELETE' => $url.'&action=delete', |
|
492 | + 'U_SYNC' => $url.'&action=sync') |
|
493 | 493 | ); |
494 | 494 | } |
495 | 495 | $this->db->sql_freeresult($result); |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | 'NAVIGATION' => $navigation, |
500 | 500 | 'CAT_BOX' => $cat_box, |
501 | 501 | 'U_SEL_ACTION' => $this->u_action, |
502 | - 'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
502 | + 'U_ACTION' => $this->u_action.'&parent_id='.$this->parent_id, |
|
503 | 503 | |
504 | - 'UA_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', |
|
504 | + 'UA_PROGRESS_BAR' => $this->u_action.'&action=progress_bar', |
|
505 | 505 | )); |
506 | 506 | } |
507 | 507 | |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | switch ($this->action) |
535 | 535 | { |
536 | 536 | case 'delete': |
537 | - $action_subcats = $this->request->variable('action_subcats', ''); |
|
538 | - $subcats_to_id = $this->request->variable('subcats_to_id', 0); |
|
539 | - $action_links = $this->request->variable('action_links', ''); |
|
540 | - $links_to_id = $this->request->variable('links_to_id', 0); |
|
537 | + $action_subcats = $this->request->variable('action_subcats', ''); |
|
538 | + $subcats_to_id = $this->request->variable('subcats_to_id', 0); |
|
539 | + $action_links = $this->request->variable('action_links', ''); |
|
540 | + $links_to_id = $this->request->variable('links_to_id', 0); |
|
541 | 541 | |
542 | 542 | try |
543 | 543 | { |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | // Purge the cache to refresh route collections |
607 | 607 | $this->cache->purge(); |
608 | 608 | |
609 | - trigger_error($this->language->lang($message) . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); |
|
609 | + trigger_error($this->language->lang($message).adm_back_link($this->u_action.'&parent_id='.$this->parent_id)); |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | } |
635 | 635 | |
636 | 636 | $sql = 'SELECT cat_route |
637 | - FROM ' . $this->categories_table . " |
|
638 | - WHERE cat_route = '" . $this->db->sql_escape($route) . "' |
|
637 | + FROM ' . $this->categories_table." |
|
638 | + WHERE cat_route = '" . $this->db->sql_escape($route)."' |
|
639 | 639 | AND cat_id <> " . $this->cat_id; |
640 | 640 | $result = $this->db->sql_query_limit($sql, 1); |
641 | 641 | $row = $this->db->sql_fetchrow($result); |
@@ -685,10 +685,10 @@ discard block |
||
685 | 685 | 'S_CAT_PARENT_ID' => $this->cat_data['parent_id'], |
686 | 686 | 'S_ADD_ACTION' => ($this->action == 'add') ? true : false, |
687 | 687 | |
688 | - 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, |
|
689 | - 'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$this->action&c=$this->cat_id", |
|
688 | + 'U_BACK' => $this->u_action.'&parent_id='.$this->parent_id, |
|
689 | + 'U_EDIT_ACTION' => $this->u_action."&parent_id={$this->parent_id}&action=$this->action&c=$this->cat_id", |
|
690 | 690 | |
691 | - 'L_TITLE' => $this->language->lang('DIR_' . strtoupper($this->action) . '_CAT'), |
|
691 | + 'L_TITLE' => $this->language->lang('DIR_'.strtoupper($this->action).'_CAT'), |
|
692 | 692 | 'ERROR_MSG' => (count($this->errors)) ? implode('<br />', $this->errors) : '', |
693 | 693 | 'ICON_IMAGE' => ($this->cat_data['cat_icon']) ? $this->get_img_path('icons', $this->cat_data['cat_icon']) : 'images/spacer.gif', |
694 | 694 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | private function _get_cat_info($cat_id) |
733 | 733 | { |
734 | 734 | $sql = 'SELECT cat_id, parent_id, right_id, left_id, cat_desc, cat_desc_uid, cat_desc_options, cat_icon, cat_name, cat_route, display_subcat_list, cat_allow_comments, cat_allow_votes, cat_must_describe, cat_count_all, cat_validate, cat_cron_freq, cat_cron_nb_check, cat_link_back, cat_cron_enable, cat_cron_next |
735 | - FROM ' . $this->categories_table . ' |
|
735 | + FROM ' . $this->categories_table.' |
|
736 | 736 | WHERE cat_id = ' . (int) $cat_id; |
737 | 737 | $result = $this->db->sql_query($sql); |
738 | 738 | $row = $this->db->sql_fetchrow($result); |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | { |
798 | 798 | if ($cat_data_sql['cat_cron_enable']) |
799 | 799 | { |
800 | - $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq']*86400; |
|
800 | + $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq'] * 86400; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | $this->cat_data = $this->nestedset_category->insert($cat_data_sql); |
@@ -820,13 +820,13 @@ discard block |
||
820 | 820 | |
821 | 821 | if ($cat_data_sql['cat_cron_enable'] && ($row['cat_cron_freq'] != $cat_data_sql['cat_cron_freq'] || !$row['cat_cron_enable'])) |
822 | 822 | { |
823 | - $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq']*86400; |
|
823 | + $cat_data_sql['cat_cron_next'] = time() + $cat_data_sql['cat_cron_freq'] * 86400; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | if ($row['cat_name'] != $cat_data_sql['cat_name']) |
827 | 827 | { |
828 | 828 | // the cat name has changed, clear the parents list of all categories (for safety) |
829 | - $sql = 'UPDATE ' . $this->categories_table . " |
|
829 | + $sql = 'UPDATE '.$this->categories_table." |
|
830 | 830 | SET cat_parents = ''"; |
831 | 831 | $this->db->sql_query($sql); |
832 | 832 | } |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | // Setting the cat id to the categorie id is not really received well by some dbs. ;) |
835 | 835 | unset($cat_data_sql['cat_id']); |
836 | 836 | |
837 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
838 | - SET ' . $this->db->sql_build_array('UPDATE', $cat_data_sql) . ' |
|
837 | + $sql = 'UPDATE '.$this->categories_table.' |
|
838 | + SET ' . $this->db->sql_build_array('UPDATE', $cat_data_sql).' |
|
839 | 839 | WHERE cat_id = ' . (int) $this->cat_id; |
840 | 840 | $this->db->sql_query($sql); |
841 | 841 | |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | $log_action_links = 'MOVE_LINKS'; |
877 | 877 | |
878 | 878 | $sql = 'SELECT cat_name |
879 | - FROM ' . $this->categories_table . ' |
|
879 | + FROM ' . $this->categories_table.' |
|
880 | 880 | WHERE cat_id = ' . (int) $links_to_id; |
881 | 881 | $result = $this->db->sql_query($sql); |
882 | 882 | $row = $this->db->sql_fetchrow($result); |
@@ -976,12 +976,12 @@ discard block |
||
976 | 976 | */ |
977 | 977 | private function _move_cat_content($from_id, $to_id) |
978 | 978 | { |
979 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
980 | - SET link_cat = ' . (int) $to_id . ' |
|
979 | + $sql = 'UPDATE '.$this->links_table.' |
|
980 | + SET link_cat = ' . (int) $to_id.' |
|
981 | 981 | WHERE link_cat = ' . (int) $from_id; |
982 | 982 | $this->db->sql_query($sql); |
983 | 983 | |
984 | - $sql = 'DELETE FROM ' . $this->watch_table . ' |
|
984 | + $sql = 'DELETE FROM '.$this->watch_table.' |
|
985 | 985 | WHERE cat_id = ' . (int) $from_id; |
986 | 986 | $this->db->sql_query($sql); |
987 | 987 | |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | |
1000 | 1000 | // Before we remove anything we make sure we are able to adjust the post counts later. ;) |
1001 | 1001 | $sql = 'SELECT link_id, link_banner |
1002 | - FROM ' . $this->links_table . ' |
|
1002 | + FROM ' . $this->links_table.' |
|
1003 | 1003 | WHERE link_cat = ' . (int) $this->cat_id; |
1004 | 1004 | $result = $this->db->sql_query($sql); |
1005 | 1005 | |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | |
1031 | 1031 | foreach ($link_datas_ary as $table => $field) |
1032 | 1032 | { |
1033 | - $this->db->sql_query("DELETE FROM $table WHERE " . $this->db->sql_in_set($field, $link_ids)); |
|
1033 | + $this->db->sql_query("DELETE FROM $table WHERE ".$this->db->sql_in_set($field, $link_ids)); |
|
1034 | 1034 | } |
1035 | 1035 | } |
1036 | 1036 | |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | foreach ($cat_datas_ary as $table => $field) |
1044 | 1044 | { |
1045 | - $this->db->sql_query("DELETE FROM $table WHERE $field = " . (int) $this->cat_id); |
|
1045 | + $this->db->sql_query("DELETE FROM $table WHERE $field = ".(int) $this->cat_id); |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | $this->db->sql_transaction('commit'); |
@@ -1057,15 +1057,15 @@ discard block |
||
1057 | 1057 | private function _sync_dir_cat($cat_id) |
1058 | 1058 | { |
1059 | 1059 | $sql = 'SELECT COUNT(link_id) AS num_links |
1060 | - FROM ' . $this->links_table . ' |
|
1061 | - WHERE link_cat = ' . (int) $cat_id . ' |
|
1060 | + FROM ' . $this->links_table.' |
|
1061 | + WHERE link_cat = ' . (int) $cat_id.' |
|
1062 | 1062 | AND link_active = 1'; |
1063 | 1063 | $result = $this->db->sql_query($sql); |
1064 | 1064 | $total_links = (int) $this->db->sql_fetchfield('num_links'); |
1065 | 1065 | $this->db->sql_freeresult($result); |
1066 | 1066 | |
1067 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
1068 | - SET cat_links = ' . $total_links . ' |
|
1067 | + $sql = 'UPDATE '.$this->categories_table.' |
|
1068 | + SET cat_links = ' . $total_links.' |
|
1069 | 1069 | WHERE cat_id = ' . (int) $cat_id; |
1070 | 1070 | $this->db->sql_query($sql); |
1071 | 1071 | } |
@@ -1085,33 +1085,33 @@ discard block |
||
1085 | 1085 | 'link_vote' => 0, |
1086 | 1086 | ); |
1087 | 1087 | |
1088 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
1089 | - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
1090 | - WHERE link_id BETWEEN ' . (int) $start . ' AND ' . (int) $stop; |
|
1088 | + $sql = 'UPDATE '.$this->links_table.' |
|
1089 | + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).' |
|
1090 | + WHERE link_id BETWEEN ' . (int) $start.' AND '.(int) $stop; |
|
1091 | 1091 | $this->db->sql_query($sql); |
1092 | 1092 | |
1093 | - $sql = 'SELECT vote_link_id, COUNT(vote_note) AS nb_vote, SUM(vote_note) AS total FROM ' . $this->votes_table . ' |
|
1094 | - WHERE vote_link_id BETWEEN ' . (int) $start . ' AND ' . (int) $stop . ' |
|
1093 | + $sql = 'SELECT vote_link_id, COUNT(vote_note) AS nb_vote, SUM(vote_note) AS total FROM '.$this->votes_table.' |
|
1094 | + WHERE vote_link_id BETWEEN ' . (int) $start.' AND '.(int) $stop.' |
|
1095 | 1095 | GROUP BY vote_link_id'; |
1096 | 1096 | $result = $this->db->sql_query($sql); |
1097 | 1097 | while ($tmp = $this->db->sql_fetchrow($result)) |
1098 | 1098 | { |
1099 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
1100 | - SET link_note = ' . (int) $tmp['total'] . ', link_vote = ' . (int) $tmp['nb_vote'] . ' |
|
1099 | + $sql = 'UPDATE '.$this->links_table.' |
|
1100 | + SET link_note = ' . (int) $tmp['total'].', link_vote = '.(int) $tmp['nb_vote'].' |
|
1101 | 1101 | WHERE link_id = ' . (int) $tmp['vote_link_id']; |
1102 | 1102 | $this->db->sql_query($sql); |
1103 | 1103 | } |
1104 | 1104 | $this->db->sql_freeresult($result); |
1105 | 1105 | |
1106 | 1106 | $sql = 'SELECT comment_link_id, COUNT(comment_id) AS nb_comment |
1107 | - FROM ' . $this->comments_table . ' |
|
1108 | - WHERE comment_link_id BETWEEN ' . (int) $start . ' AND ' . (int) $stop . ' |
|
1107 | + FROM ' . $this->comments_table.' |
|
1108 | + WHERE comment_link_id BETWEEN ' . (int) $start.' AND '.(int) $stop.' |
|
1109 | 1109 | GROUP BY comment_link_id'; |
1110 | 1110 | $result = $this->db->sql_query($sql); |
1111 | 1111 | while ($tmp = $this->db->sql_fetchrow($result)) |
1112 | 1112 | { |
1113 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
1114 | - SET link_comment = ' . (int) $tmp['nb_comment'] . ' |
|
1113 | + $sql = 'UPDATE '.$this->links_table.' |
|
1114 | + SET link_comment = ' . (int) $tmp['nb_comment'].' |
|
1115 | 1115 | WHERE link_id = ' . (int) $tmp['comment_link_id']; |
1116 | 1116 | $this->db->sql_query($sql); |
1117 | 1117 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | |
1137 | 1137 | foreach ($img_ary as $img) |
1138 | 1138 | { |
1139 | - $img = $path . $img; |
|
1139 | + $img = $path.$img; |
|
1140 | 1140 | $selected = ''; |
1141 | 1141 | |
1142 | 1142 | if (strlen($img) > 255) |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | $selected = ' selected="selected"'; |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>'; |
|
1152 | + $filename_list .= '<option value="'.htmlspecialchars($img).'"'.$selected.'>'.$img.'</option>'; |
|
1153 | 1153 | } |
1154 | 1154 | } |
1155 | 1155 |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function __construct(\phpbb\config\config $config, \phpbb\language\language $language, \phpbb\log\log $log, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) |
53 | 53 | { |
54 | - $this->config = $config; |
|
54 | + $this->config = $config; |
|
55 | 55 | $this->language = $language; |
56 | - $this->log = $log; |
|
56 | + $this->log = $log; |
|
57 | 57 | $this->template = $template; |
58 | - $this->user = $user; |
|
59 | - $this->request = $request; |
|
58 | + $this->user = $user; |
|
59 | + $this->request = $request; |
|
60 | 60 | |
61 | 61 | $this->_generate_config(); |
62 | 62 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | else if ($vars['explain']) |
97 | 97 | { |
98 | - $l_explain = $this->language->lang($vars['lang'] . '_EXPLAIN'); |
|
98 | + $l_explain = $this->language->lang($vars['lang'].'_EXPLAIN'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $this->template->assign_block_vars('options', array( |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function process() |
119 | 119 | { |
120 | - $submit = ($this->request->is_set_post('submit')) ? true : false; |
|
120 | + $submit = ($this->request->is_set_post('submit')) ? true : false; |
|
121 | 121 | |
122 | 122 | $this->new_config = $this->config; |
123 | 123 | $cfg_array = ($this->request->is_set('config')) ? $this->request->variable('config', array('' => ''), true) : $this->new_config; |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | { |
159 | 159 | $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'DIR_CONFIG_SETTINGS'); |
160 | 160 | |
161 | - trigger_error($this->language->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); |
|
161 | + trigger_error($this->language->lang('CONFIG_UPDATED').adm_back_link($this->u_action)); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $this->template->assign_vars(array( |
165 | 165 | 'L_TITLE' => $this->language->lang($this->display_vars['title']), |
166 | - 'L_TITLE_EXPLAIN' => $this->language->lang($this->display_vars['title'] . '_EXPLAIN'), |
|
166 | + 'L_TITLE_EXPLAIN' => $this->language->lang($this->display_vars['title'].'_EXPLAIN'), |
|
167 | 167 | |
168 | 168 | 'S_ERROR' => (count($error)) ? true : false, |
169 | 169 | 'ERROR_MSG' => implode('<br />', $error), |
@@ -199,44 +199,44 @@ discard block |
||
199 | 199 | 'dir_banner_width' => '', |
200 | 200 | 'dir_banner_height' => '', |
201 | 201 | |
202 | - 'dir_mail' => array('lang' => 'DIR_MAIL_VALIDATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
203 | - 'dir_activ_checkurl' => array('lang' => 'DIR_ACTIVE_CHECK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
204 | - 'dir_activ_flag' => array('lang' => 'DIR_ACTIV_FLAG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
205 | - 'dir_activ_rss' => array('lang' => 'DIR_ACTIV_RSS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
206 | - 'dir_show' => array('lang' => 'DIR_SHOW', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), |
|
207 | - 'dir_length_describe' => array('lang' => 'DIR_MAX_DESC', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => false), |
|
208 | - 'dir_new_time' => array('lang' => 'DIR_NEW_TIME', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => true), |
|
209 | - 'dir_default_order' => array('lang' => 'DIR_DEFAULT_ORDER', 'validate' => 'string', 'type' => 'select', 'explain' => false, 'method' => 'get_order_list', 'params' => array('{CONFIG_VALUE}')), |
|
202 | + 'dir_mail' => array('lang' => 'DIR_MAIL_VALIDATION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
203 | + 'dir_activ_checkurl' => array('lang' => 'DIR_ACTIVE_CHECK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
204 | + 'dir_activ_flag' => array('lang' => 'DIR_ACTIV_FLAG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
205 | + 'dir_activ_rss' => array('lang' => 'DIR_ACTIV_RSS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
206 | + 'dir_show' => array('lang' => 'DIR_SHOW', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), |
|
207 | + 'dir_length_describe' => array('lang' => 'DIR_MAX_DESC', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => false), |
|
208 | + 'dir_new_time' => array('lang' => 'DIR_NEW_TIME', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => true), |
|
209 | + 'dir_default_order' => array('lang' => 'DIR_DEFAULT_ORDER', 'validate' => 'string', 'type' => 'select', 'explain' => false, 'method' => 'get_order_list', 'params' => array('{CONFIG_VALUE}')), |
|
210 | 210 | |
211 | 211 | 'legend2' => 'DIR_RECENT_GUEST', |
212 | - 'dir_recent_block' => array('lang' => 'DIR_RECENT_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
213 | - 'dir_recent_rows' => array('lang' => 'DIR_RECENT_ROWS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => false), |
|
214 | - 'dir_recent_columns' => array('lang' => 'DIR_RECENT_COLUMNS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => false), |
|
215 | - 'dir_recent_exclude' => array('lang' => 'DIR_RECENT_EXCLUDE', 'validate' => 'string', 'type' => 'text:6:99', 'explain' => true), |
|
212 | + 'dir_recent_block' => array('lang' => 'DIR_RECENT_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
213 | + 'dir_recent_rows' => array('lang' => 'DIR_RECENT_ROWS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => false), |
|
214 | + 'dir_recent_columns' => array('lang' => 'DIR_RECENT_COLUMNS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => false), |
|
215 | + 'dir_recent_exclude' => array('lang' => 'DIR_RECENT_EXCLUDE', 'validate' => 'string', 'type' => 'text:6:99', 'explain' => true), |
|
216 | 216 | |
217 | 217 | 'legend3' => 'DIR_ADD_GUEST', |
218 | - 'dir_visual_confirm' => array('lang' => 'DIR_VISUAL_CONFIRM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
219 | - 'dir_visual_confirm_max_attempts' => array('lang' => 'DIR_MAX_ADD_ATTEMPTS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), |
|
218 | + 'dir_visual_confirm' => array('lang' => 'DIR_VISUAL_CONFIRM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
219 | + 'dir_visual_confirm_max_attempts' => array('lang' => 'DIR_MAX_ADD_ATTEMPTS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), |
|
220 | 220 | |
221 | 221 | 'legend4' => 'DIR_THUMB_PARAM', |
222 | - 'dir_activ_thumb' => array('lang' => 'DIR_ACTIVE_THUMB', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
223 | - 'dir_activ_thumb_remote' => array('lang' => 'DIR_ACTIVE_THUMB_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
224 | - 'dir_thumb_service' => array('lang' => 'DIR_THUMB_SERVICE', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'get_thumb_service_list', 'params' => array('{CONFIG_VALUE}')), |
|
225 | - 'dir_thumb_service_reverse' => array('lang' => 'DIR_THUMB_SERVICE_REVERSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
222 | + 'dir_activ_thumb' => array('lang' => 'DIR_ACTIVE_THUMB', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
223 | + 'dir_activ_thumb_remote' => array('lang' => 'DIR_ACTIVE_THUMB_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
224 | + 'dir_thumb_service' => array('lang' => 'DIR_THUMB_SERVICE', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'get_thumb_service_list', 'params' => array('{CONFIG_VALUE}')), |
|
225 | + 'dir_thumb_service_reverse' => array('lang' => 'DIR_THUMB_SERVICE_REVERSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
226 | 226 | |
227 | 227 | 'legend5' => 'DIR_COMM_PARAM', |
228 | - 'dir_allow_bbcode' => array('lang' => 'DIR_ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
229 | - 'dir_allow_flash' => array('lang' => 'DIR_ALLOW_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
230 | - 'dir_allow_links' => array('lang' => 'DIR_ALLOW_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
231 | - 'dir_allow_smilies' => array('lang' => 'DIR_ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
232 | - 'dir_length_comments' => array('lang' => 'DIR_LENGTH_COMMENTS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => true), |
|
233 | - 'dir_comments_per_page' => array('lang' => 'DIR_COMM_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), |
|
228 | + 'dir_allow_bbcode' => array('lang' => 'DIR_ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
229 | + 'dir_allow_flash' => array('lang' => 'DIR_ALLOW_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
230 | + 'dir_allow_links' => array('lang' => 'DIR_ALLOW_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
231 | + 'dir_allow_smilies' => array('lang' => 'DIR_ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
232 | + 'dir_length_comments' => array('lang' => 'DIR_LENGTH_COMMENTS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => true), |
|
233 | + 'dir_comments_per_page' => array('lang' => 'DIR_COMM_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), |
|
234 | 234 | |
235 | 235 | 'legend6' => 'DIR_BANN_PARAM', |
236 | - 'dir_activ_banner' => array('lang' => 'DIR_ACTIV_BANNER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
237 | - 'dir_banner' => array('lang' => 'DIR_MAX_BANN', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $this->user->lang['PIXEL']), |
|
238 | - 'dir_banner_filesize' => array('lang' => 'DIR_MAX_SIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), |
|
239 | - 'dir_storage_banner' => array('lang' => 'DIR_STORAGE_BANNER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
236 | + 'dir_activ_banner' => array('lang' => 'DIR_ACTIV_BANNER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
237 | + 'dir_banner' => array('lang' => 'DIR_MAX_BANN', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' '.$this->user->lang['PIXEL']), |
|
238 | + 'dir_banner_filesize' => array('lang' => 'DIR_MAX_SIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), |
|
239 | + 'dir_storage_banner' => array('lang' => 'DIR_STORAGE_BANNER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
240 | 240 | ) |
241 | 241 | ); |
242 | 242 | } |
@@ -76,20 +76,20 @@ discard block |
||
76 | 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\factory $files_factory, $root_path, $php_ext) |
78 | 78 | { |
79 | - $this->db = $db; |
|
80 | - $this->config = $config; |
|
79 | + $this->db = $db; |
|
80 | + $this->config = $config; |
|
81 | 81 | $this->language = $language; |
82 | 82 | $this->template = $template; |
83 | 83 | $this->user = $user; |
84 | - $this->helper = $helper; |
|
85 | - $this->request = $request; |
|
84 | + $this->helper = $helper; |
|
85 | + $this->request = $request; |
|
86 | 86 | $this->auth = $auth; |
87 | - $this->notification = $notification; |
|
88 | - $this->filesystem = $filesystem; |
|
87 | + $this->notification = $notification; |
|
88 | + $this->filesystem = $filesystem; |
|
89 | 89 | $this->imagesize = $imagesize; |
90 | - $this->files_factory = $files_factory; |
|
90 | + $this->files_factory = $files_factory; |
|
91 | 91 | $this->root_path = $root_path; |
92 | - $this->php_ext = $php_ext; |
|
92 | + $this->php_ext = $php_ext; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | |
106 | 106 | $this->db->sql_transaction('begin'); |
107 | 107 | |
108 | - $sql = 'INSERT INTO ' . $this->links_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
108 | + $sql = 'INSERT INTO '.$this->links_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
109 | 109 | $this->db->sql_query($sql); |
110 | 110 | $notification_data['link_id'] = $this->db->sql_nextid(); |
111 | 111 | |
112 | 112 | if (!$need_approval || $this->auth->acl_get('a_') || $this->auth->acl_get('m_')) |
113 | 113 | { |
114 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
114 | + $sql = 'UPDATE '.$this->categories_table.' |
|
115 | 115 | SET cat_links = cat_links + 1 |
116 | 116 | WHERE cat_id = ' . (int) $data['link_cat']; |
117 | 117 | $this->db->sql_query($sql); |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | |
170 | 170 | $this->db->sql_transaction('begin'); |
171 | 171 | |
172 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
172 | + $sql = 'UPDATE '.$this->categories_table.' |
|
173 | 173 | SET cat_links = cat_links - 1 |
174 | 174 | WHERE cat_id = ' . (int) $old_cat; |
175 | 175 | $this->db->sql_query($sql); |
176 | 176 | |
177 | 177 | if (!$need_approval) |
178 | 178 | { |
179 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
179 | + $sql = 'UPDATE '.$this->categories_table.' |
|
180 | 180 | SET cat_links = cat_links + 1 |
181 | 181 | WHERE cat_id = ' . (int) $data['link_cat']; |
182 | 182 | $this->db->sql_query($sql); |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $this->notification->add_notifications($notification_type, $notification_data); |
195 | 195 | } |
196 | 196 | |
197 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
198 | - SET ' . $this->db->sql_build_array('UPDATE', $data) . ' |
|
197 | + $sql = 'UPDATE '.$this->links_table.' |
|
198 | + SET ' . $this->db->sql_build_array('UPDATE', $data).' |
|
199 | 199 | WHERE link_id = ' . (int) $link_id; |
200 | 200 | $this->db->sql_query($sql); |
201 | 201 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | ); |
222 | 222 | |
223 | 223 | $sql = 'SELECT link_banner |
224 | - FROM ' . $this->links_table . ' |
|
224 | + FROM ' . $this->links_table.' |
|
225 | 225 | WHERE '. $this->db->sql_in_set('link_id', $url_array); |
226 | 226 | $result = $this->db->sql_query($sql); |
227 | 227 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $this->db->sql_query("DELETE FROM $table WHERE ".$this->db->sql_in_set($field, $url_array)); |
244 | 244 | } |
245 | 245 | |
246 | - $sql = 'UPDATE ' . $this->categories_table . ' |
|
246 | + $sql = 'UPDATE '.$this->categories_table.' |
|
247 | 247 | SET cat_links = cat_links - '.count($url_array).' |
248 | 248 | WHERE cat_id = ' . (int) $cat_id; |
249 | 249 | $this->db->sql_query($sql); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | if ($this->request->is_ajax()) |
262 | 262 | { |
263 | 263 | $sql = 'SELECT cat_links |
264 | - FROM ' . $this->categories_table . ' |
|
264 | + FROM ' . $this->categories_table.' |
|
265 | 265 | WHERE cat_id = ' . (int) $cat_id; |
266 | 266 | $result = $this->db->sql_query($sql); |
267 | 267 | $data = $this->db->sql_fetchrow($result); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | public function view($link_id) |
289 | 289 | { |
290 | 290 | $sql = 'SELECT link_id, link_url |
291 | - FROM ' . $this->links_table . ' |
|
291 | + FROM ' . $this->links_table.' |
|
292 | 292 | WHERE link_id = ' . (int) $link_id; |
293 | 293 | $result = $this->db->sql_query($sql); |
294 | 294 | $data = $this->db->sql_fetchrow($result); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_LINKS'); |
299 | 299 | } |
300 | 300 | |
301 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
301 | + $sql = 'UPDATE '.$this->links_table.' |
|
302 | 302 | SET link_view = link_view + 1 |
303 | 303 | WHERE link_id = ' . (int) $link_id; |
304 | 304 | $this->db->sql_query($sql); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if ($details['scheme'] == 'https') |
324 | 324 | { |
325 | 325 | $default_port = 443; |
326 | - $hostname = 'tls://' . $details['host']; |
|
326 | + $hostname = 'tls://'.$details['host']; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | if (!isset($details['path'])) |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $flag_path = $ext_path.'images/flags/'; |
382 | 382 | $img_flag = 'no_flag.png'; |
383 | 383 | |
384 | - if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path . $data['link_flag'])) |
|
384 | + if ($this->config['dir_activ_flag'] && !empty($data['link_flag']) && file_exists($flag_path.$data['link_flag'])) |
|
385 | 385 | { |
386 | 386 | $img_flag = $data['link_flag']; |
387 | 387 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $list = '<select name="vote">'; |
424 | 424 | for ($i = 0; $i <= 10; $i++) |
425 | 425 | { |
426 | - $list .= '<option value="' . $i . '"' . (($i == 5) ? ' selected="selected"' : '') . '>' . $i . '</option>'; |
|
426 | + $list .= '<option value="'.$i.'"'.(($i == 5) ? ' selected="selected"' : '').'>'.$i.'</option>'; |
|
427 | 427 | } |
428 | 428 | $list .= '</select>'; |
429 | 429 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | { |
462 | 462 | $thumb = $this->thumb_process($data['link_url']); |
463 | 463 | |
464 | - $sql = 'UPDATE ' . $this->links_table . " |
|
465 | - SET link_thumb = '" . $this->db->sql_escape($thumb) . "' |
|
464 | + $sql = 'UPDATE '.$this->links_table." |
|
465 | + SET link_thumb = '" . $this->db->sql_escape($thumb)."' |
|
466 | 466 | WHERE link_id = " . (int) $data['link_id']; |
467 | 467 | $this->db->sql_query($sql); |
468 | 468 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | $height /= $coef_max; |
510 | 510 | } |
511 | 511 | |
512 | - return '<img src="' . $img_src . '" width="' . $width . '" height="' . $height . '" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
512 | + return '<img src="'.$img_src.'" width="'.$width.'" height="'.$height.'" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />'; |
|
513 | 513 | } |
514 | 514 | return ''; |
515 | 515 | } |
@@ -531,12 +531,12 @@ discard block |
||
531 | 531 | |
532 | 532 | $this->db->sql_transaction('begin'); |
533 | 533 | |
534 | - $sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
534 | + $sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
535 | 535 | $this->db->sql_query($sql); |
536 | 536 | |
537 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
537 | + $sql = 'UPDATE '.$this->links_table.' |
|
538 | 538 | SET link_vote = link_vote + 1, |
539 | - link_note = link_note + ' . (int) $data['vote_note'] . ' |
|
539 | + link_note = link_note + ' . (int) $data['vote_note'].' |
|
540 | 540 | WHERE link_id = ' . (int) $link_id; |
541 | 541 | $this->db->sql_query($sql); |
542 | 542 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | if ($this->request->is_ajax()) |
546 | 546 | { |
547 | - $sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id; |
|
547 | + $sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id; |
|
548 | 548 | $result = $this->db->sql_query($sql); |
549 | 549 | $data = $this->db->sql_fetchrow($result); |
550 | 550 | |
@@ -578,8 +578,8 @@ discard block |
||
578 | 578 | |
579 | 579 | $details = parse_url($url); |
580 | 580 | |
581 | - $root_url = $details['scheme'].'://'.$details['host']; |
|
582 | - $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
581 | + $root_url = $details['scheme'].'://'.$details['host']; |
|
582 | + $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
583 | 583 | |
584 | 584 | if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host'])) |
585 | 585 | { |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $destination = $this->get_banner_path(); |
623 | 623 | |
624 | 624 | // Can we upload? |
625 | - $can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($this->root_path . $destination) && $this->filesystem->is_writable($this->root_path . $destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; |
|
625 | + $can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($this->root_path.$destination) && $this->filesystem->is_writable($this->root_path.$destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; |
|
626 | 626 | |
627 | 627 | if ($banner && $can_upload) |
628 | 628 | { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | |
669 | 669 | $file = $upload->handle_upload('files.types.remote', $banner); |
670 | 670 | |
671 | - $prefix = unique_id() . '_'; |
|
671 | + $prefix = unique_id().'_'; |
|
672 | 672 | $file->clean_filename('real', $prefix); |
673 | 673 | |
674 | 674 | if (count($file->error)) |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | { |
700 | 700 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
701 | 701 | { |
702 | - $banner = 'http://' . $banner; |
|
702 | + $banner = 'http://'.$banner; |
|
703 | 703 | } |
704 | 704 | 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)) |
705 | 705 | { |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | } |
731 | 731 | |
732 | 732 | // Check image type |
733 | - $types = \phpbb\files\upload::image_types(); |
|
734 | - $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
733 | + $types = \phpbb\files\upload::image_types(); |
|
734 | + $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
735 | 735 | |
736 | 736 | // Check if this is actually an image |
737 | 737 | if ($file_stream = @fopen($banner, 'r')) |
@@ -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' . (count($exclude_array) ? ' AND ' . $this->db->sql_in_set('l.link_cat', $exclude_array, true) : ''), |
|
887 | + 'WHERE' => 'l.link_active = 1'.(count($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 (count($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) |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | 'COUNT' => $row['link_view'], |
921 | 921 | 'COMMENT' => $row['link_comment'], |
922 | 922 | |
923 | - 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['link_cat']), |
|
923 | + 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['link_cat']), |
|
924 | 924 | 'U_COMMENT' => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])), |
925 | 925 | |
926 | 926 | 'L_DIR_SEARCH_NB_CLICKS' => $this->language->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']), |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | $match_search_query = ''; |
70 | 70 | foreach ($matches as $match) |
71 | 71 | { |
72 | - $match_search_query .= (($match_search_query) ? ' OR ' : '') . 'LOWER('. $match . ') '; |
|
73 | - $match_search_query .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $this->db->get_any_char() . strtolower($word) . $this->db->get_any_char())); |
|
72 | + $match_search_query .= (($match_search_query) ? ' OR ' : '').'LOWER('.$match.') '; |
|
73 | + $match_search_query .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $this->db->get_any_char().strtolower($word).$this->db->get_any_char())); |
|
74 | 74 | } |
75 | - $search_query .= ((!$search_query) ? '' : (($terms == 'all') ? ' AND ' : ' OR ')) . '(' . $match_search_query . ')'; |
|
75 | + $search_query .= ((!$search_query) ? '' : (($terms == 'all') ? ' AND ' : ' OR ')).'('.$match_search_query.')'; |
|
76 | 76 | } |
77 | 77 | $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); |
78 | 78 | |
79 | 79 | if (is_array($sort_by_sql[$sort_key])) |
80 | 80 | { |
81 | - $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; |
|
81 | + $sql_sort_order = implode(' '.$direction.', ', $sort_by_sql[$sort_key]).' '.$direction; |
|
82 | 82 | } |
83 | 83 | else |
84 | 84 | { |
85 | - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; |
|
85 | + $sql_sort_order = $sort_by_sql[$sort_key].' '.$direction; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $sql_array = array( |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | 'FROM' => array( |
91 | 91 | $this->links_table => 'l'), |
92 | 92 | 'WHERE' => 'l.link_active = 1 |
93 | - ' . (($search_query) ? 'AND (' . $search_query . ')' : '') . ' |
|
94 | - ' . (count($ex_cid_ary) ? ' AND ' . $this->db->sql_in_set('l.link_cat', $ex_cid_ary, true) : '') . ' |
|
95 | - ' . (($cat_id) ? ' AND ' . $this->db->sql_in_set('l.link_cat', $cat_id) : '') . ' |
|
96 | - ' . (($sort_days) ? ' AND l.link_time >= ' . (time() - ($sort_days * 86400)) : ''), |
|
93 | + ' . (($search_query) ? 'AND ('.$search_query.')' : '').' |
|
94 | + ' . (count($ex_cid_ary) ? ' AND '.$this->db->sql_in_set('l.link_cat', $ex_cid_ary, true) : '').' |
|
95 | + ' . (($cat_id) ? ' AND '.$this->db->sql_in_set('l.link_cat', $cat_id) : '').' |
|
96 | + ' . (($sort_days) ? ' AND l.link_time >= '.(time() - ($sort_days * 86400)) : ''), |
|
97 | 97 | 'ORDER_BY' => $sql_sort_order |
98 | 98 | ); |
99 | 99 |