Completed
Push — 3.2.x ( 405e9a...927199 )
by Erwan
03:07
created
core/link.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -57,23 +57,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
473 473
 	}
474 474
 
475 475
 	/**
476
-	* Display and resize a banner
477
-	*
478
-	* @param	array	$data		link's data from db
479
-	* @return	string	$s_banner	html code.
480
-	*/
476
+	 * Display and resize a banner
477
+	 *
478
+	 * @param	array	$data		link's data from db
479
+	 * @return	string	$s_banner	html code.
480
+	 */
481 481
 	public function display_bann($data)
482 482
 	{
483 483
 		if (!empty($data['link_banner']))
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 	}
516 516
 
517 517
 	/**
518
-	* Add a vote in db, for a specifi link
519
-	*
520
-	* @param	int		$link_id	Link_id from db
521
-	* @param	int		$note		Note submeted
522
-	* @return	null
523
-	*/
518
+	 * Add a vote in db, for a specifi link
519
+	 *
520
+	 * @param	int		$link_id	Link_id from db
521
+	 * @param	int		$note		Note submeted
522
+	 * @return	null
523
+	 */
524 524
 	public function add_vote($link_id, $note)
525 525
 	{
526 526
 		$data = array(
@@ -564,11 +564,11 @@  discard block
 block discarded – undo
564 564
 	}
565 565
 
566 566
 	/**
567
-	* Search an appropriate thumb for url
568
-	*
569
-	* @param	string	$url	Link's url
570
-	* @return	string			The thumb url
571
-	*/
567
+	 * Search an appropriate thumb for url
568
+	 *
569
+	 * @param	string	$url	Link's url
570
+	 * @return	string			The thumb url
571
+	 */
572 572
 	public function thumb_process($url)
573 573
 	{
574 574
 		if (!$this->config['dir_activ_thumb'])
@@ -589,12 +589,12 @@  discard block
 block discarded – undo
589 589
 	}
590 590
 
591 591
 	/**
592
-	* Check if ascreen thumb exists
593
-	*
594
-	* @param	string	$protocol	The protocol
595
-	* @param	string	$host		The hostname
596
-	* @return	bool				True if ascreen file exixts, else false
597
-	*/
592
+	 * Check if ascreen thumb exists
593
+	 *
594
+	 * @param	string	$protocol	The protocol
595
+	 * @param	string	$host		The hostname
596
+	 * @return	bool				True if ascreen file exixts, else false
597
+	 */
598 598
 	private function _ascreen_exist($protocol, $host)
599 599
 	{
600 600
 		if (($thumb_info = $this->imagesize->getImageSize($protocol.'://'.$host.'/ascreen.jpg')) !== false)
@@ -609,12 +609,12 @@  discard block
 block discarded – undo
609 609
 	}
610 610
 
611 611
 	/**
612
-	* Primary work on banner, can edit, copy or check a banner
613
-	*
614
-	* @param	string	$banner	The banner's remote url
615
-	* @param	array	$error	The array error, passed by reference
616
-	* @return	null
617
-	*/
612
+	 * Primary work on banner, can edit, copy or check a banner
613
+	 *
614
+	 * @param	string	$banner	The banner's remote url
615
+	 * @param	array	$error	The array error, passed by reference
616
+	 * @return	null
617
+	 */
618 618
 	public function banner_process(&$banner, &$error)
619 619
 	{
620 620
 		$old_banner = $this->request->variable('old_banner', '');
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
 	}
651 651
 
652 652
 	/**
653
-	* Copy a remonte banner to server.
654
-	* called by banner_process()
655
-	*
656
-	* @param	string	$banner The banner's remote url
657
-	* @param	array	$error	The array error, passed by reference
658
-	* @return	false|string	String if no errors, else false
659
-	*/
653
+	 * Copy a remonte banner to server.
654
+	 * called by banner_process()
655
+	 *
656
+	 * @param	string	$banner The banner's remote url
657
+	 * @param	array	$error	The array error, passed by reference
658
+	 * @return	false|string	String if no errors, else false
659
+	 */
660 660
 	private function _banner_upload($banner, &$error)
661 661
 	{
662 662
 		/** @var \phpbb\files\upload $upload */
@@ -688,13 +688,13 @@  discard block
 block discarded – undo
688 688
 	}
689 689
 
690 690
 	/**
691
-	* Check than remote banner exists
692
-	* called by banner_process()
693
-	*
694
-	* @param	string	$banner	The banner's remote url
695
-	* @param	array	$error	The array error, passed by reference
696
-	* @return	false|string	String if no errors, else false
697
-	*/
691
+	 * Check than remote banner exists
692
+	 * called by banner_process()
693
+	 *
694
+	 * @param	string	$banner	The banner's remote url
695
+	 * @param	array	$error	The array error, passed by reference
696
+	 * @return	false|string	String if no errors, else false
697
+	 */
698 698
 	private function _banner_remote($banner, &$error)
699 699
 	{
700 700
 		if (!preg_match('#^(http|https|ftp)://#i', $banner))
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
 	}
803 803
 
804 804
 	/**
805
-	* Delete a banner from server
806
-	*
807
-	* @param	string	$file	The file's name
808
-	* @return	bool			True if delete success, else false
809
-	*/
805
+	 * Delete a banner from server
806
+	 *
807
+	 * @param	string	$file	The file's name
808
+	 * @return	bool			True if delete success, else false
809
+	 */
810 810
 	private function _banner_delete($file)
811 811
 	{
812 812
 		if (file_exists($this->get_banner_path($file)))
@@ -819,12 +819,12 @@  discard block
 block discarded – undo
819 819
 	}
820 820
 
821 821
 	/**
822
-	* List flags
823
-	*
824
-	* @param	string	$flag_path	The flag directory path
825
-	* @param	string	$value		Selected flag
826
-	* @return	string	$list		Html code
827
-	*/
822
+	 * List flags
823
+	 *
824
+	 * @param	string	$flag_path	The flag directory path
825
+	 * @param	string	$value		Selected flag
826
+	 * @return	string	$list		Html code
827
+	 */
828 828
 	public function get_dir_flag_list($flag_path, $value)
829 829
 	{
830 830
 		$list = '';
@@ -859,10 +859,10 @@  discard block
 block discarded – undo
859 859
 	}
860 860
 
861 861
 	/**
862
-	* Display recents links added
863
-	*
864
-	* @return	null
865
-	*/
862
+	 * Display recents links added
863
+	 *
864
+	 * @return	null
865
+	 */
866 866
 	public function recents()
867 867
 	{
868 868
 		if ($this->config['dir_recent_block'])
@@ -939,13 +939,13 @@  discard block
 block discarded – undo
939 939
 	}
940 940
 
941 941
 	/**
942
-	* Validate back link
943
-	*
944
-	* @param	string		$remote_url	Page URL contains the backlink
945
-	* @param	bool		$optional	Link back is optional in this category?
946
-	* @param	bool		$cron		This methos is called by con process?
947
-	* @return	false|string			Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
948
-	*/
942
+	 * Validate back link
943
+	 *
944
+	 * @param	string		$remote_url	Page URL contains the backlink
945
+	 * @param	bool		$optional	Link back is optional in this category?
946
+	 * @param	bool		$cron		This methos is called by con process?
947
+	 * @return	false|string			Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
948
+	 */
949 949
 	public function validate_link_back($remote_url, $optional, $cron = false)
950 950
 	{
951 951
 		if (!$cron)
Please login to merge, or discard this patch.