Completed
Push — remove-tables-constants ( 5940a1...6d7635 )
by Erwan
03:20
created
core/helper.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -37,37 +37,37 @@  discard block
 block discarded – undo
37 37
 	private $ext_name = 'ernadoo/phpbbdirectory';
38 38
 
39 39
 	/**
40
-	* Set the extension manager
41
-	*
42
-	* @param \phpbb\extension\manager	$phpbb_extension_manager
43
-	* @return null
44
-	*/
40
+	 * Set the extension manager
41
+	 *
42
+	 * @param \phpbb\extension\manager	$phpbb_extension_manager
43
+	 * @return null
44
+	 */
45 45
 	public function set_extension_manager(\phpbb\extension\manager $phpbb_extension_manager)
46 46
 	{
47 47
 		$this->extension_manager	= $phpbb_extension_manager;
48 48
 	}
49 49
 
50 50
 	/**
51
-	* Set the path helper
52
-	*
53
-	* @param \phpbb\path_helper	$path_helper
54
-	* @return null
55
-	*/
51
+	 * Set the path helper
52
+	 *
53
+	 * @param \phpbb\path_helper	$path_helper
54
+	 * @return null
55
+	 */
56 56
 	public function set_path_helper(\phpbb\path_helper $path_helper)
57 57
 	{
58 58
 		$this->path_helper = $path_helper;
59 59
 	}
60 60
 
61 61
 	/**
62
-	* Set the tables names
63
-	*
64
-	* @param string	$categories_table
65
-	* @param string	$comments_table
66
-	* @param string	$links_table
67
-	* @param string	$votes_table
68
-	* @param string	$watch_table
69
-	* @return null
70
-	*/
62
+	 * Set the tables names
63
+	 *
64
+	 * @param string	$categories_table
65
+	 * @param string	$comments_table
66
+	 * @param string	$links_table
67
+	 * @param string	$votes_table
68
+	 * @param string	$watch_table
69
+	 * @return null
70
+	 */
71 71
 	public function set_tables(string $categories_table, string $comments_table, string $links_table, string $votes_table, string $watch_table)
72 72
 	{
73 73
 		$this->comments_table		= $comments_table;
@@ -77,48 +77,48 @@  discard block
 block discarded – undo
77 77
 		$this->categories_table		= $categories_table;
78 78
 	}
79 79
 	/**
80
-	* Return ext name
81
-	*
82
-	* @param	bool	$web_root_path Whether the path should be relative to web root
83
-	* @return	string					Path to an extension
84
-	*/
80
+	 * Return ext name
81
+	 *
82
+	 * @param	bool	$web_root_path Whether the path should be relative to web root
83
+	 * @return	string					Path to an extension
84
+	 */
85 85
 	public function get_ext_name($web_root_path = false)
86 86
 	{
87 87
 		return (($web_root_path) ? $this->path_helper->get_web_root_path() : '') . $this->extension_manager->get_extension_path($this->ext_name);
88 88
 	}
89 89
 
90 90
 	/**
91
-	* Return path to resource image
92
-	*
93
-	* @param	string $type	is ressource type (flags|icons)
94
-	* @param	string $image	is the resource to display
95
-	* @return	string			The relative path to ressource
96
-	*/
91
+	 * Return path to resource image
92
+	 *
93
+	 * @param	string $type	is ressource type (flags|icons)
94
+	 * @param	string $image	is the resource to display
95
+	 * @return	string			The relative path to ressource
96
+	 */
97 97
 	public function get_img_path($type, $image = '')
98 98
 	{
99 99
 		return $this->get_ext_name(true) . 'images/' . $type . '/' . $image;
100 100
 	}
101 101
 
102 102
 	/**
103
-	* Return path to banner
104
-	*
105
-	* @param	string	$banner	is the physical name
106
-	* @return	string			The relative path to banner
107
-	*/
103
+	 * Return path to banner
104
+	 *
105
+	 * @param	string	$banner	is the physical name
106
+	 * @return	string			The relative path to banner
107
+	 */
108 108
 	public function get_banner_path($banner = '')
