--- includes/functions_user.php.ORIG 2008-12-12 16:20:38.000000000 +0100 +++ includes/functions_user.php 2009-03-30 16:08:59.252359303 +0200 @@ -165,6 +165,22 @@ return false; } + $user_id=FALSE; + // External Check if available are only additional (if sucessful returns user_id, else return an ERROR-String) + $method = basename(trim($config['auth_method'])); + include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + + $method = 'user_add_' . $method; + if (function_exists($method)) + { + $external_msg = $method($user_row, $cp_data); + if (empty($external_msg) || !is_numeric($external_msg)) { + return false; + } + $user_id = $external_msg; + // proceed, to actualize the internal phpbb-structures (like group-mapping) + } + $sql_ary = array( 'username' => $user_row['username'], 'username_clean' => $username_clean, @@ -244,10 +260,14 @@ } } + if ($user_id && empty($sql_ary['user_id'])) $sql_ary['user_id'] = $user_id; + $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); - $user_id = $db->sql_nextid(); + $nextid = $db->sql_nextid(); // false if no auto-increment occured + if ($nextid) $user_id = $nextid; + if (!$user_id) return false; // Insert Custom Profile Fields if ($cp_data !== false && sizeof($cp_data)) @@ -1345,11 +1365,25 @@ */ function validate_username($username, $allowed_username = false) { - global $config, $db, $user, $cache; + global $config, $db, $user, $cache, $phpEx, $phpbb_root_path; $clean_username = utf8_clean_string($username); $allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username); + // External Check if available are only additional (only errors count) + $method = basename(trim($config['auth_method'])); + include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + + $method = 'validate_username_' . $method; + if (function_exists($method)) + { + $error = $method($username, $allowed_username); + if ($error) + { + return $error; + } + } + if ($allowed_username == $clean_username) { return false; @@ -1586,7 +1620,7 @@ */ function validate_email($email, $allowed_email = false) { - global $config, $db, $user; + global $config, $db, $user, $phpEx, $phpbb_root_path; $email = strtolower($email); $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); @@ -1596,6 +1630,21 @@ return false; } + // External Check if available are only additional (only errors count) + $method = basename(trim($config['auth_method'])); + include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + + $method = 'validate_email_' . $method; + if (function_exists($method)) + { + $error = $method($email, $allowed_email); + if ($error) + { + return $error; + } + } + + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) { return 'EMAIL_INVALID';