@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | class m1_initial_schema extends \phpbb\db\migration\migration |
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | - * {@inheritDoc} |
|
| 20 | - */ |
|
| 19 | + * {@inheritDoc} |
|
| 20 | + */ |
|
| 21 | 21 | public function effectively_installed() |
| 22 | 22 | { |
| 23 | 23 | return $this->db_tools->sql_table_exists($this->table_prefix . 'ads'); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * {@inheritDoc} |
|
| 28 | - */ |
|
| 27 | + * {@inheritDoc} |
|
| 28 | + */ |
|
| 29 | 29 | static public function depends_on() |
| 30 | 30 | { |
| 31 | 31 | return array('\phpbb\db\migration\data\v310\gold'); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * Add the ads table schema to the database: |
|
| 36 | - * ads: |
|
| 37 | - * ad_id |
|
| 38 | - * ad_name |
|
| 39 | - * ad_note |
|
| 40 | - * ad_code |
|
| 41 | - * ad_enabled |
|
| 42 | - * |
|
| 43 | - * @return array Array of table schema |
|
| 44 | - * @access public |
|
| 45 | - */ |
|
| 35 | + * Add the ads table schema to the database: |
|
| 36 | + * ads: |
|
| 37 | + * ad_id |
|
| 38 | + * ad_name |
|
| 39 | + * ad_note |
|
| 40 | + * ad_code |
|
| 41 | + * ad_enabled |
|
| 42 | + * |
|
| 43 | + * @return array Array of table schema |
|
| 44 | + * @access public |
|
| 45 | + */ |
|
| 46 | 46 | public function update_schema() |
| 47 | 47 | { |
| 48 | 48 | return array( |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * Drop the ads table schema from the database |
|
| 66 | - * |
|
| 67 | - * @return array Array of table schema |
|
| 68 | - * @access public |
|
| 69 | - */ |
|
| 65 | + * Drop the ads table schema from the database |
|
| 66 | + * |
|
| 67 | + * @return array Array of table schema |
|
| 68 | + * @access public |
|
| 69 | + */ |
|
| 70 | 70 | public function revert_schema() |
| 71 | 71 | { |
| 72 | 72 | return array( |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | class m2_acp_module 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 | $sql = 'SELECT module_id |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * {@inheritDoc} |
|
| 33 | - */ |
|
| 32 | + * {@inheritDoc} |
|
| 33 | + */ |
|
| 34 | 34 | static public function depends_on() |
| 35 | 35 | { |
| 36 | 36 | return array('\phpbb\admanagement\migrations\v10x\m1_initial_schema'); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Add the ACP module |
|
| 41 | - * |
|
| 42 | - * @return array Array of data update instructions |
|
| 43 | - */ |
|
| 40 | + * Add the ACP module |
|
| 41 | + * |
|
| 42 | + * @return array Array of data update instructions |
|
| 43 | + */ |
|
| 44 | 44 | public function update_data() |
| 45 | 45 | { |
| 46 | 46 | return array( |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | protected $ads_table; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * {@inheritdoc} |
|
| 37 | - */ |
|
| 36 | + * {@inheritdoc} |
|
| 37 | + */ |
|
| 38 | 38 | static public function getSubscribedEvents() |
| 39 | 39 | { |
| 40 | 40 | return array( |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * Constructor |
|
| 47 | - * |
|
| 48 | - * @param \phpbb\request\request $request Request object |
|
| 49 | - * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 50 | - * @param \phpbb\template\template $template Template object |
|
| 51 | - * @param string $ads_table Ads table |
|
| 52 | - */ |
|
| 46 | + * Constructor |
|
| 47 | + * |
|
| 48 | + * @param \phpbb\request\request $request Request object |
|
| 49 | + * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 50 | + * @param \phpbb\template\template $template Template object |
|
| 51 | + * @param string $ads_table Ads table |
|
| 52 | + */ |
|
| 53 | 53 | public function __construct(\phpbb\request\request $request, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, $ads_table) |
| 54 | 54 | { |
| 55 | 55 | $this->request = $request; |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | protected $errors = array(); |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Constructor |
|
| 49 | - * |
|
| 50 | - * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 51 | - * @param \phpbb\template\template $template Template object |
|
| 52 | - * @param \phpbb\user $user User object |
|
| 53 | - * @param \phpbb\request\request $request Request object |
|
| 54 | - * @param string $ads_table Ads table |
|
| 55 | - * @param string $php_ext PHP extension |
|
| 56 | - * @param string $phpbb_admin_path Path to admin |
|
| 57 | - */ |
|
| 48 | + * Constructor |
|
| 49 | + * |
|
| 50 | + * @param \phpbb\db\driver\driver_interface $db DB driver interface |
|
| 51 | + * @param \phpbb\template\template $template Template object |
|
| 52 | + * @param \phpbb\user $user User object |
|
| 53 | + * @param \phpbb\request\request $request Request object |
|
| 54 | + * @param string $ads_table Ads table |
|
| 55 | + * @param string $php_ext PHP extension |
|
| 56 | + * @param string $phpbb_admin_path Path to admin |
|
| 57 | + */ |
|
| 58 | 58 | public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\request\request $request, $ads_table, $php_ext, $phpbb_admin_path) |
| 59 | 59 | { |
| 60 | 60 | $this->db = $db; |
@@ -67,51 +67,51 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * Set page url |
|
| 71 | - * |
|
| 72 | - * @param string $u_action Custom form action |
|
| 73 | - * @return void |
|
| 74 | - */ |
|
| 70 | + * Set page url |
|
| 71 | + * |
|
| 72 | + * @param string $u_action Custom form action |
|
| 73 | + * @return void |
|
| 74 | + */ |
|
| 75 | 75 | public function set_page_url($u_action) |
| 76 | 76 | { |
| 77 | 77 | $this->u_action = $u_action; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Load module-specific language |
|
| 82 | - * |
|
| 83 | - * @return void |
|
| 84 | - */ |
|
| 81 | + * Load module-specific language |
|
| 82 | + * |
|
| 83 | + * @return void |
|
| 84 | + */ |
|
| 85 | 85 | public function load_lang() |
| 86 | 86 | { |
| 87 | 87 | $this->user->add_lang_ext('phpbb/admanagement', 'acp'); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * Get ACP page title for Ads module |
|
| 92 | - * |
|
| 93 | - * @return string Language string for Ads ACP module |
|
| 94 | - */ |
|
| 91 | + * Get ACP page title for Ads module |
|
| 92 | + * |
|
| 93 | + * @return string Language string for Ads ACP module |
|
| 94 | + */ |
|
| 95 | 95 | public function get_page_title() |
| 96 | 96 | { |
| 97 | 97 | return $this->user->lang('ACP_ADMANAGEMENT_TITLE'); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * Get action |
|
| 102 | - * |
|
| 103 | - * @return string Ads module action |
|
| 104 | - */ |
|
| 101 | + * Get action |
|
| 102 | + * |
|
| 103 | + * @return string Ads module action |
|
| 104 | + */ |
|
| 105 | 105 | public function get_action() |
| 106 | 106 | { |
| 107 | 107 | return $this->request->variable('action', ''); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * Add an advertisement |
|
| 112 | - * |
|
| 113 | - * @return void |
|
| 114 | - */ |
|
| 111 | + * Add an advertisement |
|
| 112 | + * |
|
| 113 | + * @return void |
|
| 114 | + */ |
|
| 115 | 115 | public function action_add() |
| 116 | 116 | { |
| 117 | 117 | $errors = array(); |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | - * Edit an advertisement |
|
| 152 | - * |
|
| 153 | - * @return void |
|
| 154 | - */ |
|
| 151 | + * Edit an advertisement |
|
| 152 | + * |
|
| 153 | + * @return void |
|
| 154 | + */ |
|
| 155 | 155 | public function action_edit() |
| 156 | 156 | { |
| 157 | 157 | $ad_id = $this->request->variable('id', 0); |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * Enable/disable an advertisement |
|
| 210 | - * |
|
| 211 | - * @param bool $enable Enable or disable the advertisement? |
|
| 212 | - * @return void |
|
| 213 | - */ |
|
| 209 | + * Enable/disable an advertisement |
|
| 210 | + * |
|
| 211 | + * @param bool $enable Enable or disable the advertisement? |
|
| 212 | + * @return void |
|
| 213 | + */ |
|
| 214 | 214 | public function ad_enable($enable) |
| 215 | 215 | { |
| 216 | 216 | $sql = 'UPDATE ' . $this->ads_table . ' |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | - * Delete an advertisement |
|
| 245 | - * |
|
| 246 | - * @return void |
|
| 247 | - */ |
|
| 244 | + * Delete an advertisement |
|
| 245 | + * |
|
| 246 | + * @return void |
|
| 247 | + */ |
|
| 248 | 248 | public function action_delete() |
| 249 | 249 | { |
| 250 | 250 | $ad_id = $this->request->variable('id', 0); |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | /** |
| 279 | - * Display the ads |
|
| 280 | - * |
|
| 281 | - * @return void |
|
| 282 | - */ |
|
| 279 | + * Display the ads |
|
| 280 | + * |
|
| 281 | + * @return void |
|
| 282 | + */ |
|
| 283 | 283 | public function list_ads() |
| 284 | 284 | { |
| 285 | 285 | $sql = 'SELECT ad_id, ad_name, ad_enabled |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
| 311 | - * Check the form key. |
|
| 312 | - * |
|
| 313 | - * @param string $form_name The name of the form. |
|
| 314 | - * @return void |
|
| 315 | - */ |
|
| 311 | + * Check the form key. |
|
| 312 | + * |
|
| 313 | + * @param string $form_name The name of the form. |
|
| 314 | + * @return void |
|
| 315 | + */ |
|
| 316 | 316 | protected function check_form_key($form_name) |
| 317 | 317 | { |
| 318 | 318 | if (!check_form_key($form_name)) |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
| 325 | - * Get admin form data. |
|
| 326 | - * |
|
| 327 | - * @return void |
|
| 328 | - */ |
|
| 325 | + * Get admin form data. |
|
| 326 | + * |
|
| 327 | + * @return void |
|
| 328 | + */ |
|
| 329 | 329 | protected function get_form_data() |
| 330 | 330 | { |
| 331 | 331 | return array( |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | - * Validate form data. |
|
| 341 | - * |
|
| 342 | - * @param array $data The form data. |
|
| 343 | - * @return void |
|
| 344 | - */ |
|
| 340 | + * Validate form data. |
|
| 341 | + * |
|
| 342 | + * @param array $data The form data. |
|
| 343 | + * @return void |
|
| 344 | + */ |
|
| 345 | 345 | protected function validate($data) |
| 346 | 346 | { |
| 347 | 347 | if ($data['ad_name'] === '') |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
| 358 | - * Assign errors to the template. |
|
| 359 | - * |
|
| 360 | - * @return void |
|
| 361 | - */ |
|
| 358 | + * Assign errors to the template. |
|
| 359 | + * |
|
| 360 | + * @return void |
|
| 361 | + */ |
|
| 362 | 362 | protected function assign_errors() |
| 363 | 363 | { |
| 364 | 364 | $this->template->assign_vars(array( |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
| 371 | - * Assign form data to the template. |
|
| 372 | - * |
|
| 373 | - * @param array $data The form data. |
|
| 374 | - * @return void |
|
| 375 | - */ |
|
| 371 | + * Assign form data to the template. |
|
| 372 | + * |
|
| 373 | + * @param array $data The form data. |
|
| 374 | + * @return void |
|
| 375 | + */ |
|
| 376 | 376 | protected function assign_form_data($data) |
| 377 | 377 | { |
| 378 | 378 | $this->template->assign_vars(array( |
@@ -384,20 +384,20 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
| 387 | - * Print success message. |
|
| 388 | - * |
|
| 389 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 390 | - */ |
|
| 387 | + * Print success message. |
|
| 388 | + * |
|
| 389 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 390 | + */ |
|
| 391 | 391 | protected function success() |
| 392 | 392 | { |
| 393 | 393 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action)); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
| 397 | - * Print error message. |
|
| 398 | - * |
|
| 399 | - * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 400 | - */ |
|
| 397 | + * Print error message. |
|
| 398 | + * |
|
| 399 | + * It takes arguments in the form of a language key, followed by language substitution values. |
|
| 400 | + */ |
|
| 401 | 401 | protected function error() |
| 402 | 402 | { |
| 403 | 403 | trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action), E_USER_WARNING); |