public static function getConfig() { global $gBitSystem; $authSettings = array(); foreach (BaseAuth::getAuthMethods() as $meth_name => $method) { $instance = BaseAuth::init($meth_name); if ($instance) { foreach ($instance->getSettings() as $op_id => $op) { if (!empty($_REQUEST[$op_id])) { if ($op['type'] == 'checkbox') { simple_set_toggle($op_id, USERS_PKG_NAME); } else { simple_set_value($op_id, USERS_PKG_NAME); } } $value = $gBitSystem->getConfig($op_id, $op['default']); $op['value'] = $value; $method['options'][$op_id] = $op; } $method['canManageAuth'] = $instance->canManageAuth(); $authSettings['avail'][$meth_name] = $method; } elseif (is_object($instance)) { $authSettings['err'][$meth_name] = implode("<br />", $instance->mErrors); } } if (!empty($_REQUEST["loginprefs"])) { $used = array(); for ($i = 0, $j = 0; $i < count($authSettings['avail']); $i++, $j++) { $gBitSystem->storeConfig("users_auth_method_{$i}", null, USERS_PKG_NAME); if (empty($_REQUEST["users_auth_method_{$i}"])) { $j--; } elseif (!empty($used[$_REQUEST["users_auth_method_{$i}"]])) { $j--; } else { $used[$_REQUEST["users_auth_method_{$i}"]] = "stored_{$j}"; $gBitSystem->storeConfig("users_auth_method_{$j}", $_REQUEST["users_auth_method_{$i}"], USERS_PKG_NAME); } } } $canManageAuth = false; for ($i = 0; $i < count($authSettings['avail']); $i++) { $default = ""; if ($i == 0) { $default = "bit"; } $authSettings['avail_method'][$i]['value'] = $gBitSystem->getConfig("users_auth_method_{$i}", $default); if (!$canManageAuth && !empty($authSettings['avail_method'][$i]['value'])) { $canManageAuth = $authSettings['avail'][$authSettings['avail_method'][$i]['value']]['canManageAuth']; } } if ($gBitSystem->getConfig('users_allow_register', 'y') == 'y' && !$canManageAuth) { $authSettings['err']['bit_reg'] = "Registration is enabled but there are no Auth Methods that support this, Registration won't work!"; } $method['active'] = BaseAuth::isActive($meth_name); return $authSettings; }