@@ -49,17 +49,17 @@ discard block |
||
| 49 | 49 | protected $errors = array(); |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Constructor |
|
| 53 | - * |
|
| 54 | - * @param \phpbb\template\template $template Template object |
|
| 55 | - * @param \phpbb\user $user User object |
|
| 56 | - * @param \phpbb\request\request $request Request object |
|
| 57 | - * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
| 58 | - * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
| 59 | - * @param \phpbb\log\log $log The phpBB log system |
|
| 60 | - * @param string $php_ext PHP extension |
|
| 61 | - * @param string $ext_path Path to this extension |
|
| 62 | - */ |
|
| 52 | + * Constructor |
|
| 53 | + * |
|
| 54 | + * @param \phpbb\template\template $template Template object |
|
| 55 | + * @param \phpbb\user $user User object |
|
| 56 | + * @param \phpbb\request\request $request Request object |
|
| 57 | + * @param \phpbb\admanagement\ad\manager $manager Advertisement manager object |
|
| 58 | + * @param \phpbb\admanagement\location\manager $location_manager Template location manager object |
|
| 59 | + * @param \phpbb\log\log $log The phpBB log system |
|
| 60 | + * @param string $php_ext PHP extension |
|
| 61 | + * @param string $ext_path Path to this extension |
|
| 62 | + */ |
|
| 63 | 63 | 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, $php_ext, $ext_path) |
| 64 | 64 | { |
| 65 | 65 | $this->template = $template; |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Process user request |
|
| 77 | - * |
|
| 78 | - * @return void |
|
| 79 | - */ |
|
| 76 | + * Process user request |
|
| 77 | + * |
|
| 78 | + * @return void |
|
| 79 | + */ |
|
| 80 | 80 | public function main() |
| 81 | 81 | { |
| 82 | 82 | $this->user->add_lang_ext('phpbb/admanagement', 'acp'); |
@@ -95,31 +95,31 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | - * Set page url |
|
| 99 | - * |
|
| 100 | - * @param string $u_action Custom form action |
|
| 101 | - * @return void |
|
| 102 | - */ |
|
| 98 | + * Set page url |
|
| 99 | + * |
|
| 100 | + * @param string $u_action Custom form action |
|
| 101 | + * @return void |
|
| 102 | + */ |
|
| 103 | 103 | public function set_page_url($u_action) |
| 104 | 104 | { |
| 105 | 105 | $this->u_action = $u_action; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | - * Get ACP page title for Ads module |
|
| 110 | - * |
|
| 111 | - * @return string Language string for Ads ACP module |
|
| 112 | - */ |
|
| 109 | + * Get ACP page title for Ads module |
|
| 110 | + * |
|
| 111 | + * @return string Language string for Ads ACP module |
|
| 112 | + */ |
|
| 113 | 113 | public function get_page_title() |
| 114 | 114 | { |
| 115 | 115 | return $this->user->lang('ACP_ADMANAGEMENT_TITLE'); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | - * Add an advertisement |
|
| 120 | - * |
|
| 121 | - * @return void |
|
| 122 | - */ |
|
| 119 | + * Add an advertisement |
|
| 120 | + * |
|
| 121 | + * @return void |
|
| 122 | + */ |
|
| 123 | 123 | public function action_add() |
| 124 | 124 | { |
| 125 | 125 | $preview = $this->request->is_set_post('preview'); |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * Edit an advertisement |
|
| 165 | - * |
|
| 166 | - * @return void |
|
| 167 | - */ |
|
| 164 | + * Edit an advertisement |
|
| 165 | + * |
|
| 166 | + * @return void |
|
| 167 | + */ |
|
| 168 | 168 | public function action_edit() |
| 169 | 169 | { |
| 170 | 170 | $ad_id = $this->request->variable('id', 0); |
@@ -222,30 +222,30 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | - * Enable an advertisement |
|
| 226 | - * |
|
| 227 | - * @return void |
|
| 228 | - */ |
|
| 225 | + * Enable an advertisement |
|
| 226 | + * |
|
| 227 | + * @return void |
|
| 228 | + */ |
|
| 229 | 229 | public function action_enable() |
| 230 | 230 | { |
| 231 | 231 | $this->ad_enable(true); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
| 235 | - * Disable an advertisement |
|
| 236 | - * |
|
| 237 | - * @return void |
|
| 238 | - */ |
|
| 235 | + * Disable an advertisement |
|
| 236 | + * |
|
| 237 | + * @return void |
|
| 238 | + */ |
|
| 239 | 239 | public function action_disable() |
| 240 | 240 | { |
| 241 | 241 | $this->ad_enable(false); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
| 245 | - * Delete an advertisement |
|
| 246 | - * |
|
| 247 | - * @return void |
|
| 248 | - */ |
|
| 245 | + * Delete an advertisement |
|
| 246 | + * |
|
| 247 | + * @return void |
|
| 248 | + */ |
|
| 249 | 249 | public function action_delete() |
| 250 | 250 | { |
| 251 | 251 | $ad_id = $this->request->variable('id', 0); |
@@ -288,10 +288,10 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
| 291 | - * Display the ads |
|
| 292 | - * |
|
| 293 | - * @return void |
|
| 294 | - */ |
|
| 291 | + * Display the ads |
|
| 292 | + * |
|
| 293 | + * @return void |
|
| 294 | + */ |
|
| 295 | 295 | public function list_ads() |
| 296 | 296 | { |
| 297 | 297 | foreach ($this->manager->get_all_ads() as $row) |
@@ -321,11 +321,11 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
| 324 | - * Enable/disable an advertisement |
|
| 325 | - * |
|
| 326 | - * @param bool $enable Enable or disable the advertisement? |
|
| 327 | - * @return void |
|
| 328 | - */ |
|
| 324 | + * Enable/disable an advertisement |
|
| 325 | + * |
|
| 326 | + * @param bool $enable Enable or disable the advertisement? |
|
| 327 | + * @return void |
|
| 328 | + */ |
|
| 329 | 329 | protected function ad_enable($enable) |
| 330 | 330 | { |
| 331 | 331 | $ad_id = $this->request->variable('id', 0); |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
| 359 | - * Get admin form data. |
|
| 360 | - * |
|
| 361 | - * @param string $form_name The form name. |
|
| 362 | - * @return array Form data |
|
| 363 | - */ |
|
| 359 | + * Get admin form data. |
|
| 360 | + * |
|
| 361 | + * @param string $form_name The form name. |
|
| 362 | + * @return array Form data |
|
| 363 | + */ |
|
| 364 | 364 | protected function get_form_data($form_name) |
| 365 | 365 | { |
| 366 | 366 | $data = array( |
@@ -411,11 +411,11 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
| 414 | - * Assign form data to the template. |
|
| 415 | - * |
|
| 416 | - * @param array $data The form data. |
|
| 417 | - * @return void |
|
| 418 | - */ |
|
| 414 | + * Assign form data to the template. |
|
| 415 | + * |
|
| 416 | + * @param array $data The form data. |
|
| 417 | + * @return void |
|
| 418 | + */ |
|
| 419 | 419 | protected function assign_form_data($data) |
| 420 | 420 | { |
| 421 | 421 | $this->template->assign_vars(array( |
@@ -430,11 +430,11 @@ discard block |
||
| 430 | 430 | )); |
| 431 | 431 | } |
| 432 | 432 | /** |
| 433 | - * Prepare end date for display |
|
| 434 | - * |
|
| 435 | - * @param mixed $end_date End date. |
|
| 436 | - * @return string End date prepared for display. |
|
| 437 | - */ |
|
| 433 | + * Prepare end date for display |
|
| 434 | + * |
|
| 435 | + * @param mixed $end_date End date. |
|
| 436 | + * @return string End date prepared for display. |
|
| 437 | + */ |
|
| 438 | 438 | protected function prepare_end_date($end_date) |
| 439 | 439 | { |
| 440 | 440 | if (empty($end_date)) |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
| 453 | - * Assign template locations data to the template. |
|
| 454 | - * |
|
| 455 | - * @param mixed $data The form data or nothing. |
|
| 456 | - * @return void |
|
| 457 | - */ |
|
| 453 | + * Assign template locations data to the template. |
|
| 454 | + * |
|
| 455 | + * @param mixed $data The form data or nothing. |
|
| 456 | + * @return void |
|
| 457 | + */ |
|
| 458 | 458 | protected function assign_locations($data = false) |
| 459 | 459 | { |
| 460 | 460 | foreach ($this->location_manager->get_all_locations() as $location_id => $location_data) |
@@ -469,43 +469,43 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | /** |
| 472 | - * Prepare advertisement preview |
|
| 473 | - * |
|
| 474 | - * @param string $code Ad code to preview |
|
| 475 | - * @return void |
|
| 476 | - */ |
|
| 472 | + * Prepare advertisement preview |
|
| 473 | + * |
|
| 474 | + * @param string $code Ad code to preview |
|
| 475 | + * @return void |
|
| 476 | + */ |
|
| 477 | 477 | protected function ad_preview($code) |
| 478 | 478 | { |
| 479 | 479 | $this->template->assign_var('PREVIEW', htmlspecialchars_decode($code)); |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | /** |
| 483 | - * Print success message. |
|
| 484 | - * |
|
| 485 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 486 | - */ |
|
| 483 | + * Print success message. |
|
| 484 | + * |
|
| 485 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 486 | + */ |
|
| 487 | 487 | protected function success() |
| 488 | 488 | { |
| 489 | 489 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action)); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
| 493 | - * Print error message. |
|
| 494 | - * |
|
| 495 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 496 | - */ |
|
| 493 | + * Print error message. |
|
| 494 | + * |
|
| 495 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 496 | + */ |
|
| 497 | 497 | protected function error() |
| 498 | 498 | { |
| 499 | 499 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action), E_USER_WARNING); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
| 503 | - * Log action |
|
| 504 | - * |
|
| 505 | - * @param string $action Performed action in uppercase |
|
| 506 | - * @param string $ad_name Advertisement name |
|
| 507 | - * @return void |
|
| 508 | - */ |
|
| 503 | + * Log action |
|
| 504 | + * |
|
| 505 | + * @param string $action Performed action in uppercase |
|
| 506 | + * @param string $ad_name Advertisement name |
|
| 507 | + * @return void |
|
| 508 | + */ |
|
| 509 | 509 | protected function log($action, $ad_name) |
| 510 | 510 | { |
| 511 | 511 | $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_ADMANAGEMENT_' . $action . '_LOG', time(), array($ad_name)); |