Completed
Pull Request — master (#48)
by Jakub
10:59
created

admin_controller::get_form_data()   F

Complexity

Conditions 13
Paths 1024

Size

Total Lines 84
Code Lines 39

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 182

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 84
ccs 0
cts 60
cp 0
rs 2
cc 13
eloc 39
nc 1024
nop 1
crap 182

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 *
4
 * Advertisement management. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\ads\controller;
12
13
/**
14
* Admin controller
15
*/
16
class admin_controller
17
{
18
	const MAX_NAME_LENGTH = 255;
19
	const DATE_FORMAT = 'Y-m-d';
20
	const DEFAULT_PRIORITY = 5;
21
22
	/** @var \phpbb\template\template */
23
	protected $template;
24
25
	/** @var \phpbb\user */
26
	protected $user;
27
28
	/** @var \phpbb\request\request */
29
	protected $request;
30
31
	/** @var \phpbb\ads\ad\manager */
32
	protected $manager;
33
34
	/** @var \phpbb\ads\location\manager */
35
	protected $location_manager;
36
37
	/** @var \phpbb\log\log */
38
	protected $log;
39
40
	/** @var \phpbb\config\db_text */
41
	protected $config_text;
42
43
	/** @var \phpbb\config\config */
44
	protected $config;
45
46
	/** @var string root_path */
47
	protected $root_path;
48
49
	/** @var string php_ext */
50
	protected $php_ext;
51
52
	/** @var string ext_path */
53
	protected $ext_path;
54
55
	/** @var \auth_admin Auth admin */
56
	protected $auth_admin;
57
58
	/** @var string Custom form action */
59
	protected $u_action;
60
61
	/** @var array Form validation errors */
62
	protected $errors = array();
63
64
	/**
65
	 * Constructor
66
	 *
67
	 * @param \phpbb\template\template    $template         Template object
68
	 * @param \phpbb\user                 $user             User object
69
	 * @param \phpbb\request\request      $request          Request object
70
	 * @param \phpbb\ads\ad\manager       $manager          Advertisement manager object
71
	 * @param \phpbb\ads\location\manager $location_manager Template location manager object
72
	 * @param \phpbb\log\log              $log              The phpBB log system
73
	 * @param \phpbb\config\db_text       $config_text      Config text object
74
	 * @param \phpbb\config\config        $config           Config object
75
	 * @param string                      $root_path        phpBB root path
76
	 * @param string                      $php_ext          PHP extension
77
	 * @param string                      $ext_path         Path to this extension
78
	 */
79
	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)
80
	{
81
		$this->template = $template;
82
		$this->user = $user;
83
		$this->request = $request;
84
		$this->manager = $manager;
85
		$this->location_manager = $location_manager;
86
		$this->log = $log;
87
		$this->config_text = $config_text;
88
		$this->config = $config;
89
		$this->root_path = $root_path;
90
		$this->php_ext = $php_ext;
91
		$this->ext_path = $ext_path;
92
93
		$this->auth_admin = $this->get_auth_admin();
94
	}
95
96
	/**
97
	 * Process user request for manage mode
98
	 *
99
	 * @return void
100
	 */
101
	public function mode_manage()
102
	{
103
		$this->setup();
104
105
		if (!function_exists('user_get_id_name'))
106
		{
107
			include($this->root_path . 'includes/functions_user.' . $this->php_ext);
108
		}
109
110
		// Trigger specific action
111
		$action = $this->request->variable('action', '');
112
		if (in_array($action, array('add', 'edit', 'enable', 'disable', 'delete')))
113
		{
114
			$this->{'action_' . $action}();
115
		}
116
117
		// Otherwise default to this
118
		$this->list_ads();
119
	}
120
121
	/**
122
	 * Process user request for settings mode
123
	 *
124
	 * @return void
125
	 */
126
	public function mode_settings()
127
	{
128
		$this->setup();
129
130
		add_form_key('phpbb/ads/settings');
131
		if ($this->request->is_set_post('submit'))
132
		{
133
			// Validate form key
134
			if (!check_form_key('phpbb/ads/settings'))
135
			{
136
				$this->errors[] = $this->user->lang('FORM_INVALID');
137
			}
138
139
			if (empty($this->errors))
140
			{
141
				$this->config->set('phpbb_ads_adblocker_message', $this->request->variable('adblocker_message', 0));
142
				$this->config->set('phpbb_ads_enable_views', $this->request->variable('enable_views', 0));
143
				$this->config->set('phpbb_ads_enable_clicks', $this->request->variable('enable_clicks', 0));
144
				$this->config_text->set('phpbb_ads_hide_groups', json_encode($this->request->variable('hide_groups', array(0))));
145
146
				$this->success('ACP_AD_SETTINGS_SAVED');
147
			}
148
149
			$this->template->assign_vars(array(
150
				'S_ERROR'   => (bool) count($this->errors),
151
				'ERROR_MSG' => count($this->errors) ? implode('<br />', $this->errors) : '',
152
			));
153
		}
154
155
		$hide_groups = json_decode($this->config_text->get('phpbb_ads_hide_groups'), true);
156
		$groups = $this->manager->load_groups();
157
		foreach ($groups as $group)
158
		{
159
			$group_name = ($group['group_type'] == GROUP_SPECIAL) ? $this->user->lang('G_' . $group['group_name']) : $group['group_name'];
160
161
			$this->template->assign_block_vars('groups', array(
162
				'ID'         => $group['group_id'],
163
				'NAME'       => $group_name,
164
				'S_SELECTED' => in_array($group['group_id'], $hide_groups),
165
			));
166
		}
167
168
		$this->template->assign_vars(array(
169
			'U_ACTION'          => $this->u_action,
170
			'ADBLOCKER_MESSAGE' => $this->config['phpbb_ads_adblocker_message'],
171
			'ENABLE_VIEWS'      => $this->config['phpbb_ads_enable_views'],
172
			'ENABLE_CLICKS'     => $this->config['phpbb_ads_enable_clicks'],
173
		));
174
	}
175
176
	/**
177
	 * Set page url
178
	 *
179
	 * @param string $u_action Custom form action
180
	 * @return void
181
	 */
182
	public function set_page_url($u_action)
183
	{
184
		$this->u_action = $u_action;
185
	}
186
187
	/**
188
	 * Get ACP page title for Ads module
189
	 *
190
	 * @return string    Language string for Ads ACP module
191
	 */
192
	public function get_page_title()
193
	{
194
		return $this->user->lang('ACP_PHPBB_ADS_TITLE');
195
	}
196
197
	/**
198
	 * Add an advertisement
199
	 *
200
	 * @return void
201
	 */
202
	public function action_add()
203
	{
204
		$preview = $this->request->is_set_post('preview');
205
		$submit = $this->request->is_set_post('submit');
206
207
		add_form_key('phpbb/ads/add');
208
		if ($preview || $submit)
209
		{
210
			$data = $this->get_form_data('phpbb/ads/add');
211
212 View Code Duplication
			if ($preview)
213
			{
214
				$this->ad_preview($data['ad_code']);
215
			}
216
			else if (empty($this->errors))
217
			{
218
				$ad_id = $this->manager->insert_ad($data);
219
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
220
221
				$this->log('ADD', $data['ad_name']);
222
223
				$this->success('ACP_AD_ADD_SUCCESS');
224
			}
225
226
			$this->assign_locations($data);
227
			$this->assign_form_data($data);
228
		}
229
		else
230
		{
231
			$this->assign_locations();
232
		}
233
234
		// Set output vars for display in the template
235
		$this->template->assign_vars(array(
236
			'S_ADD_AD'           => true,
237
			'U_BACK'             => $this->u_action,
238
			'U_ACTION'           => "{$this->u_action}&amp;action=add",
239
			'PICKER_DATE_FORMAT' => self::DATE_FORMAT,
240
			'U_FIND_USERNAME'    => append_sid("{$this->root_path}memberlist.{$this->php_ext}", 'mode=searchuser&amp;form=acp_admanagement_add&amp;field=ad_owner&amp;select_single=true'),
241
		));
242
	}
243
244
	/**
245
	 * Edit an advertisement
246
	 *
247
	 * @return void
248
	 */
249
	public function action_edit()
250
	{
251
		$ad_id = $this->request->variable('id', 0);
252
		$preview = $this->request->is_set_post('preview');
253
		$submit = $this->request->is_set_post('submit');
254
255
		$ad = $this->manager->get_ad($ad_id);
256
		if (empty($ad))
257
		{
258
			$this->error('ACP_AD_DOES_NOT_EXIST');
259
		}
260
261
		add_form_key('phpbb/ads/edit/' . $ad_id);
262
		if ($preview || $submit)
263
		{
264
			$data = $this->get_form_data('phpbb/ads/edit/' . $ad_id);
265
266
			if ($preview)
267
			{
268
				$this->ad_preview($data['ad_code']);
269
			}
270 View Code Duplication
			else if (empty($this->errors))
271
			{
272
				$success = $this->manager->update_ad($ad_id, $data);
273
274
				if ($success)
275
				{
276
					// Only insert new ad locations to DB when ad exists
277
					$this->manager->delete_ad_locations($ad_id);
278
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
279
280
					$this->log('EDIT', $data['ad_name']);
281
282
					$this->success('ACP_AD_EDIT_SUCCESS');
283
				}
284
285
				$this->error('ACP_AD_DOES_NOT_EXIST');
286
			}
287
		}
288
		else
289
		{
290
			// Copy ad data to new variable. $data is now either newly submitted data when user
291
			// attempts to preview or submit the form, or old data otherwise.
292
			$data = $ad;
293
294
			// Load ad template locations
295
			$data['ad_locations'] = $this->manager->get_ad_locations($ad_id);
296
		}
297
298
		// Set output vars for display in the template
299
		$this->template->assign_vars(array(
300
			'S_EDIT_AD'          => true,
301
			'EDIT_ID'            => $ad_id,
302
			'U_BACK'             => $this->u_action,
303
			'U_ACTION'           => "{$this->u_action}&amp;action=edit&amp;id=" . $ad_id,
304
			'PICKER_DATE_FORMAT' => self::DATE_FORMAT,
305
			'U_FIND_USERNAME'    => append_sid("{$this->root_path}memberlist.{$this->php_ext}", 'mode=searchuser&amp;form=acp_admanagement_add&amp;field=ad_owner&amp;select_single=true'),
306
		));
307
		$this->assign_locations($data);
308
		$this->assign_form_data($data);
309
	}
310
311
	/**
312
	 * Enable an advertisement
313
	 *
314
	 * @return void
315
	 */
316
	public function action_enable()
317
	{
318
		$this->ad_enable(true);
319
	}
320
321
	/**
322
	 * Disable an advertisement
323
	 *
324
	 * @return void
325
	 */
326
	public function action_disable()
327
	{
328
		$this->ad_enable(false);
329
	}
330
331
	/**
332
	 * Delete an advertisement
333
	 *
334
	 * @return void
335
	 */
336
	public function action_delete()
337
	{
338
		$ad_id = $this->request->variable('id', 0);
339
		if ($ad_id)
340
		{
341
			if (confirm_box(true))
342
			{
343
				// Get ad data so that we can log ad name
344
				$ad_data = $this->manager->get_ad($ad_id);
345
346
				// Delete ad and it's template locations
347
				$this->manager->delete_ad_locations($ad_id);
348
				$success = $this->manager->delete_ad($ad_id);
349
350
				// Only notify user on error or if not ajax
351
				if (!$success)
352
				{
353
					$this->error('ACP_AD_DELETE_ERRORED');
354
				}
355
				else
356
				{
357
					$this->log('DELETE', $ad_data['ad_name']);
358
359
					if (!$this->request->is_ajax())
360
					{
361
						$this->success('ACP_AD_DELETE_SUCCESS');
362
					}
363
				}
364
			}
365
			else
366
			{
367
				confirm_box(false, $this->user->lang('CONFIRM_OPERATION'), build_hidden_fields(array(
368
					'id'     => $ad_id,
369
					'i'      => $this->request->variable('i', ''),
370
					'mode'   => $this->request->variable('mode', ''),
371
					'action' => 'delete'
372
				)));
373
			}
374
		}
375
	}
376
377
	/**
378
	 * Display the ads
379
	 *
380
	 * @return void
381
	 */
382
	public function list_ads()
383
	{
384
		foreach ($this->manager->get_all_ads() as $row)
385
		{
386
			$ad_enabled = (int) $row['ad_enabled'];
387
			$ad_end_date = (int) $row['ad_end_date'];
388
			$ad_expired = $ad_end_date > 0 && $ad_end_date < time();
389
			if ($ad_expired && $ad_enabled)
390
			{
391
				$ad_enabled = 0;
392
				$this->manager->update_ad($row['ad_id'], array('ad_enabled' => 0));
393
			}
394
395
			$this->template->assign_block_vars('ads', array(
396
				'NAME'               => $row['ad_name'],
397
				'END_DATE'           => $ad_end_date ? $this->user->format_date($ad_end_date, self::DATE_FORMAT) : '',
398
				'VIEWS'              => $row['ad_views'],
399
				'CLICKS'             => $row['ad_clicks'],
400
				'VIEWS_LIMIT'        => $row['ad_views_limit'],
401
				'CLICKS_LIMIT'       => $row['ad_clicks_limit'],
402
				'S_END_DATE_EXPIRED' => $ad_expired,
403
				'S_ENABLED'          => $ad_enabled,
404
				'U_ENABLE'           => $this->u_action . '&amp;action=' . ($ad_enabled ? 'disable' : 'enable') . '&amp;id=' . $row['ad_id'],
405
				'U_EDIT'             => $this->u_action . '&amp;action=edit&amp;id=' . $row['ad_id'],
406
				'U_DELETE'           => $this->u_action . '&amp;action=delete&amp;id=' . $row['ad_id'],
407
			));
408
		}
409
410
		// Set output vars for display in the template
411
		$this->template->assign_vars(array(
412
			'U_ACTION_ADD'     => $this->u_action . '&amp;action=add',
413
			'S_VIEWS_ENABLED'  => $this->config['phpbb_ads_enable_views'],
414
			'S_CLICKS_ENABLED' => $this->config['phpbb_ads_enable_clicks'],
415
		));
416
	}
417
418
	/**
419
	 * Perform general tasks
420
	 *
421
	 * @return void
422
	 */
423
	protected function setup()
424
	{
425
		$this->user->add_lang_ext('phpbb/ads', 'acp');
426
427
		$this->template->assign_var('S_PHPBB_ADS', true);
428
	}
429
430
	/**
431
	 * Enable/disable an advertisement
432
	 *
433
	 * @param    bool $enable Enable or disable the advertisement?
434
	 * @return void
435
	 */
436
	protected function ad_enable($enable)
437
	{
438
		$ad_id = $this->request->variable('id', 0);
439
440
		$success = $this->manager->update_ad($ad_id, array(
441
			'ad_enabled' => (int) $enable,
442
		));
443
444
		// If AJAX was used, show user a result message
445
		if ($this->request->is_ajax())
446
		{
447
			$json_response = new \phpbb\json_response;
448
			$json_response->send(array(
449
				'text'  => $this->user->lang($enable ? 'ENABLED' : 'DISABLED'),
450
				'title' => $this->user->lang('AD_ENABLE_TITLE', (int) $enable),
451
			));
452
		}
453
454
		// Otherwise, show traditional infobox
455
		if ($success)
456
		{
457
			$this->success($enable ? 'ACP_AD_ENABLE_SUCCESS' : 'ACP_AD_DISABLE_SUCCESS');
458
		}
459
		else
460
		{
461
			$this->error($enable ? 'ACP_AD_ENABLE_ERRORED' : 'ACP_AD_DISABLE_ERRORED');
462
		}
463
	}
464
465
	/**
466
	 * Get admin form data.
467
	 *
468
	 * @param    string $form_name The form name.
469
	 * @return    array    Form data
470
	 */
471
	protected function get_form_data($form_name)
472
	{
473
		$data = array(
474
			'ad_name'         => $this->request->variable('ad_name', '', true),
475
			'ad_note'         => $this->request->variable('ad_note', '', true),
476
			'ad_code'         => $this->request->variable('ad_code', '', true),
477
			'ad_enabled'      => $this->request->variable('ad_enabled', 0),
478
			'ad_locations'    => $this->request->variable('ad_locations', array('')),
479
			'ad_end_date'     => $this->request->variable('ad_end_date', ''),
480
			'ad_priority'     => $this->request->variable('ad_priority', self::DEFAULT_PRIORITY),
481
			'ad_views_limit'  => $this->request->variable('ad_views_limit', 0),
482
			'ad_clicks_limit' => $this->request->variable('ad_clicks_limit', 0),
483
			'ad_owner'        => $this->request->variable('ad_owner', '', true),
484
		);
485
486
		// Get owner id
487
		\user_get_id_name($ad_owner_id, $data['ad_owner']);
0 ignored issues
show
Bug introduced by
The variable $ad_owner_id does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
488
		$data['ad_owner'] = $ad_owner_id[0];
489
		if (empty($data['ad_owner']))
490
		{
491
			$data['ad_owner'] = 0;
492
		}
493
494
		// Validate form key
495
		if (!check_form_key($form_name))
496
		{
497
			$this->errors[] = $this->user->lang('FORM_INVALID');
498
		}
499
500
		// Validate ad name
501
		if ($data['ad_name'] === '')
502
		{
503
			$this->errors[] = $this->user->lang('AD_NAME_REQUIRED');
504
		}
505
		if (truncate_string($data['ad_name'], self::MAX_NAME_LENGTH) !== $data['ad_name'])
506
		{
507
			$this->errors[] = $this->user->lang('AD_NAME_TOO_LONG', self::MAX_NAME_LENGTH);
508
		}
509
510
		// Validate ad end date
511
		if (preg_match('#^\d{4}\-\d{2}\-\d{2}$#', $data['ad_end_date']))
512
		{
513
			$data['ad_end_date'] = (int) $this->user->get_timestamp_from_format(self::DATE_FORMAT, $data['ad_end_date']);
514
515
			if ($data['ad_end_date'] < time())
516
			{
517
				$this->errors[] = $this->user->lang('AD_END_DATE_INVALID');
518
			}
519
		}
520
		else if ($data['ad_end_date'] !== '')
521
		{
522
			$this->errors[] = $this->user->lang('AD_END_DATE_INVALID');
523
		}
524
		else
525
		{
526
			$data['ad_end_date'] = 0;
527
		}
528
529
		// Validate ad priority
530
		if ($data['ad_priority'] < 1 || $data['ad_priority'] > 10)
531
		{
532
			$this->errors[] = $this->user->lang('AD_PRIORITY_INVALID');
533
		}
534
535
		// Validate ad views limit
536
		if ($data['ad_views_limit'] < 0)
537
		{
538
			$this->errors[] = $this->user->lang('AD_VIEWS_LIMIT_INVALID');
539
		}
540
541
		// Validate ad clicks limit
542
		if ($data['ad_clicks_limit'] < 0)
543
		{
544
			$this->errors[] = $this->user->lang('AD_CLICKS_LIMIT_INVALID');
545
		}
546
547
		// Validate ad owner
548
		if ($data['ad_owner'] === false)
549
		{
550
			$this->errors[] = $this->user->lang('AD_OWNER_INVALID');
551
		}
552
553
		return $data;
554
	}
555
556
	/**
557
	 * Assign form data to the template.
558
	 *
559
	 * @param    array $data The form data.
560
	 * @return void
561
	 */
562
	protected function assign_form_data($data)
563
	{
564
		\user_get_id_name($data['ad_owner'], $ad_owner_name);
0 ignored issues
show
Bug introduced by
The variable $ad_owner_name does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
565
566
		$this->template->assign_vars(array(
567
			'S_ERROR'   => (bool) count($this->errors),
568
			'ERROR_MSG' => count($this->errors) ? implode('<br />', $this->errors) : '',
569
570
			'AD_NAME'         => $data['ad_name'],
571
			'AD_NOTE'         => $data['ad_note'],
572
			'AD_CODE'         => $data['ad_code'],
573
			'AD_ENABLED'      => $data['ad_enabled'],
574
			'AD_END_DATE'     => $this->prepare_end_date($data['ad_end_date']),
575
			'AD_PRIORITY'     => $data['ad_priority'],
576
			'AD_VIEWS_LIMIT'  => $data['ad_views_limit'],
577
			'AD_CLICKS_LIMIT' => $data['ad_clicks_limit'],
578
			'AD_OWNER'        => $ad_owner_name[(int) $data['ad_owner'][0]],
579
		));
580
	}
581
582
	/**
583
	 * Prepare end date for display
584
	 *
585
	 * @param    mixed $end_date End date.
586
	 * @return    string    End date prepared for display.
587
	 */
588
	protected function prepare_end_date($end_date)
589
	{
590
		if (empty($end_date))
591
		{
592
			return '';
593
		}
594
595
		if (is_numeric($end_date))
596
		{
597
			return $this->user->format_date($end_date, self::DATE_FORMAT);
598
		}
599
600
		return (string) $end_date;
601
	}
602
603
	/**
604
	 * Assign template locations data to the template.
605
	 *
606
	 * @param    mixed $data The form data or nothing.
607
	 * @return    void
608
	 */
609
	protected function assign_locations($data = false)
610
	{
611
		foreach ($this->location_manager->get_all_locations() as $location_id => $location_data)
612
		{
613
			$this->template->assign_block_vars('ad_locations', array(
614
				'LOCATION_ID'   => $location_id,
615
				'LOCATION_DESC' => $location_data['desc'],
616
				'LOCATION_NAME' => $location_data['name'],
617
				'S_SELECTED'    => $data ? in_array($location_id, $data['ad_locations']) : false,
618
			));
619
		}
620
	}
621
622
	/**
623
	 * Prepare advertisement preview
624
	 *
625
	 * @param    string $code Ad code to preview
626
	 * @return    void
627
	 */
628
	protected function ad_preview($code)
629
	{
630
		$this->template->assign_var('PREVIEW', htmlspecialchars_decode($code));
631
	}
632
633
	/**
634
	 * Print success message.
635
	 *
636
	 * It takes arguments in the form of a language key, followed by language substitution values.
637
	 */
638
	protected function success()
639
	{
640
		trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action));
641
	}
642
643
	/**
644
	 * Print error message.
645
	 *
646
	 * It takes arguments in the form of a language key, followed by language substitution values.
647
	 */
648
	protected function error()
649
	{
650
		trigger_error(call_user_func_array(array($this->user, 'lang'), func_get_args()) . adm_back_link($this->u_action), E_USER_WARNING);
651
	}
652
653
	/**
654
	 * Log action
655
	 *
656
	 * @param    string $action  Performed action in uppercase
657
	 * @param    string $ad_name Advertisement name
658
	 * @return    void
659
	 */
660
	protected function log($action, $ad_name)
661
	{
662
		$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_PHPBB_ADS_' . $action . '_LOG', time(), array($ad_name));
663
	}
664
665
	/**
666
	 * Get auth_admin class
667
	 *
668
	 * @return \auth_admin
669
	 */
670
	protected function get_auth_admin()
671
	{
672
		if (!class_exists('auth_admin'))
673
		{
674
			include($this->root_path . 'includes/acp/auth.' . $this->php_ext);
675
		}
676
		return new \auth_admin();
677
	}
678
}
679