1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

alt_auth - updated/enhanced - first cut ready for some proper testing

This commit is contained in:
e107steved 2008-07-25 19:33:04 +00:00
parent ec13689f67
commit 85339ec550
20 changed files with 1445 additions and 375 deletions

View File

@ -1,5 +1,13 @@
<?php
define("AUTH_SUCCESS", -1);
define("AUTH_NOUSER", 1);
define("AUTH_BADPASSWORD", 2);
define("AUTH_NOCONNECT", 3);
define('AUTH_UNKNOWN', 4);
define('AUTH_NOT_AVAILABLE', 5);
function alt_auth_get_authlist()
{
$authlist = array("e107");
@ -15,6 +23,239 @@ function alt_auth_get_authlist()
return $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_loginname' => array('prompt' => LAN_ALT_10, 'optname' => 'xf_user_loginname', 'default' => 'user_loginname', 'optional' => FALSE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => TRUE, 'ldap' => TRUE, 'ldap_field' => 'cn'),
// 'user_password' => array('prompt' => LAN_ALT_11, 'optname' => 'xf_user_password', 'default' => 'user_password', 'optional' => FALSE, 'otherdb' => TRUE, 'e107db' => TRUE, 'importdb' => TRUE, 'ldap' => TRUE, 'ldap_field' => ''),
'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' => FALSE, 'e107db' => TRUE, 'importdb' => FALSE, 'ldap' => TRUE, 'ldap_field' => ''),
'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)
);
// Returns a block of table rows with user DB fields and either checkboxes or entry boxes
// $tableType is the prefix used, without the following underscore
function alt_auth_get_field_list($tableType, $frm, $parm, $asCheckboxes = FALSE)
{
global $alt_auth_user_fields;
$ret = '';
foreach ($alt_auth_user_fields as $f => $v)
{
if ($v[$tableType] == TRUE)
{
$ret .= "<tr><td class='forumheader3'>";
if ($v['optional'] == FALSE) $ret .= '*&nbsp;';
$ret .= $v['prompt'].':';
if (isset($v['help']))
{
$ret .= "<br /><span class='smalltext'>".$v['help']."</span>";
}
$ret .= "</td><td class='forumheader3'>";
$fieldname = $tableType.'_'.$v['optname'];
$value = varset($v['default'],'');
if (isset($v[$tableType.'_field'])) $value = $v[$tableType.'_field'];
if (isset($parm[$fieldname])) $value = $parm[$fieldname];
// echo "Field: {$fieldname} => {$value}<br />";
if ($asCheckboxes)
{
$ret .= $frm -> form_checkbox($fieldname, 1, $value);
}
else
{
$ret .= $frm -> form_text($fieldname, 35, $value, 120);
}
$ret .= "</td></tr>\n";
}
}
return $ret;
}
// Returns a list of all the user-related fields allowed as an array, whhere the key is the field name
function alt_auth_get_allowed_fields($tableType)
{
global $alt_auth_user_fields;
$ret = array();
foreach ($alt_auth_user_fields as $f => $v)
{
if ($v[$tableType] == TRUE)
{
$fieldname = $tableType.'_'.$v['optname'];
$ret[$fieldname] = '1';
}
}
return $ret;
}
$common_fields = array(
'server' => array('fieldname' => 'server', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_32, 'help' => ''),
'uname' => array('fieldname' => 'username', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_33, 'help' => ''),
'pwd' => array('fieldname' => 'password', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_34, 'help' => ''),
'db' => array('fieldname' => 'database', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_35, 'help' => ''),
'table' => array('fieldname' => 'table', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_36, 'help' => ''),
'ufield' => array('fieldname' => 'user_field','size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_37, 'help' => ''),
'pwfield'=> array('fieldname' => 'password_field','size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_38, 'help' => ''),
'salt' => array('fieldname' => 'password_salt','size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_24, 'help' => LAN_ALT_25)
);
function alt_auth_get_db_fields($prefix, $frm, $parm, $fields = 'server|uname|pwd|db|table|ufield|pwfield')
{
global $common_fields;
$opts = explode('|',$fields);
$ret = '';
foreach ($common_fields as $fn => $cf)
{
if (in_array($fn,$opts))
{
$ret .= "<tr><td class='forumheader3'>".$cf['prompt'];
if ($cf['help']) $ret .= "<br /><span class='smalltext'>".$cf['help']."</span>";
$ret .= "</td><td class='forumheader3'>";
$ret .= $frm -> form_text($prefix.'_'.$cf['fieldname'], $cf['size'], $parm[$prefix.'_'.$cf['fieldname']], $cf['max_size']);
$ret .= "</td></tr>\n";
}
}
return $ret;
}
// Write all the options to the DB. $prefix must NOT have trailing underscore
function alt_auth_post_options($prefix)
{
global $common_fields, $sql;
$lprefix = $prefix.'_';
$user_fields = alt_auth_get_allowed_fields($prefix); // Need this list in case checkboxes for parameters
foreach ($user_fields as $k => $v)
{
if (!isset($_POST[$k]))
{
$_POST[$k] = '0';
}
}
// Now we can post everything
foreach($_POST as $k => $v)
{
if (strpos($k,$lprefix) === 0)
{
$v = base64_encode(base64_encode($v));
if($sql -> db_Select("alt_auth", "*", "auth_type='{$prefix}' AND auth_parmname='{$k}' "))
{
$sql -> db_Update("alt_auth", "auth_parmval='{$v}' WHERE auth_type='{$prefix}' AND auth_parmname='{$k}' ");
}
else
{
$sql -> db_Insert("alt_auth", "'{$prefix}','{$k}','{$v}' ");
}
}
}
return LAN_ALT_UPDATED;
}
// Return test form
function alt_auth_test_form($prefix,$frm)
{
$text = $frm -> form_open("post", e_SELF, 'testform');
$text .= "<table style='width:96%'>
<tr><td colspan='2' class='forumheader2' style='text-align:center;'>".LAN_ALT_42."</td></tr>";
if (isset($_POST['testauth']))
{
// Try and connect to DB/server, and maybe validate user name
require_once(e_PLUGIN.'alt_auth/'.$prefix.'_auth.php');
$_login = new auth_login;
$log_result = AUTH_UNKNOWN;
$pass_vars = array();
$val_name = trim(varset($_POST['nametovalidate'],''));
if(isset($_login->Available) && ($_login->Available === FALSE))
{ // Relevant auth method not available (e.g. PHP extension not loaded)
$log_result = AUTH_NOT_AVAILABLE;
}
else
{
$log_result = $_login -> login($val_name, $_POST['passtovalidate'], $pass_vars, ($val_name == ''));
}
$text .= "<tr><td class='forumheader3'>".LAN_ALT_48;
if ($val_name)
{
$text .= "<br />".LAN_ALT_49.$val_name.'<br />'.LAN_ALT_50;
if (varset($_POST['passtovalidate'],'')) $text .= str_repeat('*',strlen($_POST['passtovalidate'])); else $text .= LAN_ALT_51;
}
$text .= "</td><td class='forumheader3'>";
switch ($log_result)
{
case AUTH_SUCCESS :
$text .= LAN_ALT_58;
if (count($pass_vars))
{
$text .= '<br />'.LAN_ALT_59;
foreach ($pass_vars as $k => $v)
{
$text .= '<br />&nbsp;&nbsp;'.$k.'=>'.$v;
}
}
break;
case AUTH_NOUSER :
$text .= LAN_ALT_52.LAN_ALT_55;
break;
case AUTH_BADPASSWORD :
$text .= LAN_ALT_52.LAN_ALT_56;
break;
case AUTH_NOCONNECT :
$text .= LAN_ALT_52.LAN_ALT_54;
break;
case AUTH_UNKNOWN :
$text .= LAN_ALT_52.LAN_ALT_53;
break;
case AUTH_NOT_AVAILABLE :
$text .= LAN_ALT_52.LAN_ALT_57;
break;
default :
$text .= "Coding error";
}
$text .= "</td></tr>";
}
$text .= "<tr><td class='forumheader3'>".LAN_ALT_33."</td><td class='forumheader3'>";
$text .= $frm -> form_text('nametovalidate', 35, '', 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LAN_ALT_34."</td><td class='forumheader3'>";
$text .= $frm -> form_password('passtovalidate', 35, '', 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button("submit", 'testauth', LAN_ALT_47);
$text .= "</td></tr>";
$text .= "</table>";
$text .= $frm -> form_close();
return $text;
}
function alt_auth_adminmenu()
{
global $authlist;
@ -25,18 +266,18 @@ function alt_auth_adminmenu()
}
define("ALT_AUTH_ACTION", "main");
$var['main']['text'] = "Main config";
$var['main']['text'] = LAN_ALT_31;
$var['main']['link'] = e_PLUGIN."alt_auth/alt_auth_conf.php";
show_admin_menu("alt auth", ALT_AUTH_ACTION, $var);
$var = array();
foreach($authlist as $a)
{
if($a != 'e107')
{
$var[$a]['text'] = "Config {$a}";
$var[$a]['link'] = e_PLUGIN."alt_auth/{$a}_conf.php";
}
if($a != 'e107')
{
$var[$a]['text'] = LAN_ALT_30.$a;
$var[$a]['link'] = e_PLUGIN."alt_auth/{$a}_conf.php";
}
}
show_admin_menu("Auth methods", ALT_AUTH_ACTION, $var);
show_admin_menu(LAN_ALT_29, ALT_AUTH_ACTION, $var);
}
?>

View File

@ -11,77 +11,92 @@
| 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.2 $
| $Date: 2007-01-12 02:49:56 $
| $Author: mcfly_e107 $
| $Revision: 1.3 $
| $Date: 2008-07-25 19:33:02 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
class alt_login
{
function alt_login($method, &$username, &$userpass)
{
global $pref;
$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");
$_login = new auth_login;
global $pref;
$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");
$_login = new auth_login;
if($_login->Available === FALSE)
{
return false;
}
if(isset($_login->Available) && ($_login->Available === FALSE))
{ // Relevant auth method not available (e.g. PHP extension not loaded)
return AUTH_NOCONNECT;
}
$login_result = $_login -> login($username, $userpass, $newvals);
$login_result = $_login -> login($username, $userpass, $newvals, FALSE);
if($login_result === AUTH_SUCCESS )
if($login_result === AUTH_SUCCESS )
{
if (MAGIC_QUOTES_GPC == FALSE)
{
$sql = new db;
if (MAGIC_QUOTES_GPC == FALSE)
{
$username = mysql_real_escape_string($username);
}
$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
$username = substr($username, 0, 30);
$username = mysql_real_escape_string($username);
}
$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
$username = substr($username, 0, varset($pref['loginname_maxlength'],30));
if(!$sql -> db_Select("user", "user_id", "user_loginname='{$username}' "))
{
// User not found in e107 database - add it now.
$qry = "INSERT INTO #user (user_id, user_loginname, user_name, user_join) VALUES ('0','{$username}','{$username}',".time().")";
$sql -> db_Select_gen($qry);
}
// Set password and any other applicable fields
$qry="user_password='".md5($userpass)."'";
foreach($newvals as $key => $val)
{
$qry .= " ,user_{$key}='{$val}' ";
}
$qry.=" WHERE user_loginname='{$username}' ";
$sql -> db_Update("user", $qry);
$aa_sql = new db;
$uh = new UserHandler;
$db_vals = array('user_password' => $aa_sql->escape($uh->HashPassword($userpass,$username)));
foreach ($newvals as $k => $v)
{
if (strpos($k,'user_' !== 0)) $k = 'user_'.$k; // translate the field names (but latest handlers don't need translation)
$db_vals[$k] = $v;
}
if($aa_sql -> db_Select("user","*","user_loginname='{$username}' "))
{ // Existing user - get current data, see if any changes
$row = $aa_sql->db_Fetch();
foreach ($db_vals as $k => $v)
{
if ($row[$k] == $v) unset($db_vals[$k]);
}
if (count($db_vals)) $aa_sql->db_UpdateArray('user',$db_vals," WHERE `user_id`=".$row['user_id']);
}
else
{ // Just add a new user
if (!isset($db_vals['user_name'])) $db_vals['user_name'] = $username;
if (!isset($db_vals['user_loginname'])) $db_vals['user_loginname'] = $username;
if (!isset($db_vals['user_join'])) $db_vals['user_join'] = time();
$aa_sql->db_Insert('user',$db_vals);
}
return LOGIN_CONTINUE;
}
else
{ // Failure modes
switch($login_result)
{
switch($login_result)
case AUTH_NOUSER:
if(!varset($pref['auth_nouser'],0))
{
case AUTH_NOUSER:
if(!isset($pref['auth_nouser']) || !$pref['auth_nouser'])
{
$username=md5("xx_nouser_xx");
}
break;
case AUTH_NOCONNECT:
if(!isset($pref['auth_noconn']) || !$pref['auth_noconn'])
{
$username=md5("xx_noconn_xx");
}
break;
case AUTH_BADPASSWORD:
$userpass=md5("xx_badpassword_xx");
break;
$username=md5("xx_nouser_xx");
return LOGIN_ABORT;
}
}
break;
case AUTH_NOCONNECT:
if(!varset($pref['auth_noconn']))
{
$username=md5("xx_noconn_xx");
return LOGIN_ABORT;
}
break;
case AUTH_BADPASSWORD:
$userpass=md5("xx_badpassword_xx");
return LOGIN_ABORT; // Not going to magically be able to log in!
break;
}
}
return LOGIN_ABORT; // catch-all just in case
}
}
?>

View File

@ -1,52 +0,0 @@
/*
| Copyright (C) 2003 Thom Michelbrink
|
| Author: Thom Michelbrink mcfly@e107.org
|
*/
Purpose:
This is a plugin for the E107 CMS system (e107.org).
This plugin will enable Alternate authorization functionality to your site.
Requirements:
This plugin requires e107 Verion 0.600+
############## INSTALLATION #######################
1) Upload all files to your e107_plugins directory on your server, retaining directory structure.
2) Go to the admin section of the website, go the to plugin manager and install the Alt auth.
3) Go to the admin section of the website and configure the Alternate Authorization setting.
Until this is integrated into the e107 core. the following lines need to be added to the e107_handlers\login.php file. They need to be inserted into the userlogin() function, just after the 'global $pref;' line:
if($pref['auth_method'] && $pref['auth_method'] != "e107"){
$auth_file=e_PLUGIN."alt_auth/".$pref['auth_method']."_auth.php";
if(file_exists($auth_file)){
require_once(e_PLUGIN."alt_auth/alt_auth_login_class.php");
$result = new alt_login($pref['auth_method'],$username, $userpass);
}
}
--- AUTHORIZATION TYPES --
This version currently supports Active Directory and LDAP authorization types. Others could easily
be added though.
The requirements to add a new auth type are:
xxx_auth.php - Actual file the performs the authorization based on user input of uname / passwd.
xxx_conf.php - The file used to edit any configuration option for your auth type.
The xxx_auth.php must contain a class named auth_login(), the class must contain a function named login($uname,$passwd). The login() function must return values of:
AUTH_SUCCESS - valid login
AUTH_NOUSER - User not found
AUTH_BADPASSWORD - Password is incorrect
-----------------------------------------------------------------------------
Version history:
11/11/2003 - Initial beta release