109 109
 	{
110 110
 		return 'files/' . $this->get_ext_name() . 'banners/' . $banner;
111 111
 	}
112 112
 
113 113
 	/**
114
-	* Return array entries that match the pattern
115
-	*
116
-	* @link http://php.net/manual/fr/function.preg-grep.php#95787
117
-	*
118
-	* @param 	string	$pattern	The pattern to search for
119
-	* @param	array	$input		The input array
120
-	* @return	array	$vals		Returns an array indexed using the keys from the input array
121
-	*/
114
+	 * Return array entries that match the pattern
115
+	 *
116
+	 * @link http://php.net/manual/fr/function.preg-grep.php#95787
117
+	 *
118
+	 * @param 	string	$pattern	The pattern to search for
119
+	 * @param	array	$input		The input array
120
+	 * @return	array	$vals		Returns an array indexed using the keys from the input array
121
+	 */
122 122
 	public function preg_grep_keys($pattern, $input)
123 123
 	{
124 124
 		$keys = preg_grep($pattern, array_keys($input));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	*/
45 45
 	public function set_extension_manager(\phpbb\extension\manager $phpbb_extension_manager)
46 46
 	{
47
-		$this->extension_manager	= $phpbb_extension_manager;
47
+		$this->extension_manager = $phpbb_extension_manager;
48 48
 	}
49 49
 
50 50
 	/**
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	*/
71 71
 	public function set_tables(string $categories_table, string $comments_table, string $links_table, string $votes_table, string $watch_table)
72 72
 	{
73
-		$this->comments_table		= $comments_table;
73
+		$this->comments_table = $comments_table;
74 74
 		$this->links_table			= $links_table;
75 75
 		$this->votes_table			= $votes_table;
76 76
 		$this->watch_table			= $watch_table;
77
-		$this->categories_table		= $categories_table;
77
+		$this->categories_table = $categories_table;
78 78
 	}
79 79
 	/**
80 80
 	* Return ext name
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	*/
85 85
 	public function get_ext_name($web_root_path = false)
86 86
 	{
87
-		return (($web_root_path) ? $this->path_helper->get_web_root_path() : '') . $this->extension_manager->get_extension_path($this->ext_name);
87
+		return (($web_root_path) ? $this->path_helper->get_web_root_path() : '').$this->extension_manager->get_extension_path($this->ext_name);
88 88
 	}
89 89
 
90 90
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	*/
97 97
 	public function get_img_path($type, $image = '')
98 98
 	{
99
-		return $this->get_ext_name(true) . 'images/' . $type . '/' . $image;
99
+		return $this->get_ext_name(true).'images/'.$type.'/'.$image;
100 100
 	}
101 101
 
102 102
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	*/
108 108
 	public function get_banner_path($banner = '')
109 109
 	{
110
-		return 'files/' . $this->get_ext_name() . 'banners/' . $banner;
110
+		return 'files/'.$this->get_ext_name().'banners/'.$banner;
111 111
 	}
112 112
 
113 113
 	/**
Please login to merge, or discard this patch.
core/link.php 2 patches
Indentation   +161 added lines, -161 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 calculate PageRank if needed
477
-	*
478
-	* @param	array	$data	Link's data from db
479
-	* @return	string			Pagerank, 'n/a' or false
480
-	*/
476
+	 * Display and calculate PageRank if needed
477
+	 *
478
+	 * @param	array	$data	Link's data from db
479
+	 * @return	string			Pagerank, 'n/a' or false
480
+	 */
481 481
 	public function display_pagerank($data)
482 482
 	{
483 483
 		if ($this->config['dir_activ_pagerank'])
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 	}
508 508
 
509 509
 	/**
510
-	* Display and resize a banner
511
-	*
512
-	* @param	array	$data		link's data from db
513
-	* @return	string	$s_banner	html code.
514
-	*/
510
+	 * Display and resize a banner
511
+	 *
512
+	 * @param	array	$data		link's data from db
513
+	 * @return	string	$s_banner	html code.
514
+	 */
515 515
 	public function display_bann($data)
516 516
 	{
517 517
 		if (!empty($data['link_banner']))
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
 	}
550 550
 
551 551
 	/**
552
-	* Add a vote in db, for a specifi link
553
-	*
554
-	* @param	int		$link_id	Link_id from db
555
-	* @return	null
556
-	*/
552
+	 * Add a vote in db, for a specifi link
553
+	 *
554
+	 * @param	int		$link_id	Link_id from db
555
+	 * @return	null
556
+	 */
557 557
 	public function add_vote($link_id)
558 558
 	{
559 559
 		$data = array(
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 	}
598 598
 
599 599
 	/**
600
-	* Search an appropriate thumb for url
601
-	*
602
-	* @param	string	$url	Link's url
603
-	* @return	string			The thumb url
604
-	*/
600
+	 * Search an appropriate thumb for url
601
+	 *
602
+	 * @param	string	$url	Link's url
603
+	 * @return	string			The thumb url
604
+	 */
605 605
 	public function thumb_process($url)
606 606
 	{
607 607
 		if (!$this->config['dir_activ_thumb'])
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
 	}
623 623
 
624 624
 	/**
625
-	* Check if ascreen thumb exists
626
-	*
627
-	* @param	string	$protocol	The protocol
628
-	* @param	string	$host		The hostname
629
-	* @return	bool				True if ascreen file exixts, else false
630
-	*/
625
+	 * Check if ascreen thumb exists
626
+	 *
627
+	 * @param	string	$protocol	The protocol
628
+	 * @param	string	$host		The hostname
629
+	 * @return	bool				True if ascreen file exixts, else false
630
+	 */
631 631
 	private function _ascreen_exist($protocol, $host)
632 632
 	{
633 633
 		if (($thumb_info = $this->imagesize->getImageSize($protocol.'://'.$host.'/ascreen.jpg')) !== false)
@@ -642,12 +642,12 @@  discard block
 block discarded – undo
642 642
 	}
643 643
 
644 644
 	/**
645
-	* Primary work on banner, can edit, copy or check a banner
646
-	*
647
-	* @param	string	$banner	The banner's remote url
648
-	* @param	array	$error	The array error, passed by reference
649
-	* @return	null
650
-	*/
645
+	 * Primary work on banner, can edit, copy or check a banner
646
+	 *
647
+	 * @param	string	$banner	The banner's remote url
648
+	 * @param	array	$error	The array error, passed by reference
649
+	 * @return	null
650
+	 */
651 651
 	public function banner_process(&$banner, &$error)
652 652
 	{
653 653
 		$old_banner = $this->request->variable('old_banner', '');
@@ -683,13 +683,13 @@  discard block
 block discarded – undo
683 683
 	}
684 684
 
685 685
 	/**
686
-	* Copy a remonte banner to server.
687
-	* called by banner_process()
688
-	*
689
-	* @param	string	$banner The banner's remote url
690
-	* @param	array	$error	The array error, passed by reference
691
-	* @return	false|string	String if no errors, else false
692
-	*/
686
+	 * Copy a remonte banner to server.
687
+	 * called by banner_process()
688
+	 *
689
+	 * @param	string	$banner The banner's remote url
690
+	 * @param	array	$error	The array error, passed by reference
691
+	 * @return	false|string	String if no errors, else false
692
+	 */
693 693
 	private function _banner_upload($banner, &$error)
694 694
 	{
695 695
 		/** @var \phpbb\files\upload $upload */
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	}
722 722
 
723 723
 	/**
724
-	* Check than remote banner exists
725
-	* called by banner_process()
726
-	*
727
-	* @param	string	$banner	The banner's remote url
728
-	* @param	array	$error	The array error, passed by reference
729
-	* @return	false|string	String if no errors, else false
730
-	*/
724
+	 * Check than remote banner exists
725
+	 * called by banner_process()
726
+	 *
727
+	 * @param	string	$banner	The banner's remote url
728
+	 * @param	array	$error	The array error, passed by reference
729
+	 * @return	false|string	String if no errors, else false
730
+	 */
731 731
 	private function _banner_remote($banner, &$error)
732 732
 	{
733 733
 		if (!preg_match('#^(http|https|ftp)://#i', $banner))
@@ -835,11 +835,11 @@  discard block
 block discarded – undo
835 835
 	}
836 836
 
837 837
 	/**
838
-	* Delete a banner from server
839
-	*
840
-	* @param	string	$file	The file's name
841
-	* @return	bool			True if delete success, else false
842
-	*/
838
+	 * Delete a banner from server
839
+	 *
840
+	 * @param	string	$file	The file's name
841
+	 * @return	bool			True if delete success, else false
842
+	 */
843 843
 	private function _banner_delete($file)
844 844
 	{
845 845
 		if (file_exists($this->get_banner_path($file)))
@@ -852,18 +852,18 @@  discard block
 block discarded – undo
852 852
 	}
853 853
 
854 854
 	/**
855
-	* PageRank Lookup (Based on Google Toolbar for Mozilla Firefox)
856
-	*
857
-	* @copyright 2012 HM2K <[email protected]>
858
-	* @link http://pagerank.phurix.net/
859
-	* @author James Wade <[email protected]>
860
-	* @version $Revision: 2.1 $
861
-	* @require PHP 4.3.0 (file_get_contents)
862
-	* @updated 06/10/11
863
-	*
864
-	* @param	string		$q	The website URL
865
-	* @return	string			The calculated pagerank, or -1
866
-	*/
855
+	 * PageRank Lookup (Based on Google Toolbar for Mozilla Firefox)
856
+	 *
857
+	 * @copyright 2012 HM2K <[email protected]>
858
+	 * @link http://pagerank.phurix.net/
859
+	 * @author James Wade <[email protected]>
860
+	 * @version $Revision: 2.1 $
861
+	 * @require PHP 4.3.0 (file_get_contents)
862
+	 * @updated 06/10/11
863
+	 *
864
+	 * @param	string		$q	The website URL
865
+	 * @return	string			The calculated pagerank, or -1
866
+	 */
867 867
 	public function pagerank_process($q)
868 868
 	{
869 869
 		$googleDomains	= array('.com', '.com.tr', '.de', '.fr', '.be', '.ca', '.ro', '.ch');
@@ -897,12 +897,12 @@  discard block
 block discarded – undo
897 897
 	}
898 898
 
899 899
 	/**
900
-	* List flags
901
-	*
902
-	* @param	string	$flag_path	The flag directory path
903
-	* @param	string	$value		Selected flag
904
-	* @return	string	$list		Html code
905
-	*/
900
+	 * List flags
901
+	 *
902
+	 * @param	string	$flag_path	The flag directory path
903
+	 * @param	string	$value		Selected flag
904
+	 * @return	string	$list		Html code
905
+	 */
906 906
 	public function get_dir_flag_list($flag_path, $value)
907 907
 	{
908 908
 		$list = '';
@@ -937,10 +937,10 @@  discard block
 block discarded – undo
937 937
 	}
938 938
 
939 939
 	/**
940
-	* Display recents links added
941
-	*
942
-	* @return	null
943
-	*/
940
+	 * Display recents links added
941
+	 *
942
+	 * @return	null
943
+	 */
944 944
 	public function recents()
945 945
 	{
946 946
 		if ($this->config['dir_recent_block'])
@@ -1017,13 +1017,13 @@  discard block
 block discarded – undo
1017 1017
 	}
1018 1018
 
1019 1019
 	/**
1020
-	* Validate back link
1021
-	*
1022
-	* @param	string		$remote_url	Page URL contains the backlink
1023
-	* @param	bool		$optional	Link back is optional in this category?
1024
-	* @param	bool		$cron		This methos is called by con process?
1025
-	* @return	false|string			Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
1026
-	*/
1020
+	 * Validate back link
1021
+	 *
1022
+	 * @param	string		$remote_url	Page URL contains the backlink
1023
+	 * @param	bool		$optional	Link back is optional in this category?
1024
+	 * @param	bool		$cron		This methos is called by con process?
1025
+	 * @return	false|string			Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
1026
+	 */
1027 1027
 	public function validate_link_back($remote_url, $optional, $cron = false)
1028 1028
 	{
1029 1029
 		if (!$cron)
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -76,20 +76,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -486,8 +486,8 @@  discard block
 block discarded – undo
486 486
 			{
487 487
 				$pagerank = $this->pagerank_process($data['link_url']);
488 488
 
489
-				$sql = 'UPDATE ' . $this->links_table . '
490
-					SET link_pagerank = ' . (int) $pagerank . '
489
+				$sql = 'UPDATE '.$this->links_table.'
490
+					SET link_pagerank = ' . (int) $pagerank.'
491 491
 					WHERE link_id = ' . (int) $data['link_id'];
492 492
 				$this->db->sql_query($sql);
493 493
 			}
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
 				$pagerank = (int) $data['link_pagerank'];
497 497
 			}
498 498
 
499
-			$prpos=40*$pagerank/10;
500
-			$prneg=40-$prpos;
501
-			$html='<img src="http://www.google.com/images/pos.gif" width="'.$prpos.'" height="4" alt="'.$pagerank.'" /><img src="http://www.google.com/images/neg.gif" width="'.$prneg.'" height="4" alt="'.$pagerank.'" /> ';
499
+			$prpos = 40 * $pagerank / 10;
500
+			$prneg = 40 - $prpos;
501
+			$html = '<img src="http://www.google.com/images/pos.gif" width="'.$prpos.'" height="4" alt="'.$pagerank.'" /><img src="http://www.google.com/images/neg.gif" width="'.$prneg.'" height="4" alt="'.$pagerank.'" /> ';
502 502
 
503 503
 			$pagerank = $pagerank == '-1' ? $this->language->lang('DIR_PAGERANK_NOT_AVAILABLE') : $this->language->lang('DIR_FROM_TEN', $pagerank);
504 504
 			return $html.$pagerank;
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 				$height /= $coef_max;
544 544
 			}
545 545
 
546
-			return '<img src="' . $img_src . '" width="' . $width . '" height="' . $height . '" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />';
546
+			return '<img src="'.$img_src.'" width="'.$width.'" height="'.$height.'" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />';
547 547
 		}
