@@ -13,16 +13,16 @@ |
||
13 | 13 | class after_profile extends base |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function get_id() |
19 | 19 | { |
20 | 20 | return 'after_profile'; |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritDoc} |
|
25 | - */ |
|
24 | + * {@inheritDoc} |
|
25 | + */ |
|
26 | 26 | public function will_display() |
27 | 27 | { |
28 | 28 | return strpos($this->user->page['page_name'], 'memberlist') !== false && strpos($this->user->page['query_string'], 'viewprofile') !== false; |
@@ -13,16 +13,16 @@ |
||
13 | 13 | class before_profile extends base |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function get_id() |
19 | 19 | { |
20 | 20 | return 'before_profile'; |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritDoc} |
|
25 | - */ |
|
24 | + * {@inheritDoc} |
|
25 | + */ |
|
26 | 26 | public function will_display() |
27 | 27 | { |
28 | 28 | return strpos($this->user->page['page_name'], 'memberlist') !== false && strpos($this->user->page['query_string'], 'viewprofile') !== false; |
@@ -13,16 +13,16 @@ |
||
13 | 13 | class after_not_first_post extends base |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function get_id() |
19 | 19 | { |
20 | 20 | return 'after_not_first_post'; |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritDoc} |
|
25 | - */ |
|
24 | + * {@inheritDoc} |
|
25 | + */ |
|
26 | 26 | public function will_display() |
27 | 27 | { |
28 | 28 | return strpos($this->user->page['page_name'], 'viewtopic') !== false; |
@@ -13,8 +13,8 @@ |
||
13 | 13 | class below_footer extends base |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function get_id() |
19 | 19 | { |
20 | 20 | return 'below_footer'; |
@@ -16,40 +16,40 @@ |
||
16 | 16 | abstract class base implements \phpbb\admanagement\location\type\type_interface |
17 | 17 | { |
18 | 18 | /** |
19 | - * User object |
|
20 | - * @var \phpbb\user |
|
21 | - */ |
|
19 | + * User object |
|
20 | + * @var \phpbb\user |
|
21 | + */ |
|
22 | 22 | protected $user; |
23 | 23 | |
24 | 24 | /** |
25 | - * Construct an after_profile template location object |
|
26 | - * |
|
27 | - * @param \phpbb\user $user User object |
|
28 | - */ |
|
25 | + * Construct an after_profile template location object |
|
26 | + * |
|
27 | + * @param \phpbb\user $user User object |
|
28 | + */ |
|
29 | 29 | public function __construct(\phpbb\user $user) |
30 | 30 | { |
31 | 31 | $this->user = $user; |
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * {@inheritDoc} |
|
36 | - */ |
|
35 | + * {@inheritDoc} |
|
36 | + */ |
|
37 | 37 | public function get_name() |
38 | 38 | { |
39 | 39 | return $this->user->lang('AD_' . strtoupper($this->get_id())); |
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * {@inheritDoc} |
|
44 | - */ |
|
43 | + * {@inheritDoc} |
|
44 | + */ |
|
45 | 45 | public function get_desc() |
46 | 46 | { |
47 | 47 | return $this->user->lang('AD_' . strtoupper($this->get_id()) . '_DESC'); |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * {@inheritDoc} |
|
52 | - */ |
|
51 | + * {@inheritDoc} |
|
52 | + */ |
|
53 | 53 | public function will_display() |
54 | 54 | { |
55 | 55 | return true; |
@@ -13,30 +13,30 @@ discard block |
||
13 | 13 | class m3_template_locations_schema extends \phpbb\db\migration\migration |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function effectively_installed() |
19 | 19 | { |
20 | 20 | return $this->db_tools->sql_table_exists($this->table_prefix . 'ad_locations'); |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritDoc} |
|
25 | - */ |
|
24 | + * {@inheritDoc} |
|
25 | + */ |
|
26 | 26 | static public function depends_on() |
27 | 27 | { |
28 | 28 | return array('\phpbb\admanagement\migrations\v10x\m2_acp_module'); |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Add the ad_locations table schema to the database: |
|
33 | - * ad_locations: |
|
34 | - * ad_id |
|
35 | - * location_id |
|
36 | - * |
|
37 | - * @return array Array of table schema |
|
38 | - * @access public |
|
39 | - */ |
|
32 | + * Add the ad_locations table schema to the database: |
|
33 | + * ad_locations: |
|
34 | + * ad_id |
|
35 | + * location_id |
|
36 | + * |
|
37 | + * @return array Array of table schema |
|
38 | + * @access public |
|
39 | + */ |
|
40 | 40 | public function update_schema() |
41 | 41 | { |
42 | 42 | return array( |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Drop the ad_locations table schema from the database |
|
57 | - * |
|
58 | - * @return array Array of table schema |
|
59 | - * @access public |
|
60 | - */ |
|
56 | + * Drop the ad_locations table schema from the database |
|
57 | + * |
|
58 | + * @return array Array of table schema |
|
59 | + * @access public |
|
60 | + */ |
|
61 | 61 | public function revert_schema() |
62 | 62 | { |
63 | 63 | return array( |
@@ -13,27 +13,27 @@ discard block |
||
13 | 13 | class m4_indexes extends \phpbb\db\migration\migration |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function effectively_installed() |
19 | 19 | { |
20 | 20 | return $this->db_tools->sql_index_exists($this->table_prefix . 'ads', 'ad_enabled'); |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritDoc} |
|
25 | - */ |
|
24 | + * {@inheritDoc} |
|
25 | + */ |
|
26 | 26 | static public function depends_on() |
27 | 27 | { |
28 | 28 | return array('\phpbb\admanagement\migrations\v10x\m3_template_locations_schema'); |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Add the indexes |
|
33 | - * |
|
34 | - * @return array Array of altered table schema |
|
35 | - * @access public |
|
36 | - */ |
|
32 | + * Add the indexes |
|
33 | + * |
|
34 | + * @return array Array of altered table schema |
|
35 | + * @access public |
|
36 | + */ |
|
37 | 37 | public function update_schema() |
38 | 38 | { |
39 | 39 | return array( |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * Drop the indexes |
|
53 | - * |
|
54 | - * @return array Array of altered table schema |
|
55 | - * @access public |
|
56 | - */ |
|
52 | + * Drop the indexes |
|
53 | + * |
|
54 | + * @return array Array of altered table schema |
|
55 | + * @access public |
|
56 | + */ |
|
57 | 57 | public function revert_schema() |
58 | 58 | { |
59 | 59 | return array( |
@@ -13,27 +13,27 @@ discard block |
||
13 | 13 | class m5_end_date extends \phpbb\db\migration\migration |
14 | 14 | { |
15 | 15 | /** |
16 | - * {@inheritDoc} |
|
17 | - */ |
|
16 | + * {@inheritDoc} |
|
17 | + */ |
|
18 | 18 | public function effectively_installed() |
19 | 19 | { |
20 | 20 | return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'ad_end_date'); |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | - * {@inheritDoc} |
|
25 | - */ |
|
24 | + * {@inheritDoc} |
|
25 | + */ |
|
26 | 26 | static public function depends_on() |
27 | 27 | { |
28 | 28 | return array('\phpbb\admanagement\migrations\v10x\m4_indexes'); |
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Add the end date to ads table |
|
33 | - * |
|
34 | - * @return array Array of table schema |
|
35 | - * @access public |
|
36 | - */ |
|
32 | + * Add the end date to ads table |
|
33 | + * |
|
34 | + * @return array Array of table schema |
|
35 | + * @access public |
|
36 | + */ |
|
37 | 37 | public function update_schema() |
38 | 38 | { |
39 | 39 | return array( |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * Drop the end date from ads table |
|
50 | - * |
|
51 | - * @return array Array of table schema |
|
52 | - * @access public |
|
53 | - */ |
|
49 | + * Drop the end date from ads table |
|
50 | + * |
|
51 | + * @return array Array of table schema |
|
52 | + * @access public |
|
53 | + */ |
|
54 | 54 | public function revert_schema() |
55 | 55 | { |
56 | 56 | return array( |
@@ -55,19 +55,19 @@ discard block |
||
55 | 55 | protected $errors = array(); |
56 | 56 | |
57 | 57 | /** |
58 | - * Constructor |
|
59 | - * |
|
60 | - * @param \phpbb\template\template $template Template object |
|
61 | - * @param \phpbb\user $user User object |
|
62 | - * @param \phpbb\request\request $request Request object |
|
63 | - * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
64 | - * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
65 | - * @param \phpbb\log\log $log The phpBB log system |
|
66 | - * @param \phpbb\config\db_text $config_text Config text object |
|
67 | - * @param \phpbb\cache\driver\driver_interface $cache Cache object |
|
68 | - * @param string $php_ext PHP extension |
|
69 | - * @param string $ext_path Path to this extension |
|
70 | - */ |
|
58 | + * Constructor |
|
59 | + * |
|
60 | + * @param \phpbb\template\template $template Template object |
|
61 | + * @param \phpbb\user $user User object |
|
62 | + * @param \phpbb\request\request $request Request object |
|
63 | + * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
64 | + * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
65 | + * @param \phpbb\log\log $log The phpBB log system |
|
66 | + * @param \phpbb\config\db_text $config_text Config text object |
|
67 | + * @param \phpbb\cache\driver\driver_interface $cache Cache object |
|
68 | + * @param string $php_ext PHP extension |
|
69 | + * @param string $ext_path Path to this extension |
|
70 | + */ |
|
71 | 71 | public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\request\request $request, \phpbb\admanagement\ad\manager $manager, \phpbb\admanagement\location\manager $location_manager, \phpbb\log\log $log, \phpbb\config\db_text $config_text, \phpbb\cache\driver\driver_interface $cache, $php_ext, $ext_path) |
72 | 72 | { |
73 | 73 | $this->template = $template; |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * Process user request for manage mode |
|
87 | - * |
|
88 | - * @return void |
|
89 | - */ |
|
86 | + * Process user request for manage mode |
|
87 | + * |
|
88 | + * @return void |
|
89 | + */ |
|
90 | 90 | public function mode_manage() |
91 | 91 | { |
92 | 92 | $this->setup(); |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | - * Process user request for settings mode |
|
107 | - * |
|
108 | - * @return void |
|
109 | - */ |
|
106 | + * Process user request for settings mode |
|
107 | + * |
|
108 | + * @return void |
|
109 | + */ |
|
110 | 110 | public function mode_settings() |
111 | 111 | { |
112 | 112 | $this->setup(); |
@@ -142,31 +142,31 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Set page url |
|
146 | - * |
|
147 | - * @param string $u_action Custom form action |
|
148 | - * @return void |
|
149 | - */ |
|
145 | + * Set page url |
|
146 | + * |
|
147 | + * @param string $u_action Custom form action |
|
148 | + * @return void |
|
149 | + */ |
|
150 | 150 | public function set_page_url($u_action) |
151 | 151 | { |
152 | 152 | $this->u_action = $u_action; |
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
156 | - * Get ACP page title for Ads module |
|
157 | - * |
|
158 | - * @return string Language string for Ads ACP module |
|
159 | - */ |
|
156 | + * Get ACP page title for Ads module |
|
157 | + * |
|
158 | + * @return string Language string for Ads ACP module |
|
159 | + */ |
|
160 | 160 | public function get_page_title() |
161 | 161 | { |
162 | 162 | return $this->user->lang('ACP_ADMANAGEMENT_TITLE'); |
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * Add an advertisement |
|
167 | - * |
|
168 | - * @return void |
|
169 | - */ |
|
166 | + * Add an advertisement |
|
167 | + * |
|
168 | + * @return void |
|
169 | + */ |
|
170 | 170 | public function action_add() |
171 | 171 | { |
172 | 172 | $preview = $this->request->is_set_post('preview'); |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
211 | - * Edit an advertisement |
|
212 | - * |
|
213 | - * @return void |
|
214 | - */ |
|
211 | + * Edit an advertisement |
|
212 | + * |
|
213 | + * @return void |
|
214 | + */ |
|
215 | 215 | public function action_edit() |
216 | 216 | { |
217 | 217 | $ad_id = $this->request->variable('id', 0); |
@@ -269,30 +269,30 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
272 | - * Enable an advertisement |
|
273 | - * |
|
274 | - * @return void |
|
275 | - */ |
|
272 | + * Enable an advertisement |
|
273 | + * |
|
274 | + * @return void |
|
275 | + */ |
|
276 | 276 | public function action_enable() |
277 | 277 | { |
278 | 278 | $this->ad_enable(true); |
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | - * Disable an advertisement |
|
283 | - * |
|
284 | - * @return void |
|
285 | - */ |
|
282 | + * Disable an advertisement |
|
283 | + * |
|
284 | + * @return void |
|
285 | + */ |
|
286 | 286 | public function action_disable() |
287 | 287 | { |
288 | 288 | $this->ad_enable(false); |
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * Delete an advertisement |
|
293 | - * |
|
294 | - * @return void |
|
295 | - */ |
|
292 | + * Delete an advertisement |
|
293 | + * |
|
294 | + * @return void |
|
295 | + */ |
|
296 | 296 | public function action_delete() |
297 | 297 | { |
298 | 298 | $ad_id = $this->request->variable('id', 0); |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
338 | - * Display the ads |
|
339 | - * |
|
340 | - * @return void |
|
341 | - */ |
|
338 | + * Display the ads |
|
339 | + * |
|
340 | + * @return void |
|
341 | + */ |
|
342 | 342 | public function list_ads() |
343 | 343 | { |
344 | 344 | foreach ($this->manager->get_all_ads() as $row) |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Perform general tasks |
|
372 | - * |
|
373 | - * @return void |
|
374 | - */ |
|
371 | + * Perform general tasks |
|
372 | + * |
|
373 | + * @return void |
|
374 | + */ |
|
375 | 375 | protected function setup() |
376 | 376 | { |
377 | 377 | $this->user->add_lang_ext('phpbb/admanagement', 'acp'); |
@@ -380,11 +380,11 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
383 | - * Enable/disable an advertisement |
|
384 | - * |
|
385 | - * @param bool $enable Enable or disable the advertisement? |
|
386 | - * @return void |
|
387 | - */ |
|
383 | + * Enable/disable an advertisement |
|
384 | + * |
|
385 | + * @param bool $enable Enable or disable the advertisement? |
|
386 | + * @return void |
|
387 | + */ |
|
388 | 388 | protected function ad_enable($enable) |
389 | 389 | { |
390 | 390 | $ad_id = $this->request->variable('id', 0); |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
418 | - * Get admin form data. |
|
419 | - * |
|
420 | - * @param string $form_name The form name. |
|
421 | - * @return array Form data |
|
422 | - */ |
|
418 | + * Get admin form data. |
|
419 | + * |
|
420 | + * @param string $form_name The form name. |
|
421 | + * @return array Form data |
|
422 | + */ |
|
423 | 423 | protected function get_form_data($form_name) |
424 | 424 | { |
425 | 425 | $data = array( |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
473 | - * Assign form data to the template. |
|
474 | - * |
|
475 | - * @param array $data The form data. |
|
476 | - * @return void |
|
477 | - */ |
|
473 | + * Assign form data to the template. |
|
474 | + * |
|
475 | + * @param array $data The form data. |
|
476 | + * @return void |
|
477 | + */ |
|
478 | 478 | protected function assign_form_data($data) |
479 | 479 | { |
480 | 480 | $this->template->assign_vars(array( |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | )); |
490 | 490 | } |
491 | 491 | /** |
492 | - * Prepare end date for display |
|
493 | - * |
|
494 | - * @param mixed $end_date End date. |
|
495 | - * @return string End date prepared for display. |
|
496 | - */ |
|
492 | + * Prepare end date for display |
|
493 | + * |
|
494 | + * @param mixed $end_date End date. |
|
495 | + * @return string End date prepared for display. |
|
496 | + */ |
|
497 | 497 | protected function prepare_end_date($end_date) |
498 | 498 | { |
499 | 499 | if (empty($end_date)) |
@@ -509,11 +509,11 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | /** |
512 | - * Assign template locations data to the template. |
|
513 | - * |
|
514 | - * @param mixed $data The form data or nothing. |
|
515 | - * @return void |
|
516 | - */ |
|
512 | + * Assign template locations data to the template. |
|
513 | + * |
|
514 | + * @param mixed $data The form data or nothing. |
|
515 | + * @return void |
|
516 | + */ |
|
517 | 517 | protected function assign_locations($data = false) |
518 | 518 | { |
519 | 519 | foreach ($this->location_manager->get_all_locations() as $location_id => $location_data) |
@@ -528,43 +528,43 @@ discard block |
||
528 | 528 | } |
529 | 529 | |
530 | 530 | /** |
531 | - * Prepare advertisement preview |
|
532 | - * |
|
533 | - * @param string $code Ad code to preview |
|
534 | - * @return void |
|
535 | - */ |
|
531 | + * Prepare advertisement preview |
|
532 | + * |
|
533 | + * @param string $code Ad code to preview |
|
534 | + * @return void |
|
535 | + */ |
|
536 | 536 | protected function ad_preview($code) |
537 | 537 | { |
538 | 538 | $this->template->assign_var('PREVIEW', htmlspecialchars_decode($code)); |
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
542 | - * Print success message. |
|
543 | - * |
|
544 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
545 | - */ |
|
542 | + * Print success message. |
|
543 | + * |
|
544 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
545 | + */ |
|
546 | 546 | protected function success() |
547 | 547 | { |
548 | 548 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action)); |
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
552 | - * Print error message. |
|
553 | - * |
|
554 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
555 | - */ |
|
552 | + * Print error message. |
|
553 | + * |
|
554 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
555 | + */ |
|
556 | 556 | protected function error() |
557 | 557 | { |
558 | 558 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action), E_USER_WARNING); |
559 | 559 | } |
560 | 560 | |
561 | 561 | /** |
562 | - * Log action |
|
563 | - * |
|
564 | - * @param string $action Performed action in uppercase |
|
565 | - * @param string $ad_name Advertisement name |
|
566 | - * @return void |
|
567 | - */ |
|
562 | + * Log action |
|
563 | + * |
|
564 | + * @param string $action Performed action in uppercase |
|
565 | + * @param string $ad_name Advertisement name |
|
566 | + * @return void |
|
567 | + */ |
|
568 | 568 | protected function log($action, $ad_name) |
569 | 569 | { |
570 | 570 | $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_ADMANAGEMENT_' . $action . '_LOG', time(), array($ad_name)); |