Completed
Push — 3.2.x ( 46ca38...dcf539 )
by Erwan
02:22
created
core/link.php 2 patches
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\upload								$files_upload		Upload object
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\upload								$files_upload		Upload object
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\upload $files_upload, $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
 		$old_banner = $this->root_path  . $this->get_banner_path($file);
@@ -821,12 +821,12 @@  discard block
 block discarded – undo
821 821
 	}
822 822
 
823 823
 	/**
824
-	* List flags
825
-	*
826
-	* @param	string	$flag_path	The flag directory path
827
-	* @param	string	$value		Selected flag
828
-	* @return	string	$list		Html code
829
-	*/
824
+	 * List flags
825
+	 *
826
+	 * @param	string	$flag_path	The flag directory path
827
+	 * @param	string	$value		Selected flag
828
+	 * @return	string	$list		Html code
829
+	 */
830 830
 	public function get_dir_flag_list($flag_path, $value)
831 831
 	{
832 832
 		$list = '';
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 	}
862 862
 
863 863
 	/**
864
-	* Display recents links added
865
-	*
866
-	* @return	null
867
-	*/
864
+	 * Display recents links added
865
+	 *
866
+	 * @return	null
867
+	 */
868 868
 	public function recents()
869 869
 	{
870 870
 		if ($this->config['dir_recent_block'])
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
 	}
942 942
 
943 943
 	/**
944
-	* Validate back link
945
-	*
946
-	* @param	string		$remote_url	Page URL contains the backlink
947
-	* @param	bool		$optional	Link back is optional in this category?
948
-	* @param	bool		$cron		This methos is called by con process?
949
-	* @return	false|string			Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
950
-	*/
944
+	 * Validate back link
945
+	 *
946
+	 * @param	string		$remote_url	Page URL contains the backlink
947
+	 * @param	bool		$optional	Link back is optional in this category?
948
+	 * @param	bool		$cron		This methos is called by con process?
949
+	 * @return	false|string			Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
950
+	 */
951 951
 	public function validate_link_back($remote_url, $optional, $cron = false)
