1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-20 14:31:31 +02:00

alt_auth GUI fixes

This commit is contained in:
Cameron
2012-11-28 01:26:18 -08:00
parent 3bf5951bf5
commit a1461cc8e7
7 changed files with 61 additions and 47 deletions

View File

@@ -131,14 +131,14 @@ function alt_auth_get_field_list($tableType, $frm, $parm, $asCheckboxes = FALSE)
{ {
if (varsettrue($v['showAll']) || varsettrue($v[$tableType])) if (varsettrue($v['showAll']) || varsettrue($v[$tableType]))
{ {
$ret .= "<tr><td class='forumheader3'>"; $ret .= "<tr><td$log>";
if ($v['optional'] == FALSE) $ret .= '*&nbsp;'; if ($v['optional'] == FALSE) $ret .= '*&nbsp;';
$ret .= $v['prompt'].':'; $ret .= $v['prompt'].':';
if (isset($v['help'])) if (isset($v['help']))
{ {
$ret .= "<br /><span class='smalltext'>".$v['help']."</span>"; $ret .= "<br /><span class='smalltext'>".$v['help']."</span>";
} }
$ret .= "</td><td class='forumheader3'>"; $ret .= "</td><td$log>";
// $fieldname = $tableType.'_'.$v['optname']; // $fieldname = $tableType.'_'.$v['optname'];
$fieldname = $tableType.'_xf_'.$f; // Name of the input box $fieldname = $tableType.'_xf_'.$f; // Name of the input box
$value = varset($v['default'],''); $value = varset($v['default'],'');
@@ -267,10 +267,11 @@ function alt_auth_get_db_fields($prefix, $frm, $parm, $fields = 'server|uname|pw
{ {
if (in_array($fn,$opts)) if (in_array($fn,$opts))
{ {
$ret .= "<tr><td class='forumheader3'>".$cf['prompt']; $ret .= "<tr><td$log>".$cf['prompt'];
if ($cf['help']) $ret .= "<br /><span class='smalltext'>".$cf['help']."</span>";
$ret .= "</td><td class='forumheader3'>"; $ret .= "</td><td$log>";
$ret .= $frm -> form_text($prefix.'_'.$cf['fieldname'], $cf['size'], $parm[$prefix.'_'.$cf['fieldname']], $cf['max_size']); $ret .= $frm -> form_text($prefix.'_'.$cf['fieldname'], $cf['size'], $parm[$prefix.'_'.$cf['fieldname']], $cf['max_size']);
if ($cf['help']) $ret .= "<br /><span class='field-help'>".$cf['help']."</span>";
$ret .= "</td></tr>\n"; $ret .= "</td></tr>\n";
} }
} }
@@ -376,7 +377,7 @@ function altAuthGetParams($prefix)
function alt_auth_test_form($prefix, $frm) function alt_auth_test_form($prefix, $frm)
{ {
$text = $frm -> form_open('post', e_SELF, 'testform'); $text = $frm -> form_open('post', e_SELF, 'testform');
$text .= "<table style='width:96%' class='fborder'> $text .= "<table class='table adminform'>
<tr><td colspan='2' class='forumheader2' style='text-align:center;'>".LAN_ALT_42."</td></tr>"; <tr><td colspan='2' class='forumheader2' style='text-align:center;'>".LAN_ALT_42."</td></tr>";
if (isset($_POST['testauth'])) if (isset($_POST['testauth']))
@@ -397,13 +398,13 @@ function alt_auth_test_form($prefix, $frm)
$log_result = $_login->login($val_name, $_POST['passtovalidate'], $pass_vars, ($val_name == '')); $log_result = $_login->login($val_name, $_POST['passtovalidate'], $pass_vars, ($val_name == ''));
} }
$text .= "<tr><td class='forumheader3'>".LAN_ALT_48; $text .= "<tr><td$log>".LAN_ALT_48;
if ($val_name) if ($val_name)
{ {
$text .= "<br />".LAN_ALT_49.$val_name.'<br />'.LAN_ALT_50; $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; if (varset($_POST['passtovalidate'],'')) $text .= str_repeat('*',strlen($_POST['passtovalidate'])); else $text .= LAN_ALT_51;
} }
$text .= "</td><td class='forumheader3'>"; $text .= "</td><td $log>";
switch ($log_result) switch ($log_result)
{ {
case AUTH_SUCCESS : case AUTH_SUCCESS :
@@ -439,16 +440,17 @@ function alt_auth_test_form($prefix, $frm)
$text .= "</td></tr>"; $text .= "</td></tr>";
} }
$text .= "<tr><td class='forumheader3'>".LAN_ALT_33."</td><td class='forumheader3'>"; $text .= "<tr><td $log>".LAN_ALT_33."</td><td $log>";
$text .= $frm->form_text('nametovalidate', 35, '', 120); $text .= $frm->form_text('nametovalidate', 35, '', 120);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LAN_ALT_34."</td><td class='forumheader3'>"; $text .= "<tr><td $log>".LAN_ALT_34."</td><td $log>";
$text .= $frm->form_password('passtovalidate', 35, '', 120); $text .= $frm->form_password('passtovalidate', 35, '', 120);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>"; $text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm->form_button("submit", 'testauth', LAN_ALT_47); // $text .= $frm->form_button("submit", 'testauth', LAN_ALT_47);
$text .= e107::getForm()->admin_button('testauth', LAN_ALT_47,'other');
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "</table>"; $text .= "</table>";

View File

@@ -35,6 +35,7 @@ if(!getperms('P') || !e107::isInstalled('alt_auth'))
exit(); exit();
} }
require_once(e_HANDLER.'form_handler.php'); require_once(e_HANDLER.'form_handler.php');
$frm = e107::getForm();
require_once(e_ADMIN.'auth.php'); require_once(e_ADMIN.'auth.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php'); include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define('ALT_AUTH_ACTION', 'main'); define('ALT_AUTH_ACTION', 'main');
@@ -113,7 +114,7 @@ if(isset($message))
$text = " $text = "
<div> <div>
<form method='post' action='".e_SELF."'> <form method='post' action='".e_SELF."'>
<table cellpadding='0' cellspacing='0' class='adminform'> <table class='table adminform'>
<colgroup span='2'> <colgroup span='2'>
<col class='col-label' /> <col class='col-label' />
<col class='col-control' /> <col class='col-control' />
@@ -159,13 +160,14 @@ $text .= "<option value='1' {$sel} >".LAN_ALT_FALLBACK."</option>
</tr> </tr>
</table> </table>
<div class='buttons-bar center'> <div class='buttons-bar center'>".
<input class='button' type='submit' name='updateprefs' value='".LAN_ALT_2."' /> $frm->admin_button('updateprefs',LAN_UPDATE,'update')."
</div> </div>
</form> </form>
</div>"; </div>";
$ns = e107::getRender();
e107::getRender()->tablerender(LAN_ALT_3, $text); $ns->tablerender(LAN_ALT_3, $text);
if ($euf->userCount) if ($euf->userCount)
@@ -201,7 +203,8 @@ if ($euf->userCount)
} }
$text .= "</tbody> $text .= "</tbody>
</table><div class='buttons-bar center'> </table><div class='buttons-bar center'>
<input class='button' type='submit' name='updateeufs' value='".LAN_ALT_2."' /> ".$frm->admin_button('updateeufs',LAN_UPDATE,'update')."
</div> </div>
</form> </form>

View File

@@ -54,19 +54,19 @@ function show_e107db_form()
$frm = new form; $frm = new form;
$text = $frm -> form_open('post', e_SELF); $text = $frm -> form_open('post', e_SELF);
$text .= "<table cellpadding='0' cellspacing='0' class='fborder'> $text .= "<table class='table adminform'>
<colgroup span='2'> <colgroup span='2'>
<col class='col-label' /> <col class='col-label' />
<col class='col-control' /> <col class='col-control' />
</colgroup>"; </colgroup>";
$text .= "<tr><td class='forumheader3'>".LAN_ALT_26."</td><td class='forumheader3'>"; $text .= "<tr><td>".LAN_ALT_26."</td><td>";
$text .= E107DB_LAN_1; $text .= E107DB_LAN_1;
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= alt_auth_get_db_fields('e107db', $frm, $parm, 'server|uname|pwd|db|prefix|classfilt'); $text .= alt_auth_get_db_fields('e107db', $frm, $parm, 'server|uname|pwd|db|prefix|classfilt');
$text .= "<tr><td class='forumheader3'>".E107DB_LAN_9."</td><td class='forumheader3'>"; $text .= "<tr><td>".E107DB_LAN_9."</td><td>";
$text .= altAuthGetPasswordSelector('e107db_password_method', $frm, $parm['e107db_password_method'], FALSE); $text .= altAuthGetPasswordSelector('e107db_password_method', $frm, $parm['e107db_password_method'], FALSE);
$text .= "</td></tr>"; $text .= "</td></tr>";
@@ -76,7 +76,8 @@ function show_e107db_form()
$text .= alt_auth_get_field_list('e107db',$frm, $parm, TRUE); $text .= alt_auth_get_field_list('e107db',$frm, $parm, TRUE);
$text .= "</table><div class='buttons-bar center'>"; $text .= "</table><div class='buttons-bar center'>";
$text .= $frm -> form_button("submit", "update", LAN_ALT_UPDATESET); $text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
// $text .= $frm -> form_button("submit", "update", LAN_ALT_UPDATESET);
$text .= '</div>'; $text .= '</div>';
$text .= $frm -> form_close(); $text .= $frm -> form_close();

View File

@@ -55,14 +55,14 @@ function show_importdb_form()
$frm = new form; $frm = new form;
$text = $frm -> form_open('post', e_SELF); $text = $frm -> form_open('post', e_SELF);
$text .= "<table cellpadding='0' cellspacing='0' class='adminform'> $text .= "<table class='table adminform'>
<colgroup span='2'> <colgroup span='2'>
<col class='col-label' /> <col class='col-label' />
<col class='col-control' /> <col class='col-control' />
</colgroup>"; </colgroup>";
$text .= "<tr><td colspan='2' class='forumheader3'>".IMPORTDB_LAN_11."</td></tr>"; $text .= "<tr><td colspan='2'>".IMPORTDB_LAN_11."</td></tr>";
$text .= "<tr><td>".IMPORTDB_LAN_9."</td><td>"; $text .= "<tr><td>".IMPORTDB_LAN_9."</td><td>";
$text .= altAuthGetPasswordSelector('importdb_password_method', $frm, $parm['importdb_password_method'], TRUE); $text .= altAuthGetPasswordSelector('importdb_password_method', $frm, $parm['importdb_password_method'], TRUE);
@@ -70,7 +70,7 @@ function show_importdb_form()
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "</table><div class='buttons-bar center'>"; $text .= "</table><div class='buttons-bar center'>";
$text .= $frm -> form_button("submit", "update", LAN_ALT_UPDATESET); $text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
$text .= "</div>"; $text .= "</div>";
$text .= $frm -> form_close(); $text .= $frm -> form_close();

View File

@@ -29,6 +29,7 @@ include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define('ALT_AUTH_ACTION', 'ldap'); define('ALT_AUTH_ACTION', 'ldap');
require_once(e_PLUGIN.'alt_auth/alt_auth_adminmenu.php'); require_once(e_PLUGIN.'alt_auth/alt_auth_adminmenu.php');
$mes = e107::getMessage();
$server_types[1] = 'LDAP'; $server_types[1] = 'LDAP';
$server_types[2] = 'ActiveDirectory'; $server_types[2] = 'ActiveDirectory';
@@ -46,7 +47,8 @@ if($_POST['update'])
if(!function_exists('ldap_connect')) if(!function_exists('ldap_connect'))
{ {
$message .= "<br /><br /><div style='color:#f00; font-weight:bold'>".LDAPLAN_11."</div><br />"; // $message .= "<br /><br /><div style='color:#f00; font-weight:bold'>".LDAPLAN_11."</div><br />";
$mes->addWarning(LDAPLAN_11);
} }
@@ -64,8 +66,8 @@ $current_filter = "(&(cn=[USERNAME]){$ldap['ldap_edirfilter']})";
$frm = new form; $frm = new form;
$text = $frm -> form_open('post',e_SELF); $text = $frm -> form_open('post',e_SELF);
$text .= "<table style='width:96%' class='fborder'>"; $text .= "<table class='table adminform'>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_12."</td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_12."</td><td>";
$text .= $frm -> form_select_open("ldap_servertype"); $text .= $frm -> form_select_open("ldap_servertype");
foreach($server_types as $v) foreach($server_types as $v)
{ {
@@ -75,25 +77,25 @@ foreach($server_types as $v)
$text .= $frm -> form_select_close(); $text .= $frm -> form_select_close();
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_1."</td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_1."</td><td>";
$text .= $frm -> form_text("ldap_server", 35, $ldap['ldap_server'], 120); $text .= $frm -> form_text("ldap_server", 35, $ldap['ldap_server'], 120);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_2."</td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_2."</td><td>";
$text .= $frm -> form_text("ldap_basedn", 35, $ldap['ldap_basedn'], 120); $text .= $frm -> form_text("ldap_basedn", 35, $ldap['ldap_basedn'], 120);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_14."</td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_14."</td><td>";
$text .= $frm -> form_text("ldap_ou", 35, $ldap['ldap_ou'], 60); $text .= $frm -> form_text("ldap_ou", 35, $ldap['ldap_ou'], 60);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_3."</td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_3."</td><td>";
$text .= $frm -> form_text("ldap_user", 35, $ldap['ldap_user'], 120); $text .= $frm -> form_text("ldap_user", 35, $ldap['ldap_user'], 120);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_4."</td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_4."</td><td>";
$text .= $frm -> form_text("ldap_passwd", 35, $ldap['ldap_passwd'], 120); $text .= $frm -> form_text("ldap_passwd", 35, $ldap['ldap_passwd'], 120);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_5."</td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_5."</td><td>";
$text .= $frm -> form_select_open("ldap_version"); $text .= $frm -> form_select_open("ldap_version");
foreach($ldap_ver as $v) foreach($ldap_ver as $v)
@@ -105,7 +107,7 @@ foreach($ldap_ver as $v)
$text .= $frm -> form_select_close(); $text .= $frm -> form_select_close();
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_7."<br /><span class='smalltext'>".LDAPLAN_8."</span></td><td class='forumheader3'>"; $text .= "<tr><td>".LDAPLAN_7."<br /><span class='smalltext'>".LDAPLAN_8."</span></td><td>";
$text .= $frm -> form_text('ldap_edirfilter', 35, $ldap['ldap_edirfilter'], 120); $text .= $frm -> form_text('ldap_edirfilter', 35, $ldap['ldap_edirfilter'], 120);
$text .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />".htmlentities($current_filter)."</span></td></tr>"; $text .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />".htmlentities($current_filter)."</span></td></tr>";
@@ -115,13 +117,15 @@ $text .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />".htmlentities($curre
$text .= alt_auth_get_field_list('ldap',$frm, $ldap, FALSE); $text .= alt_auth_get_field_list('ldap',$frm, $ldap, FALSE);
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>"; $text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button('submit', 'update', LDAPLAN_13);
$text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
//$text .= $frm -> form_button('submit', 'update', LDAPLAN_13);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "</table>\n"; $text .= "</table>\n";
$text .= $frm -> form_close(); $text .= $frm -> form_close();
e107::getRender()->tablerender(LDAPLAN_6,$text); e107::getRender()->tablerender(LDAPLAN_6, $mes->render(). $text);
e107::getRender()->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('ldap',$frm)); e107::getRender()->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('ldap',$frm));
require_once(e_ADMIN.'footer.php'); require_once(e_ADMIN.'footer.php');

View File

@@ -54,14 +54,14 @@ function show_otherdb_form()
$frm = new form; $frm = new form;
$text = $frm -> form_open("post", e_SELF); $text = $frm -> form_open("post", e_SELF);
$text .= "<table style='width:96%' class='fborder'>"; $text .= "<table class='table adminform'>";
$text .= "<tr><td class='forumheader3'>".LAN_ALT_26."</td><td class='forumheader3'>"; $text .= "<tr><td>".LAN_ALT_26."</td><td>";
$text .= OTHERDB_LAN_15; $text .= OTHERDB_LAN_15;
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= alt_auth_get_db_fields('otherdb', $frm, $parm, 'server|uname|pwd|db|table|ufield|pwfield|salt'); $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 .= "<tr><td>".OTHERDB_LAN_9."</td><td>";
$text .= altAuthGetPasswordSelector('otherdb_password_method', $frm, $parm['otherdb_password_method'], TRUE); $text .= altAuthGetPasswordSelector('otherdb_password_method', $frm, $parm['otherdb_password_method'], TRUE);
@@ -72,7 +72,7 @@ function show_otherdb_form()
$text .= alt_auth_get_field_list('otherdb',$frm, $parm, FALSE); $text .= alt_auth_get_field_list('otherdb',$frm, $parm, FALSE);
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>"; $text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button('submit', 'update', LAN_ALT_UPDATESET); $text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
$text .= '</td></tr>'; $text .= '</td></tr>';
$text .= '</table>'; $text .= '</table>';

View File

@@ -24,17 +24,20 @@ include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_radius_conf.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php'); include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define("ALT_AUTH_ACTION", "radius"); define("ALT_AUTH_ACTION", "radius");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php"); require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
$mes = e107::getMessage();
$message = ''; $message = '';
if($_POST['update']) if($_POST['update'])
{ {
$message .= alt_auth_post_options('radius'); // $message .= alt_auth_post_options('radius');
$mes->addSuccess(alt_auth_post_options('radius'));
} }
if (!extension_loaded('radius')) if (!extension_loaded('radius'))
{ {
$message .= "<br /><br /><div style='color:#f00; font-weight:bold'>".LAN_RADIUS_11."</div><br />"; // $message .= "<br /><br /><div style='color:#f00; font-weight:bold'>".LAN_RADIUS_11."</div><br />";
$mes->addWarning(LAN_RADIUS_11);
} }
@@ -53,12 +56,12 @@ while($row = $sql->db_Fetch())
$frm = new form; $frm = new form;
$text = $frm -> form_open("post",e_SELF); $text = $frm -> form_open("post",e_SELF);
$text .= "<table style='width:96%' class='fborder'>"; $text .= "<table class='table adminform'>";
$text .= "<tr><td class='forumheader3'>".LAN_RADIUS_01."</td><td class='forumheader3'>"; $text .= "<tr><td>".LAN_RADIUS_01."</td><td>";
$text .= $frm -> form_text("radius_server", 35, $radius['radius_server'], 120); $text .= $frm -> form_text("radius_server", 35, $radius['radius_server'], 120);
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "<tr><td class='forumheader3'>".LAN_RADIUS_02."</td><td class='forumheader3'>"; $text .= "<tr><td>".LAN_RADIUS_02."</td><td>";
$text .= $frm -> form_text('radius_secret', 35, $radius['radius_secret'], 200); $text .= $frm -> form_text('radius_secret', 35, $radius['radius_secret'], 200);
$text .= "</td></tr>"; $text .= "</td></tr>";
@@ -70,13 +73,14 @@ if ($tmp)
} }
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>"; $text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
$text .= $frm -> form_button("submit", "update", LAN_ALT_2); // $text .= $frm -> form_button("submit", "update", LAN_ALT_2);
$text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
$text .= "</td></tr>"; $text .= "</td></tr>";
$text .= "</table>"; $text .= "</table>";
$text .= $frm -> form_close(); $text .= $frm -> form_close();
$ns -> tablerender(LAN_RADIUS_06,$text); $ns -> tablerender(LAN_RADIUS_06, $mes->render() . $text);
$ns->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('radius',$frm)); $ns->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('radius',$frm));
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");