548 548
 		return '';
549 549
 	}
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
 
565 565
 		$this->db->sql_transaction('begin');
566 566
 
567
-		$sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data);
567
+		$sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data);
568 568
 		$this->db->sql_query($sql);
569 569
 
570
-		$sql = 'UPDATE ' . $this->links_table . '
570
+		$sql = 'UPDATE '.$this->links_table.'
571 571
 			SET link_vote = link_vote + 1,
572
-			link_note = link_note + ' . (int) $data['vote_note'] . '
572
+			link_note = link_note + ' . (int) $data['vote_note'].'
573 573
 		WHERE link_id = ' . (int) $link_id;
574 574
 		$this->db->sql_query($sql);
575 575
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 
578 578
 		if ($this->request->is_ajax())
579 579
 		{
580
-			$sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id;
580
+			$sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id;
581 581
 			$result = $this->db->sql_query($sql);
582 582
 			$data = $this->db->sql_fetchrow($result);
583 583
 
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 
612 612
 		$details = parse_url($url);
613 613
 
614
-		$root_url		= $details['scheme'].'://'.$details['host'];
615
-		$absolute_url	= isset($details['path']) ? $root_url.$details['path'] : $root_url;
614
+		$root_url = $details['scheme'].'://'.$details['host'];
615
+		$absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url;
616 616
 
617 617
 		if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host']))
618 618
 		{
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 		$destination = $this->get_banner_path();
656 656
 
657 657
 		// Can we upload?
658
-		$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;
658
+		$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;
659 659
 
660 660
 		if ($banner && $can_upload)
661 661
 		{
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$file = $upload->handle_upload('files.types.remote', $banner);
703 703
 
704
-		$prefix = unique_id() . '_';
704
+		$prefix = unique_id().'_';
705 705
 		$file->clean_filename('real', $prefix);
706 706
 
707 707
 		if (sizeof($file->error))
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	{
733 733
 		if (!preg_match('#^(http|https|ftp)://#i', $banner))
734 734
 		{
735
-			$banner = 'http://' . $banner;
735
+			$banner = 'http://'.$banner;
736 736
 		}
737 737
 		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))
738 738
 		{
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 		}
764 764
 
765 765
 		// Check image type
766
-		$types		= \phpbb\files\upload::image_types();
767
-		$extension	= strtolower(\phpbb\files\filespec::get_extension($banner));
766
+		$types = \phpbb\files\upload::image_types();
767
+		$extension = strtolower(\phpbb\files\filespec::get_extension($banner));
768 768
 
769 769
 		// Check if this is actually an image
770 770
 		if ($file_stream = @fopen($banner, 'r'))
@@ -866,14 +866,14 @@  discard block
 block discarded – undo
866 866
 	*/
867 867
 	public function pagerank_process($q)
868 868
 	{
869
-		$googleDomains	= array('.com', '.com.tr', '.de', '.fr', '.be', '.ca', '.ro', '.ch');
870
-		$seed			= $this->language->lang('SEED');
871
-		$result			= 0x01020345;
869
+		$googleDomains = array('.com', '.com.tr', '.de', '.fr', '.be', '.ca', '.ro', '.ch');
870
+		$seed = $this->language->lang('SEED');
871
+		$result = 0x01020345;
872 872
 		$len			= strlen($q);
873 873
 
874
-		for ($i=0; $i<$len; $i++)
874
+		for ($i = 0; $i < $len; $i++)
875 875
 		{
876
-			$result ^= ord($seed{$i%strlen($seed)}) ^ ord($q{$i});
876
+			$result ^= ord($seed{$i % strlen($seed)}) ^ ord($q{$i});
877 877
 			$result = (($result >> 23) & 0x1ff) | $result << 9;
878 878
 		}
879 879
 
@@ -884,10 +884,10 @@  discard block
 block discarded – undo
884 884
 
885 885
 		$ch		= sprintf('8%x', $result);
886 886
 		$url	= 'http://%s/tbr?client=navclient-auto&ch=%s&features=Rank&q=info:%s';
887
-		$host	= 'toolbarqueries.google'.$googleDomains[mt_rand(0,count($googleDomains)-1)];
887
+		$host = 'toolbarqueries.google'.$googleDomains[mt_rand(0, count($googleDomains) - 1)];
888 888
 
889
-		$url	= sprintf($url,$host,$ch,$q);
890
-		@$pr	= trim(file_get_contents($url,false));
889
+		$url	= sprintf($url, $host, $ch, $q);
890
+		@$pr	= trim(file_get_contents($url, false));
891 891
 
892 892
 		if (is_numeric(substr(strrchr($pr, ':'), 1)))
893 893
 		{
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
 			if (file_exists($flag_path.$img_file))
931 931
 			{
932
-				$list .= '<option value="' . $img_file . '" ' . (($img_file == $value) ? 'selected="selected"' : '') . '>' . $name . '</option>';
932
+				$list .= '<option value="'.$img_file.'" '.(($img_file == $value) ? 'selected="selected"' : '').'>'.$name.'</option>';
933 933
 			}
934 934
 		}
935 935
 
@@ -945,8 +945,8 @@  discard block
 block discarded – undo
945 945
 	{
946 946
 		if ($this->config['dir_recent_block'])
947 947
 		{
948
-			$limit_sql		= $this->config['dir_recent_rows'] * $this->config['dir_recent_columns'];
949
-			$exclude_array	= explode(',', str_replace(' ', '', $this->config['dir_recent_exclude']));
948
+			$limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns'];
949
+			$exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude']));
950 950
 
951 951
 			$sql_array = array(
952 952
 				'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',
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 			if (sizeof($rowset))
980 980
 			{
981 981
 				$this->template->assign_block_vars('block', array(
982
-					'S_COL_WIDTH'			=> (100 / $this->config['dir_recent_columns']) . '%',
982
+					'S_COL_WIDTH'			=> (100 / $this->config['dir_recent_columns']).'%',
983 983
 				));
984 984
 
985 985
 				foreach ($rowset as $row)
Please login to merge, or discard this patch.