diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-06-19 14:57:11 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-06-19 15:02:34 -0400 |
commit | 2445766b922d2dd2d52becb6471a83f174eebec6 (patch) | |
tree | 19cc9910ae0e66da603f2971110539177bc7aff7 /phpBB/includes/acp | |
parent | 553c300688818c36acc4d579762b3eb428d27321 (diff) | |
download | forums-2445766b922d2dd2d52becb6471a83f174eebec6.tar forums-2445766b922d2dd2d52becb6471a83f174eebec6.tar.gz forums-2445766b922d2dd2d52becb6471a83f174eebec6.tar.bz2 forums-2445766b922d2dd2d52becb6471a83f174eebec6.tar.xz forums-2445766b922d2dd2d52becb6471a83f174eebec6.zip |
[feature/auth-refactor] Refactor acp_board for new auth interface
Partially refactors acp_board for the new authentication interface.
Leaves some questionable if statements in the file.
Modifies the interface to correctly impletment the acp() method.
Modifies each provider to comply with the above mentioned interface
modification.
PHPBB3-9734
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 6881e03fdb..9407d81575 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -530,9 +530,9 @@ class acp_board { while (($file = readdir($dp)) !== false) { - if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) + if (preg_match('#^provider_(.*?)\.' . $phpEx . '$#', $file) && !preg_match('#^provider_interface\.' . $phpEx . '$#', $file)) { - $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file)); + $auth_plugins[] = basename(preg_replace('#^provider_(.*?)\.' . $phpEx . '$#', '\1', $file)); } } closedir($dp); @@ -544,14 +544,13 @@ class acp_board $old_auth_config = array(); foreach ($auth_plugins as $method) { - if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) + if ($method) { - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); - - $method = 'acp_' . $method; - if (function_exists($method)) + $class = 'phpbb_auth_provider_' . $method; + if (class_exists($class)) { - if ($fields = $method($this->new_config)) + $provider = new $class(); + if ($fields = $provider->acp($this->new_config)) { // Check if we need to create config fields for this plugin and save config when submit was pressed foreach ($fields['config'] as $field) @@ -585,14 +584,13 @@ class acp_board if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings)) { $method = basename($cfg_array['auth_method']); - if ($method && in_array($method, $auth_plugins)) + if ($method) { - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); - - $method = 'init_' . $method; - if (function_exists($method)) + $class = 'phpbb_auth_provider_' . $method; + if (class_exists($class)) { - if ($error = $method()) + $provider = new $class(); + if ($error = $provider->init()) { foreach ($old_auth_config as $config_name => $config_value) { @@ -685,12 +683,13 @@ class acp_board foreach ($auth_plugins as $method) { - if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) + if ($method) { - $method = 'acp_' . $method; - if (function_exists($method)) + $class = 'phpbb_auth_provider_' . $method; + if (class_exists($class)) { - $fields = $method($this->new_config); + $provider = new $class(); + $fields = $provider->acp($this->new_config); if ($fields['tpl']) { |