952 952
 	{
953 953
 		if (!$cron)
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 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\upload $files_upload, $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 87
 		$this->notification		= $notification;
88
-		$this->filesystem		= $filesystem;
88
+		$this->filesystem = $filesystem;
89 89
 		$this->imagesize		= $imagesize;
90 90
 		$this->files_upload 	= $files_upload;
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
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		{
230 230
 			if ($row['link_banner'] && !preg_match('/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|www\.).+/si', $row['link_banner']))
231 231
 			{
232
-				$banner_img = $this->root_path . $this->get_banner_path(basename($row['link_banner']));
232
+				$banner_img = $this->root_path.$this->get_banner_path(basename($row['link_banner']));
233 233
 
234 234
 				if (file_exists($banner_img))
235 235
 				{
@@ -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
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 				$height /= $coef_max;
510 510
 			}
511 511
 
512
-			return '<img src="' . $img_src . '" width="' . $width . '" height="' . $height . '" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />';
512
+			return '<img src="'.$img_src.'" width="'.$width.'" height="'.$height.'" alt="'.$data['link_name'].'" title="'.$data['link_name'].'" />';
513 513
 		}
514 514
 		return '';
515 515
 	}
@@ -531,12 +531,12 @@  discard block
 block discarded – undo
531 531
 
532 532
 		$this->db->sql_transaction('begin');
533 533
 
534
-		$sql = 'INSERT INTO ' . $this->votes_table . ' ' . $this->db->sql_build_array('INSERT', $data);
534
+		$sql = 'INSERT INTO '.$this->votes_table.' '.$this->db->sql_build_array('INSERT', $data);
535 535
 		$this->db->sql_query($sql);
536 536
 
537
-		$sql = 'UPDATE ' . $this->links_table . '
537
+		$sql = 'UPDATE '.$this->links_table.'
538 538
 			SET link_vote = link_vote + 1,
539
-			link_note = link_note + ' . (int) $data['vote_note'] . '
539
+			link_note = link_note + ' . (int) $data['vote_note'].'
540 540
 		WHERE link_id = ' . (int) $link_id;
541 541
 		$this->db->sql_query($sql);
542 542
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
 		if ($this->request->is_ajax())
546 546
 		{
547
-			$sql= 'SELECT link_vote, link_note FROM ' . $this->links_table . ' WHERE link_id = ' . (int) $link_id;
547
+			$sql = 'SELECT link_vote, link_note FROM '.$this->links_table.' WHERE link_id = '.(int) $link_id;
548 548
 			$result = $this->db->sql_query($sql);
549 549
 			$data = $this->db->sql_fetchrow($result);
550 550
 
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
 
579 579
 		$details = parse_url($url);
580 580
 
581
-		$root_url		= $details['scheme'].'://'.$details['host'];
582
-		$absolute_url	= isset($details['path']) ? $root_url.$details['path'] : $root_url;
581
+		$root_url = $details['scheme'].'://'.$details['host'];
582
+		$absolute_url = isset($details['path']) ? $root_url.$details['path'] : $root_url;
583 583
 
584 584
 		if ($this->config['dir_activ_thumb_remote'] && $this->_ascreen_exist($details['scheme'], $details['host']))
585 585
 		{
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	{
620 620
 		$old_banner = $this->request->variable('old_banner', '');
621 621
 
622
-		$destination = $this->root_path . $this->get_banner_path();
622
+		$destination = $this->root_path.$this->get_banner_path();
623 623
 
624 624
 		// Can we upload?
625 625
 		$can_upload = ($this->config['dir_storage_banner'] && $this->filesystem->exists($destination) && $this->filesystem->is_writable($destination) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 
669 669
 		$file = $upload->handle_upload('files.types.remote', $banner);
670 670
 
671
-		$prefix = unique_id() . '_';
671
+		$prefix = unique_id().'_';
672 672
 		$file->clean_filename('real', $prefix);
673 673
 
674 674
 		if (sizeof($file->error))
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	{
700 700
 		if (!preg_match('#^(http|https|ftp)://#i', $banner))
701 701
 		{
702
-			$banner = 'http://' . $banner;
702
+			$banner = 'http://'.$banner;
703 703
 		}
704 704
 		if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $banner))
705 705
 		{
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
 		}
731 731
 
732 732
 		// Check image type
733
-		$types		= \phpbb\files\upload::image_types();
734
-		$extension	= strtolower(\phpbb\files\filespec::get_extension($banner));
733
+		$types = \phpbb\files\upload::image_types();
734
+		$extension = strtolower(\phpbb\files\filespec::get_extension($banner));
735 735
 
736 736
 		// Check if this is actually an image
737 737
 		if ($file_stream = @fopen($banner, 'r'))
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	*/
810 810
 	private function _banner_delete($file)
811 811
 	{
812
-		$old_banner = $this->root_path  . $this->get_banner_path($file);
812
+		$old_banner = $this->root_path.$this->get_banner_path($file);
813 813
 
814 814
 		if (file_exists($old_banner))
815 815
 		{
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 
854 854
 			if (file_exists($flag_path.$img_file))
855 855
 			{
856
-				$list .= '<option value="' . $img_file . '" ' . (($img_file == $value) ? 'selected="selected"' : '') . '>' . $name . '</option>';
856
+				$list .= '<option value="'.$img_file.'" '.(($img_file == $value) ? 'selected="selected"' : '').'>'.$name.'</option>';
857 857
 			}
858 858
 		}
859 859
 
@@ -869,8 +869,8 @@  discard block
 block discarded – undo
869 869
 	{
870 870
 		if ($this->config['dir_recent_block'])
871 871
 		{
872
-			$limit_sql		= $this->config['dir_recent_rows'] * $this->config['dir_recent_columns'];
873
-			$exclude_array	= array_filter(explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])));
872
+			$limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns'];
873
+			$exclude_array = array_filter(explode(',', str_replace(' ', '', $this->config['dir_recent_exclude'])));
874 874
 
875 875
 			$sql_array = array(
876 876
 				'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',
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 							'ON'	=> 'l.link_cat = c.cat_id'
887 887
 						)
888 888
 				),
889
-				'WHERE'		=> 'l.link_active = 1' . (sizeof($exclude_array) ? ' AND ' . $this->db->sql_in_set('l.link_cat', $exclude_array, true) : ''),
889
+				'WHERE'		=> 'l.link_active = 1'.(sizeof($exclude_array) ? ' AND '.$this->db->sql_in_set('l.link_cat', $exclude_array, true) : ''),
890 890
 				'ORDER_BY'	=> 'l.link_time DESC, l.link_id DESC');
891 891
 
892 892
 			$sql = $this->db->sql_build_query('SELECT', $sql_array);
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 			if (sizeof($rowset))
904 904
 			{
905 905
 				$this->template->assign_block_vars('block', array(
906
-					'S_COL_WIDTH'			=> (100 / $this->config['dir_recent_columns']) . '%',
906
+					'S_COL_WIDTH'			=> (100 / $this->config['dir_recent_columns']).'%',
907 907
 				));
908 908
 
909 909
 				foreach ($rowset as $row)
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 						'COUNT'					  => $row['link_view'],
923 923
 						'COMMENT'                 => $row['link_comment'],
924 924
 
925
-						'U_CAT'                   => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $row['link_cat']),
925
+						'U_CAT'                   => $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_'.$row['link_cat']),
926 926
 						'U_COMMENT'               => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])),
