Completed
Pull Request — master (#48)
by Jakub
08:27
created
ad/manager.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 
43 43
 	/**
44
-	* Get specific ad
45
-	*
46
-	* @param	int		$ad_id	Advertisement ID
47
-	* @return	mixed	Array with advertisement data, false if ad doesn't exist
48
-	*/
44
+	 * Get specific ad
45
+	 *
46
+	 * @param	int		$ad_id	Advertisement ID
47
+	 * @return	mixed	Array with advertisement data, false if ad doesn't exist
48
+	 */
49 49
 	public function get_ad($ad_id)
50 50
 	{
51 51
 		$sql = 'SELECT *
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 
61 61
 	/**
62
-	* Get one ad per every location
63
-	*
64
-	* @param	array	$ad_locations	List of ad locations to fetch ads for
65
-	* @return	array	List of ad codes for each location
66
-	*/
62
+	 * Get one ad per every location
63
+	 *
64
+	 * @param	array	$ad_locations	List of ad locations to fetch ads for
65
+	 * @return	array	List of ad codes for each location
66
+	 */
67 67
 	public function get_ads($ad_locations)
68 68
 	{
69 69
 		$sql_where_views = $this->config['phpbb_ads_enable_views'] ? 'AND (a.ad_views_limit = 0 OR a.ad_views_limit > a.ad_views)' : '';
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 
122 122
 	/**
123
-	* Increment views for specified ads
124
-	*
125
-	* Note, that views are incremented only by one even when
126
-	* an ad is displayed multiple times on the same page.
127
-	*
128
-	* @param	array	$ad_ids	IDs of ads to increment views
129
-	* @return	void
130
-	*/
123
+	 * Increment views for specified ads
124
+	 *
125
+	 * Note, that views are incremented only by one even when
126
+	 * an ad is displayed multiple times on the same page.
127
+	 *
128
+	 * @param	array	$ad_ids	IDs of ads to increment views
129
+	 * @return	void
130
+	 */
131 131
 	public function increment_ads_views($ad_ids)
132 132
 	{
133 133
 		if (!empty($ad_ids))
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 	/**
143
-	* Increment clicks for specified ad
144
-	*
145
-	* @param	int	$ad_id	ID of an ad to increment clicks
146
-	* @return	void
147
-	*/
143
+	 * Increment clicks for specified ad
144
+	 *
145
+	 * @param	int	$ad_id	ID of an ad to increment clicks
146
+	 * @return	void
147
+	 */
148 148
 	public function increment_ad_clicks($ad_id)
149 149
 	{
150 150
 		$sql = 'UPDATE ' . $this->ads_table . '
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	/**
157
-	* Insert new advertisement to the database
158
-	*
159
-	* @param	array	$data	New ad data
160
-	* @return	int		New advertisement ID
161
-	*/
157
+	 * Insert new advertisement to the database
158
+	 *
159
+	 * @param	array	$data	New ad data
160
+	 * @return	int		New advertisement ID
161
+	 */
162 162
 	public function insert_ad($data)
163 163
 	{
164 164
 		$data = $this->intersect_ad_data($data);
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Update advertisement
174
-	*
175
-	* @param	int		$ad_id	Advertisement ID
176
-	* @param	array	$data	List of data to update in the database
177
-	* @return	int		Number of affected rows. Can be used to determine if any ad has been updated.
178
-	*/
173
+	 * Update advertisement
174
+	 *
175
+	 * @param	int		$ad_id	Advertisement ID
176
+	 * @param	array	$data	List of data to update in the database
177
+	 * @return	int		Number of affected rows. Can be used to determine if any ad has been updated.
178
+	 */
179 179
 	public function update_ad($ad_id, $data)
180 180
 	{
181 181
 		$data = $this->intersect_ad_data($data);
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Delete advertisement
193
-	*
194
-	* @param	int		$ad_id	Advertisement ID
195
-	* @return	int		Number of affected rows. Can be used to determine if any ad has been deleted.
196
-	*/
192
+	 * Delete advertisement
193
+	 *
194
+	 * @param	int		$ad_id	Advertisement ID
195
+	 * @return	int		Number of affected rows. Can be used to determine if any ad has been deleted.
196
+	 */
197 197
 	public function delete_ad($ad_id)
198 198
 	{
199 199
 		$sql = 'DELETE FROM ' . $this->ads_table . '
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	}
205 205
 
206 206
 	/**
207
-	* Get all locations for specified advertisement
208
-	*
209
-	* @param	int		$ad_id	Advertisement ID
210
-	* @return	array	List of template locations for specified ad
211
-	*/
207
+	 * Get all locations for specified advertisement
208
+	 *
209
+	 * @param	int		$ad_id	Advertisement ID
210
+	 * @return	array	List of template locations for specified ad
211
+	 */
212 212
 	public function get_ad_locations($ad_id)
213 213
 	{
214 214
 		$ad_locations = array();
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 	}
228 228
 
229 229
 	/**
230
-	* Insert advertisement locations
231
-	*
232
-	* @param	int		$ad_id			Advertisement ID
233
-	* @param	array	$ad_locations	List of template locations for this ad
234
-	* @return	void
235
-	*/
230
+	 * Insert advertisement locations
231
+	 *
232
+	 * @param	int		$ad_id			Advertisement ID
233
+	 * @param	array	$ad_locations	List of template locations for this ad
234
+	 * @return	void
235
+	 */
236 236
 	public function insert_ad_locations($ad_id, $ad_locations)
237 237
 	{
238 238
 		$sql_ary = array();
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	}
248 248
 
249 249
 	/**
250
-	* Delete advertisement locations
251
-	*
252
-	* @param	int		$ad_id	Advertisement ID
253
-	* @return	void
254
-	*/
250
+	 * Delete advertisement locations
251
+	 *
252
+	 * @param	int		$ad_id	Advertisement ID
253
+	 * @return	void
254
+	 */
255 255
 	public function delete_ad_locations($ad_id)
256 256
 	{
257 257
 		$sql = 'DELETE FROM ' . $this->ad_locations_table . '
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 	}
261 261
 
262 262
 	/**
263
-	* Load memberships of the user
264
-	*
265
-	* @param	int		$user_id	User ID to load memberships
266
-	* @return	array	List of group IDs user is member of
267
-	*/
263
+	 * Load memberships of the user
264
+	 *
265
+	 * @param	int		$user_id	User ID to load memberships
266
+	 * @return	array	List of group IDs user is member of
267
+	 */
268 268
 	public function load_memberships($user_id)
269 269
 	{
270 270
 		$memberships = array();
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
 	}
283 283
 
284 284
 	/**
285
-	* Load all board groups
286
-	*
287
-	* @return	array	List of groups
288
-	*/
285
+	 * Load all board groups
286
+	 *
287
+	 * @return	array	List of groups
288
+	 */
289 289
 	public function load_groups()
290 290
 	{
291 291
 		$sql = 'SELECT group_id, group_name, group_type
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	}
336 336
 
337 337
 	/**
338
-	* Make sure only necessary data make their way to SQL query
339
-	*
340
-	* @param	array	$data	List of data to query the database
341
-	* @return	array	Cleaned data that contain only valid keys
342
-	*/
338
+	 * Make sure only necessary data make their way to SQL query
339
+	 *
340
+	 * @param	array	$data	List of data to query the database
341
+	 * @return	array	Cleaned data that contain only valid keys
342
+	 */
343 343
 	protected function intersect_ad_data($data)
344 344
 	{
345 345
 		return array_intersect_key($data, array(
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
 	}
357 357
 
358 358
 	/**
359
-	* Get the random statement for this database layer
360
-	* Random function should generate a float value between 0 and 1
361
-	*
362
-	* @return	string	Random statement for current database layer
363
-	*/
359
+	 * Get the random statement for this database layer
360
+	 * Random function should generate a float value between 0 and 1
361
+	 *
362
+	 * @return	string	Random statement for current database layer
363
+	 */
364 364
 	protected function sql_random()
365 365
 	{
366 366
 		switch ($this->db->get_sql_layer())
Please login to merge, or discard this patch.
controller/admin_controller.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 	protected $errors = array();
60 60
 
61 61
 	/**
62
-	* Constructor
63
-	*
64
-	* @param \phpbb\template\template				$template			Template object
65
-	* @param \phpbb\user							$user				User object
66
-	* @param \phpbb\request\request					$request			Request object
67
-	* @param \phpbb\ads\ad\manager					$manager			Advertisement manager object
68
-	* @param \phpbb\ads\location\manager			$location_manager	Template location manager object
69
-	* @param \phpbb\log\log							$log				The phpBB log system
70
-	* @param \phpbb\config\db_text					$config_text		Config text object
71
-	* @param \phpbb\config\config					$config				Config object
72
-	* @param string									$root_path			phpBB root path
73
-	* @param string									$php_ext			PHP extension
74
-	* @param string									$ext_path			Path to this extension
75
-	*/
62
+	 * Constructor
63
+	 *
64
+	 * @param \phpbb\template\template				$template			Template object
65
+	 * @param \phpbb\user							$user				User object
66
+	 * @param \phpbb\request\request					$request			Request object
67
+	 * @param \phpbb\ads\ad\manager					$manager			Advertisement manager object
68
+	 * @param \phpbb\ads\location\manager			$location_manager	Template location manager object
69
+	 * @param \phpbb\log\log							$log				The phpBB log system
70
+	 * @param \phpbb\config\db_text					$config_text		Config text object
71
+	 * @param \phpbb\config\config					$config				Config object
72
+	 * @param string									$root_path			phpBB root path
73
+	 * @param string									$php_ext			PHP extension
74
+	 * @param string									$ext_path			Path to this extension
75
+	 */
76 76
 	public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\request\request $request, \phpbb\ads\ad\manager $manager, \phpbb\ads\location\manager $location_manager, \phpbb\log\log $log, \phpbb\config\db_text $config_text, \phpbb\config\config $config, $root_path, $php_ext, $ext_path)
77 77
 	{
78 78
 		$this->template = $template;
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 	/**
92
-	* Process user request for manage mode
93
-	*
94
-	* @return void
95
-	*/
92
+	 * Process user request for manage mode
93
+	 *
94
+	 * @return void
95
+	 */
96 96
 	public function mode_manage()
97 97
 	{
98 98
 		$this->setup();
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	}
110 110
 
111 111
 	/**
112
-	* Process user request for settings mode
113
-	*
114
-	* @return void
115
-	*/
112
+	 * Process user request for settings mode
113
+	 *
114
+	 * @return void
115
+	 */
116 116
 	public function mode_settings()
117 117
 	{
118 118
 		$this->setup();
@@ -164,31 +164,31 @@  discard block
 block discarded – undo
164 164
 	}
165 165
 
166 166
 	/**
167
-	* Set page url
168
-	*
169
-	* @param string $u_action Custom form action
170
-	* @return void
171
-	*/
167
+	 * Set page url
168
+	 *
169
+	 * @param string $u_action Custom form action
170
+	 * @return void
171
+	 */
172 172
 	public function set_page_url($u_action)
173 173
 	{
174 174
 		$this->u_action = $u_action;
175 175
 	}
176 176
 
177 177
 	/**
178
-	* Get ACP page title for Ads module
179
-	*
180
-	* @return string	Language string for Ads ACP module
181
-	*/
178
+	 * Get ACP page title for Ads module
179
+	 *
180
+	 * @return string	Language string for Ads ACP module
181
+	 */
182 182
 	public function get_page_title()
183 183
 	{
184 184
 		return $this->user->lang('ACP_PHPBB_ADS_TITLE');
185 185
 	}
186 186
 
187 187
 	/**
188
-	* Add an advertisement
189
-	*
190
-	* @return void
191
-	*/
188
+	 * Add an advertisement
189
+	 *
190
+	 * @return void
191
+	 */
192 192
 	public function action_add()
193 193
 	{
194 194
 		$preview = $this->request->is_set_post('preview');
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
 	}
233 233
 
234 234
 	/**
235
-	* Edit an advertisement
236
-	*
237
-	* @return void
238
-	*/
235
+	 * Edit an advertisement
236
+	 *
237
+	 * @return void
238
+	 */
239 239
 	public function action_edit()
240 240
 	{
241 241
 		$ad_id = $this->request->variable('id', 0);
@@ -295,30 +295,30 @@  discard block
 block discarded – undo
295 295
 	}
296 296
 
297 297
 	/**
298
-	* Enable an advertisement
299
-	*
300
-	* @return void
301
-	*/
298
+	 * Enable an advertisement
299
+	 *
300
+	 * @return void
301
+	 */
302 302
 	public function action_enable()
303 303
 	{
304 304
 		$this->ad_enable(true);
305 305
 	}
306 306
 
307 307
 	/**
308
-	* Disable an advertisement
309
-	*
310
-	* @return void
311
-	*/
308
+	 * Disable an advertisement
309
+	 *
310
+	 * @return void
311
+	 */
312 312
 	public function action_disable()
313 313
 	{
314 314
 		$this->ad_enable(false);
315 315
 	}
316 316
 
317 317
 	/**
318
-	* Delete an advertisement
319
-	*
320
-	* @return void
321
-	*/
318
+	 * Delete an advertisement
319
+	 *
320
+	 * @return void
321
+	 */
322 322
 	public function action_delete()
323 323
 	{
324 324
 		$ad_id = $this->request->variable('id', 0);
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 	}
362 362
 
363 363
 	/**
364
-	* Display the ads
365
-	*
366
-	* @return void
367
-	*/
364
+	 * Display the ads
365
+	 *
366
+	 * @return void
367
+	 */
368 368
 	public function list_ads()
369 369
 	{
370 370
 		foreach ($this->manager->get_all_ads() as $row)
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
 	}
403 403
 
404 404
 	/**
405
-	* Perform general tasks
406
-	*
407
-	* @return void
408
-	*/
405
+	 * Perform general tasks
406
+	 *
407
+	 * @return void
408
+	 */
409 409
 	protected function setup()
410 410
 	{
411 411
 		$this->user->add_lang_ext('phpbb/ads', 'acp');
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 	}
415 415
 
416 416
 	/**
417
-	* Enable/disable an advertisement
418
-	*
419
-	* @param	bool	$enable	Enable or disable the advertisement?
420
-	* @return void
421
-	*/
417
+	 * Enable/disable an advertisement
418
+	 *
419
+	 * @param	bool	$enable	Enable or disable the advertisement?
420
+	 * @return void
421
+	 */
422 422
 	protected function ad_enable($enable)
423 423
 	{
424 424
 		$ad_id = $this->request->variable('id', 0);
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
 	}
450 450
 
451 451
 	/**
452
-	* Get admin form data.
453
-	*
454
-	* @param	string	$form_name	The form name.
455
-	* @return	array	Form data
456
-	*/
452
+	 * Get admin form data.
453
+	 *
454
+	 * @param	string	$form_name	The form name.
455
+	 * @return	array	Form data
456
+	 */
457 457
 	protected function get_form_data($form_name)
458 458
 	{
459 459
 		$data = array(
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
 	}
536 536
 
537 537
 	/**
538
-	* Assign form data to the template.
539
-	*
540
-	* @param	array	$data	The form data.
541
-	* @return void
542
-	*/
538
+	 * Assign form data to the template.
539
+	 *
540
+	 * @param	array	$data	The form data.
541
+	 * @return void
542
+	 */
543 543
 	protected function assign_form_data($data)
544 544
 	{
545 545
 		$this->template->assign_vars(array(
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 	}
560 560
 
561 561
 	/**
562
-	* Prepare end date for display
563
-	*
564
-	* @param	mixed	$end_date	End date.
565
-	* @return	string	End date prepared for display.
566
-	*/
562
+	 * Prepare end date for display
563
+	 *
564
+	 * @param	mixed	$end_date	End date.
565
+	 * @return	string	End date prepared for display.
566
+	 */
567 567
 	protected function prepare_end_date($end_date)
568 568
 	{
569 569
 		if (empty($end_date))
@@ -580,11 +580,11 @@  discard block
 block discarded – undo
580 580
 	}
581 581
 
582 582
 	/**
583
-	* Assign template locations data to the template.
584
-	*
585
-	* @param	mixed	$data	The form data or nothing.
586
-	* @return	void
587
-	*/
583
+	 * Assign template locations data to the template.
584
+	 *
585
+	 * @param	mixed	$data	The form data or nothing.
586
+	 * @return	void
587
+	 */
588 588
 	protected function assign_locations($data = false)
589 589
 	{
590 590
 		foreach ($this->location_manager->get_all_locations() as $location_id => $location_data)
@@ -599,43 +599,43 @@  discard block
 block discarded – undo
599 599
 	}
600 600
 
601 601
 	/**
602
-	* Prepare advertisement preview
603
-	*
604
-	* @param	string	$code	Ad code to preview
605
-	* @return	void
606
-	*/
602
+	 * Prepare advertisement preview
603
+	 *
604
+	 * @param	string	$code	Ad code to preview
605
+	 * @return	void
606
+	 */
607 607
 	protected function ad_preview($code)
608 608
 	{
609 609
 		$this->template->assign_var('PREVIEW', htmlspecialchars_decode($code));
610 610
 	}
611 611
 
612 612
 	/**
613
-	* Print success message.
614
-	*
615
-	* It takes arguments in the form of a language key, followed by language substitution values.
616
-	*/
613
+	 * Print success message.
614
+	 *
615
+	 * It takes arguments in the form of a language key, followed by language substitution values.
616
+	 */
617 617
 	protected function success()
618 618
 	{
619 619
 		trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action));
620 620
 	}
621 621
 
622 622
 	/**
623
-	* Print error message.
624
-	*
625
-	* It takes arguments in the form of a language key, followed by language substitution values.
626
-	*/
623
+	 * Print error message.
624
+	 *
625
+	 * It takes arguments in the form of a language key, followed by language substitution values.
626
+	 */
627 627
 	protected function error()
628 628
 	{
629 629
 		trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action), E_USER_WARNING);
630 630
 	}
631 631
 
632 632
 	/**
633
-	* Log action
634
-	*
635
-	* @param	string	$action		Performed action in uppercase
636
-	* @param	string	$ad_name	Advertisement name
637
-	* @return	void
638
-	*/
633
+	 * Log action
634
+	 *
635
+	 * @param	string	$action		Performed action in uppercase
636
+	 * @param	string	$ad_name	Advertisement name
637
+	 * @return	void
638
+	 */
639 639
 	protected function log($action, $ad_name)
640 640
 	{
641 641
 		$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_PHPBB_ADS_' . $action . '_LOG', time(), array($ad_name));
Please login to merge, or discard this patch.