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

Issue #84 - review/tidy up alt_auth plugin.

Further testing needed.
This commit is contained in:
SteveD
2013-01-21 22:08:48 +00:00
parent 25da842c5e
commit 5457247787
14 changed files with 2599 additions and 2489 deletions

View File

@@ -3,7 +3,7 @@
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Copyright (C) 2008-2009 e107 Inc (e107.org)
| Copyright (C) 2008-2013 e107 Inc (e107.org)
| http://e107.org
|
|
@@ -26,11 +26,64 @@ define("ALT_AUTH_ACTION", "radius");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
$mes = e107::getMessage();
class alt_auth_radius extends alt_auth_admin
{
private $radius;
public function __construct()
{
}
public function readOptions()
{
$this->radius = $this->altAuthGetParams('radius');
}
public function showForm($mes)
{
$ns = e107::getRender();
$frm = new form;
$text = $frm->form_open('post',e_SELF);
$text .= "<table class='table adminform'>";
$text .= "<tr><td>".LAN_RADIUS_01."</td><td>";
$text .= $frm->form_text('radius_server', 35, vartrue($this->radius['radius_server']), 120);
$text .= "</td></tr>\n";
$text .= "<tr><td>".LAN_RADIUS_02."</td><td>";
$text .= $frm->form_text('radius_secret', 35, vartrue($this->radius['radius_secret']), 200);
$text .= "</td></tr>\n";
$tmp = $this->alt_auth_get_field_list('radius', $frm, $this->radius, FALSE);
if ($tmp)
{
$text .= "<tr><td class='forumheader2' colspan='2'>".LAN_ALT_27."</td></tr>\n".$tmp;
unset($tmp);
}
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
// $text .= $frm -> form_button("submit", "update", LAN_ALT_2);
$text .= e107::getForm()->admin_button('update', LAN_UPDATE,'update');
$text .= "</td></tr>\n";
$text .= "</table>\n";
$text .= $frm->form_close();
$ns->tablerender(LAN_RADIUS_06, $mes->render().$text);
$ns->tablerender(LAN_ALT_40.LAN_ALT_41, $this->alt_auth_test_form('radius',$frm));
}
}
$message = '';
$radiusAdmin = new alt_auth_radius();
if(vartrue($_POST['update']))
{
// $message .= alt_auth_post_options('radius');
$mes->addSuccess(alt_auth_post_options('radius'));
$mes->addSuccess($radiusAdmin->alt_auth_post_options('radius'));
}
@@ -43,47 +96,15 @@ if (!extension_loaded('radius'))
if($message)
{
$ns->tablerender("","<div style='text-align:center;'>".$message."</div>");
$ns->tablerender('',"<div style='text-align:center;'>".$message."</div>");
}
$sql -> db_Select("alt_auth", "*", "auth_type = 'radius' ");
while($row = $sql->db_Fetch())
{
$radius[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval'])); // Encoding is new for 0.8
}
$radiusAdmin->readOptions();
$radiusAdmin->showForm($mes);
$frm = new form;
$text = $frm -> form_open("post",e_SELF);
$text .= "<table class='table adminform'>";
$text .= "<tr><td>".LAN_RADIUS_01."</td><td>";
$text .= $frm -> form_text("radius_server", 35, vartrue($radius['radius_server']), 120);
$text .= "</td></tr>";
$text .= "<tr><td>".LAN_RADIUS_02."</td><td>";
$text .= $frm -> form_text('radius_secret', 35, vartrue($radius['radius_secret']), 200);
$text .= "</td></tr>";
$tmp = alt_auth_get_field_list('radius',$frm, vartrue($ldap), FALSE);
if ($tmp)
{
$text .= "<tr><td class='forumheader2' colspan='2'>".LAN_ALT_27."</td></tr>".$tmp;
unset($tmp);
}
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
// $text .= $frm -> form_button("submit", "update", LAN_ALT_2);
$text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
$text .= "</td></tr>";
$text .= "</table>";
$text .= $frm -> form_close();
$ns -> tablerender(LAN_RADIUS_06, $mes->render() . $text);
$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');
function radius_conf_adminmenu()