From 0f28f81f8911e432ae4bf50da7ed2c334618fd95 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 27 Dec 2012 15:14:44 +0400 Subject: move authentication modules to plugins/ --- include/functions.php | 13 ++++++++++++- include/sanity_config.php | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/functions.php b/include/functions.php index d03fcfb15..f6ef7c2b3 100644 --- a/include/functions.php +++ b/include/functions.php @@ -547,7 +547,7 @@ if (!SINGLE_USER_MODE) { $user_id = false; - $modules = explode(",", AUTH_MODULES); + /* $modules = explode(",", AUTH_MODULES); foreach ($modules as $module) { $module_class = "auth_$module"; @@ -565,6 +565,17 @@ print T_sprintf("Fatal: authentication module %s not found.", $module); die; } + } */ + + global $pluginhost; + foreach ($pluginhost->get_hooks($pluginhost::HOOK_AUTH_USER) as $plugin) { + + $user_id = (int) $plugin->authenticate($login, $password); + + if ($user_id) { + $_SESSION["auth_module"] = strtolower(get_class($plugin)); + break; + } } if ($user_id && !$check_only) { diff --git a/include/sanity_config.php b/include/sanity_config.php index f5436b6b0..04058560f 100644 --- a/include/sanity_config.php +++ b/include/sanity_config.php @@ -1,3 +1,3 @@ - +$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'PUBSUBHUBBUB_HUB', 'PUBSUBHUBBUB_ENABLED', 'SPHINX_ENABLED', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SESSION_EXPIRE_TIME', 'SESSION_CHECK_ADDRESS', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'SMTP_HOST', 'SMTP_LOGIN', 'SMTP_PASSWORD', 'CHECK_FOR_NEW_VERSION', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'FEEDBACK_URL', 'CONFIG_VERSION'); ?> -- cgit v1.2.3-54-g00ecf