@@ -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\factory $files_factory File classes factory |
|
| 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\factory $files_factory File classes factory |
|
| 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\factory $files_factory, $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,11 +515,11 @@ 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 | - * @return null |
|
| 522 | - */ |
|
| 518 | + * Add a vote in db, for a specifi link |
|
| 519 | + * |
|
| 520 | + * @param int $link_id Link_id from db |
|
| 521 | + * @return null |
|
| 522 | + */ |
|
| 523 | 523 | public function add_vote($link_id) |
| 524 | 524 | { |
| 525 | 525 | $data = array( |
@@ -563,11 +563,11 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
| 566 | - * Search an appropriate thumb for url |
|
| 567 | - * |
|
| 568 | - * @param string $url Link's url |
|
| 569 | - * @return string The thumb url |
|
| 570 | - */ |
|
| 566 | + * Search an appropriate thumb for url |
|
| 567 | + * |
|
| 568 | + * @param string $url Link's url |
|
| 569 | + * @return string The thumb url |
|
| 570 | + */ |
|
| 571 | 571 | public function thumb_process($url) |
| 572 | 572 | { |
| 573 | 573 | if (!$this->config['dir_activ_thumb']) |
@@ -588,12 +588,12 @@ discard block |
||
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | /** |
| 591 | - * Check if ascreen thumb exists |
|
| 592 | - * |
|
| 593 | - * @param string $protocol The protocol |
|
| 594 | - * @param string $host The hostname |
|
| 595 | - * @return bool True if ascreen file exixts, else false |
|
| 596 | - */ |
|
| 591 | + * Check if ascreen thumb exists |
|
| 592 | + * |
|
| 593 | + * @param string $protocol The protocol |
|
| 594 | + * @param string $host The hostname |
|
| 595 | + * @return bool True if ascreen file exixts, else false |
|
| 596 | + */ |
|
| 597 | 597 | private function _ascreen_exist($protocol, $host) |
| 598 | 598 | { |
| 599 | 599 | if (($thumb_info = $this->imagesize->getImageSize($protocol.'://'.$host.'/ascreen.jpg')) !== false) |
@@ -608,12 +608,12 @@ discard block |
||
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | /** |
| 611 | - * Primary work on banner, can edit, copy or check a banner |
|
| 612 | - * |
|
| 613 | - * @param string $banner The banner's remote url |
|
| 614 | - * @param array $error The array error, passed by reference |
|
| 615 | - * @return null |
|
| 616 | - */ |
|
| 611 | + * Primary work on banner, can edit, copy or check a banner |
|
| 612 | + * |
|
| 613 | + * @param string $banner The banner's remote url |
|
| 614 | + * @param array $error The array error, passed by reference |
|
| 615 | + * @return null |
|
| 616 | + */ |
|
| 617 | 617 | public function banner_process(&$banner, &$error) |
| 618 | 618 | { |
| 619 | 619 | $old_banner = $this->request->variable('old_banner', ''); |
@@ -649,13 +649,13 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
| 652 | - * Copy a remonte banner to server. |
|
| 653 | - * called by banner_process() |
|
| 654 | - * |
|
| 655 | - * @param string $banner The banner's remote url |
|
| 656 | - * @param array $error The array error, passed by reference |
|
| 657 | - * @return false|string String if no errors, else false |
|
| 658 | - */ |
|
| 652 | + * Copy a remonte banner to server. |
|
| 653 | + * called by banner_process() |
|
| 654 | + * |
|
| 655 | + * @param string $banner The banner's remote url |
|
| 656 | + * @param array $error The array error, passed by reference |
|
| 657 | + * @return false|string String if no errors, else false |
|
| 658 | + */ |
|
| 659 | 659 | private function _banner_upload($banner, &$error) |
| 660 | 660 | { |
| 661 | 661 | /** @var \phpbb\files\upload $upload */ |
@@ -687,13 +687,13 @@ discard block |
||
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | /** |
| 690 | - * Check than remote banner exists |
|
| 691 | - * called by banner_process() |
|
| 692 | - * |
|
| 693 | - * @param string $banner The banner's remote url |
|
| 694 | - * @param array $error The array error, passed by reference |
|
| 695 | - * @return false|string String if no errors, else false |
|
| 696 | - */ |
|
| 690 | + * Check than remote banner exists |
|
| 691 | + * called by banner_process() |
|
| 692 | + * |
|
| 693 | + * @param string $banner The banner's remote url |
|
| 694 | + * @param array $error The array error, passed by reference |
|
| 695 | + * @return false|string String if no errors, else false |
|
| 696 | + */ |
|
| 697 | 697 | private function _banner_remote($banner, &$error) |
| 698 | 698 | { |
| 699 | 699 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
@@ -801,11 +801,11 @@ discard block |
||
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | - * Delete a banner from server |
|
| 805 | - * |
|
| 806 | - * @param string $file The file's name |
|
| 807 | - * @return bool True if delete success, else false |
|
| 808 | - */ |
|
| 804 | + * Delete a banner from server |
|
| 805 | + * |
|
| 806 | + * @param string $file The file's name |
|
| 807 | + * @return bool True if delete success, else false |
|
| 808 | + */ |
|
| 809 | 809 | private function _banner_delete($file) |
| 810 | 810 | { |
| 811 | 811 | if (file_exists($this->get_banner_path($file))) |
@@ -818,12 +818,12 @@ discard block |
||
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /** |
| 821 | - * List flags |
|
| 822 | - * |
|
| 823 | - * @param string $flag_path The flag directory path |
|
| 824 | - * @param string $value Selected flag |
|
| 825 | - * @return string $list Html code |
|
| 826 | - */ |
|
| 821 | + * List flags |
|
| 822 | + * |
|
| 823 | + * @param string $flag_path The flag directory path |
|
| 824 | + * @param string $value Selected flag |
|
| 825 | + * @return string $list Html code |
|
| 826 | + */ |
|
| 827 | 827 | public function get_dir_flag_list($flag_path, $value) |
| 828 | 828 | { |
| 829 | 829 | $list = ''; |
@@ -858,10 +858,10 @@ discard block |
||
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
| 861 | - * Display recents links added |
|
| 862 | - * |
|
| 863 | - * @return null |
|
| 864 | - */ |
|
| 861 | + * Display recents links added |
|
| 862 | + * |
|
| 863 | + * @return null |
|
| 864 | + */ |
|
| 865 | 865 | public function recents() |
| 866 | 866 | { |
| 867 | 867 | if ($this->config['dir_recent_block']) |
@@ -938,13 +938,13 @@ discard block |
||
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | /** |
| 941 | - * Validate back link |
|
| 942 | - * |
|
| 943 | - * @param string $remote_url Page URL contains the backlink |
|
| 944 | - * @param bool $optional Link back is optional in this category? |
|
| 945 | - * @param bool $cron This methos is called by con process? |
|
| 946 | - * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) |
|
| 947 | - */ |
|
| 941 | + * Validate back link |
|
| 942 | + * |
|
| 943 | + * @param string $remote_url Page URL contains the backlink |
|
| 944 | + * @param bool $optional Link back is optional in this category? |
|
| 945 | + * @param bool $cron This methos is called by con process? |
|
| 946 | + * @return false|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) |
|
| 947 | + */ |
|
| 948 | 948 | public function validate_link_back($remote_url, $optional, $cron = false) |
| 949 | 949 | { |
| 950 | 950 | if (!$cron) |
@@ -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 - '.sizeof($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 | } |
@@ -530,12 +530,12 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | $this->db->sql_transaction('begin'); |
| 532 | 532 | |
| 533 | - $sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 533 | + $sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data); |
|
| 534 | 534 | $this->db->sql_query($sql); |
| 535 | 535 | |
| 536 | - $sql = 'UPDATE ' . $this->links_table . ' |
|
| 536 | + $sql = 'UPDATE '.$this->links_table.' |
|
| 537 | 537 | SET link_vote = link_vote + 1, |
| 538 | - link_note = link_note + ' . (int) $data['vote_note'] . ' |
|
| 538 | + link_note = link_note + ' . (int) $data['vote_note'].' |
|
| 539 | 539 | WHERE link_id = ' . (int) $link_id; |
| 540 | 540 | $this->db->sql_query($sql); |
| 541 | 541 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | if ($this->request->is_ajax()) |
| 545 | 545 | { |
| 546 | - $sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id; |
|
| 546 | + $sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id; |
|
| 547 | 547 | $result = $this->db->sql_query($sql); |
| 548 | 548 | $data = $this->db->sql_fetchrow($result); |
| 549 | 549 | |
@@ -577,8 +577,8 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | $details = parse_url($url); |
| 579 | 579 | |
| 580 | - $root_url = $details['scheme'].'://'.$details['host']; |
|
| 581 | - $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
| 580 | + $root_url = $details['scheme'].'://'.$details['host']; |
|
| 581 | + $absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url; |
|
| 582 | 582 | |
| 583 | 583 | if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host'])) |
| 584 | 584 | { |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | $destination = $this->get_banner_path(); |
| 622 | 622 | |
| 623 | 623 | // Can we upload? |
| 624 | - $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; |
|
| 624 | + $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 | 625 | |
| 626 | 626 | if ($banner && $can_upload) |
| 627 | 627 | { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | |
| 668 | 668 | $file = $upload->handle_upload('files.types.remote', $banner); |
| 669 | 669 | |
| 670 | - $prefix = unique_id() . '_'; |
|
| 670 | + $prefix = unique_id().'_'; |
|
| 671 | 671 | $file->clean_filename('real', $prefix); |
| 672 | 672 | |
| 673 | 673 | if (sizeof($file->error)) |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | { |
| 699 | 699 | if (!preg_match('#^(http|https|ftp)://#i', $banner)) |
| 700 | 700 | { |
| 701 | - $banner = 'http://' . $banner; |
|
| 701 | + $banner = 'http://'.$banner; |
|
| 702 | 702 | } |
| 703 | 703 | 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)) |
| 704 | 704 | { |
@@ -729,8 +729,8 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | // Check image type |
| 732 | - $types = \phpbb\files\upload::image_types(); |
|
| 733 | - $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
| 732 | + $types = \phpbb\files\upload::image_types(); |
|
| 733 | + $extension = strtolower(\phpbb\files\filespec::get_extension($banner)); |
|
| 734 | 734 | |
| 735 | 735 | // Check if this is actually an image |
| 736 | 736 | if ($file_stream = @fopen($banner, 'r')) |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | if (file_exists($flag_path.$img_file)) |
| 852 | 852 | { |
| 853 | - $list .= '<option value="' . $img_file . '" ' . (($img_file == $value) ? 'selected="selected"' : '') . '>' . $name . '</option>'; |
|
| 853 | + $list .= '<option value="'.$img_file.'" '.(($img_file == $value) ? 'selected="selected"' : '').'>'.$name.'</option>'; |
|
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | |
@@ -866,8 +866,8 @@ discard block |
||
| 866 | 866 | { |
| 867 | 867 | if ($this->config['dir_recent_block']) |
| 868 | 868 | { |
| 869 | - $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
| 870 | - $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])); |
|
| 869 | + $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns']; |
|
| 870 | + $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])); |
|
| 871 | 871 | |
| 872 | 872 | $sql_array = array( |
| 873 | 873 | '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', |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | if (sizeof($rowset)) |
| 901 | 901 | { |
| 902 | 902 | $this->template->assign_block_vars('block', array( |
| 903 | - 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']) . '%', |
|
| 903 | + 'S_COL_WIDTH' => (100 / $this->config['dir_recent_columns']).'%', |
|
| 904 | 904 | )); |
| 905 | 905 | |
| 906 | 906 | 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 | |
| 925 | 925 | 'L_DIR_SEARCH_NB_CLICKS' => $this->language->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']), |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | protected $categories_table; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * Constructor |
|
| 30 | - * |
|
| 31 | - * @param \phpbb\db\driver\driver_interface $db Database connection |
|
| 32 | - * @param string $categories_table Table name |
|
| 33 | - * @access public |
|
| 34 | - */ |
|
| 29 | + * Constructor |
|
| 30 | + * |
|
| 31 | + * @param \phpbb\db\driver\driver_interface $db Database connection |
|
| 32 | + * @param string $categories_table Table name |
|
| 33 | + * @access public |
|
| 34 | + */ |
|
| 35 | 35 | public function __construct(\phpbb\db\driver\driver_interface $db, $categories_table) |
| 36 | 36 | { |
| 37 | 37 | $this->db = $db; |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * {@inheritdoc} |
|
| 43 | - * |
|
| 44 | - * @api |
|
| 45 | - */ |
|
| 42 | + * {@inheritdoc} |
|
| 43 | + * |
|
| 44 | + * @api |
|
| 45 | + */ |
|
| 46 | 46 | public function load($resource, $type = null) |
| 47 | 47 | { |
| 48 | 48 | $routes = new RouteCollection(); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * {@inheritdoc} |
|
| 82 | - * |
|
| 83 | - * @api |
|
| 84 | - */ |
|
| 81 | + * {@inheritdoc} |
|
| 82 | + * |
|
| 83 | + * @api |
|
| 84 | + */ |
|
| 85 | 85 | public function supports($resource, $type = null) |
| 86 | 86 | { |
| 87 | 87 | return $type === 'ernadoo_phpbbdirectory_route'; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct(\phpbb\db\driver\driver_interface $db, $categories_table) |
| 36 | 36 | { |
| 37 | - $this->db = $db; |
|
| 37 | + $this->db = $db; |
|
| 38 | 38 | $this->categories_table = $categories_table; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | while ($row = $this->db->sql_fetchrow($result)) |
| 68 | 68 | { |
| 69 | 69 | $defaults['cat_id'] = $row['cat_id']; |
| 70 | - $path = 'directory/' . $row['cat_route'] . '/{page}/{sort_days}/{sort_key}/{sort_dir}'; |
|
| 70 | + $path = 'directory/'.$row['cat_route'].'/{page}/{sort_days}/{sort_key}/{sort_dir}'; |
|
| 71 | 71 | |
| 72 | 72 | $route = new Route($path, $defaults, $requirements); |
| 73 | - $routes->add('ernadoo_phpbbdirectory_dynamic_route_' . $row['cat_id'], $route); |
|
| 73 | + $routes->add('ernadoo_phpbbdirectory_dynamic_route_'.$row['cat_id'], $route); |
|
| 74 | 74 | } |
| 75 | 75 | $this->db->sql_freeresult(); |
| 76 | 76 | |
@@ -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 | $language->add_lang('directory', 'ernadoo/phpbbdirectory'); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | throw new \phpbb\exception\http_exception(404, 'DIR_ERROR_NO_CATS'); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)); |
|
| 122 | + $url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)); |
|
| 123 | 123 | |
| 124 | 124 | return new RedirectResponse($url, 301); |
| 125 | 125 | } |
@@ -145,13 +145,13 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $start = ($page - 1) * $this->config['dir_show']; |
| 147 | 147 | |
| 148 | - $default_sort_days = 0; |
|
| 148 | + $default_sort_days = 0; |
|
| 149 | 149 | $default_sort_key = (string) substr($this->config['dir_default_order'], 0, 1); |
| 150 | 150 | $default_sort_dir = (string) substr($this->config['dir_default_order'], 2); |
| 151 | 151 | |
| 152 | 152 | $sort_days = (!$sort_days) ? $this->request->variable('st', $default_sort_days) : $sort_days; |
| 153 | 153 | $sort_key = (!$sort_key) ? $this->request->variable('sk', $default_sort_key) : $sort_key; |
| 154 | - $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
| 154 | + $sort_dir = (!$sort_dir) ? $this->request->variable('sd', $default_sort_dir) : $sort_dir; |
|
| 155 | 155 | $link_list = $rowset = array(); |
| 156 | 156 | |
| 157 | 157 | // Categorie ordering options |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | $min_post_time = time() - ($sort_days * 86400); |
| 190 | 190 | |
| 191 | 191 | $sql = 'SELECT COUNT(link_id) AS nb_links |
| 192 | - FROM ' . $this->links_table . ' |
|
| 193 | - WHERE link_cat = ' . (int) $cat_id . ' |
|
| 192 | + FROM ' . $this->links_table.' |
|
| 193 | + WHERE link_cat = ' . (int) $cat_id.' |
|
| 194 | 194 | AND link_time >= ' . $min_post_time; |
| 195 | 195 | $result = $this->db->sql_query($sql); |
| 196 | 196 | $nb_links = (int) $this->db->sql_fetchfield('nb_links'); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | else |
| 206 | 206 | { |
| 207 | 207 | $sql_limit_time = ''; |
| 208 | - $nb_links = (int) $this->categorie->data['cat_links']; |
|
| 208 | + $nb_links = (int) $this->categorie->data['cat_links']; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // Make sure $start is set to the last page if it exceeds the amount |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $this->categorie->make_cat_jumpbox(); |
| 219 | 219 | |
| 220 | 220 | $base_url = array( |
| 221 | - 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, |
|
| 221 | + 'routes' => 'ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, |
|
| 222 | 222 | 'params' => array_merge(array('cat_id' => $cat_id), $u_sort_param), |
| 223 | 223 | ); |
| 224 | 224 | |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | 'S_SELECT_SORT_KEY' => $s_sort_key, |
| 232 | 232 | 'S_SELECT_SORT_DAYS' => $s_limit_days, |
| 233 | 233 | 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), |
| 234 | - 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id, array('page' => $page)), |
|
| 234 | + 'S_PAGE_ACTION' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id, array('page' => $page)), |
|
| 235 | 235 | 'S_CAT_ID' => $cat_id, |
| 236 | 236 | |
| 237 | 237 | 'TOTAL_LINKS' => $this->language->lang('DIR_NB_LINKS', (int) $nb_links), |
| 238 | 238 | |
| 239 | 239 | 'U_NEW_SITE' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => $cat_id)), |
| 240 | 240 | |
| 241 | - 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id), |
|
| 241 | + 'U_VIEW_CAT' => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id), |
|
| 242 | 242 | 'U_WATCH_CAT' => $s_watching_categorie['link'], |
| 243 | 243 | 'U_WATCH_CAT_TOGGLE' => $s_watching_categorie['link_toggle'], |
| 244 | 244 | 'S_WATCH_CAT_TITLE' => $s_watching_categorie['title'], |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | if (is_array($sort_by_sql[$sort_key])) |
| 270 | 270 | { |
| 271 | - $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; |
|
| 271 | + $sql_sort_order = implode(' '.$direction.', ', $sort_by_sql[$sort_key]).' '.$direction; |
|
| 272 | 272 | } |
| 273 | 273 | else |
| 274 | 274 | { |
| 275 | - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; |
|
| 275 | + $sql_sort_order = $sort_by_sql[$sort_key].' '.$direction; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // Grab just the sorted link ids |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | ), |
| 316 | 316 | array( |
| 317 | 317 | 'FROM' => array($this->votes_table => 'v'), |
| 318 | - 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = ' . $this->user->data['user_id'] |
|
| 318 | + 'ON' => 'l.link_id = v.vote_link_id AND v.vote_user_id = '.$this->user->data['user_id'] |
|
| 319 | 319 | ) |
| 320 | 320 | ), |
| 321 | 321 | 'WHERE' => $this->db->sql_in_set('l.link_id', $link_list) |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $link_list = ($store_reverse) ? array_reverse($link_list) : $link_list; |
| 334 | 334 | |
| 335 | - $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
| 336 | - $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
| 335 | + $votes_status = ($this->categorie->data['cat_allow_votes']) ? true : false; |
|
| 336 | + $comments_status = ($this->categorie->data['cat_allow_comments']) ? true : false; |
|
| 337 | 337 | |
| 338 | 338 | foreach ($link_list as $link_id) |
| 339 | 339 | { |
@@ -343,10 +343,10 @@ discard block |
||
| 343 | 343 | $s_note = $this->link->display_note($site['link_note'], $site['link_vote'], $votes_status); |
| 344 | 344 | $s_thumb = $this->link->display_thumb($site); |
| 345 | 345 | $s_vote = $this->link->display_vote($site); |
| 346 | - $s_banner = $this->link->display_bann($site); |
|
| 347 | - $s_rss = $this->link->display_rss($site); |
|
| 346 | + $s_banner = $this->link->display_bann($site); |
|
| 347 | + $s_rss = $this->link->display_rss($site); |
|
| 348 | 348 | |
| 349 | - $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')))); |
|
| 349 | + $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')))); |
|
| 350 | 350 | $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')))); |
| 351 | 351 | |
| 352 | 352 | $this->template->assign_block_vars('site', array( |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $this->template->assign_block_vars('no_draw_link', array()); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - $page_title = $this->language->lang('DIRECTORY') . ' - ' . $this->categorie->data['cat_name']; |
|
| 385 | + $page_title = $this->language->lang('DIRECTORY').' - '.$this->categorie->data['cat_name']; |
|
| 386 | 386 | |
| 387 | 387 | $this->categorie->display(); |
| 388 | 388 | |
@@ -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()) |
@@ -69,19 +69,19 @@ discard block |
||
| 69 | 69 | private $update; |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | - * Constructor |
|
| 73 | - * |
|
| 74 | - * @param \phpbb\cache\service $cache Cache object |
|
| 75 | - * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 76 | - * @param \phpbb\controller\helper $helper Helper object |
|
| 77 | - * @param \phpbb\language\language $language Language object |
|
| 78 | - * @param \phpbb\log\log $log Log object |
|
| 79 | - * @param \phpbb\request\request $request Request object |
|
| 80 | - * @param \phpbb\template\template $template Template object |
|
| 81 | - * @param \phpbb\user $user User object |
|
| 82 | - * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 83 | - * @param \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category PhpBB Directory extension nestedset object |
|
| 84 | - */ |
|
| 72 | + * Constructor |
|
| 73 | + * |
|
| 74 | + * @param \phpbb\cache\service $cache Cache object |
|
| 75 | + * @param \phpbb\db\driver\driver_interface $db Database object |
|
| 76 | + * @param \phpbb\controller\helper $helper Helper object |
|
| 77 | + * @param \phpbb\language\language $language Language object |
|
| 78 | + * @param \phpbb\log\log $log Log object |
|
| 79 | + * @param \phpbb\request\request $request Request object |
|
| 80 | + * @param \phpbb\template\template $template Template object |
|
| 81 | + * @param \phpbb\user $user User object |
|
| 82 | + * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object |
|
| 83 | + * @param \ernadoo\phpbbdirectory\core\nestedset_category $nestedset_category PhpBB Directory extension nestedset object |
|
| 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 | 87 | $this->cache = $cache; |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * Initialize defaults data for add page |
|
| 109 | - * |
|
| 110 | - * @return null |
|
| 111 | - */ |
|
| 108 | + * Initialize defaults data for add page |
|
| 109 | + * |
|
| 110 | + * @return null |
|
| 111 | + */ |
|
| 112 | 112 | public function action_add() |
| 113 | 113 | { |
| 114 | 114 | $this->cat_id = $this->parent_id; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * Display deleting page |
|
| 147 | - * |
|
| 148 | - * @return null |
|
| 149 | - */ |
|
| 146 | + * Display deleting page |
|
| 147 | + * |
|
| 148 | + * @return null |
|
| 149 | + */ |
|
| 150 | 150 | public function action_delete() |
| 151 | 151 | { |
| 152 | 152 | if (!$this->cat_id) |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | - * Initialize data for edit page |
|
| 201 | - * |
|
| 202 | - * @return null |
|
| 203 | - */ |
|
| 200 | + * Initialize data for edit page |
|
| 201 | + * |
|
| 202 | + * @return null |
|
| 203 | + */ |
|
| 204 | 204 | public function action_edit() |
| 205 | 205 | { |
| 206 | 206 | $row = $this->_get_cat_info($this->cat_id); |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * Move order categories |
|
| 231 | - * |
|
| 232 | - * @return null |
|
| 233 | - */ |
|
| 230 | + * Move order categories |
|
| 231 | + * |
|
| 232 | + * @return null |
|
| 233 | + */ |
|
| 234 | 234 | public function action_move() |
| 235 | 235 | { |
| 236 | 236 | if (!$this->cat_id) |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | - * Display progress bar for syncinc categories |
|
| 277 | - * |
|
| 278 | - * @return null |
|
| 279 | - */ |
|
| 276 | + * Display progress bar for syncinc categories |
|
| 277 | + * |
|
| 278 | + * @return null |
|
| 279 | + */ |
|
| 280 | 280 | public function action_progress_bar() |
| 281 | 281 | { |
| 282 | 282 | $start = $this->request->variable('start', 0); |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
| 300 | - * Get link's ID interval for _sync_dir_links() |
|
| 301 | - * |
|
| 302 | - * @return null |
|
| 303 | - */ |
|
| 300 | + * Get link's ID interval for _sync_dir_links() |
|
| 301 | + * |
|
| 302 | + * @return null |
|
| 303 | + */ |
|
| 304 | 304 | public function action_sync() |
| 305 | 305 | { |
| 306 | 306 | if (!$this->cat_id) |
@@ -382,10 +382,10 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /** |
| 385 | - * Sync category data |
|
| 386 | - * |
|
| 387 | - * @return null |
|
| 388 | - */ |
|
| 385 | + * Sync category data |
|
| 386 | + * |
|
| 387 | + * @return null |
|
| 388 | + */ |
|
| 389 | 389 | public function action_sync_cat() |
| 390 | 390 | { |
| 391 | 391 | $sql = 'SELECT cat_name |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | - * Display categories page |
|
| 413 | - * |
|
| 414 | - * @return null |
|
| 415 | - */ |
|
| 412 | + * Display categories page |
|
| 413 | + * |
|
| 414 | + * @return null |
|
| 415 | + */ |
|
| 416 | 416 | public function display_cats() |
| 417 | 417 | { |
| 418 | 418 | // Default management page |
@@ -506,22 +506,22 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | /** |
| 509 | - * Set page url |
|
| 510 | - * |
|
| 511 | - * @param string $u_action Custom form action |
|
| 512 | - * @return null |
|
| 513 | - * @access public |
|
| 514 | - */ |
|
| 509 | + * Set page url |
|
| 510 | + * |
|
| 511 | + * @param string $u_action Custom form action |
|
| 512 | + * @return null |
|
| 513 | + * @access public |
|
| 514 | + */ |
|
| 515 | 515 | public function set_page_url($u_action) |
| 516 | 516 | { |
| 517 | 517 | $this->u_action = $u_action; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
| 521 | - * Update cat table |
|
| 522 | - * |
|
| 523 | - * @return null |
|
| 524 | - */ |
|
| 521 | + * Update cat table |
|
| 522 | + * |
|
| 523 | + * @return null |
|
| 524 | + */ |
|
| 525 | 525 | public function update() |
| 526 | 526 | { |
| 527 | 527 | if (!check_form_key($this->form_key)) |
@@ -611,13 +611,13 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /** |
| 614 | - * Check route |
|
| 615 | - * |
|
| 616 | - * @param string $route Route text |
|
| 617 | - * @return null |
|
| 618 | - * @access public |
|
| 619 | - * @throws \phpbb\pages\exception\unexpected_value |
|
| 620 | - */ |
|
| 614 | + * Check route |
|
| 615 | + * |
|
| 616 | + * @param string $route Route text |
|
| 617 | + * @return null |
|
| 618 | + * @access public |
|
| 619 | + * @throws \phpbb\pages\exception\unexpected_value |
|
| 620 | + */ |
|
| 621 | 621 | private function _check_route($route) |
| 622 | 622 | { |
| 623 | 623 | // Route is a required field |
@@ -648,11 +648,11 @@ discard block |
||
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | /** |
| 651 | - * Display form |
|
| 652 | - * |
|
| 653 | - * @param string $parents_list Drop-down list |
|
| 654 | - * @return null |
|
| 655 | - */ |
|
| 651 | + * Display form |
|
| 652 | + * |
|
| 653 | + * @param string $parents_list Drop-down list |
|
| 654 | + * @return null |
|
| 655 | + */ |
|
| 656 | 656 | private function _display_cat_form($parents_list) |
| 657 | 657 | { |
| 658 | 658 | $dir_cat_desc_data = array( |
@@ -724,11 +724,11 @@ discard block |
||
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | /** |
| 727 | - * Get category details |
|
| 728 | - * |
|
| 729 | - * @param int $cat_id The category ID |
|
| 730 | - * @return array |
|
| 731 | - */ |
|
| 727 | + * Get category details |
|
| 728 | + * |
|
| 729 | + * @param int $cat_id The category ID |
|
| 730 | + * @return array |
|
| 731 | + */ |
|
| 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 |
@@ -747,10 +747,10 @@ discard block |
||
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | /** |
| 750 | - * Update category data |
|
| 751 | - * |
|
| 752 | - * @return array |
|
| 753 | - */ |
|
| 750 | + * Update category data |
|
| 751 | + * |
|
| 752 | + * @return array |
|
| 753 | + */ |
|
| 754 | 754 | private function _update_cat_data() |
| 755 | 755 | { |
| 756 | 756 | if (!$this->cat_data['cat_name']) |
@@ -846,14 +846,14 @@ discard block |
||
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | /** |
| 849 | - * Remove complete category |
|
| 850 | - * |
|
| 851 | - * @param string $action_links Action for categories links |
|
| 852 | - * @param string $action_subcats Action for sub-categories |
|
| 853 | - * @param int $links_to_id New category ID for links |
|
| 854 | - * @param int $subcats_to_id New category ID for sub-categories |
|
| 855 | - * @return array|null |
|
| 856 | - */ |
|
| 849 | + * Remove complete category |
|
| 850 | + * |
|
| 851 | + * @param string $action_links Action for categories links |
|
| 852 | + * @param string $action_subcats Action for sub-categories |
|
| 853 | + * @param int $links_to_id New category ID for links |
|
| 854 | + * @param int $subcats_to_id New category ID for sub-categories |
|
| 855 | + * @return array|null |
|
| 856 | + */ |
|
| 857 | 857 | private function _delete_cat($action_links = 'delete', $action_subcats = 'delete', $links_to_id = 0, $subcats_to_id = 0) |
| 858 | 858 | { |
| 859 | 859 | $this->cat_data = $this->_get_cat_info($this->cat_id); |
@@ -968,12 +968,12 @@ discard block |
||
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | /** |
| 971 | - * Move category content from one to another forum |
|
| 972 | - * |
|
| 973 | - * @param int $from_id |
|
| 974 | - * @param int $to_id |
|
| 975 | - * @return null |
|
| 976 | - */ |
|
| 971 | + * Move category content from one to another forum |
|
| 972 | + * |
|
| 973 | + * @param int $from_id |
|
| 974 | + * @param int $to_id |
|
| 975 | + * @return null |
|
| 976 | + */ |
|
| 977 | 977 | private function _move_cat_content($from_id, $to_id) |
| 978 | 978 | { |
| 979 | 979 | $sql = 'UPDATE ' . $this->links_table . ' |
@@ -989,10 +989,10 @@ discard block |
||
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | /** |
| 992 | - * Delete category content |
|
| 993 | - * |
|
| 994 | - * @return null |
|
| 995 | - */ |
|
| 992 | + * Delete category content |
|
| 993 | + * |
|
| 994 | + * @return null |
|
| 995 | + */ |
|
| 996 | 996 | private function _delete_cat_content() |
| 997 | 997 | { |
| 998 | 998 | $this->db->sql_transaction('begin'); |
@@ -1049,11 +1049,11 @@ discard block |
||
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | /** |
| 1052 | - * Update links counter |
|
| 1053 | - * |
|
| 1054 | - * @param int $cat_id The category ID |
|
| 1055 | - * @return null |
|
| 1056 | - */ |
|
| 1052 | + * Update links counter |
|
| 1053 | + * |
|
| 1054 | + * @param int $cat_id The category ID |
|
| 1055 | + * @return null |
|
| 1056 | + */ |
|
| 1057 | 1057 | private function _sync_dir_cat($cat_id) |
| 1058 | 1058 | { |
| 1059 | 1059 | $sql = 'SELECT COUNT(link_id) AS num_links |
@@ -1071,12 +1071,12 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | /** |
| 1074 | - * Update link data (note, vote, comment) |
|
| 1075 | - * |
|
| 1076 | - * @param int $start |
|
| 1077 | - * @param int $stop |
|
| 1078 | - * @return null |
|
| 1079 | - */ |
|
| 1074 | + * Update link data (note, vote, comment) |
|
| 1075 | + * |
|
| 1076 | + * @param int $start |
|
| 1077 | + * @param int $stop |
|
| 1078 | + * @return null |
|
| 1079 | + */ |
|
| 1080 | 1080 | private function _sync_dir_links($start, $stop) |
| 1081 | 1081 | { |
| 1082 | 1082 | $sql_ary = array( |
@@ -1119,12 +1119,12 @@ discard block |
||
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | /** |
| 1122 | - * Display icons drop-down list |
|
| 1123 | - * |
|
| 1124 | - * @param string $icons_path |
|
| 1125 | - * @param string $img_selected |
|
| 1126 | - * @return string |
|
| 1127 | - */ |
|
| 1122 | + * Display icons drop-down list |
|
| 1123 | + * |
|
| 1124 | + * @param string $icons_path |
|
| 1125 | + * @param string $img_selected |
|
| 1126 | + * @return string |
|
| 1127 | + */ |
|
| 1128 | 1128 | private function _get_dir_icon_list($icons_path, $img_selected) |
| 1129 | 1129 | { |
| 1130 | 1130 | $imglist = filelist($icons_path, ''); |
@@ -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' => (sizeof($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 | |
@@ -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 | $language->add_lang('directory', 'ernadoo/phpbbdirectory'); |
| 105 | 105 | |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | if ($this->request->is_set_post('cancel')) |
| 121 | 121 | { |
| 122 | - $redirect = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
| 122 | + $redirect = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
| 123 | 123 | redirect($redirect); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $sql = 'SELECT link_user_id |
| 127 | - FROM ' . $this->links_table . ' |
|
| 127 | + FROM ' . $this->links_table.' |
|
| 128 | 128 | WHERE link_id = ' . (int) $link_id; |
| 129 | 129 | $result = $this->db->sql_query($sql); |
| 130 | 130 | $link_data = $this->db->sql_fetchrow($result); |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | { |
| 146 | 146 | $this->link->del($cat_id, $link_id); |
| 147 | 147 | |
| 148 | - $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
| 148 | + $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
| 149 | 149 | meta_refresh(3, $meta_info); |
| 150 | - $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>'); |
|
| 150 | + $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>'); |
|
| 151 | 151 | return $this->helper->message($message); |
| 152 | 152 | } |
| 153 | 153 | else |
@@ -167,7 +167,7 @@ discard block |
||
| 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 |
| 170 | - FROM ' . $this->links_table . ' |
|
| 170 | + FROM ' . $this->links_table.' |
|
| 171 | 171 | WHERE link_id = ' . (int) $link_id; |
| 172 | 172 | $result = $this->db->sql_query($sql); |
| 173 | 173 | $link_data = $this->db->sql_fetchrow($result); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $cat_id = $this->request->variable('id', $cat_id); |
| 188 | 188 | $submit = $this->request->is_set_post('submit') ? true : false; |
| 189 | 189 | $refresh = $this->request->is_set_post('refresh_vc') ? true : false; |
| 190 | - $title = $this->language->lang('DIR_EDIT_SITE'); |
|
| 190 | + $title = $this->language->lang('DIR_EDIT_SITE'); |
|
| 191 | 191 | |
| 192 | 192 | $this->template->assign_block_vars('dir_navlinks', array( |
| 193 | 193 | 'FORUM_NAME' => $title, |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | 'old_banner' => $link_data['link_banner'], |
| 212 | 212 | ); |
| 213 | 213 | |
| 214 | - $site_description = generate_text_for_edit($link_data['link_description'], $link_data['link_uid'], $link_data['link_flags']); |
|
| 215 | - $link_data['link_banner'] = (preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $link_data['link_banner'])) ? $link_data['link_banner'] : ''; |
|
| 214 | + $site_description = generate_text_for_edit($link_data['link_description'], $link_data['link_uid'], $link_data['link_flags']); |
|
| 215 | + $link_data['link_banner'] = (preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $link_data['link_banner'])) ? $link_data['link_banner'] : ''; |
|
| 216 | 216 | |
| 217 | - $this->url = $link_data['link_url']; |
|
| 218 | - $this->site_name = $link_data['link_name']; |
|
| 217 | + $this->url = $link_data['link_url']; |
|
| 218 | + $this->site_name = $link_data['link_name']; |
|
| 219 | 219 | $this->description = $site_description['text']; |
| 220 | 220 | $this->guest_email = $link_data['link_guest_email']; |
| 221 | - $this->rss = $link_data['link_rss']; |
|
| 222 | - $this->banner = $link_data['link_banner']; |
|
| 221 | + $this->rss = $link_data['link_rss']; |
|
| 222 | + $this->banner = $link_data['link_banner']; |
|
| 223 | 223 | $this->back = $link_data['link_back']; |
| 224 | 224 | $this->flag = $link_data['link_flag']; |
| 225 | 225 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $cat_id = $this->request->variable('id', $cat_id); |
| 247 | 247 | $submit = $this->request->is_set_post('submit') ? true : false; |
| 248 | 248 | $refresh = $this->request->is_set_post('refresh_vc') ? true : false; |
| 249 | - $title = $this->language->lang('DIR_NEW_SITE'); |
|
| 249 | + $title = $this->language->lang('DIR_NEW_SITE'); |
|
| 250 | 250 | |
| 251 | 251 | $this->template->assign_block_vars('dir_navlinks', array( |
| 252 | 252 | 'FORUM_NAME' => $title, |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | // We check if user had already vot for this website. |
| 312 | 312 | $sql = 'SELECT vote_link_id |
| 313 | - FROM ' . $this->votes_table . ' |
|
| 313 | + FROM ' . $this->votes_table.' |
|
| 314 | 314 | WHERE ' . $this->db->sql_build_array('SELECT', $data); |
| 315 | 315 | $result = $this->db->sql_query($sql); |
| 316 | 316 | $data = $this->db->sql_fetchrow($result); |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $this->link->add_vote($link_id); |
| 324 | 324 | |
| 325 | - $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
| 325 | + $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
| 326 | 326 | meta_refresh(3, $meta_info); |
| 327 | - $message = $this->language->lang('DIR_VOTE_OK') . '<br /><br />' . $this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="' . $meta_info . '">', '</a>'); |
|
| 327 | + $message = $this->language->lang('DIR_VOTE_OK').'<br /><br />'.$this->language->lang('DIR_CLICK_RETURN_CAT', '<a href="'.$meta_info.'">', '</a>'); |
|
| 328 | 328 | return $this->helper->message($message); |
| 329 | 329 | } |
| 330 | 330 | |
@@ -349,18 +349,18 @@ discard block |
||
| 349 | 349 | return $this->helper->message('FORM_INVALID'); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - $this->url = $this->request->variable('url', ''); |
|
| 353 | - $this->site_name = $this->request->variable('site_name', '', true); |
|
| 352 | + $this->url = $this->request->variable('url', ''); |
|
| 353 | + $this->site_name = $this->request->variable('site_name', '', true); |
|
| 354 | 354 | $this->description = $this->request->variable('description', '', true); |
| 355 | 355 | $this->guest_email = $this->request->variable('guest_email', ''); |
| 356 | - $this->rss = $this->request->variable('rss', ''); |
|
| 357 | - $this->banner = $this->request->variable('banner', ''); |
|
| 356 | + $this->rss = $this->request->variable('rss', ''); |
|
| 357 | + $this->banner = $this->request->variable('banner', ''); |
|
| 358 | 358 | $this->back = $this->request->variable('back', ''); |
| 359 | 359 | $this->flag = $this->request->variable('flag', ''); |
| 360 | 360 | |
| 361 | 361 | if (!function_exists('validate_data')) |
| 362 | 362 | { |
| 363 | - include($this->root_path . 'includes/functions_user.' . $this->php_ext); |
|
| 363 | + include($this->root_path.'includes/functions_user.'.$this->php_ext); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // We define variables to check |
@@ -383,17 +383,17 @@ discard block |
||
| 383 | 383 | 'site_name' => array( |
| 384 | 384 | array('string', false, 1, 100)), |
| 385 | 385 | 'website' => array( |
| 386 | - array('string', false, 12, 255), |
|
| 387 | - array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
| 386 | + array('string', false, 12, 255), |
|
| 387 | + array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
| 388 | 388 | 'description' => array( |
| 389 | 389 | array('string', !$this->categorie->data['cat_must_describe'], 1, $this->config['dir_length_describe'])), |
| 390 | 390 | 'rss' => array( |
| 391 | 391 | array('string', true, 12, 255), |
| 392 | - array('match', empty($this->rss), '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
| 392 | + array('match', empty($this->rss), '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
|
| 393 | 393 | 'banner' => array( |
| 394 | 394 | array('string', true, 5, 255)), |
| 395 | 395 | 'back' => array( |
| 396 | - array('string', !$this->categorie->data['cat_link_back'], 12, 255), |
|
| 396 | + array('string', !$this->categorie->data['cat_link_back'], 12, 255), |
|
| 397 | 397 | array(array($this->link, 'link_back'), true)), |
| 398 | 398 | 'cat' => array( |
| 399 | 399 | array('num', '', 1)) |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | // Still no errors?? So let's go! |
| 440 | 440 | if (!$error) |
| 441 | 441 | { |
| 442 | - $this->banner = (!$this->banner && !$this->request->is_set_post('delete_banner')) ? $this->request->variable('old_banner', '') : $this->banner; |
|
| 443 | - $this->url = $this->link->clean_url($this->url); |
|
| 442 | + $this->banner = (!$this->banner && !$this->request->is_set_post('delete_banner')) ? $this->request->variable('old_banner', '') : $this->banner; |
|
| 443 | + $this->url = $this->link->clean_url($this->url); |
|
| 444 | 444 | |
| 445 | 445 | $data_edit = array( |
| 446 | 446 | 'link_user_id' => $this->link_user_id, |
@@ -485,10 +485,10 @@ discard block |
||
| 485 | 485 | $this->link->add($data_add, $need_approval); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id); |
|
| 488 | + $meta_info = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$cat_id); |
|
| 489 | 489 | meta_refresh(3, $meta_info); |
| 490 | 490 | $message = ($need_approval) ? $this->language->lang('DIR_'.strtoupper($mode).'_SITE_ACTIVE') : $this->language->lang('DIR_'.strtoupper($mode).'_SITE_OK'); |
| 491 | - $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 | + $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>'); |
|
| 492 | 492 | return $this->helper->message($message); |
| 493 | 493 | } |
| 494 | 494 | else |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | { |
| 518 | 518 | if (!function_exists('file_gc')) |
| 519 | 519 | { |
| 520 | - include($this->root_path . 'includes/functions_download.' . $this->php_ext); |
|
| 520 | + include($this->root_path.'includes/functions_download.'.$this->php_ext); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | $file_path = $this->get_banner_path($banner_img); |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | |
| 573 | 573 | if (!function_exists('display_custom_bbcodes')) |
| 574 | 574 | { |
| 575 | - include($this->root_path . 'includes/functions_display.' . $this->php_ext); |
|
| 575 | + include($this->root_path.'includes/functions_display.'.$this->php_ext); |
|
| 576 | 576 | } |
| 577 | 577 | display_custom_bbcodes(); |
| 578 | 578 | add_form_key('dir_form'); |
@@ -581,17 +581,17 @@ discard block |
||
| 581 | 581 | $flag_path = $ext_path.'images/flags/'; |
| 582 | 582 | |
| 583 | 583 | $s_guest = (!$this->user->data['is_registered'] || !empty($this->guest_email)); |
| 584 | - $s_rss = $this->config['dir_activ_rss']; |
|
| 585 | - $s_banner = $this->config['dir_activ_banner']; |
|
| 584 | + $s_rss = $this->config['dir_activ_rss']; |
|
| 585 | + $s_banner = $this->config['dir_activ_banner']; |
|
| 586 | 586 | $s_back = $this->categorie->data['cat_link_back']; |
| 587 | 587 | $s_flag = $this->config['dir_activ_flag']; |
| 588 | 588 | |
| 589 | 589 | $this->template->assign_vars(array( |
| 590 | - '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>'), |
|
| 591 | - 'IMG_STATUS' => ($this->config['allow_bbcode']) ? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), |
|
| 590 | + '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>'), |
|
| 591 | + 'IMG_STATUS' => ($this->config['allow_bbcode']) ? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), |
|
| 592 | 592 | 'SMILIES_STATUS' => ($this->config['allow_smilies']) ? $this->language->lang('SMILIES_ARE_ON') : $this->language->lang('SMILIES_ARE_OFF'), |
| 593 | 593 | 'URL_STATUS' => ($this->config['allow_post_links']) ? $this->language->lang('URL_IS_ON') : $this->language->lang('URL_IS_OFF'), |
| 594 | - 'FLASH_STATUS' => ($this->config['allow_bbcode'] && $this->config['allow_post_flash']) ? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), |
|
| 594 | + 'FLASH_STATUS' => ($this->config['allow_bbcode'] && $this->config['allow_post_flash']) ? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), |
|
| 595 | 595 | |
| 596 | 596 | 'L_TITLE' => $title, |
| 597 | 597 | 'L_DIR_DESCRIPTION_EXP' => $this->language->lang('DIR_DESCRIPTION_EXP', $this->config['dir_length_describe']), |