1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-09 08:06:38 +02:00

Various bug fixes, bug creations, tweaks and changes

This commit is contained in:
e107steved
2009-06-12 20:41:35 +00:00
parent 24d7565064
commit 6aa6fd68b4
10 changed files with 179 additions and 125 deletions

View File

@@ -40,24 +40,6 @@ function alt_auth_get_authlist()
}
/*
// All user fields which might, just possibly, be transferred. The option name must be the corresponding field in the E107 user database, prefixed with 'xf_'
$alt_auth_user_fields = array(
'user_email' => array('prompt' => LAN_ALT_12, 'optname' => 'xf_user_email', 'default' => 'user_email', 'optional' => TRUE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => TRUE, 'ldap_field' => 'mail'),
'user_hideemail' => array('prompt' => LAN_ALT_13, 'optname' => 'xf_user_hideemail', 'default' => 'user_hideemail', 'optional' => TRUE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => TRUE, 'ldap_field' => '', method => 'bool1'),
'user_name' => array('prompt' => LAN_ALT_14, 'optname' => 'xf_user_name', 'default' => 'user_name', 'optional' => TRUE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => TRUE, 'ldap_field' => ''),
'user_login' => array('prompt' => LAN_ALT_15, 'optname' => 'xf_user_login', 'default' => 'user_login', 'optional' => TRUE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => TRUE, 'ldap_field' => 'sn'),
'user_customtitle'=> array('prompt' => LAN_ALT_16, 'optname' => 'xf_user_customtitle', 'default' => 'user_customtitle', 'optional' => TRUE, 'otherdb' => FALSE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => FALSE),
'user_signature' => array('prompt' => LAN_ALT_17, 'optname' => 'xf_user_signature', 'default' => 'user_signature', 'optional' => TRUE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => FALSE),
'user_image' => array('prompt' => LAN_ALT_18, 'optname' => 'xf_user_image', 'default' => 'user_image', 'optional' => TRUE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => FALSE),
'user_sess' => array('prompt' => LAN_ALT_19, 'optname' => 'xf_user_sess', 'default' => 'user_sess', 'optional' => TRUE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => FALSE),
'user_join' => array('prompt' => LAN_ALT_20, 'optname' => 'xf_user_join', 'default' => 'user_join', 'optional' => TRUE, 'otherdb' => FALSE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => TRUE, 'ldap_field' => ''),
'user_ban' => array('prompt' => LAN_ALT_21, 'optname' => 'xf_user_ban', 'default' => 'user_ban', 'optional' => TRUE, 'otherdb' => FALSE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => FALSE),
'user_class' => array('prompt' => LAN_ALT_22, 'optname' => 'xf_user_class', 'default' => 'user_class', 'optional' => TRUE, 'otherdb' => FALSE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => FALSE),
'user_xup' => array('prompt' => LAN_ALT_23, 'optname' => 'xf_user_xup', 'default' => 'user_xup', 'optional' => TRUE, 'otherdb' => FALSE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => FALSE)
);
*/
// All user fields which might, just possibly, be transferred. The array key is the corresponding field in the E107 user database; code prefixes it with 'xf_' to get the parameter
// 'default' may be a single value to set the same for all connect methods, or an array to set different defaults.
$alt_auth_user_fields = array(

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/alt_auth_conf.php,v $
| $Revision: 1.3 $
| $Date: 2008-12-23 20:31:30 $
| $Revision: 1.4 $
| $Date: 2009-06-12 20:41:34 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -142,10 +142,13 @@ $text .= "<option value='1' {$sel} >".LAN_ALT_FALLBACK."</option>
$ns -> tablerender("<div style='text-align:center'>".LAN_ALT_3."</div>", $text);
$extendedFields = $euf->user_extended_get_fields();
//$extendedFields = $euf->user_extended_get_fields();
//$extendedFields = &$euf->fieldDefinitions;
//print_a($extendedFields);
if (count($extendedFields))
if (count($euf->fieldDefinitions))
{
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user_extended.php');
$fl = &$euf->fieldDefinitions;
$text = "<div style='text-align:center'>
<form method='post' action='".e_SELF."'>
<table style='width:95%' class='fborder' cellspacing='1' cellpadding='0'>
@@ -156,8 +159,6 @@ if (count($extendedFields))
<col style='width:20%' />
</colgroup>\n";
foreach ($extendedFields as $p => $fl )
{
$text .= "<tr>
<td class='forumheader2'>".LAN_ALT_61."</td>
<td class='forumheader2'>".LAN_ALT_62."</td>
@@ -170,10 +171,9 @@ if (count($extendedFields))
$text .= "<tr>
<td class='forumheader3'><input type='checkbox' name='auth_euf_include[]' value='{$f['user_extended_struct_name']}'{$checked} /></td>
<td class='forumheader3'>{$f['user_extended_struct_name']}</td>
<td class='forumheader3'>{$f['user_extended_struct_text']}</td>
<td class='forumheader3'>".$tp->toHTML($f['user_extended_struct_text'],FALSE,'TITLE')."</td>
<td class='forumheader3'>{$euf->user_extended_types[$f['user_extended_struct_type']]}</td></tr>\n";
}
}
$text .= "<tr style='vertical-align:top'>
<td colspan='4' class='forumheader3' style='text-align:center'>
<input class='button' type='submit' name='updateeufs' value='".LAN_ALT_2."' />

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/alt_auth_login_class.php,v $
| $Revision: 1.6 $
| $Date: 2008-12-23 20:31:30 $
| $Revision: 1.7 $
| $Date: 2009-06-12 20:41:34 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -25,11 +25,11 @@ class alt_login
{
global $pref, $admin_log;
$newvals=array();
define("AUTH_SUCCESS", -1);
define("AUTH_NOUSER", 1);
define("AUTH_BADPASSWORD", 2);
define("AUTH_NOCONNECT", 3);
require_once(e_PLUGIN."alt_auth/".$method."_auth.php");
define('AUTH_SUCCESS', -1);
define('AUTH_NOUSER', 1);
define('AUTH_BADPASSWORD', 2);
define('AUTH_NOCONNECT', 3);
require_once(e_PLUGIN.'alt_auth/'.$method.'_auth.php');
$_login = new auth_login;
if(isset($_login->Available) && ($_login->Available === FALSE))
@@ -41,6 +41,9 @@ class alt_login
if($login_result === AUTH_SUCCESS )
{
require_once (e_HANDLER.'user_handler.php');
require_once(e_HANDLER.'validator_class.php');
if (MAGIC_QUOTES_GPC == FALSE)
{
$username = mysql_real_escape_string($username);
@@ -49,8 +52,8 @@ class alt_login
$username = substr($username, 0, varset($pref['loginname_maxlength'],30));
$aa_sql = new db;
$uh = new UserHandler;
$db_vals = array('user_password' => $aa_sql->escape($uh->HashPassword($userpass,$username)));
$userMethods = new UserHandler;
$db_vals = array('user_password' => $aa_sql->escape($userMethods->HashPassword($userpass,$username)));
$xFields = array(); // Possible extended user fields
// See if any of the fields need processing before save
@@ -79,7 +82,9 @@ class alt_login
}
}
if (count($xFields))
{
{ // We're going to have to do something with extended fields as well - make sure there's an object
require_once (e_HANDLER.'user_extended_class.php');
$ue = new e107_user_extended;
$qry = "SELECT u.user_id,u.".implode(',u.',array_keys($db_vals)).", ue.user_extended_id, ue.".implode(',ue.',array_keys($xFields))." FROM `#user` AS u
LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id
WHERE u.user_loginname='{$username}' ";
@@ -98,27 +103,36 @@ class alt_login
}
if (count($db_vals))
{
$aa_sql->db_UpdateArray('user',$db_vals," WHERE `user_id`=".$row['user_id']);
$newUser = array();
$newUser['data'] = $db_vals;
validatorClass::addFieldTypes($userMethods->userVettingInfo,$allData);
$newUser['WHERE'] = '`user_id`='.$row['user_id'];
$aa_sql->db_Update('user',$db_vals);
if (AA_DEBUG1) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User data update: ".print_r($db_vals,TRUE),FALSE,LOG_TO_ROLLING);
}
foreach ($xFields as $k => $v)
{
if ($row[$k] == $v) unset($xFields[$k]);
}
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User data read: ".print_r($row,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (AA_DEBUG1) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd read: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (AA_DEBUG1) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User data read: ".print_r($row,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd read: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (count($xFields))
{
$xArray = array();
$xArray['data'] = $xFields;
if ($row['user_extended_id'])
{
if (AA_DEBUG1) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd update: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
$aa_sql->db_UpdateArray('user_extended',$xFields," WHERE `user_extended_id`=".intval($row['user_id']));
$ue->addFieldTypes($xArray); // Add in the data types for storage
$xArray['WHERE'] = '`user_extended_id`='.intval($row['user_id']);
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User xtnd update: ".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
$aa_sql->db_Update('user_extended',$xArray );
}
else
{ // Never been an extended user fields record for this user
$xFields['user_extended_id'] = $row['user_id'];
$xArray['data']['user_extended_id'] = $row['user_id'];
$ue->addDefaultFields($xArray); // Add in the data types for storage, plus any default values
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Write new extended record".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
$aa_sql->db_Insert('user_extended',$xFields);
$aa_sql->db_Insert('user_extended',$xArray);
}
}
}
@@ -132,11 +146,20 @@ class alt_login
if (!isset($db_vals['user_signature'])) $db_vals['user_signature'] = '';
if (!isset($db_vals['user_prefs'])) $db_vals['user_prefs'] = '';
if (!isset($db_vals['user_perms'])) $db_vals['user_perms'] = '';
$newID = $aa_sql->db_Insert('user',$db_vals);
if (($newID !== FALSE) && count($xfields))
$userMethods->userClassUpdate($db_vals, 'userall');
$newUser = array();
$newUser['data'] = $db_vals;
$userMethods->addNonDefaulted($newUser);
validatorClass::addFieldTypes($userMethods->userVettingInfo,$newUser);
$newID = $aa_sql->db_Insert('user',$newUser);
if (($newID !== FALSE) && count($xFields))
{
$xFields['user_extended_id'] = $newID;
$aa_sql->db_Insert('user_extended',$xFields);
$xArray = array();
$xArray['data'] = $xFields;
$ue->addDefaultFields($xArray); // Add in the data types for storage, plus any default values
$result = $aa_sql->db_Insert('user_extended',$xArray);
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Add extended: UID={$newID} result={$result}",FALSE,LOG_TO_ROLLING);
}
}
return LOGIN_CONTINUE;
@@ -148,19 +171,19 @@ class alt_login
case AUTH_NOUSER:
if(!varset($pref['auth_nouser'],0))
{
$username=md5("xx_nouser_xx");
$username=md5('xx_nouser_xx');
return LOGIN_ABORT;
}
break;
case AUTH_NOCONNECT:
if(!varset($pref['auth_noconn']))
{
$username=md5("xx_noconn_xx");
$username=md5('xx_noconn_xx');
return LOGIN_ABORT;
}
break;
case AUTH_BADPASSWORD:
$userpass=md5("xx_badpassword_xx");
$userpass=md5('xx_badpassword_xx');
return LOGIN_ABORT; // Not going to magically be able to log in!
break;
}