aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/auth.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-08-02 15:53:19 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-08-02 15:53:19 +0000
commitb15a3111be0c51410e302500df9b4cbce9cd38d3 (patch)
tree97fee705ff510123c39fb8f6fe6e7280ce18cf7f /phpBB/includes/auth.php
parent48a48aa86d578fb61524f6d3e4ecf2dc8f2b9256 (diff)
downloadforums-b15a3111be0c51410e302500df9b4cbce9cd38d3.tar
forums-b15a3111be0c51410e302500df9b4cbce9cd38d3.tar.gz
forums-b15a3111be0c51410e302500df9b4cbce9cd38d3.tar.bz2
forums-b15a3111be0c51410e302500df9b4cbce9cd38d3.tar.xz
forums-b15a3111be0c51410e302500df9b4cbce9cd38d3.zip
- fixing some bugs
- removed file_exists calls for auth plugins since they need to be there once set up git-svn-id: file:///svn/phpbb/trunk@6228 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/auth.php')
-rw-r--r--phpBB/includes/auth.php94
1 files changed, 45 insertions, 49 deletions
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php
index 06b2ac0689..af833d04d9 100644
--- a/phpBB/includes/auth.php
+++ b/phpBB/includes/auth.php
@@ -707,74 +707,70 @@ class auth
global $config, $db, $user, $phpbb_root_path, $phpEx;
$method = trim(basename($config['auth_method']));
+ include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
- if (file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
+ $method = 'login_' . $method;
+ if (function_exists($method))
{
- include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
+ $login = $method($username, $password);
- $method = 'login_' . $method;
- if (function_exists($method))
+ // If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS
+ if ($login['status'] == LOGIN_SUCCESS_CREATE_PROFILE)
{
- $login = $method($username, $password);
-
- // If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS
- if ($login['status'] == LOGIN_SUCCESS_CREATE_PROFILE)
+ // we are going to use the user_add function so include functions_user.php if it wasn't defined yet
+ if (!function_exists('user_add'))
{
- // we are going to use the user_add function so include functions_user.php if it wasn't defined yet
- if (!function_exists('user_add'))
- {
- include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
- }
-
- user_add($login['user_row'], (isset($login['cp_data'])) ? $login['cp_data'] : false);
+ include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
- $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
- FROM ' . USERS_TABLE . "
- WHERE username = '" . $db->sql_escape($username) . "'";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ user_add($login['user_row'], (isset($login['cp_data'])) ? $login['cp_data'] : false);
- if (!$row)
- {
- return array(
- 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
- 'error_msg' => 'AUTH_NO_PROFILE_CREATED',
- 'user_row' => array('user_id' => ANONYMOUS),
- );
- }
+ $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
+ FROM ' . USERS_TABLE . "
+ WHERE username = '" . $db->sql_escape($username) . "'";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- $login = array(
- 'status' => LOGIN_SUCCESS,
- 'error_msg' => false,
- 'user_row' => $row,
+ if (!$row)
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'AUTH_NO_PROFILE_CREATED',
+ 'user_row' => array('user_id' => ANONYMOUS),
);
}
- // If login succeeded, we will log the user in... else we pass the login array through...
- if ($login['status'] == LOGIN_SUCCESS)
- {
- $result = $user->session_create($login['user_row']['user_id'], $admin, $autologin, $viewonline);
+ $login = array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
- // Successful session creation
- if ($result === true)
- {
- return array(
- 'status' => LOGIN_SUCCESS,
- 'error_msg' => false,
- 'user_row' => $login['user_row'],
- );
- }
+ // If login succeeded, we will log the user in... else we pass the login array through...
+ if ($login['status'] == LOGIN_SUCCESS)
+ {
+ $result = $user->session_create($login['user_row']['user_id'], $admin, $autologin, $viewonline);
+ // Successful session creation
+ if ($result === true)
+ {
return array(
- 'status' => LOGIN_BREAK,
- 'error_msg' => $result,
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
'user_row' => $login['user_row'],
);
}
- return $login;
+ return array(
+ 'status' => LOGIN_BREAK,
+ 'error_msg' => $result,
+ 'user_row' => $login['user_row'],
+ );
}
+
+ return $login;
}
trigger_error('Authentication method not found', E_USER_ERROR);