diff options
Diffstat (limited to 'phpBB/includes/auth')
-rw-r--r-- | phpBB/includes/auth/provider/base.php | 10 | ||||
-rw-r--r-- | phpBB/includes/auth/provider/interface.php | 24 | ||||
-rw-r--r-- | phpBB/includes/auth/provider/ldap.php | 62 |
3 files changed, 50 insertions, 46 deletions
diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/includes/auth/provider/base.php index f28f352e2c..7eaf8bb2d3 100644 --- a/phpBB/includes/auth/provider/base.php +++ b/phpBB/includes/auth/provider/base.php @@ -41,7 +41,15 @@ abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface /** * {@inheritdoc} */ - public function acp($new) + public function acp() + { + return; + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) { return; } diff --git a/phpBB/includes/auth/provider/interface.php b/phpBB/includes/auth/provider/interface.php index 2d1935f8f0..47043bc107 100644 --- a/phpBB/includes/auth/provider/interface.php +++ b/phpBB/includes/auth/provider/interface.php @@ -60,16 +60,28 @@ interface phpbb_auth_provider_interface * This function is used to output any required fields in the authentication * admin panel. It also defines any required configuration table fields. * - * @param array $new Contains the new configuration values that have - * been set in acp_board. * @return array|null Returns null if not implemented or an array of the - * form: + * configuration fields of the provider. + */ + public function acp(); + + /** + * This function updates the template with variables related to the acp + * options with whatever configuraton values are passed to it as an array. + * It then returns the name of the acp file related to this authentication + * provider. + * @param array $new_config Contains the new configuration values that + * have been set in acp_board. + * @return array|null Returns null if not implemented or an array with + * the template file name and an array of the vars + * that the template needs that must conform to the + * following example: * array( - * 'tpl' => string - * 'config' => array + * 'TEMPLATE_FILE' => string, + * 'TEMPLATE_VARS' => array(...), * ) */ - public function acp($new); + public function get_acp_template($new_config); /** * Performs additional actions during logout. diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/includes/auth/provider/ldap.php index e10986abf0..0196529408 100644 --- a/phpBB/includes/auth/provider/ldap.php +++ b/phpBB/includes/auth/provider/ldap.php @@ -286,48 +286,32 @@ class phpbb_auth_provider_ldap extends phpbb_auth_provider_base /** * {@inheritdoc} */ - public function acp($new) - { - $tpl = ' - - <dl> - <dt><label for="ldap_server">' . $this->user->lang['LDAP_SERVER'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_SERVER_EXPLAIN'] . '</span></dt> - <dd><input type="text" id="ldap_server" size="40" name="config[ldap_server]" value="' . $new['ldap_server'] . '" /></dd> - </dl> - <dl> - <dt><label for="ldap_port">' . $this->user->lang['LDAP_PORT'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_PORT_EXPLAIN'] . '</span></dt> - <dd><input type="text" id="ldap_port" size="40" name="config[ldap_port]" value="' . $new['ldap_port'] . '" /></dd> - </dl> - <dl> - <dt><label for="ldap_dn">' . $this->user->lang['LDAP_DN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_DN_EXPLAIN'] . '</span></dt> - <dd><input type="text" id="ldap_dn" size="40" name="config[ldap_base_dn]" value="' . $new['ldap_base_dn'] . '" /></dd> - </dl> - <dl> - <dt><label for="ldap_uid">' . $this->user->lang['LDAP_UID'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_UID_EXPLAIN'] . '</span></dt> - <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="' . $new['ldap_uid'] . '" /></dd> - </dl> - <dl> - <dt><label for="ldap_user_filter">' . $this->user->lang['LDAP_USER_FILTER'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_USER_FILTER_EXPLAIN'] . '</span></dt> - <dd><input type="text" id="ldap_user_filter" size="40" name="config[ldap_user_filter]" value="' . $new['ldap_user_filter'] . '" /></dd> - </dl> - <dl> - <dt><label for="ldap_email">' . $this->user->lang['LDAP_EMAIL'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt> - <dd><input type="email" id="ldap_email" size="40" name="config[ldap_email]" value="' . $new['ldap_email'] . '" /></dd> - </dl> - <dl> - <dt><label for="ldap_user">' . $this->user->lang['LDAP_USER'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_USER_EXPLAIN'] . '</span></dt> - <dd><input type="text" id="ldap_user" size="40" name="config[ldap_user]" value="' . $new['ldap_user'] . '" /></dd> - </dl> - <dl> - <dt><label for="ldap_password">' . $this->user->lang['LDAP_PASSWORD'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['LDAP_PASSWORD_EXPLAIN'] . '</span></dt> - <dd><input type="password" id="ldap_password" size="40" name="config[ldap_password]" value="' . $new['ldap_password'] . '" autocomplete="off" /></dd> - </dl> - '; + public function acp() + { // These are fields required in the config table return array( - 'tpl' => $tpl, - 'config' => array('ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password') + 'ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password', + ); + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) + { + return array( + 'TEMPLATE_FILE' => 'auth_provider_ldap.html', + 'TEMPLATE_VARS' => array( + 'AUTH_LDAP_DN' => $new_config['ldap_base_dn'], + 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'], + 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'], + 'AUTH_LDAP_PORT' => $new_config['ldap_port'], + 'AUTH_LDAP_SERVER' => $new_config['ldap_server'], + 'AUTH_LDAP_UID' => $new_config['ldap_uid'], + 'AUTH_LDAP_USER' => $new_config['ldap_user'], + 'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'], + ), ); } |