927 927
 
928 928
 						'L_DIR_SEARCH_NB_CLICKS'	=> $this->language->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']),
Please login to merge, or discard this patch.
core/cron.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 	*/
53 53
 	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\log\log $phpbb_log, \phpbb\user $user, \phpbb\notification\manager $notification, \ernadoo\phpbbdirectory\core\link $link, $root_path, $php_ext)
54 54
 	{
55
-		$this->db				= $db;
56
-		$this->config			= $config;
57
-		$this->phpbb_log		= $phpbb_log;
55
+		$this->db = $db;
56
+		$this->config = $config;
57
+		$this->phpbb_log = $phpbb_log;
58 58
 		$this->user				= $user;
59
-		$this->notification		= $notification;
59
+		$this->notification = $notification;
60 60
 		$this->link				= $link;
61
-		$this->root_path		= $root_path;
62
-		$this->php_ext			= $php_ext;
61
+		$this->root_path = $root_path;
62
+		$this->php_ext = $php_ext;
63 63
 	}
64 64
 
65 65
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	public function auto_check($cat_data)
72 72
 	{
73 73
 		$sql = 'SELECT cat_name
74
-			FROM ' . $this->categories_table . '
74
+			FROM ' . $this->categories_table.'
75 75
 			WHERE cat_id = ' . (int) $cat_data['cat_id'];
76 76
 		$result = $this->db->sql_query($sql);
77 77
 		$row = $this->db->sql_fetchrow($result);
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 			$this->_check($cat_data['cat_id'], $cat_data['cat_cron_nb_check'], $next_prune);
85 85
 
86
-			$sql = 'UPDATE ' . $this->categories_table . "
86
+			$sql = 'UPDATE '.$this->categories_table."
87 87
 			SET cat_cron_next = $next_prune
88
-			WHERE cat_id = " . (int) $cat_data['cat_id'];
88
+			WHERE cat_id = ".(int) $cat_data['cat_id'];
89 89
 			$this->db->sql_query($sql);
90 90
 
91 91
 			$this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DIR_AUTO_PRUNE', time(), array($row['cat_name']));
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	public function get_cat($cat_id)
104 104
 	{
105 105
 		$sql = 'SELECT cat_id, cat_cron_enable, cat_cron_next, cat_cron_freq, cat_cron_nb_check
106
-				FROM ' . $this->categories_table . '
106
+				FROM ' . $this->categories_table.'
107 107
 					WHERE cat_id = ' . (int) $cat_id;
108 108
 		$result = $this->db->sql_query($sql);
109 109
 		$row = $this->db->sql_fetchrow($result);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 					'ON'	=> 'l.link_user_id = u.user_id'
139 139
 				)
140 140
 			),
141
-			'WHERE'		=> "l.link_back <> '' AND l.link_active = 1 AND l.link_cat = "  . (int) $cat_id);
141
+			'WHERE'		=> "l.link_back <> '' AND l.link_active = 1 AND l.link_cat = ".(int) $cat_id);
142 142
 
