@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | private $cat_data; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Constructor. |
|
| 26 | - * |
|
| 27 | - * @param \phpbb\config\config $config Config object |
|
| 28 | - * @param \ernadoo\phpbbdirectory\core\cron $directory_cron PhpBB Directory extension link object |
|
| 29 | - */ |
|
| 25 | + * Constructor. |
|
| 26 | + * |
|
| 27 | + * @param \phpbb\config\config $config Config object |
|
| 28 | + * @param \ernadoo\phpbbdirectory\core\cron $directory_cron PhpBB Directory extension link object |
|
| 29 | + */ |
|
| 30 | 30 | public function __construct(\phpbb\config\config $config, \ernadoo\phpbbdirectory\core\cron $directory_cron) |
| 31 | 31 | { |
| 32 | 32 | $this->config = $config; |
@@ -34,66 +34,66 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * Manually set categorie data. |
|
| 38 | - * |
|
| 39 | - * @param array $cat_data Information about a category to be pruned. |
|
| 40 | - */ |
|
| 37 | + * Manually set categorie data. |
|
| 38 | + * |
|
| 39 | + * @param array $cat_data Information about a category to be pruned. |
|
| 40 | + */ |
|
| 41 | 41 | public function set_categorie_data($cat_data) |
| 42 | 42 | { |
| 43 | 43 | $this->cat_data = $cat_data; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * Runs this cron task. |
|
| 48 | - * |
|
| 49 | - * @return null |
|
| 50 | - */ |
|
| 47 | + * Runs this cron task. |
|
| 48 | + * |
|
| 49 | + * @return null |
|
| 50 | + */ |
|
| 51 | 51 | public function run() |
| 52 | 52 | { |
| 53 | 53 | $this->dir_cron->auto_check($this->cat_data); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Returns whether this cron task can run, given current board configuration. |
|
| 58 | - * |
|
| 59 | - * @return bool |
|
| 60 | - */ |
|
| 57 | + * Returns whether this cron task can run, given current board configuration. |
|
| 58 | + * |
|
| 59 | + * @return bool |
|
| 60 | + */ |
|
| 61 | 61 | public function is_runnable() |
| 62 | 62 | { |
| 63 | 63 | return !$this->config['use_system_cron'] && !empty($this->cat_data); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Returns whether this cron task should run now, because enough time |
|
| 68 | - * has passed since it was last run. |
|
| 69 | - * |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 67 | + * Returns whether this cron task should run now, because enough time |
|
| 68 | + * has passed since it was last run. |
|
| 69 | + * |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | 72 | public function should_run() |
| 73 | 73 | { |
| 74 | 74 | return $this->cat_data['cat_cron_enable'] && $this->cat_data['cat_cron_next'] < time(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Returns parameters of this cron task as an array. |
|
| 79 | - * The array has one key, c, whose value is id of the category to be pruned. |
|
| 80 | - * |
|
| 81 | - * @return array |
|
| 82 | - */ |
|
| 78 | + * Returns parameters of this cron task as an array. |
|
| 79 | + * The array has one key, c, whose value is id of the category to be pruned. |
|
| 80 | + * |
|
| 81 | + * @return array |
|
| 82 | + */ |
|
| 83 | 83 | public function get_parameters() |
| 84 | 84 | { |
| 85 | 85 | return array('c' => $this->cat_data['cat_id']); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Parses parameters found in $request, which is an instance of |
|
| 90 | - * \phpbb\request\request_interface. |
|
| 91 | - * |
|
| 92 | - * It is expected to have a key f whose value is id of the forum to be pruned. |
|
| 93 | - * |
|
| 94 | - * @param \phpbb\request\request_interface $request Request object. |
|
| 95 | - * @return null |
|
| 96 | - */ |
|
| 89 | + * Parses parameters found in $request, which is an instance of |
|
| 90 | + * \phpbb\request\request_interface. |
|
| 91 | + * |
|
| 92 | + * It is expected to have a key f whose value is id of the forum to be pruned. |
|
| 93 | + * |
|
| 94 | + * @param \phpbb\request\request_interface $request Request object. |
|
| 95 | + * @return null |
|
| 96 | + */ |
|
| 97 | 97 | public function parse_parameters(\phpbb\request\request_interface $request) |
| 98 | 98 | { |
| 99 | 99 | $this->cat_data = array(); |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function __construct(\phpbb\config\config $config, \ernadoo\phpbbdirectory\core\cron $directory_cron) |
| 31 | 31 | { |
| 32 | - $this->config = $config; |
|
| 33 | - $this->dir_cron = $directory_cron; |
|
| 32 | + $this->config = $config; |
|
| 33 | + $this->dir_cron = $directory_cron; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | return array( |
| 39 | 39 | 'drop_columns' => array( |
| 40 | - $this->table_prefix . 'directory_links' => array( |
|
| 40 | + $this->table_prefix.'directory_links' => array( |
|
| 41 | 41 | 'link_pagerank', |
| 42 | 42 | ), |
| 43 | 43 | ), |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | return array( |
| 50 | 50 | 'add_columns' => array( |
| 51 | - $this->table_prefix . 'directory_links' => array( |
|
| 51 | + $this->table_prefix.'directory_links' => array( |
|
| 52 | 52 | 'link_pagerank' => array('CHAR:2', ''), |
| 53 | 53 | ), |
| 54 | 54 | ), |
@@ -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) |