View File

@ -0,0 +1,5 @@
CREATE TABLE alt_auth (
auth_type varchar(20) NOT NULL default '',
auth_parmname varchar(30) NOT NULL default '',
auth_parmval varchar(120) NOT NULL default ''
) TYPE=MyISAM;

View File

@ -1,56 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/alt_login_class.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:43 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
class alt_login{
function alt_login($method,&$username,&$userpass){
$newvals=array();
define("AUTH_SUCCESS",-1);
define("AUTH_NOUSER",1);
define("AUTH_BADPASSWORD",2);
require_once(e_PLUGIN."auth_".$method."/auth_".$method.".php");
$xx = new auth_login;
$login_result = $xx -> login($username,$userpass,$newvals);
if($login_result === AUTH_SUCCESS ){
$sql = new db;
if(!$sql -> db_Select("user","*","user_loginname='{$username}' ")){
// User not found in e107 database - add it now.
$qry = "INSERT INTO ".MPREFIX."user (user_id, user_loginname, user_name, user_join) VALUES ('0', '{$username}', '{$username}', ".time().")";
$sql -> db_Select_gen($qry);
}
// Set password and any other applicable fields
$qry="user_password='".md5($userpass)."'";
foreach($newvals as $key => $val){
$qry .= " ,user_{$key}='{$val}' ";
}
$qry.=" WHERE user_loginname='{$username}' ";
$sql -> db_Update("user",$qry);
} else {
switch($login_result){
case AUTH_NOUSER:
$username=md5("xx_nouser_xx");
break;
case AUTH_BADPASSWORD:
$userpass=md5("xx_badpassword_xx");
break;
}
}
}
}
?>