143 143
 			$sql = $this->db->sql_build_query('SELECT', $sql_array);
144 144
 			$result = $this->db->sql_query($sql);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			{
148 148
 				if ($this->link->validate_link_back($row['link_back'], false, true) !== false)
149 149
 				{
150
-					if (!$nb_check || ($row['link_nb_check']+1) >= $nb_check)
150
+					if (!$nb_check || ($row['link_nb_check'] + 1) >= $nb_check)
151 151
 					{
152 152
 						$del_array[] = $row['link_id'];
153 153
 					}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	{
182 182
 		if (!class_exists('messenger'))
183 183
 		{
184
-			include($this->root_path . 'includes/functions_messenger.' . $this->php_ext);
184
+			include($this->root_path.'includes/functions_messenger.'.$this->php_ext);
185 185
 		}
186 186
 
187 187
 		$messenger = new \messenger(false);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		// We need to define it, because we use user->format_date below
191 191
 		$this->user->timezone = new \DateTimeZone($this->config['board_timezone']);
192 192
 
193
-		$sql = 'UPDATE ' . $this->links_table . '
193
+		$sql = 'UPDATE '.$this->links_table.'
194 194
 			SET link_nb_check = link_nb_check + 1
195 195
 			WHERE ' . $this->db->sql_in_set('link_id', array_keys($u_array));
196 196
 		$this->db->sql_query($sql);
Please login to merge, or discard this patch.
core/categorie.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 	public $data = array();
47 47
 
48 48
 	/**
49
-	* Constructor
50
-	*
51
-	* @param \phpbb\db\driver\driver_interface 		$db			Database object
52
-	* @param \phpbb\config\config 					$config		Config object
53
-	* @param \phpbb\language\language				$language	Language object
54
-	* @param \phpbb\template\template 				$template	Template object
55
-	* @param \phpbb\user 							$user		User object
56
-	* @param \phpbb\controller\helper 				$helper		Controller helper object
57
-	* @param \phpbb\request\request 				$request	Request object
58
-	* @param \phpbb\auth\auth 						$auth		Auth object
59
-	* @param \phpbb\cron\manager					$cron		Cron object
60
-	*/
49
+	 * Constructor
50
+	 *
51
+	 * @param \phpbb\db\driver\driver_interface 		$db			Database object
52
+	 * @param \phpbb\config\config 					$config		Config object
53
+	 * @param \phpbb\language\language				$language	Language object
54
+	 * @param \phpbb\template\template 				$template	Template object
55
+	 * @param \phpbb\user 							$user		User object
56
+	 * @param \phpbb\controller\helper 				$helper		Controller helper object
57
+	 * @param \phpbb\request\request 				$request	Request object
58
+	 * @param \phpbb\auth\auth 						$auth		Auth object
59
+	 * @param \phpbb\cron\manager					$cron		Cron object
60
+	 */
61 61
 	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\cron\manager $cron)
62 62
 	{
63 63
 		$this->db			= $db;
@@ -72,21 +72,21 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	/**
75
-	* Function for get approval setting
76
-	* used in edit mode for test the setting of new category's link
77
-	*
78
-	* @return bool
79
-	*/
75
+	 * Function for get approval setting
76
+	 * used in edit mode for test the setting of new category's link
77
+	 *
78
+	 * @return bool
79
+	 */
80 80
 	public function need_approval()
81 81
 	{
82 82
 		return (bool) $this->data['cat_validate'];
83 83
 	}
84 84
 
85 85
 	/**
86
-	* Generate Jumpbox
87
-	*
88
-	* @return null
89
-	*/
86
+	 * Generate Jumpbox
87
+	 *
88
+	 * @return null
89
+	 */
90 90
 	public function make_cat_jumpbox()
91 91
 	{
92 92
 		$sql = 'SELECT cat_id, cat_name, parent_id, left_id, right_id
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 	}
140 140
 
141 141
 	/**
142
-	* Generate a list of directory's categories
143
-	*
144
-	* @param	int		$select_id		Selected category
145
-	* @param	array	$ignore_id		Array of ignored categories
146
-	* @return	string	$cat_list		html code
147
-	*/
142
+	 * Generate a list of directory's categories
143
+	 *
144
+	 * @param	int		$select_id		Selected category
145
+	 * @param	array	$ignore_id		Array of ignored categories
146
+	 * @return	string	$cat_list		html code
147
+	 */
148 148
 	public function make_cat_select($select_id = 0, $ignore_id = array())
149 149
 	{
150 150
 		$ignore_id = is_array($ignore_id) ? $ignore_id : array($ignore_id);
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	}
191 191
 
192 192
 	/**
193
-	* Display cat or subcat
194
-	*
195
-	* @return	null
196
-	*/
193
+	 * Display cat or subcat
194
+	 *
195
+	 * @return	null
196
+	 */
197 197
 	public function display()
198 198
 	{
199 199
 		$cat_rows	= $subcats = array();
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 	}
323 323
 
324 324
 	/**
325
-	* Get informations about a cat or subcat
326
-	*
327
-	* @param	int	$cat_id		The category ID
328
-	* @return	null|false
329
-	*/
325
+	 * Get informations about a cat or subcat
326
+	 *
327
+	 * @param	int	$cat_id		The category ID
328
+	 * @return	null|false
329
+	 */
330 330
 	public function get($cat_id = 0)
331 331
 	{
332 332
 		if ($cat_id)
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 	}
355 355
 
356 356
 	/**
357
-	* Create category navigation links for given category, create parent
358
-	* list if currently null, assign basic category info to template
359
-	*
360
-	* @param	array	$dir_cat_data
361
-	*/
357
+	 * Create category navigation links for given category, create parent
358
+	 * list if currently null, assign basic category info to template
359
+	 *
360
+	 * @param	array	$dir_cat_data
361
+	 */
362 362
 	public function generate_dir_nav(&$dir_cat_data)
363 363
 	{
364 364
 		global $phpbb_container;
@@ -395,12 +395,12 @@  discard block
 block discarded – undo
395 395
 	}
396 396
 
397 397
 	/**
398
-	* Return good key language
399
-	*
400
-	* @param	bool	$validate	True if approbation needed before publication
401
-	* @return	string				Information about approval, depends on user auth level
402
-	* @throws	\phpbb\exception\runtime_exception
403
-	*/
398
+	 * Return good key language
399
+	 *
400
+	 * @param	bool	$validate	True if approbation needed before publication
401
+	 * @return	string				Information about approval, depends on user auth level
402
+	 * @throws	\phpbb\exception\runtime_exception
403
+	 */
404 404
 	public function dir_submit_type($validate)
405 405
 	{
406 406
 		if ($validate)
@@ -421,15 +421,15 @@  discard block
 block discarded – undo
421 421
 	}
422 422
 
423 423
 	/**
424
-	* Category watching common code
425
-	*
426
-	* @param	string		$mode			Watch or unwatch a category
427
-	* @param	array		$s_watching		An empty array, passed by reference
428
-	* @param	int			$user_id		The user ID
429
-	* @param	int			$cat_id			The category ID
430
-	* @param	string		$notify_status	User is watching the category?
431
-	* @return	null|string
432
-	*/
424
+	 * Category watching common code
425
+	 *
426
+	 * @param	string		$mode			Watch or unwatch a category
427
+	 * @param	array		$s_watching		An empty array, passed by reference
428
+	 * @param	int			$user_id		The user ID
429
+	 * @param	int			$cat_id			The category ID
430
+	 * @param	string		$notify_status	User is watching the category?
431
+	 * @return	null|string
432
+	 */
433 433
 	public function watch_categorie($mode, &$s_watching, $user_id, $cat_id, $notify_status)
434 434
 	{
435 435
 		// Is user watching this thread?
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
 	}
516 516
 
517 517
 	/**
518
-	* Return Category name
519
-	*
520
-	* @param	int		$cat_id		The category ID
521
-	* @return	string				The category name
522
-	*/
518
+	 * Return Category name
519
+	 *
520
+	 * @param	int		$cat_id		The category ID
521
+	 * @return	string				The category name
522
+	 */
523 523
 	static public function getname($cat_id)
524 524
 	{
525 525
 		global $db, $phpbb_container;
Please login to merge, or discard this patch.