function authLdap_options_panel() { // inclusde style sheet wp_enqueue_style('authLdap-style', plugin_dir_url(__FILE__) . 'authLdap.css'); if ($_SERVER['REQUEST_METHOD'] == 'POST' && array_key_exists('ldapOptionsSave', $_POST)) { $new_options = array('Enabled' => authLdap_get_post('authLDAPAuth', false), 'CachePW' => authLdap_get_post('authLDAPCachePW', false), 'URI' => authLdap_get_post('authLDAPURI'), 'URISeparator' => authLdap_get_post('authLDAPURISeparator'), 'StartTLS' => authLdap_get_post('authLDAPStartTLS', false), 'Filter' => authLdap_get_post('authLDAPFilter'), 'NameAttr' => authLdap_get_post('authLDAPNameAttr'), 'SecName' => authLdap_get_post('authLDAPSecName'), 'UidAttr' => authLdap_get_post('authLDAPUidAttr'), 'MailAttr' => authLdap_get_post('authLDAPMailAttr'), 'WebAttr' => authLdap_get_post('authLDAPWebAttr'), 'Groups' => authLdap_get_post('authLDAPGroups', array()), 'GroupSeparator' => authLdap_get_post('authLDAPGroupSeparator', ','), 'Debug' => authLdap_get_post('authLDAPDebug', false), 'GroupAttr' => authLdap_get_post('authLDAPGroupAttr'), 'GroupFilter' => authLdap_get_post('authLDAPGroupFilter'), 'DefaultRole' => authLdap_get_post('authLDAPDefaultRole'), 'GroupEnable' => authLdap_get_post('authLDAPGroupEnable', false), 'GroupOverUser' => authLdap_get_post('authLDAPGroupOverUser', false)); if (authLdap_set_options($new_options)) { echo "<div class='updated'><p>Saved Options!</p></div>"; } else { echo "<div class='error'><p>Could not save Options!</p></div>"; } } // Do some initialization for the admin-view $authLDAP = authLdap_get_option('Enabled'); $authLDAPCachePW = authLdap_get_option('CachePW'); $authLDAPURI = authLdap_get_option('URI'); $authLDAPURISeparator = authLdap_get_option('URISeparator'); $authLDAPStartTLS = authLdap_get_option('StartTLS'); $authLDAPFilter = authLdap_get_option('Filter'); $authLDAPNameAttr = authLdap_get_option('NameAttr'); $authLDAPSecName = authLdap_get_option('SecName'); $authLDAPMailAttr = authLdap_get_option('MailAttr'); $authLDAPUidAttr = authLdap_get_option('UidAttr'); $authLDAPWebAttr = authLdap_get_option('WebAttr'); $authLDAPGroups = authLdap_get_option('Groups'); $authLDAPGroupSeparator = authLdap_get_option('GroupSeparator'); $authLDAPDebug = authLdap_get_option('Debug'); $authLDAPGroupAttr = authLdap_get_option('GroupAttr'); $authLDAPGroupFilter = authLdap_get_option('GroupFilter'); $authLDAPDefaultRole = authLdap_get_option('DefaultRole'); $authLDAPGroupEnable = authLdap_get_option('GroupEnable'); $authLDAPGroupOverUser = authLdap_get_option('GroupOverUser'); $tChecked = $authLDAP ? ' checked="checked"' : ''; $tDebugChecked = $authLDAPDebug ? ' checked="checked"' : ''; $tPWChecked = $authLDAPCachePW ? ' checked="checked"' : ''; $tGroupChecked = $authLDAPGroupEnable ? ' checked="checked"' : ''; $tGroupOverUserChecked = $authLDAPGroupOverUser ? ' checked="checked"' : ''; $tStartTLSChecked = $authLDAPStartTLS ? ' checked="checked"' : ''; $roles = new WP_Roles(); $action = $_SERVER['REQUEST_URI']; if (!extension_loaded('ldap')) { echo '<div class="warning">The LDAP-Extension is not available on your ' . 'WebServer. Therefore Everything you can alter here does not ' . 'make any sense!</div>'; } include dirname(__FILE__) . '/view/admin.phtml'; }
function authLdap_options_panel() { // inclusde style sheet wp_enqueue_style('authLdap-style', plugin_dir_url(__FILE__) . 'authLdap.css'); if ($_POST['ldapOptionsSave']) { update_option('authLDAP', authLdap_get_post('authLDAPAuth', false)); update_option('authLDAPCachePW', authLdap_get_post('authLDAPCachePW', false)); update_option('authLDAPURI', authLdap_get_post('authLDAPURI')); update_option('authLDAPFilter', authLdap_get_post('authLDAPFilter')); update_option('authLDAPNameAttr', authLdap_get_post('authLDAPNameAttr')); update_option('authLDAPSecName', authLdap_get_post('authLDAPSecName')); update_option('authLDAPUidAttr', authLdap_get_post('authLDAPUidAttr')); update_option('authLDAPMailAttr', authLdap_get_post('authLDAPMailAttr')); update_option('authLDAPWebAttr', authLdap_get_post('authLDAPWebAttr')); update_option('authLDAPGroups', authLdap_get_post('authLDAPGroups', array())); update_option('authLDAPDebug', authLdap_get_post('authLDAPDebug', false)); update_option('authLDAPGroupAttr', authLdap_get_post('authLDAPGroupAttr')); update_option('authLDAPGroupFilter', authLdap_get_post('authLDAPGroupFilter')); update_option('authLDAPDefaultRole', authLdap_get_post('authLDAPDefaultRole')); update_option('authLDAPGroupEnable', authLdap_get_post('authLDAPGroupEnable', false)); update_option('authLDAPGroupOverUser', authLdap_get_post('authLDAPGroupOverUser', false)); echo "<div class='updated'><p>Saved Options!</p></div>"; } // Do some initialization for the admin-view $authLDAP = get_option('authLDAP'); $authLDAPCachePW = get_option('authLDAPCachePW'); $authLDAPCookieMarker = get_option('authLDAPCookieMarker'); $authLDAPURI = get_option('authLDAPURI'); $authLDAPFilter = get_option('authLDAPFilter'); $authLDAPNameAttr = get_option('authLDAPNameAttr'); $authLDAPSecName = get_option('authLDAPSecName'); $authLDAPMailAttr = get_option('authLDAPMailAttr'); $authLDAPUidAttr = get_option('authLDAPUidAttr'); $authLDAPWebAttr = get_option('authLDAPWebAttr'); $authLDAPGroups = get_option('authLDAPGroups'); $authLDAPDebug = get_option('authLDAPDebug'); $authLDAPGroupAttr = get_option('authLDAPGroupAttr'); $authLDAPGroupFilter = get_option('authLDAPGroupFilter'); $authLDAPDefaultRole = get_option('authLDAPDefaultRole'); $authLDAPGroupEnable = get_option('authLDAPGroupEnable', true); $authLDAPGroupOverUser = get_option('authLDAPGroupOverUser', true); if ($authLDAP) { $tChecked = ' checked="checked"'; } if ($authLDAPDebug) { $tDebugChecked = ' checked="checked"'; } if ($authLDAPCachePW) { $tPWChecked = ' checked="checked"'; } if ($authLDAPGroupEnable) { $tGroupChecked = ' checked="checked"'; } if ($authLDAPGroupOverUser) { $tGroupOverUserChecked = ' checked="checked"'; } $roles = new WP_Roles(); $action = $_SERVER['REQUEST_URI']; if (!extension_loaded('ldap')) { echo '<div class="warning">The LDAP-Extension is not available on your ' . 'WebServer. Therefore Everything you can alter here does not ' . 'make any sense!</div>'; } include dirname(__FILE__) . '/view/admin.phtml'; }