mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-24 14:11:29 +01:00
Fix calls to common, and set $phpgw_info vars as needed to make ldap connection work
This commit is contained in:
parent
cdbe460eea
commit
7f98c8abff
@ -28,7 +28,13 @@
|
|||||||
}
|
}
|
||||||
// Does not return unless user is authorized
|
// Does not return unless user is authorized
|
||||||
|
|
||||||
$common = CreateObject("phpgwapi.common");
|
class phpgw {
|
||||||
|
var $common;
|
||||||
|
}
|
||||||
|
$phpgw = new phpgw;
|
||||||
|
$phpgw->common = CreateObject("phpgwapi.common");
|
||||||
|
|
||||||
|
$common = $phpgw->common;
|
||||||
$phpgw_setup->loaddb();
|
$phpgw_setup->loaddb();
|
||||||
|
|
||||||
$phpgw_info["server"]["auth_type"] = "ldap";
|
$phpgw_info["server"]["auth_type"] = "ldap";
|
||||||
@ -39,20 +45,19 @@
|
|||||||
while ($phpgw_setup->db->next_record()) {
|
while ($phpgw_setup->db->next_record()) {
|
||||||
$config[$phpgw_setup->db->f("config_name")] = $phpgw_setup->db->f("config_value");
|
$config[$phpgw_setup->db->f("config_name")] = $phpgw_setup->db->f("config_value");
|
||||||
}
|
}
|
||||||
|
$phpgw_info["server"]["ldap_host"] = $config["ldap_host"];
|
||||||
|
$phpgw_info["server"]["ldap_context"] = $config["ldap_context"];
|
||||||
|
$phpgw_info["server"]["ldap_root_dn"] = $config["ldap_root_dn"];
|
||||||
|
$phpgw_info["server"]["ldap_root_pw"] = $config["ldap_root_pw"];
|
||||||
|
|
||||||
// First, see if we can connect to the LDAP server, if not send `em back to config.php with an
|
// First, see if we can connect to the LDAP server, if not send `em back to config.php with an
|
||||||
// error message.
|
// error message.
|
||||||
|
|
||||||
// connect to ldap server
|
// connect to ldap server
|
||||||
if (! $ldap = @ldap_connect($config["ldap_host"])) {
|
if (! $ldap = $common->ldapConnect()) {
|
||||||
$noldapconnection = True;
|
$noldapconnection = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bind as admin, we not to able to do everything
|
|
||||||
if (! @ldap_bind($ldap,$config["ldap_root_dn"],$config["ldap_root_pw"])) {
|
|
||||||
$noldapconnection = True;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($noldapconnection) {
|
if ($noldapconnection) {
|
||||||
Header("Location: config.php?error=badldapconnection");
|
Header("Location: config.php?error=badldapconnection");
|
||||||
exit;
|
exit;
|
||||||
@ -87,7 +92,7 @@
|
|||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
// Create the 'Default' group
|
// Create the 'Default' group
|
||||||
$defaultgroupid = mt_rand (100, 600000);
|
$defaultgroupid = mt_rand (100, 65535);
|
||||||
|
|
||||||
$acct = CreateObject('phpgwapi.accounts',$defaultgroupid);
|
$acct = CreateObject('phpgwapi.accounts',$defaultgroupid);
|
||||||
$acct->db = $phpgw_setup->db;
|
$acct->db = $phpgw_setup->db;
|
||||||
|
Loading…
Reference in New Issue
Block a user