1
0
mirror of https://github.com/e107inc/e107.git synced 2025-02-06 23:39:11 +01:00

140 lines
3.9 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* LDAP configuration for alt_auth plugin
*
* $URL$
* $Id$
*/
/**
* e107 Alternate authorisation plugin
*
* @package e107_plugins
* @subpackage alt_auth
* @version $Id$;
*/
2006-12-02 04:36:16 +00:00
$eplug_admin = true;
require_once('../../class2.php');
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_ldap_conf.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define('ALT_AUTH_ACTION', 'ldap');
require_once(e_PLUGIN.'alt_auth/alt_auth_adminmenu.php');
2006-12-02 04:36:16 +00:00
2012-11-28 01:26:18 -08:00
$mes = e107::getMessage();
2006-12-02 04:36:16 +00:00
$server_types[1] = 'LDAP';
$server_types[2] = 'ActiveDirectory';
$server_types[3] = 'eDirectory';
2006-12-02 04:36:16 +00:00
$ldap_ver[1]='2';
$ldap_ver[2]='3';
2006-12-02 04:36:16 +00:00
$message = '';
2012-12-16 12:28:28 +01:00
if(vartrue($_POST['update']))
2006-12-02 04:36:16 +00:00
{
$message .= alt_auth_post_options('ldap');
2006-12-02 04:36:16 +00:00
}
2006-12-02 04:36:16 +00:00
if(!function_exists('ldap_connect'))
{
2012-11-28 01:26:18 -08:00
// $message .= "<br /><br /><div style='color:#f00; font-weight:bold'>".LDAPLAN_11."</div><br />";
$mes->addWarning(LDAPLAN_11);
2006-12-02 04:36:16 +00:00
}
2006-12-02 04:36:16 +00:00
if($message)
{
e107::getRender()->tablerender('',"<div style='text-align:center;'>".$message.'</div>');
2006-12-02 04:36:16 +00:00
}
$ldap = altAuthGetParams('ldap');
if (!isset($ldap['ldap_edirfilter'])) $ldap['ldap_edirfilter'] == '';
2008-12-23 20:31:30 +00:00
//print_a($ldap);
2006-12-02 04:36:16 +00:00
$current_filter = "(&(cn=[USERNAME]){$ldap['ldap_edirfilter']})";
$frm = new form;
$text = $frm -> form_open('post',e_SELF);
2012-11-28 01:26:18 -08:00
$text .= "<table class='table adminform'>";
$text .= "<tr><td>".LDAPLAN_12."</td><td>";
2006-12-02 04:36:16 +00:00
$text .= $frm -> form_select_open("ldap_servertype");
foreach($server_types as $v)
{
2012-12-16 12:28:28 +01:00
$sel = (vartrue($ldap['ldap_servertype']) == $v) ? " Selected='selected'" : '';
2006-12-02 04:36:16 +00:00
$text .= $frm -> form_option($v, $sel, $v);
}
$text .= $frm -> form_select_close();
$text .= "</td></tr>";
2012-11-28 01:26:18 -08:00
$text .= "<tr><td>".LDAPLAN_1."</td><td>";
2012-12-16 12:28:28 +01:00
$text .= $frm -> form_text("ldap_server", 35, vartrue($ldap['ldap_server']), 120);
2006-12-02 04:36:16 +00:00
$text .= "</td></tr>";
2012-11-28 01:26:18 -08:00
$text .= "<tr><td>".LDAPLAN_2."</td><td>";
2012-12-16 12:28:28 +01:00
$text .= $frm -> form_text("ldap_basedn", 35, vartrue($ldap['ldap_basedn']), 120);
2006-12-02 04:36:16 +00:00
$text .= "</td></tr>";
2012-11-28 01:26:18 -08:00
$text .= "<tr><td>".LDAPLAN_14."</td><td>";
2012-12-16 12:28:28 +01:00
$text .= $frm -> form_text("ldap_ou", 35, vartrue($ldap['ldap_ou']), 60);
$text .= "</td></tr>";
2006-12-02 04:36:16 +00:00
2012-11-28 01:26:18 -08:00
$text .= "<tr><td>".LDAPLAN_3."</td><td>";
2012-12-16 12:28:28 +01:00
$text .= $frm -> form_text("ldap_user", 35, vartrue($ldap['ldap_user']), 120);
2006-12-02 04:36:16 +00:00
$text .= "</td></tr>";
2012-11-28 01:26:18 -08:00
$text .= "<tr><td>".LDAPLAN_4."</td><td>";
2012-12-16 12:28:28 +01:00
$text .= $frm -> form_text("ldap_passwd", 35, vartrue($ldap['ldap_passwd']), 120);
2006-12-02 04:36:16 +00:00
$text .= "</td></tr>";
2012-11-28 01:26:18 -08:00
$text .= "<tr><td>".LDAPLAN_5."</td><td>";
2006-12-02 04:36:16 +00:00
$text .= $frm -> form_select_open("ldap_version");
foreach($ldap_ver as $v)
{
$sel = ($ldap['ldap_version'] == $v) ? " Selected='selected'" : "";
2006-12-02 04:36:16 +00:00
$text .= $frm -> form_option($v, $sel, $v);
}
$text .= $frm -> form_select_close();
$text .= "</td></tr>";
2012-11-28 01:26:18 -08:00
$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 .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />".htmlentities($current_filter)."</span></td></tr>";
$text .= "<tr><td class='forumheader2' colspan='2'>".LAN_ALT_27."</td></tr>";
add_extended_fields();
$text .= alt_auth_get_field_list('ldap',$frm, $ldap, FALSE);
2006-12-02 04:36:16 +00:00
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
2012-11-28 01:26:18 -08:00
$text .= e107::getForm()->admin_button("update", LAN_UPDATE,'update');
//$text .= $frm -> form_button('submit', 'update', LDAPLAN_13);
2006-12-02 04:36:16 +00:00
$text .= "</td></tr>";
$text .= "</table>\n";
2006-12-02 04:36:16 +00:00
$text .= $frm -> form_close();
2012-11-28 01:26:18 -08:00
e107::getRender()->tablerender(LDAPLAN_6, $mes->render(). $text);
e107::getRender()->tablerender(LAN_ALT_40.LAN_ALT_41,alt_auth_test_form('ldap',$frm));
require_once(e_ADMIN.'footer.php');
2006-12-02 04:36:16 +00:00
function ldap_conf_adminmenu()
{
alt_auth_adminmenu();
}
?>