View File

@ -0,0 +1,152 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/e107db_auth.php,v $
| $Revision: 1.1 $
| $Date: 2008-07-25 19:33:03 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
/*
return values
AUTH_NOCONNECT = unable to connect to db
AUTH_NOUSER = user not found
AUTH_BADPASSWORD = supplied password incorrect
AUTH_SUCCESS = valid login
*/
class auth_login
{
var $od;
var $Available;
function auth_login()
{
// global $otherdb_conf, $sql;
global $sql;
$sql -> db_Select("alt_auth", "*", "auth_type = 'e107db' ");
while($row = $sql -> db_Fetch())
{
$e107db_conf[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
}
$class_name = "e107db_mysql_class";
if(class_exists($class_name))
{
$this->od = new $class_name($e107db_conf);
$this->Available = TRUE;
}
else
{
$this->Available = FALSE;
return AUTH_NOCONNECT;
}
}
function login($uname, $pword, &$newvals, $connect_only = FALSE)
{
global $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $sql;
$ret = $this->od->login($uname, $pword, $newvals, $connect_only);
$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
return $ret;
}
}
class e107db_mysql_class
{
var $conf;
function e107db_mysql_class($otherdb_conf)
{
$this->conf = $otherdb_conf;
// print_a($this->conf);
}
function login($uname, $pword, &$newvals, $connect_only = FALSE)
{
//Attempt to open connection to sql database
if(!$res = mysql_connect($this->conf['e107db_server'], $this->conf['e107db_username'], $this->conf['e107db_password']))
{
return AUTH_NOCONNECT;
}
//Select correct db
if(!mysql_select_db($this->conf['e107db_database'], $res))
{
mysql_close($res);
return AUTH_NOCONNECT;
}
if ($connect_only) return AUTH_SUCCESS; // Test mode may just want to connect to the DB
$sel_fields = array();
// Make an array of the fields we want from the source DB
foreach($this->conf as $k => $v)
{
if ($v && (strpos($k,'e107db_xf_') === 0))
{
$sel_fields[] = substr($k,strlen('e107db_xf_'));
}
}
$sel_fields[] = 'user_password';
$user_field = 'user_loginname';
//Get record containing supplied login name
$qry = "SELECT ".implode(',',$sel_fields)." FROM ".MPREFIX."user WHERE {$user_field} = '{$uname}'";
// echo "Query: {$qry}<br />";
if(!$r1 = mysql_query($qry))
{
mysql_close($res);
return AUTH_NOCONNECT;
}
if(!$row = mysql_fetch_array($r1))
{
mysql_close($res);
return AUTH_NOUSER;
}
mysql_close($res); // Finished with 'foreign' DB now
// Got something from the DB - see whether password valid
require_once(e_PLUGIN.'alt_auth/extended_password_handler.php'); // This auto-loads the 'standard' password handler as well
$pass_check = new ExtendedPasswordHandler();
$passMethod = $pass_check->passwordMapping($this->conf['e107db_password_method']);
if ($passMethod === FALSE) return AUTH_BADPASSWORD;
$pwFromDB = $row['user_password']; // Password stored in DB
if ($pass_check->checkPassword($pword, $uname, $pwFromDB, $passMethod) !== PASSWORD_VALID)
{
return AUTH_BADPASSWORD;
}
// Now copy across any values we have selected
foreach($this->conf as $k => $v)
{
if ($v && (strpos($k,'e107db_xf_') === 0))
{
$f = substr($k,strlen('e107db_xf_'));
if (isset($row[$f])) $newvals[$f] = $row[$f];
}
}
return AUTH_SUCCESS;
}
}
?>

View File

@ -0,0 +1,122 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+----------------------------------------------------------------------------+
*/
$eplug_admin = true;
require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_e107db_auth.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "e107db");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
require_once(e_PLUGIN."alt_auth/extended_password_handler.php");
if($_POST['update'])
{
// $message = update_e107db_prefs();
$message = alt_auth_post_options('e107db');
}
if($message)
{
$ns->tablerender("","<div style='text-align:center;'>".$message."</div>");
}
show_e107db_form();
function show_e107db_form()
{
global $sql, $tp, $ns;
$password_methods = ExtendedPasswordHandler::GetPasswordTypes('core');
$sql -> db_Select("alt_auth", "*", "auth_type = 'e107db' ");
$parm = array();
while($row = $sql->db_Fetch())
{
$parm[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
}
$frm = new form;
$text = $frm -> form_open("post", e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<tr><td class='forumheader3'>".LAN_ALT_26."</td><td class='forumheader3'>";
$text .= E107DB_LAN_1;
$text .= "</td></tr>";
$text .= alt_auth_get_db_fields('e107db', $frm, $parm, 'server|uname|pwd|db');
$text .= "<tr><td class='forumheader3'>".E107DB_LAN_9."</td><td class='forumheader3'>";
$text .= $frm -> form_select_open("e107db_password_method");
foreach($password_methods as $k => $v)
{
$sel = ($parm['e107db_password_method'] == $k) ? " Selected" : "";
$text .= $frm -> form_option($v, $sel, $k);
}
$text .= $frm -> form_select_close();
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader2' colspan='2'>".E107DB_LAN_11."</td></tr>";
$text .= alt_auth_get_field_list('e107db',$frm, $parm, TRUE);
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button("submit", "update", LAN_ALT_UPDATESET);
$text .= "</td></tr>";
$text .= "</table>";
$text .= $frm -> form_close();
$ns -> tablerender(E107DB_LAN_10, $text);
$ns->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('e107db',$frm));
}
require_once(e_ADMIN."footer.php");
// Obsolete function update_e107db_prefs()
/*
function update_e107db_prefs()
{
global $sql;
foreach($_POST as $k => $v)
{
$v = base64_encode(base64_encode($v));
if (substr($k,0,7) == 'e107db_')
// if(preg_match("/e107db_/", $k))
{
if($sql -> db_Select("alt_auth", "*", "auth_type='e107db' AND auth_parmname='{$k}' "))
{
$sql -> db_Update("alt_auth", "auth_parmval='{$v}' WHERE auth_type='e107db' AND auth_parmname='{$k}' ");
}
else
{
$sql -> db_Insert("alt_auth", "'e107db','{$k}','{$v}' ");
}
}
}
return E107DB_LAN_UPDATED;
}
*/
function e107db_conf_adminmenu()
{
alt_auth_adminmenu();
}
?>

View File

@ -0,0 +1,266 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/extended_password_handler.php,v $
| $Revision: 1.1 $
| $Date: 2008-07-25 19:33:03 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
/*
EXTENDED PASSWORD HANDLER CLASS
- supports many password formats used on other systems
- implements checking of existing passwords only
To use:
Instantiate ExtendedPasswordHandler
call CheckPassword(plaintext_password,login_name, stored_value)
or, optionally:
call CheckPassword(plaintext_password,login_name, stored_value, password_type)
To do:
*/
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER.'user_handler.php');
define('PASSWORD_PHPBB_SALT',2);
define('PASSWORD_MAMBO_SALT',3);
define('PASSWORD_JOOMLA_SALT',4);
define('PASSWORD_GENERAL_MD5',5);
define('PASSWORD_PLAINTEXT',6);
define('PASSWORD_GENERAL_SHA1',7);
// Supported formats:
define('PASSWORD_PHPBB_ID','$H$'); // PHPBB salted
define('PASSWORD_ORIG_ID','$P$'); // 'Original' code
class ExtendedPasswordHandler extends UserHandler
{
var $itoa64; // Holds a string of 64 characters for base64 conversion
// var $iteration_count_log2; // Used to compute number of iterations in calculating hash
var $random_state = ''; // A (hopefully) random number
// Constructor
function ExtendedPasswordHandler()
{
// Lookup string ready for base64 conversions
$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$this->UserHandler(); // Ancestor constructor
}
// Return a number of random bytes as specified by $count
function get_random_bytes($count)
{
$this->random_state = md5($this->random_state.microtime().mt_rand(0,10000)); // This will 'auto seed'
$output = '';
for ($i = 0; $i < $count; $i += 16)
{ // Only do this loop once unless we need more than 16 bytes
$this->random_state = md5(microtime() . $this->random_state);
$output .= pack('H*', md5($this->random_state)); // Becomes an array of 16 bytes
}
$output = substr($output, 0, $count);
return $output;
}
// Encode to base64 (each block of three 8-bit chars becomes 4 printable chars)
// Use first $count characters of $input string
function encode64($input, $count)
{
$output = '';
$i = 0;
do
{
$value = ord($input[$i++]);
$output .= $this->itoa64[$value & 0x3f];
if ($i < $count) $value |= ord($input[$i]) << 8;
$output .= $this->itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count) break;
if ($i < $count) $value |= ord($input[$i]) << 16;
$output .= $this->itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count) break;
$output .= $this->itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
// Method for PHPBB3-style salted passwords, which begin '$H$'
// Given a plaintext password and the complete password/hash function (which includes any salt), calculate hash
// Returns FALSE on error
function crypt_private($password, $stored_password)
{
$output = '*0';
if (substr($stored_password, 0, 2) == $output)
$output = '*1';
switch (substr($stored_password, 0, 3))
{
case PASSWORD_PHPBB_ID : // PHPBB3 encoding
case PASSWORD_ORIG_ID : // Original algorithm's encoding
break;
default :
return $output;
}
$count_log2 = strpos($this->itoa64, $stored_password[3]); // 4th character indicates hash depth count
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($stored_password, 4, 8); // Salt is characters 5..12
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION >= '5')
{ // Get raw binary output (always 16 bytes)
$hash = md5($salt . $password, TRUE);
do
{
$hash = md5($hash . $password, TRUE);
} while (--$count);
}
else
{ // Use 'pack' to create 16 bytes from the hex string
$hash = pack('H*', md5($salt . $password));
do
{
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12); // Identifier, shift count and salt - total 12 chars
$output .= $this->encode64($hash, 16); // Returns 22-character string
return $output;
}
// Return array of supported password types - key is used internally, text is displayed
function getPasswordTypes($include_core = FALSE)
{
$vals = array();
if ($include_core)
{
$vals = array('md5' => IMPORTDB_LAN_7,'e107_salt' => IMPORTDB_LAN_8); // Methods supported in core
}
if (is_bool($include_core))
{
$vals = array_merge($vals,array(
'plaintext' => IMPORTDB_LAN_2,
'joomla_salt' => IMPORTDB_LAN_3,
'mambo_salt' => IMPORTDB_LAN_4,
'smf_sha1' => IMPORTDB_LAN_5,
'sha1' => IMPORTDB_LAN_6,
'phpbb3_salt' => IMPORTDB_LAN_12
));
}
return $vals;
}
// Return password type which relates to a specific foreign system
function passwordMapping($ptype)
{
$maps = array(
'plaintext' => PASSWORD_PLAINTEXT,
'joomla_salt' => PASSWORD_JOOMLA_SALT,
'mambo_salt' => PASSWORD_MAMBO_SALT,
'smf_sha1' => PASSWORD_GENERAL_SHA1,
'sha1' => PASSWORD_GENERAL_SHA1,
'mambo' => PASSWORD_GENERAL_MD5,
'phpbb2' => PASSWORD_GENERAL_MD5,
'e107' => PASSWORD_GENERAL_MD5,
'md5' => PASSWORD_GENERAL_MD5,
'e107_salt' => PASSWORD_E107_SALT,
'phpbb2_salt' => PASSWORD_PHPBB_SALT
);
if (isset($maps[$ptype])) return $maps[$ptype];
return FALSE;
}
// Extension of password validation -
function CheckPassword($pword, $login_name, $stored_hash, $password_type = PASSWORD_DEFAULT_TYPE)
{
switch ($password_type)
{
case PASSWORD_GENERAL_MD5 :
case PASSWORD_E107_MD5 :
$pwHash = md5($pword);
break;
case PASSWORD_GENERAL_SHA1 :
if (strlen($stored_hash) != 40) return PASSWORD_INVALID;
$pwHash = sha1($pword);
break;
case PASSWORD_JOOMLA_SALT :
case PASSWORD_MAMBO_SALT :
if ((strpos($row['user_password'], ':') === false) || (strlen($row[0]) < 40))
{
return PASSWORD_INVALID;
}
// Mambo/Joomla salted hash - should be 32-character md5 hash, ':', 16-character salt (but could be 8-char salt, maybe)
list($hash, $salt) = explode(':', $stored_hash);
$pwHash = md5($pword.$salt);
$stored_hash = $hash;
break;
case PASSWORD_E107_SALT :
return UserHandler::CheckPassword($password, $login_name, $stored_hash);
break;
case PASSWORD_PHPBB_SALT :
if (strlen($stored_hash) != 34) return PASSWORD_INVALID;
$pwHash = $this->HashPassword($pword, PASSWORD_PHPBB_SALT);
break;
case PASSWORD_PLAINTEXT :
$pwHash = $pword;
break;
default :
return PASSWORD_INVALID;
}
if ($stored_hash != $pwHash) return PASSWORD_INVALID;
return PASSWORD_VALID;
}
}
?>

View File

@ -0,0 +1,101 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/importdb_auth.php,v $
| $Revision: 1.1 $
| $Date: 2008-07-25 19:33:03 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
/*
return values
AUTH_NOCONNECT = unable to connect to db
AUTH_NOUSER = user not found
AUTH_BADPASSWORD = supplied password incorrect
AUTH_SUCCESS = valid login
*/
class auth_login
{
var $od;
function auth_login()
{
global $importdb_conf, $sql;
if (!$sql -> db_Select("alt_auth", "*", "auth_type = 'importdb' ")) return AUTH_NOCONNECT; // We should get at least one value
while ($row = $sql -> db_Fetch())
{
$importdb_conf[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
}
$this->Available = TRUE;
$this->od = new importdb_mysql_class;
}
function login($uname, $pword, &$newvals, $connect_only = FALSE)
{
// global $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $sql;
$ret = $this->od->login($uname, $pword, $newvals, $connect_only);
// $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
return $ret;
}
}
class importdb_mysql_class
{
var $conf;
function importdb_mysql_class()
{
global $importdb_conf;
$this->conf = $importdb_conf;
}
function login($uname, $pword, &$newvals, $connect_only = FALSE)
{
if ($connect_only) return AUTH_SUCCESS; // Big problem if can't connect to our own DB!
// See if the user's in the E107 database - otherwise they can go away
global $sql, $tp;
if (!$sql->db_Select("user", "user_loginname, user_password", "user_loginname = '".$tp -> toDB($uname)."'"))
{ // Invalid user
return AUTH_NOUSER;
}
// Now look at their password - we always need to verify it, even if its a core E107 format.
// Higher levels will always convert an authorised password to E107 format and save it for us.
if (!$row = $sql->db_Fetch())
{
return AUTH_NOCONNECT; // Debateable return code - really a DB error. But consistent with other handler
}
require_once(e_PLUGIN.'alt_auth/extended_password_handler.php'); // This auto-loads the 'standard' password handler as well
$pass_check = new ExtendedPasswordHandler();
$passMethod = $pass_check->passwordMapping($this->conf['importdb_password_method']);
if ($passMethod === FALSE) return AUTH_BADPASSWORD;
$pwFromDB = $row['user_password']; // Password stored in DB
if ($pass_check->checkPassword($pword, $uname, $pwFromDB, $passMethod) !== PASSWORD_VALID)
{
return AUTH_BADPASSWORD;
}
return AUTH_SUCCESS;
}
}
?>

View File

@ -0,0 +1,124 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+----------------------------------------------------------------------------+
*/
$eplug_admin = true;
require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_importdb_auth.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "importdb");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
require_once(e_PLUGIN."alt_auth/extended_password_handler.php");
if($_POST['update'])
{
// $message = update_importdb_prefs();
$message = alt_auth_post_options('importdb');
}
if($message)
{
$ns->tablerender("","<div style='text-align:center;'>".$message."</div>");
}
show_importdb_form();
function show_importdb_form()
{
global $sql, $tp, $ns;
$password_methods = ExtendedPasswordHandler::GetPasswordTypes(FALSE);
// Get the parameters
$sql -> db_Select("alt_auth", "*", "auth_type = 'importdb' ");
$parm = array();
while($row = $sql->db_Fetch())
{
$parm[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
}
$frm = new form;
$text = $frm -> form_open("post", e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<tr><td colspan='2' class='forumheader3'>".IMPORTDB_LAN_11."</td></tr>";
/* $text .= $frm -> form_select_open("importdb_dbtype");
foreach($db_types as $k => $v)
{
$sel = ($parm['importdb_dbtype'] == $k) ? " Selected" : "";
$text .= $frm -> form_option($v, $sel, $k);
}
$text .= $frm -> form_select_close();
$text .= "</td></tr>";
*/
$text .= "<tr><td class='forumheader3'>".IMPORTDB_LAN_9."</td><td class='forumheader3'>";
$text .= $frm -> form_select_open("importdb_password_method");
foreach($password_methods as $k => $v)
{
$sel = ($parm['importdb_password_method'] == $k) ? " Selected" : "";
$text .= $frm -> form_option($v, $sel, $k);
}
$text .= $frm -> form_select_close();
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button("submit", "update", LAN_ALT_UPDATESET);
$text .= "</td></tr>";
$text .= "</table>";
$text .= $frm -> form_close();
$ns -> tablerender(IMPORTDB_LAN_10, $text);
$ns->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('importdb',$frm));
}
require_once(e_ADMIN."footer.php");
/*
function update_importdb_prefs()
{
global $sql;
foreach($_POST as $k => $v)
{
$v = base64_encode(base64_encode($v));
if(preg_match("/importdb_/", $k))
{
if($sql -> db_Select("alt_auth", "*", "auth_type='importdb' AND auth_parmname='{$k}' "))
{
$sql -> db_Update("alt_auth", "auth_parmval='{$v}' WHERE auth_type='importdb' AND auth_parmname='{$k}' ");
}
else
{
$sql -> db_Insert("alt_auth", "'importdb','{$k}','{$v}' ");
}
}
}
return "Settings Updated";
}
*/
function importdb_conf_adminmenu()
{
alt_auth_adminmenu();
}
?>

View File

@ -1,15 +1,68 @@
<?php
define("LAN_ALT_1", "Current authorization type");
define("LAN_ALT_1", "Current authorisation type");
define("LAN_ALT_2", "Update settings");
define("LAN_ALT_3", "Choose Alternate Authorization Type");
define("LAN_ALT_3", "Choose Alternate Authorisation Type");
define("LAN_ALT_4", "Configure parameters for");
define("LAN_ALT_5", "Configure authorization parameters");
define("LAN_ALT_5", "Configure authorisation parameters");
define("LAN_ALT_6", "Failed connection action");
define("LAN_ALT_7", "If connection to the alternate method fails, how should that be handled?");
define("LAN_ALT_8", "User not found action");
define("LAN_ALT_9", "If username is not found using alternate method, how should that be handled?");
define('LAN_ALT_10', 'User login name field');
define('LAN_ALT_11', 'User password field');
define('LAN_ALT_12', 'User email field');
define('LAN_ALT_13', 'Hide email? field');
define('LAN_ALT_14', 'User display name field');
define('LAN_ALT_15', 'User real name field');
define('LAN_ALT_16', 'User Custom Title field');
define('LAN_ALT_17', 'Signature field');
define('LAN_ALT_18', 'Avatar field');
define('LAN_ALT_19', 'Photo field');
define('LAN_ALT_20', 'Join date field');
define('LAN_ALT_21', 'Ban status field');
define('LAN_ALT_22', 'Class membership field');
define('LAN_ALT_23', 'XUP file field');
define('LAN_ALT_24', 'Password salt field');
define('LAN_ALT_25', '(sometimes combined with password for added security)');
define('LAN_ALT_26', 'Database type:');
define('LAN_ALT_29', 'Auth methods');
define('LAN_ALT_30', 'Configure ');
define('LAN_ALT_31', 'Main configuration');
define("LAN_ALT_32", "Server:");
define("LAN_ALT_33", "Username:");
define("LAN_ALT_34", "Password:");
define("LAN_ALT_35", "Database:");
define("LAN_ALT_36", "Table:");
define("LAN_ALT_37", "Username Field:");
define("LAN_ALT_38", "Password Field:");
define('LAN_ALT_40', 'Test database access');
define('LAN_ALT_41', ' (using above credentials)');
define('LAN_ALT_42', 'If a username and password are entered, that user will also be validated');
define('LAN_ALT_43', 'Connection to database successful');
define('LAN_ALT_44', 'Connection to database failed');
define('LAN_ALT_45', 'Username lookup successful');
define('LAN_ALT_46', 'Uername lookup failed');
define('LAN_ALT_47', 'Test');
define('LAN_ALT_48', 'Previous validation');
define('LAN_ALT_49', 'Username = ');
define('LAN_ALT_50', 'Password = ');
define('LAN_ALT_51', '(blank)');
define('LAN_ALT_52', 'Authentication failed - ');
define('LAN_ALT_53', 'unknown cause');
define('LAN_ALT_54', 'could not connect to DB');
define('LAN_ALT_55', 'invalid user');
define('LAN_ALT_56', 'bad password');
define('LAN_ALT_57', 'method not available');
define('LAN_ALT_58', 'Authentification successful');
define('LAN_ALT_59', 'Retrieved parameters:');
define('LAN_ALT_60', '');
define("LAN_ALT_FALLBACK", "Use e107 user table");
define("LAN_ALT_FAIL", "Failed login");
define('LAN_ALT_UPDATESET', "Update settings");
define('LAN_ALT_UPDATED','Settings updated');
?>

View File

@ -0,0 +1,16 @@
<?php
define('E107DB_LAN_1', 'E107 format database');
//define("E107DB_LAN_2", "Server:");
//define("E107DB_LAN_3", "Username:");
//define("E107DB_LAN_4", "Password:");
//define("E107DB_LAN_5", "Database");
define("E107DB_LAN_9", "Password Method:");
define("E107DB_LAN_10", "Configure E107 db auth");
define("E107DB_LAN_11", "Check the box against any field you wish to be transferred to the local database:");
define("IMPORTDB_LAN_7", 'MD5 (E107 original)');
define("IMPORTDB_LAN_8", 'E107 salted (option 0.8 on)');
?>

View File

@ -0,0 +1,19 @@
<?php
define("IMPORTDB_LAN_1", 'Database type');
define("IMPORTDB_LAN_2", 'Plain Text');
define("IMPORTDB_LAN_3", 'Joomla salted');
define("IMPORTDB_LAN_4", 'Mambo salted');
define("IMPORTDB_LAN_5", 'SMF (SHA1)');
define("IMPORTDB_LAN_6", 'Generic SHA1');
define("IMPORTDB_LAN_7", 'MD5 (E107 original)');
define("IMPORTDB_LAN_8", 'E107 salted (option 0.8 on)');
define("IMPORTDB_LAN_9", "Password Method:");
define("IMPORTDB_LAN_10", "Configure imported database password type");
define("IMPORTDB_LAN_11", 'This option is to be used when you have imported some other user-based system into E107.
It allows you to accept passwords encoded in the selected non-standard format.
Each user\'s password is converted to E107 format when they log in.');
define("IMPORTDB_LAN_12", 'PHPBB2/PHPBB3 salted');
define("IMPORTDB_LAN_13", '');
define("IMPORTDB_LAN_14", '');
?>

View File

@ -9,7 +9,11 @@ define("LDAPLAN_7", "eDirectory search filter:");
define("LDAPLAN_8", "This will be used to ensure the username is in the correct tree, <br />ie '(objectclass=inetOrgPerson)'");
define("LDAPLAN_9", "Current search filter will be:");
define("LDAPLAN_10", "Settings Updated");
define("LDAPLAN_11", "WARNING: It appears as if the ldap module is not currently available, setting your auth method to LDAP will probably not work!");
define("LDAPLAN_11", "WARNING: It appears as if the ldap module is not currently available; setting your auth method to LDAP will probably not work!");
define("LDAPLAN_12", "Server Type");
define("LDAPLAN_13", "Update settings");
define("LDAPLAN_14", "To transfer a field (attribute) value into the local database, specify its name in the corresponding box below. Fields marked with
an asterisk (*) are mandatory.
<br />Leave the box blank for it not to be transferred at all");
?>

View File

@ -9,6 +9,20 @@ define("OTHERDB_LAN_7", "Username Field:");
define("OTHERDB_LAN_8", "Password Field:");
define("OTHERDB_LAN_9", "Password Method:");
define("OTHERDB_LAN_10", "Configure otherdb auth");
define("OTHERDB_LAN_11", "** The following fields are not required if using an e107 database");
define("OTHERDB_LAN_11", "To transfer a field value into the local database, specify the field name in the corresponding box below. Fields marked with
an asterisk (*) are mandatory.<br />Leave the field blank for it not to be transferred at all");
define('OTHERDB_LAN_12', 'Password Salt Field:');
define('OTHERDB_LAN_13', '(Leave blank if not used)');
define('OTHERDB_LAN_14', 'Email address Field:');
define('OTHERDB_LAN_15', 'MySQL - generic database');
define("IMPORTDB_LAN_2", 'Plain Text');
define("IMPORTDB_LAN_3", 'Joomla salted');
define("IMPORTDB_LAN_4", 'Mambo salted');
define("IMPORTDB_LAN_5", 'SMF (SHA1)');
define("IMPORTDB_LAN_6", 'Generic SHA1');
define("IMPORTDB_LAN_7", 'MD5 (E107 original)');
define("IMPORTDB_LAN_8", 'E107 salted (option 0.8 on)');
define("IMPORTDB_LAN_12", 'PHPBB2/PHPBB3 salted');
?>

View File

@ -11,9 +11,12 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/ldap_auth.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:43 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-07-25 19:33:02 $
| $Author: e107steved $
To do:
1. Sort out a method of just checking the connection on login (needed for test)
+----------------------------------------------------------------------------+
*/
@ -32,16 +35,22 @@ class auth_login
var $ldapVersion;
var $Available;
var $filter;
var $copyAttribs; // Any attributes which are to be copied on successful login
function auth_login()
{
$this->copyAttribs = array();
$sql = new db;
$sql -> db_Select("alt_auth", "*", "auth_type = 'ldap' ");
while($row = $sql -> db_Fetch())
{
$ldap[$row['auth_parmname']]=$row['auth_parmval'];
$ldap[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
if ((strpos($row['auth_parmname'],'ldap_xf_') === 0) && $ldap[$row['auth_parmname']])
{ // Attribute to copy on successful login
$this->copyAttribs[$ldap[$row['auth_parmname']]] = substr($row['auth_parmname'],strlen('ldap_xf_')); // Key = LDAP attribute. Value = e107 field name
unset($row['auth_parmname']);
}
}
$this->server = explode(",", $ldap['ldap_server']);
$this->serverType = $ldap['ldap_servertype'];
$this->dn = $ldap['ldap_basedn'];
@ -62,6 +71,8 @@ class auth_login
}
}
function connect()
{
foreach ($this->server as $key => $host)
@ -81,6 +92,8 @@ class auth_login
return false;
}
function close()
{
if ( !@ldap_close( $this->connection))
@ -95,67 +108,121 @@ class auth_login
}
}
function login($uname, $pass)
function login($uname, $pass, &$newvals, $connect_only = FALSE)
{
/* Construct the full DN, eg:-
** "uid=username, ou=People, dc=orgname,dc=com"
*/
// echo "Login to server type: {$this->serverType}<br />";
$current_filter = "";
if ($this->serverType == "ActiveDirectory")
{
$checkDn = "$uname@$this->dn";
$checkDn = $uname.'@'.$this->dn;
}
else
{
if ($this -> usr != '' && $this -> pwd != '')
{
$this -> result = ldap_bind($this -> connection, $this -> usr, $this -> pwd);
}
else
{
$this -> result = ldap_bind($this -> connection);
}
if ($this -> usr != '' && $this -> pwd != '')
{
$this -> result = ldap_bind($this -> connection, $this -> usr, $this -> pwd);
}
else
{
$this -> result = ldap_bind($this -> connection);
}
if ($this->result === FALSE)
{
// echo "LDAP bind failed<br />";
return AUTH_NOCONNECT;
}
// In ldap_auth.php, should look like this instead for eDirectory
// $query = ldap_search($this -> connection, $this -> dn, "cn=".$uname);
if($this->serverType == "eDirectory")
{
$_filter = (isset($ldap['ldap_edirfilter']) ? $ldap['ldap_edirfilter'] : "");
$current_filter = "(&(cn={$uname})".$this->filter.")";
$query = ldap_search($this->connection, $this->dn, $current_filter);
}
else
{
$query = ldap_search($this->connection, $this->dn, "uid=".$uname);
}
if($this->serverType == "eDirectory")
{
$current_filter = "(&(cn={$uname})".$this->filter.")";
}
else
{
$current_filter = "uid=".$uname;
}
// echo "LDAP search: {$this->dn}, {$current_filter}<br />";
$query = ldap_search($this->connection, $this->dn, $current_filter);
if ($query == false)
{
if ($query === false)
{
// Could not perform query to LDAP directory
return AUTH_NOCONNECT;
echo "LDAP - search for user failed<br />";
return AUTH_NOCONNECT;
}
else
{
$query_result = ldap_get_entries($this -> connection, $query);
if ($query_result["count"] != 1)
{
if ($connect_only) return AUTH_SUCCESS; else return AUTH_NOUSER;
}
else
{
$query_result = ldap_get_entries($this -> connection, $query);
if ($query_result["count"] != 1)
{
return AUTH_NOUSER;
}
else
{
$checkDn = $query_result[0]["dn"];
$this -> close();
$this -> connect();
}
$checkDn = $query_result[0]["dn"];
$this -> close();
$this -> connect();
}
}
}
// Try and connect...
$this->result = ldap_bind($this -> connection, $checkDn, $pass);
if ( $this->result)
{
// Connected OK - login credentials are fine!
return AUTH_SUCCESS;
// Connected OK - login credentials are fine!
// But bind can return success even if no password! Does reject an invalid password, however
if ($connect_only) return AUTH_SUCCESS;
if (trim($pass) == '') return AUTH_BADPASSWORD; // Pick up a blank password
if (count($this->copyAttribs) == 0) return AUTH_SUCCESS; // No attributes required - we're done
$ldap_attributes = array_keys($this->copyAttribs);
// echo "Validation search: {$checkDn}, {$current_filter},"; print_a($ldap_attributes); echo "<br />";
$this->result = ldap_search($this -> connection, $checkDn, $current_filter, $ldap_attributes);
if ($this->result)
{
$entries = ldap_get_entries($this->connection, $this->result);
// print_a($entries);
if (count($entries) == 2)
{ // All OK
for ($j = 0; $j < $entries[0]['count']; $j++)
{
$k = $entries[0][$j];
$tlv = $entries[0][$k];
if (is_array($tlv) && isset($this->copyAttribs[$k]))
{ // This bit executed if we've successfully got some data. Key is the attribute name, then array of data
$newvals[$this->copyAttribs[$k]] = $tlv[0]; // Just grab the first value
// echo $j.":Key: {$k} (Values: {$tlv['count']})";
// for ($i = 0; $i < $tlv['count']; $i++) { echo ' '.$tlv[$i]; }
// echo "<br />";
}
else
{
// echo " Unexpected non-array value - Key: {$k} Value: {$tlv}<br />";
return AUTH_NOCONNECT; // Not really a suitable return code for this - its an error
}
}
}
else
{
// echo "Got wrong number of entries<br />";
return AUTH_NOUSER; // Bit debateable what to return if this happens
}
}
else
{ // Probably a bit strange if we don't get any info back - but possible
// echo "No results!<br />";
}
return AUTH_SUCCESS;
}
else
{
@ -170,12 +237,11 @@ class auth_login
$this->ldapErrorCode = ldap_errno( $this->connection);
$this->ldapErrorText = ldap_error( $this->connection);
if($this -> ldapErrorCode == 32)
switch ($this -> ldapErrorCode)
{
case 32 :
return AUTH_NOUSER;
}
if($this -> ldapErrorCode == 49)
{
case 49 :
return AUTH_BADPASSWORD;
}
// return error code as if it never connected, maybe change that in the future

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/ldap_conf.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:43 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-07-25 19:33:02 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
$eplug_admin = true;
@ -21,6 +21,7 @@ require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_ldap_auth.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "ldap");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
@ -32,46 +33,36 @@ $server_types[3]="eDirectory";
$ldap_ver[1]="2";
$ldap_ver[2]="3";
$message = '';
if($_POST['update'])
{
foreach($_POST as $k => $v)
{
if(preg_match("/ldap_/", $k))
{
if($sql -> db_Select("alt_auth", "*", "auth_type='ldap' AND auth_parmname='{$k}' "))
{
$sql -> db_Update("alt_auth", "auth_parmval='{$v}' WHERE auth_type='ldap' AND auth_parmname='{$k}' ");
}
else
{
$sql -> db_Insert("alt_auth", "'ldap','{$k}','{$v}' ");
}
}
}
$message = LDAPLAN_10;
$message .= alt_auth_post_options('ldap');
}
if(!function_exists('ldap_connect'))
{
$message = "<div style='color:#f00; font-weight:bold'>".LDAPLAN_11."</div>";
$message .= "<br /><br /><div style='color:#f00; font-weight:bold'>".LDAPLAN_11."</div><br />";
}
if($message)
{
$ns->tablerender("","<div style='text-align:center;'>".$message."</div>");
$ns->tablerender("","<div style='text-align:center;'>".$message."</div>");
}
$ldap['ldap_edirfilter'] == "";
$sql -> db_Select("alt_auth", "*", "auth_type = 'ldap' ");
while($row = $sql->db_Fetch())
{
$ldap[$row['auth_parmname']] = $row['auth_parmval'];
$ldap[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval'])); // Encoding is new for 0.8
}
$current_filter = "(&(cn=[USERNAME]){$ldap['ldap_edirfilter']})";
$frm = new form;
$text = $frm -> form_open("POST",e_SELF);
$text = $frm -> form_open("post",e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_12."</td><td class='forumheader3'>";
$text .= $frm -> form_select_open("ldap_servertype");
@ -113,7 +104,11 @@ $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_7."<br /><span class='smalltext'>".LDAPLAN_8."</span></td><td class='forumheader3'>";
$text .= $frm -> form_text("ldap_edirfilter", 35, $ldap['ldap_edirfilter'], 120);
$text .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />{$current_filter}</span></td></tr>";
$text .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />".htmlentities($current_filter)."</span></td></tr>";
$text .= "<tr><td class='forumheader2' colspan='2'>".LDAPLAN_14."</td></tr>";
$text .= alt_auth_get_field_list('ldap',$frm, $ldap, FALSE);
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button("submit", "update", LDAPLAN_13);
@ -123,6 +118,8 @@ $text .= "</table>";
$text .= $frm -> form_close();
$ns -> tablerender(LDAPLAN_6,$text);
$ns->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('ldap',$frm));
require_once(e_ADMIN."footer.php");
function ldap_conf_adminmenu()

View File

@ -11,55 +11,54 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/otherdb_auth.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:43 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-07-25 19:33:02 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
/*
return values
AUTH_NOCONNECT = unable to connect to db
AUTH_NOUSER = user not found
AUTH_NOUSER = user not found
AUTH_BADPASSWORD = supplied password incorrect
AUTH_SUCCESS = valid login
AUTH_SUCCESS = valid login
*/
class auth_login
{
var $od;
var $Available;
function auth_login()
{
global $otherdb_conf, $sql;
// global $otherdb_conf, $sql;
global $sql;
$sql -> db_Select("alt_auth", "*", "auth_type = 'otherdb' ");
while($row = $sql -> db_Fetch())
{
$otherdb_conf[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
}
$class_name = "otherdb_".$otherdb_conf['otherdb_dbtype']."_class";
$class_name = "otherdb_mysql_class";
if($otherdb_conf['otherdb_dbtype'] == 'e107')
{
$class_name = "otherdb_mysql_class";
}
if(class_exists($class_name))
{
$this->od = new $class_name;
$this->od = new $class_name($otherdb_conf);
$this->Available = TRUE;
}
else
{
return AUTH_NOCONNECT;
$this->Available = FALSE;
return AUTH_NOCONNECT;
}
}
function login($uname, $pword, &$newvals)
function login($uname, $pword, &$newvals, $connect_only = FALSE)
{
global $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $sql;
$ret = $this->od->login($uname, $pword, $newvals);
$ret = $this->od->login($uname, $pword, $newvals, $connect_only);
$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
return $ret;
}
@ -71,76 +70,85 @@ class otherdb_mysql_class
var $conf;
function otherdb_mysql_class()
function otherdb_mysql_class($otherdb_conf)
{
global $otherdb_conf;
// global $otherdb_conf;
$this->conf = $otherdb_conf;
}
function login($uname, $pword, &$newvals)
function login($uname, $pword, &$newvals, $connect_only = FALSE)
{
//Attempt to open connection to sql database
if(!$res = mysql_connect($this->conf['otherdb_server'], $this->conf['otherdb_username'], $this->conf['otherdb_password']))
{
return AUTH_NOCONNECT;
}
//Select correct db
if(!mysql_select_db($this->conf['otherdb_database'], $res))
{
mysql_close($res);
return AUTH_NOCONNECT;
}
if($this->conf['otherdb_dbtype'] == 'mysql')
{
$sel_fields = $this->conf['otherdb_password_field'];
$user_field = $this->conf['otherdb_user_field'];
}
else
{
$sel_fields = 'user_password, user_email, user_join';
$user_field = "user_loginname";
}
//Get record containing supplied login name
$qry = "SELECT {$sel_fields} FROM {$this->conf['otherdb_table']} WHERE {$user_field} = '{$uname}'";
if(!$r1 = mysql_query($qry))
{
mysql_close($res);
return AUTH_NOCONNECT;
}
if(!$row = mysql_fetch_array($r1))
{
mysql_close($res);
return AUTH_NOUSER;
}
//Compare password in db to supplied password
if($this->conf['otherdb_password_method'] == 'md5' || $this->conf['otherdb_dbtype'] == 'e107')
{
$goodpw = md5($pword) == $row[0];
}
else
{
$goodpw = $pword == $row[0];
}
if($goodpw)
{
//Close newly opened mysql connection
mysql_close($res);
if($this->conf['otherdb_dbtype'] == 'e107')
{
$newvals['email'] = $row[1];
$newvals['join'] = $row[2];
}
return AUTH_SUCCESS;
}
//Attempt to open connection to sql database
if(!$res = mysql_connect($this->conf['otherdb_server'], $this->conf['otherdb_username'], $this->conf['otherdb_password']))
{
return AUTH_NOCONNECT;
}
//Select correct db
if(!mysql_select_db($this->conf['otherdb_database'], $res))
{
mysql_close($res);
return AUTH_NOCONNECT;
}
if ($connect_only) return AUTH_SUCCESS; // Test mode may just want to connect to the DB
$sel_fields = array();
// Make an array of the fields we want from the source DB
foreach($this->conf as $k => $v)
{
if ($v && (strpos($k,'otherdb_xf_') === 0))
{
$sel_fields[] = $v;
}
}
$sel_fields[] = $this->conf['otherdb_password_field'];
$user_field = $this->conf['otherdb_user_field'];
if (isset($this->conf['otherdb_salt_field']))
{
$sel_fields[] = $this->conf['otherdb_salt_field'];
}
//Get record containing supplied login name
$qry = "SELECT ".implode(',',$sel_fields)." FROM {$this->conf['otherdb_table']} WHERE {$user_field} = '{$uname}'";
// echo "Query: {$qry}<br />";
if(!$r1 = mysql_query($qry))
{
mysql_close($res);
return AUTH_NOCONNECT;
}
if(!$row = mysql_fetch_array($r1))
{
mysql_close($res);
return AUTH_NOUSER;
}
mysql_close($res); // Finished with 'foreign' DB now
// Got something from the DB - see whether password valid
require_once(e_PLUGIN.'alt_auth/extended_password_handler.php'); // This auto-loads the 'standard' password handler as well
$pass_check = new ExtendedPasswordHandler();
$passMethod = $pass_check->passwordMapping($this->conf['otherdb_password_method']);
if ($passMethod === FALSE) return AUTH_BADPASSWORD;
$pwFromDB = $row[$this->conf['otherdb_password_field']]; // Password stored in DB
if ($salt_field) $pwFromDB .= ':'.$row[$salt_field];
if ($pass_check->checkPassword($pword, $uname, $pwFromDB, $passMethod) !== PASSWORD_VALID)
{
return AUTH_BADPASSWORD;
}
// Now copy across any values we have selected
foreach($this->conf as $k => $v)
{
if ($v && (strpos($k,'otherdb_xf_') === 0) && isset($row[$v]))
{
$newvals[substr($k,strlen('otherdb_xf_'))] = $row[$v];
}
}
return AUTH_SUCCESS;
}
}

View File

@ -16,12 +16,15 @@ require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_otherdb_auth.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "otherdb");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
require_once(e_PLUGIN."alt_auth/extended_password_handler.php");
if($_POST['update'])
{
$message = update_otherdb_prefs();
// $message = update_otherdb_prefs();
$message = alt_auth_post_options('otherdb');
}
if($message)
@ -36,8 +39,9 @@ function show_otherdb_form()
{
global $sql, $tp, $ns;
$password_methods = array("md5", "plaintext");
$db_types = array("e107" => "mysql - e107 database", "mysql" => "mysql - generic database");
$password_methods = ExtendedPasswordHandler::GetPasswordTypes(TRUE);
// $db_types = array("e107" => "mysql - e107 database", "mysql" => "mysql - generic database");
$sql -> db_Select("alt_auth", "*", "auth_type = 'otherdb' ");
$parm = array();
@ -47,72 +51,43 @@ function show_otherdb_form()
}
$frm = new form;
$text = $frm -> form_open("POST", e_SELF);
$text = $frm -> form_open("post", e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_1."</td><td class='forumheader3'>";
$text .= $frm -> form_select_open("otherdb_dbtype");
foreach($db_types as $k => $v)
$text .= "<tr><td class='forumheader3'>".LAN_ALT_26."</td><td class='forumheader3'>";
$text .= OTHERDB_LAN_15;
$text .= "</td></tr>";
$text .= alt_auth_get_db_fields('otherdb', $frm, $parm, 'server|uname|pwd|db|table|ufield|pwfield|salt');
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_9."</td><td class='forumheader3'>";
$text .= $frm -> form_select_open("otherdb_password_method");
foreach($password_methods as $k => $v)
{
$sel = ($parm['otherdb_dbtype'] == $k) ? " Selected" : "";
$sel = ($parm['otherdb_password_method'] == $k) ? " Selected" : "";
$text .= $frm -> form_option($v, $sel, $k);
}
$text .= $frm -> form_select_close();
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_2."</td><td class='forumheader3'>";
$text .= $frm -> form_text("otherdb_server", 35, $parm['otherdb_server'], 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_3."</td><td class='forumheader3'>";
$text .= $frm -> form_text("otherdb_username", 35, $parm['otherdb_username'], 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_4."</td><td class='forumheader3'>";
$text .= $frm -> form_text("otherdb_password", 35, $parm['otherdb_password'], 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_5."</td><td class='forumheader3'>";
$text .= $frm -> form_text("otherdb_database", 35, $parm['otherdb_database'], 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_6."</td><td class='forumheader3'>";
$text .= $frm -> form_text("otherdb_table", 35, $parm['otherdb_table'], 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader2' colspan='2'>".OTHERDB_LAN_11."</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_7."</td><td class='forumheader3'>";
$text .= $frm -> form_text("otherdb_user_field", 35, $parm['otherdb_user_field'], 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_8."</td><td class='forumheader3'>";
$text .= $frm -> form_text("otherdb_password_field", 35, $parm['otherdb_password_field'], 120);
$text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_9."</td><td class='forumheader3'>";
$text .= $frm -> form_select_open("otherdb_password_method");
foreach($password_methods as $v)
{
$sel = ($parm['otherdb_password_method'] == $v) ? " Selected" : "";
$text .= $frm -> form_option($v, $sel, $v);
}
$text .= $frm -> form_select_close();
$text .= "</td></tr>";
$text .= alt_auth_get_field_list('otherdb',$frm, $parm, FALSE);
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button("submit", "update", "Update settings");
$text .= $frm -> form_button("submit", "update", LAN_ALT_UPDATESET);
$text .= "</td></tr>";
$text .= "</table>";
$text .= $frm -> form_close();
$ns -> tablerender(OTHERDB_LAN_10, $text);
$ns->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('otherdb',$frm));
}
require_once(e_ADMIN."footer.php");
/*
function update_otherdb_prefs()
{
global $sql;
@ -134,7 +109,7 @@ function update_otherdb_prefs()
}
return "Settings Updated";
}
*/
function otherdb_conf_adminmenu()
{
alt_auth_adminmenu();

View File

@ -11,16 +11,16 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/plugin.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:44 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-07-25 19:33:03 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "Alternate Authentication";
$eplug_version = "0.3";
$eplug_version = "0.4";
$eplug_author = "McFly";
$eplug_logo = "/images/icon_ldap.png";
$eplug_url = "";