crlf 2 lf whitespace fixes
This commit is contained in:
parent
0d39ad1169
commit
ccfec5606d
|
@ -0,0 +1,6 @@
|
|||
* text eol=lf
|
||||
|
||||
*.png binary
|
||||
*.gif binary
|
||||
*.ico binary
|
||||
*.xcf binary
|
|
@ -18,12 +18,12 @@ class common_infofunctions_test extends DokuWikiTest {
|
|||
|
||||
function _get_info() {
|
||||
global $USERINFO;
|
||||
$info = array (
|
||||
'isadmin' => true,
|
||||
$info = array (
|
||||
'isadmin' => true,
|
||||
'ismanager' => true,
|
||||
'userinfo' => $USERINFO,
|
||||
'perm' => 255,
|
||||
'namespace' => false,
|
||||
'userinfo' => $USERINFO,
|
||||
'perm' => 255,
|
||||
'namespace' => false,
|
||||
'ismobile' => false,
|
||||
'client' => 'testuser',
|
||||
);
|
||||
|
|
|
@ -18,12 +18,12 @@ class common_basicinfo_test extends DokuWikiTest {
|
|||
|
||||
function _get_info() {
|
||||
global $USERINFO;
|
||||
$info = array (
|
||||
'isadmin' => true,
|
||||
$info = array (
|
||||
'isadmin' => true,
|
||||
'ismanager' => true,
|
||||
'userinfo' => $USERINFO,
|
||||
'perm' => 255,
|
||||
'namespace' => false,
|
||||
'userinfo' => $USERINFO,
|
||||
'perm' => 255,
|
||||
'namespace' => false,
|
||||
'ismobile' => false,
|
||||
'client' => 'testuser',
|
||||
);
|
||||
|
|
|
@ -31,18 +31,18 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
'ismobile' => false,
|
||||
'client' => 'testuser',
|
||||
);
|
||||
$info['rev'] = null;
|
||||
$info['subscribed'] = false;
|
||||
$info['locked'] = false;
|
||||
$info['exists'] = false;
|
||||
$info['writable'] = true;
|
||||
$info['editable'] = true;
|
||||
$info['lastmod'] = false;
|
||||
$info['meta'] = array();
|
||||
$info['ip'] = null;
|
||||
$info['user'] = null;
|
||||
$info['sum'] = null;
|
||||
$info['editor'] = null;
|
||||
$info['rev'] = null;
|
||||
$info['subscribed'] = false;
|
||||
$info['locked'] = false;
|
||||
$info['exists'] = false;
|
||||
$info['writable'] = true;
|
||||
$info['editable'] = true;
|
||||
$info['lastmod'] = false;
|
||||
$info['meta'] = array();
|
||||
$info['ip'] = null;
|
||||
$info['user'] = null;
|
||||
$info['sum'] = null;
|
||||
$info['editor'] = null;
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
@ -72,15 +72,15 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
$rev = filemtime($filename);
|
||||
|
||||
$info = $this->_get_expected_pageinfo();
|
||||
$info['id'] = 'wiki:syntax';
|
||||
$info['id'] = 'wiki:syntax';
|
||||
$info['namespace'] = 'wiki';
|
||||
$info['filepath'] = $filename;
|
||||
$info['exists'] = true;
|
||||
$info['lastmod'] = $rev;
|
||||
$info['meta'] = p_get_metadata($ID);
|
||||
$info['exists'] = true;
|
||||
$info['lastmod'] = $rev;
|
||||
$info['meta'] = p_get_metadata($ID);
|
||||
|
||||
$this->assertEquals($info, pageinfo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check info keys and values for anonymous user
|
||||
|
@ -88,8 +88,8 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
function test_anonymoususer(){
|
||||
global $ID,$conf,$REV;
|
||||
|
||||
unset($_SERVER['REMOTE_USER']);
|
||||
global $USERINFO; $USERINFO = array();
|
||||
unset($_SERVER['REMOTE_USER']);
|
||||
global $USERINFO; $USERINFO = array();
|
||||
|
||||
$ID = 'wiki:syntax';
|
||||
$filename = $conf['datadir'].'/wiki/syntax.txt';
|
||||
|
@ -104,15 +104,15 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
$info['meta'] = p_get_metadata($ID);
|
||||
$info['rev'] = '';
|
||||
|
||||
$info = array_merge($info, array(
|
||||
'isadmin' => false,
|
||||
'ismanager' => false,
|
||||
'perm' => 8,
|
||||
'client' => '1.2.3.4',
|
||||
$info = array_merge($info, array(
|
||||
'isadmin' => false,
|
||||
'ismanager' => false,
|
||||
'perm' => 8,
|
||||
'client' => '1.2.3.4',
|
||||
));
|
||||
unset($info['userinfo']);
|
||||
$this->assertEquals($info, pageinfo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check info keys and values with $REV
|
||||
|
@ -135,7 +135,7 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
|
||||
$this->assertEquals($info, pageinfo());
|
||||
$this->assertEquals($rev-100, $REV);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check info keys and values with $RANGE
|
||||
|
@ -146,7 +146,7 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
$ID = 'wiki:syntax';
|
||||
$filename = $conf['datadir'].'/wiki/syntax.txt';
|
||||
$rev = filemtime($filename);
|
||||
$range = '1000-2000';
|
||||
$range = '1000-2000';
|
||||
|
||||
$info = $this->_get_expected_pageinfo();
|
||||
$info['id'] = 'wiki:syntax';
|
||||
|
@ -160,18 +160,18 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
// expected result $RANGE unchanged
|
||||
$RANGE = $range;
|
||||
|
||||
$this->assertEquals($info, pageinfo());
|
||||
$this->assertEquals($info, pageinfo());
|
||||
$this->assertFalse(isset($REV));
|
||||
$this->assertEquals($range,$RANGE);
|
||||
$this->assertEquals($range,$RANGE);
|
||||
|
||||
// check $RANGE with $REV = current
|
||||
// expected result: $RANGE unchanged, $REV cleared
|
||||
$REV = $rev;
|
||||
$info['rev'] = '';
|
||||
$info['rev'] = '';
|
||||
|
||||
$this->assertEquals($info, pageinfo());
|
||||
$this->assertEquals($info, pageinfo());
|
||||
$this->assertEquals('',$REV);
|
||||
$this->assertEquals($range,$RANGE);
|
||||
$this->assertEquals($range,$RANGE);
|
||||
|
||||
// check with a real $REV
|
||||
// expected result: $REV and $RANGE are cleared
|
||||
|
@ -218,7 +218,7 @@ class common_pageinfo_test extends DokuWikiTest {
|
|||
p_set_metadata($ID,array('last_change' => false));
|
||||
|
||||
$this->assertEquals($info, pageinfo());
|
||||
$this->assertEquals($info['meta']['last_change'], p_get_metadata($ID,'last_change'));
|
||||
$this->assertEquals($info['meta']['last_change'], p_get_metadata($ID,'last_change'));
|
||||
|
||||
// fake an external edit, pageinfo should clear the last change from meta data
|
||||
// and not return any editor data
|
||||
|
|
|
@ -123,11 +123,11 @@ class InttestsBasicTest extends DokuWikiTest {
|
|||
$request = new TestRequest();
|
||||
|
||||
// doku
|
||||
$response = $request->get();
|
||||
$this->assertEquals('doku.php',$request->getScript());
|
||||
$response = $request->get();
|
||||
$this->assertEquals('doku.php',$request->getScript());
|
||||
|
||||
$response = $request->get(array(),'/doku.php?id=wiki:dokuwiki&test=foo');
|
||||
$this->assertEquals('doku.php',$request->getScript());
|
||||
$response = $request->get(array(),'/doku.php?id=wiki:dokuwiki&test=foo');
|
||||
$this->assertEquals('doku.php',$request->getScript());
|
||||
|
||||
// fetch
|
||||
$response = $request->get(array(),'/lib/exe/fetch.php?media=wiki:dokuwiki-128.png');
|
||||
|
@ -149,8 +149,8 @@ class InttestsBasicTest extends DokuWikiTest {
|
|||
|
||||
$request = new TestRequest();
|
||||
$response = $request->get(array(),'/lib/exe/fetch.php?media=wiki:dokuwiki-128.png');
|
||||
$headers = $response->getHeaders();
|
||||
$this->assertTrue(!empty($headers));
|
||||
$headers = $response->getHeaders();
|
||||
$this->assertTrue(!empty($headers));
|
||||
}
|
||||
|
||||
function testGetHeader(){
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,153 +1,153 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Computers
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
require_once(dirname(__FILE__) . '/../collections/adLDAPComputerCollection.php');
|
||||
|
||||
/**
|
||||
* COMPUTER MANAGEMENT FUNCTIONS
|
||||
*/
|
||||
class adLDAPComputers {
|
||||
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about a specific computer. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param array $fields Attributes to return
|
||||
* @return array
|
||||
*/
|
||||
public function info($computerName, $fields = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$filter = "(&(objectClass=computer)(cn=" . $computerName . "))";
|
||||
if ($fields === NULL) {
|
||||
$fields = array("memberof","cn","displayname","dnshostname","distinguishedname","objectcategory","operatingsystem","operatingsystemservicepack","operatingsystemversion");
|
||||
}
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
|
||||
$entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find information about the computers. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param array $fields Array of parameters to query
|
||||
* @return mixed
|
||||
*/
|
||||
public function infoCollection($computerName, $fields = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$info = $this->info($computerName, $fields);
|
||||
|
||||
if ($info !== false) {
|
||||
$collection = new adLDAPComputerCollection($info, $this->adldap);
|
||||
return $collection;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a computer is in a group
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param string $group The group to check
|
||||
* @param bool $recursive Whether to check recursively
|
||||
* @return array
|
||||
*/
|
||||
public function inGroup($computerName, $group, $recursive = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if ($group === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } // use the default option if they haven't set it
|
||||
|
||||
//get a list of the groups
|
||||
$groups = $this->groups($computerName, array("memberof"), $recursive);
|
||||
|
||||
//return true if the specified group is in the group list
|
||||
if (in_array($group, $groups)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the groups a computer is in
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param bool $recursive Whether to check recursively
|
||||
* @return array
|
||||
*/
|
||||
public function groups($computerName, $recursive = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
|
||||
//search the directory for their information
|
||||
$info = @$this->info($computerName, array("memberof", "primarygroupid"));
|
||||
$groups = $this->adldap->utilities()->niceNames($info[0]["memberof"]); //presuming the entry returned is our guy (unique usernames)
|
||||
|
||||
if ($recursive === true) {
|
||||
foreach ($groups as $id => $groupName){
|
||||
$extraGroups = $this->adldap->group()->recursiveGroups($groupName);
|
||||
$groups = array_merge($groups, $extraGroups);
|
||||
}
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Computers
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
require_once(dirname(__FILE__) . '/../collections/adLDAPComputerCollection.php');
|
||||
|
||||
/**
|
||||
* COMPUTER MANAGEMENT FUNCTIONS
|
||||
*/
|
||||
class adLDAPComputers {
|
||||
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about a specific computer. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param array $fields Attributes to return
|
||||
* @return array
|
||||
*/
|
||||
public function info($computerName, $fields = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$filter = "(&(objectClass=computer)(cn=" . $computerName . "))";
|
||||
if ($fields === NULL) {
|
||||
$fields = array("memberof","cn","displayname","dnshostname","distinguishedname","objectcategory","operatingsystem","operatingsystemservicepack","operatingsystemversion");
|
||||
}
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
|
||||
$entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find information about the computers. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param array $fields Array of parameters to query
|
||||
* @return mixed
|
||||
*/
|
||||
public function infoCollection($computerName, $fields = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$info = $this->info($computerName, $fields);
|
||||
|
||||
if ($info !== false) {
|
||||
$collection = new adLDAPComputerCollection($info, $this->adldap);
|
||||
return $collection;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a computer is in a group
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param string $group The group to check
|
||||
* @param bool $recursive Whether to check recursively
|
||||
* @return array
|
||||
*/
|
||||
public function inGroup($computerName, $group, $recursive = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if ($group === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } // use the default option if they haven't set it
|
||||
|
||||
//get a list of the groups
|
||||
$groups = $this->groups($computerName, array("memberof"), $recursive);
|
||||
|
||||
//return true if the specified group is in the group list
|
||||
if (in_array($group, $groups)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the groups a computer is in
|
||||
*
|
||||
* @param string $computerName The name of the computer
|
||||
* @param bool $recursive Whether to check recursively
|
||||
* @return array
|
||||
*/
|
||||
public function groups($computerName, $recursive = NULL)
|
||||
{
|
||||
if ($computerName === NULL) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
|
||||
//search the directory for their information
|
||||
$info = @$this->info($computerName, array("memberof", "primarygroupid"));
|
||||
$groups = $this->adldap->utilities()->niceNames($info[0]["memberof"]); //presuming the entry returned is our guy (unique usernames)
|
||||
|
||||
if ($recursive === true) {
|
||||
foreach ($groups as $id => $groupName){
|
||||
$extraGroups = $this->adldap->group()->recursiveGroups($groupName);
|
||||
$groups = array_merge($groups, $extraGroups);
|
||||
}
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,294 +1,294 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Contacts
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
require_once(dirname(__FILE__) . '/../collections/adLDAPContactCollection.php');
|
||||
|
||||
class adLDAPContacts {
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
//*****************************************************************************************************************
|
||||
// CONTACT FUNCTIONS
|
||||
// * Still work to do in this area, and new functions to write
|
||||
|
||||
/**
|
||||
* Create a contact
|
||||
*
|
||||
* @param array $attributes The attributes to set to the contact
|
||||
* @return bool
|
||||
*/
|
||||
public function create($attributes)
|
||||
{
|
||||
// Check for compulsory fields
|
||||
if (!array_key_exists("display_name", $attributes)) { return "Missing compulsory field [display_name]"; }
|
||||
if (!array_key_exists("email", $attributes)) { return "Missing compulsory field [email]"; }
|
||||
if (!array_key_exists("container", $attributes)) { return "Missing compulsory field [container]"; }
|
||||
if (!is_array($attributes["container"])) { return "Container attribute must be an array."; }
|
||||
|
||||
// Translate the schema
|
||||
$add = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
// Additional stuff only used for adding contacts
|
||||
$add["cn"][0] = $attributes["display_name"];
|
||||
$add["objectclass"][0] = "top";
|
||||
$add["objectclass"][1] = "person";
|
||||
$add["objectclass"][2] = "organizationalPerson";
|
||||
$add["objectclass"][3] = "contact";
|
||||
if (!isset($attributes['exchange_hidefromlists'])) {
|
||||
$add["msExchHideFromAddressLists"][0] = "TRUE";
|
||||
}
|
||||
|
||||
// Determine the container
|
||||
$attributes["container"] = array_reverse($attributes["container"]);
|
||||
$container= "OU=" . implode(",OU=", $attributes["container"]);
|
||||
|
||||
// Add the entry
|
||||
$result = @ldap_add($this->adldap->getLdapConnection(), "CN=" . $this->adldap->utilities()->escapeCharacters($add["cn"][0]) . ", " . $container . "," . $this->adldap->getBaseDn(), $add);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the list of groups a contact is a member of
|
||||
*
|
||||
* @param string $distinguisedname The full DN of a contact
|
||||
* @param bool $recursive Recursively check groups
|
||||
* @return array
|
||||
*/
|
||||
public function groups($distinguishedName, $recursive = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
|
||||
// Search the directory for their information
|
||||
$info = @$this->info($distinguishedName, array("memberof", "primarygroupid"));
|
||||
$groups = $this->adldap->utilities()->niceNames($info[0]["memberof"]); //presuming the entry returned is our contact
|
||||
|
||||
if ($recursive === true){
|
||||
foreach ($groups as $id => $groupName){
|
||||
$extraGroups = $this->adldap->group()->recursiveGroups($groupName);
|
||||
$groups = array_merge($groups, $extraGroups);
|
||||
}
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contact information. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $distinguisedname The full DN of a contact
|
||||
* @param array $fields Attributes to be returned
|
||||
* @return array
|
||||
*/
|
||||
public function info($distinguishedName, $fields = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$filter = "distinguishedName=" . $distinguishedName;
|
||||
if ($fields === NULL) {
|
||||
$fields = array("distinguishedname", "mail", "memberof", "department", "displayname", "telephonenumber", "primarygroupid", "objectsid");
|
||||
}
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
|
||||
$entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
if ($entries[0]['count'] >= 1) {
|
||||
// AD does not return the primary group in the ldap query, we may need to fudge it
|
||||
if ($this->adldap->getRealPrimaryGroup() && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["primarygroupid"][0])){
|
||||
//$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
|
||||
$entries[0]["memberof"][] = $this->adldap->group()->getPrimaryGroup($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
|
||||
} else {
|
||||
$entries[0]["memberof"][] = "CN=Domain Users,CN=Users," . $this->adldap->getBaseDn();
|
||||
}
|
||||
}
|
||||
|
||||
$entries[0]["memberof"]["count"]++;
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find information about the contacts. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $distinguishedName The full DN of a contact
|
||||
* @param array $fields Array of parameters to query
|
||||
* @return mixed
|
||||
*/
|
||||
public function infoCollection($distinguishedName, $fields = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$info = $this->info($distinguishedName, $fields);
|
||||
|
||||
if ($info !== false) {
|
||||
$collection = new adLDAPContactCollection($info, $this->adldap);
|
||||
return $collection;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a contact is a member of a group
|
||||
*
|
||||
* @param string $distinguisedName The full DN of a contact
|
||||
* @param string $group The group name to query
|
||||
* @param bool $recursive Recursively check groups
|
||||
* @return bool
|
||||
*/
|
||||
public function inGroup($distinguisedName, $group, $recursive = NULL)
|
||||
{
|
||||
if ($distinguisedName === NULL) { return false; }
|
||||
if ($group === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
|
||||
// Get a list of the groups
|
||||
$groups = $this->groups($distinguisedName, array("memberof"), $recursive);
|
||||
|
||||
// Return true if the specified group is in the group list
|
||||
if (in_array($group, $groups)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a contact
|
||||
*
|
||||
* @param string $distinguishedName The contact to query
|
||||
* @param array $attributes The attributes to modify. Note if you set the enabled attribute you must not specify any other attributes
|
||||
* @return bool
|
||||
*/
|
||||
public function modify($distinguishedName, $attributes) {
|
||||
if ($distinguishedName === NULL) { return "Missing compulsory field [distinguishedname]"; }
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$mod = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
// Check to see if this is an enabled status update
|
||||
if (!$mod) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do the update
|
||||
$result = ldap_modify($this->adldap->getLdapConnection(), $distinguishedName, $mod);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a contact
|
||||
*
|
||||
* @param string $distinguishedName The contact dn to delete (please be careful here!)
|
||||
* @return array
|
||||
*/
|
||||
public function delete($distinguishedName)
|
||||
{
|
||||
$result = $this->folder()->delete($distinguishedName);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all contacts
|
||||
*
|
||||
* @param bool $includeDescription Include a description of a contact
|
||||
* @param string $search The search parameters
|
||||
* @param bool $sorted Whether to sort the results
|
||||
* @return array
|
||||
*/
|
||||
public function all($includeDescription = false, $search = "*", $sorted = true) {
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
// Perform the search and grab all their details
|
||||
$filter = "(&(objectClass=contact)(cn=" . $search . "))";
|
||||
$fields = array("displayname","distinguishedname");
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
|
||||
$entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
$usersArray = array();
|
||||
for ($i=0; $i<$entries["count"]; $i++){
|
||||
if ($includeDescription && strlen($entries[$i]["displayname"][0])>0){
|
||||
$usersArray[$entries[$i]["distinguishedname"][0]] = $entries[$i]["displayname"][0];
|
||||
} elseif ($includeDescription){
|
||||
$usersArray[$entries[$i]["distinguishedname"][0]] = $entries[$i]["distinguishedname"][0];
|
||||
} else {
|
||||
array_push($usersArray, $entries[$i]["distinguishedname"][0]);
|
||||
}
|
||||
}
|
||||
if ($sorted) {
|
||||
asort($usersArray);
|
||||
}
|
||||
return $usersArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mail enable a contact
|
||||
* Allows email to be sent to them through Exchange
|
||||
*
|
||||
* @param string $distinguishedname The contact to mail enable
|
||||
* @param string $emailaddress The email address to allow emails to be sent through
|
||||
* @param string $mailnickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name
|
||||
* @return bool
|
||||
*/
|
||||
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = NULL){
|
||||
return $this->adldap->exchange()->contactMailEnable($distinguishedName, $emailAddress, $mailNickname);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Contacts
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
require_once(dirname(__FILE__) . '/../collections/adLDAPContactCollection.php');
|
||||
|
||||
class adLDAPContacts {
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
//*****************************************************************************************************************
|
||||
// CONTACT FUNCTIONS
|
||||
// * Still work to do in this area, and new functions to write
|
||||
|
||||
/**
|
||||
* Create a contact
|
||||
*
|
||||
* @param array $attributes The attributes to set to the contact
|
||||
* @return bool
|
||||
*/
|
||||
public function create($attributes)
|
||||
{
|
||||
// Check for compulsory fields
|
||||
if (!array_key_exists("display_name", $attributes)) { return "Missing compulsory field [display_name]"; }
|
||||
if (!array_key_exists("email", $attributes)) { return "Missing compulsory field [email]"; }
|
||||
if (!array_key_exists("container", $attributes)) { return "Missing compulsory field [container]"; }
|
||||
if (!is_array($attributes["container"])) { return "Container attribute must be an array."; }
|
||||
|
||||
// Translate the schema
|
||||
$add = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
// Additional stuff only used for adding contacts
|
||||
$add["cn"][0] = $attributes["display_name"];
|
||||
$add["objectclass"][0] = "top";
|
||||
$add["objectclass"][1] = "person";
|
||||
$add["objectclass"][2] = "organizationalPerson";
|
||||
$add["objectclass"][3] = "contact";
|
||||
if (!isset($attributes['exchange_hidefromlists'])) {
|
||||
$add["msExchHideFromAddressLists"][0] = "TRUE";
|
||||
}
|
||||
|
||||
// Determine the container
|
||||
$attributes["container"] = array_reverse($attributes["container"]);
|
||||
$container= "OU=" . implode(",OU=", $attributes["container"]);
|
||||
|
||||
// Add the entry
|
||||
$result = @ldap_add($this->adldap->getLdapConnection(), "CN=" . $this->adldap->utilities()->escapeCharacters($add["cn"][0]) . ", " . $container . "," . $this->adldap->getBaseDn(), $add);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the list of groups a contact is a member of
|
||||
*
|
||||
* @param string $distinguisedname The full DN of a contact
|
||||
* @param bool $recursive Recursively check groups
|
||||
* @return array
|
||||
*/
|
||||
public function groups($distinguishedName, $recursive = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
|
||||
// Search the directory for their information
|
||||
$info = @$this->info($distinguishedName, array("memberof", "primarygroupid"));
|
||||
$groups = $this->adldap->utilities()->niceNames($info[0]["memberof"]); //presuming the entry returned is our contact
|
||||
|
||||
if ($recursive === true){
|
||||
foreach ($groups as $id => $groupName){
|
||||
$extraGroups = $this->adldap->group()->recursiveGroups($groupName);
|
||||
$groups = array_merge($groups, $extraGroups);
|
||||
}
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contact information. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $distinguisedname The full DN of a contact
|
||||
* @param array $fields Attributes to be returned
|
||||
* @return array
|
||||
*/
|
||||
public function info($distinguishedName, $fields = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$filter = "distinguishedName=" . $distinguishedName;
|
||||
if ($fields === NULL) {
|
||||
$fields = array("distinguishedname", "mail", "memberof", "department", "displayname", "telephonenumber", "primarygroupid", "objectsid");
|
||||
}
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
|
||||
$entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
if ($entries[0]['count'] >= 1) {
|
||||
// AD does not return the primary group in the ldap query, we may need to fudge it
|
||||
if ($this->adldap->getRealPrimaryGroup() && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["primarygroupid"][0])){
|
||||
//$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
|
||||
$entries[0]["memberof"][] = $this->adldap->group()->getPrimaryGroup($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
|
||||
} else {
|
||||
$entries[0]["memberof"][] = "CN=Domain Users,CN=Users," . $this->adldap->getBaseDn();
|
||||
}
|
||||
}
|
||||
|
||||
$entries[0]["memberof"]["count"]++;
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find information about the contacts. Returned in a raw array format from AD
|
||||
*
|
||||
* @param string $distinguishedName The full DN of a contact
|
||||
* @param array $fields Array of parameters to query
|
||||
* @return mixed
|
||||
*/
|
||||
public function infoCollection($distinguishedName, $fields = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$info = $this->info($distinguishedName, $fields);
|
||||
|
||||
if ($info !== false) {
|
||||
$collection = new adLDAPContactCollection($info, $this->adldap);
|
||||
return $collection;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a contact is a member of a group
|
||||
*
|
||||
* @param string $distinguisedName The full DN of a contact
|
||||
* @param string $group The group name to query
|
||||
* @param bool $recursive Recursively check groups
|
||||
* @return bool
|
||||
*/
|
||||
public function inGroup($distinguisedName, $group, $recursive = NULL)
|
||||
{
|
||||
if ($distinguisedName === NULL) { return false; }
|
||||
if ($group === NULL) { return false; }
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
|
||||
// Get a list of the groups
|
||||
$groups = $this->groups($distinguisedName, array("memberof"), $recursive);
|
||||
|
||||
// Return true if the specified group is in the group list
|
||||
if (in_array($group, $groups)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify a contact
|
||||
*
|
||||
* @param string $distinguishedName The contact to query
|
||||
* @param array $attributes The attributes to modify. Note if you set the enabled attribute you must not specify any other attributes
|
||||
* @return bool
|
||||
*/
|
||||
public function modify($distinguishedName, $attributes) {
|
||||
if ($distinguishedName === NULL) { return "Missing compulsory field [distinguishedname]"; }
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$mod = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
// Check to see if this is an enabled status update
|
||||
if (!$mod) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do the update
|
||||
$result = ldap_modify($this->adldap->getLdapConnection(), $distinguishedName, $mod);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a contact
|
||||
*
|
||||
* @param string $distinguishedName The contact dn to delete (please be careful here!)
|
||||
* @return array
|
||||
*/
|
||||
public function delete($distinguishedName)
|
||||
{
|
||||
$result = $this->folder()->delete($distinguishedName);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of all contacts
|
||||
*
|
||||
* @param bool $includeDescription Include a description of a contact
|
||||
* @param string $search The search parameters
|
||||
* @param bool $sorted Whether to sort the results
|
||||
* @return array
|
||||
*/
|
||||
public function all($includeDescription = false, $search = "*", $sorted = true) {
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
// Perform the search and grab all their details
|
||||
$filter = "(&(objectClass=contact)(cn=" . $search . "))";
|
||||
$fields = array("displayname","distinguishedname");
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
|
||||
$entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
$usersArray = array();
|
||||
for ($i=0; $i<$entries["count"]; $i++){
|
||||
if ($includeDescription && strlen($entries[$i]["displayname"][0])>0){
|
||||
$usersArray[$entries[$i]["distinguishedname"][0]] = $entries[$i]["displayname"][0];
|
||||
} elseif ($includeDescription){
|
||||
$usersArray[$entries[$i]["distinguishedname"][0]] = $entries[$i]["distinguishedname"][0];
|
||||
} else {
|
||||
array_push($usersArray, $entries[$i]["distinguishedname"][0]);
|
||||
}
|
||||
}
|
||||
if ($sorted) {
|
||||
asort($usersArray);
|
||||
}
|
||||
return $usersArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mail enable a contact
|
||||
* Allows email to be sent to them through Exchange
|
||||
*
|
||||
* @param string $distinguishedname The contact to mail enable
|
||||
* @param string $emailaddress The email address to allow emails to be sent through
|
||||
* @param string $mailnickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name
|
||||
* @return bool
|
||||
*/
|
||||
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = NULL){
|
||||
return $this->adldap->exchange()->contactMailEnable($distinguishedName, $emailAddress, $mailNickname);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,390 +1,390 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Exchange
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
|
||||
/**
|
||||
* MICROSOFT EXCHANGE FUNCTIONS
|
||||
*/
|
||||
class adLDAPExchange {
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an Exchange account
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param array $storageGroup The mailbox, Exchange Storage Group, for the user account, this must be a full CN
|
||||
* If the storage group has a different base_dn to the adLDAP configuration, set it using $base_dn
|
||||
* @param string $emailAddress The primary email address to add to this user
|
||||
* @param string $mailNickname The mail nick name. If mail nickname is blank, the username will be used
|
||||
* @param bool $mdbUseDefaults Indicates whether the store should use the default quota, rather than the per-mailbox quota.
|
||||
* @param string $baseDn Specify an alternative base_dn for the Exchange storage group
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function createMailbox($username, $storageGroup, $emailAddress, $mailNickname=NULL, $useDefaults=TRUE, $baseDn=NULL, $isGUID=false)
|
||||
{
|
||||
if ($username === NULL){ return "Missing compulsory field [username]"; }
|
||||
if ($storageGroup === NULL) { return "Missing compulsory array [storagegroup]"; }
|
||||
if (!is_array($storageGroup)) { return "[storagegroup] must be an array"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory field [emailAddress]"; }
|
||||
|
||||
if ($baseDn === NULL) {
|
||||
$baseDn = $this->adldap->getBaseDn();
|
||||
}
|
||||
|
||||
$container = "CN=" . implode(",CN=", $storageGroup);
|
||||
|
||||
if ($mailNickname === NULL) {
|
||||
$mailNickname = $username;
|
||||
}
|
||||
$mdbUseDefaults = $this->adldap->utilities()->boolToString($useDefaults);
|
||||
|
||||
$attributes = array(
|
||||
'exchange_homemdb'=>$container.",".$baseDn,
|
||||
'exchange_proxyaddress'=>'SMTP:' . $emailAddress,
|
||||
'exchange_mailnickname'=>$mailNickname,
|
||||
'exchange_usedefaults'=>$mdbUseDefaults
|
||||
);
|
||||
$result = $this->adldap->user()->modify($username, $attributes, $isGUID);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an X400 address to Exchange
|
||||
* See http://tools.ietf.org/html/rfc1685 for more information.
|
||||
* An X400 Address looks similar to this X400:c=US;a= ;p=Domain;o=Organization;s=Doe;g=John;
|
||||
*
|
||||
* @param string $username The username of the user to add the X400 to to
|
||||
* @param string $country Country
|
||||
* @param string $admd Administration Management Domain
|
||||
* @param string $pdmd Private Management Domain (often your AD domain)
|
||||
* @param string $org Organization
|
||||
* @param string $surname Surname
|
||||
* @param string $givenName Given name
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function addX400($username, $country, $admd, $pdmd, $org, $surname, $givenName, $isGUID=false)
|
||||
{
|
||||
if ($username === NULL){ return "Missing compulsory field [username]"; }
|
||||
|
||||
$proxyValue = 'X400:';
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL) { return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
// We do not have to demote an email address from the default so we can just add the new proxy address
|
||||
$attributes['exchange_proxyaddress'] = $proxyValue . 'c=' . $country . ';a=' . $admd . ';p=' . $pdmd . ';o=' . $org . ';s=' . $surname . ';g=' . $givenName . ';';
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$add = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
if (!$add) { return false; }
|
||||
|
||||
// Do the update
|
||||
// Take out the @ to see any errors, usually this error might occur because the address already
|
||||
// exists in the list of proxyAddresses
|
||||
$result = @ldap_mod_add($this->adldap->getLdapConnection(), $userDn, $add);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an address to Exchange
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param string $emailAddress The email address to add to this user
|
||||
* @param bool $default Make this email address the default address, this is a bit more intensive as we have to demote any existing default addresses
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function addAddress($username, $emailAddress, $default = FALSE, $isGUID = false)
|
||||
{
|
||||
if ($username === NULL) { return "Missing compulsory field [username]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; }
|
||||
|
||||
$proxyValue = 'smtp:';
|
||||
if ($default === true) {
|
||||
$proxyValue = 'SMTP:';
|
||||
}
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL){ return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
// We need to scan existing proxy addresses and demote the default one
|
||||
if (is_array($user[0]["proxyaddresses"]) && $default === true) {
|
||||
$modAddresses = array();
|
||||
for ($i=0;$i<sizeof($user[0]['proxyaddresses']);$i++) {
|
||||
if (strstr($user[0]['proxyaddresses'][$i], 'SMTP:') !== false) {
|
||||
$user[0]['proxyaddresses'][$i] = str_replace('SMTP:', 'smtp:', $user[0]['proxyaddresses'][$i]);
|
||||
}
|
||||
if ($user[0]['proxyaddresses'][$i] != '') {
|
||||
$modAddresses['proxyAddresses'][$i] = $user[0]['proxyaddresses'][$i];
|
||||
}
|
||||
}
|
||||
$modAddresses['proxyAddresses'][(sizeof($user[0]['proxyaddresses'])-1)] = 'SMTP:' . $emailAddress;
|
||||
|
||||
$result = @ldap_mod_replace($this->adldap->getLdapConnection(), $userDn, $modAddresses);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// We do not have to demote an email address from the default so we can just add the new proxy address
|
||||
$attributes['exchange_proxyaddress'] = $proxyValue . $emailAddress;
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$add = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
if (!$add) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do the update
|
||||
// Take out the @ to see any errors, usually this error might occur because the address already
|
||||
// exists in the list of proxyAddresses
|
||||
$result = @ldap_mod_add($this->adldap->getLdapConnection(), $userDn,$add);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an address to Exchange
|
||||
* If you remove a default address the account will no longer have a default,
|
||||
* we recommend changing the default address first
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param string $emailAddress The email address to add to this user
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteAddress($username, $emailAddress, $isGUID=false)
|
||||
{
|
||||
if ($username === NULL) { return "Missing compulsory field [username]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; }
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL) { return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
if (is_array($user[0]["proxyaddresses"])) {
|
||||
$mod = array();
|
||||
for ($i=0;$i<sizeof($user[0]['proxyaddresses']);$i++) {
|
||||
if (strstr($user[0]['proxyaddresses'][$i], 'SMTP:') !== false && $user[0]['proxyaddresses'][$i] == 'SMTP:' . $emailAddress) {
|
||||
$mod['proxyAddresses'][0] = 'SMTP:' . $emailAddress;
|
||||
}
|
||||
elseif (strstr($user[0]['proxyaddresses'][$i], 'smtp:') !== false && $user[0]['proxyaddresses'][$i] == 'smtp:' . $emailAddress) {
|
||||
$mod['proxyAddresses'][0] = 'smtp:' . $emailAddress;
|
||||
}
|
||||
}
|
||||
|
||||
$result = @ldap_mod_del($this->adldap->getLdapConnection(), $userDn,$mod);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Change the default address
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param string $emailAddress The email address to make default
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function primaryAddress($username, $emailAddress, $isGUID = false)
|
||||
{
|
||||
if ($username === NULL) { return "Missing compulsory field [username]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; }
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL){ return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
if (is_array($user[0]["proxyaddresses"])) {
|
||||
$modAddresses = array();
|
||||
for ($i=0;$i<sizeof($user[0]['proxyaddresses']);$i++) {
|
||||
if (strstr($user[0]['proxyaddresses'][$i], 'SMTP:') !== false) {
|
||||
$user[0]['proxyaddresses'][$i] = str_replace('SMTP:', 'smtp:', $user[0]['proxyaddresses'][$i]);
|
||||
}
|
||||
if ($user[0]['proxyaddresses'][$i] == 'smtp:' . $emailAddress) {
|
||||
$user[0]['proxyaddresses'][$i] = str_replace('smtp:', 'SMTP:', $user[0]['proxyaddresses'][$i]);
|
||||
}
|
||||
if ($user[0]['proxyaddresses'][$i] != '') {
|
||||
$modAddresses['proxyAddresses'][$i] = $user[0]['proxyaddresses'][$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = @ldap_mod_replace($this->adldap->getLdapConnection(), $userDn, $modAddresses);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Mail enable a contact
|
||||
* Allows email to be sent to them through Exchange
|
||||
*
|
||||
* @param string $distinguishedName The contact to mail enable
|
||||
* @param string $emailAddress The email address to allow emails to be sent through
|
||||
* @param string $mailNickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name
|
||||
* @return bool
|
||||
*/
|
||||
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return "Missing compulsory field [distinguishedName]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory field [emailAddress]"; }
|
||||
|
||||
if ($mailNickname !== NULL) {
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->contact()->info($distinguishedName, array("cn","displayname"));
|
||||
if ($user[0]["displayname"] === NULL) { return false; }
|
||||
$mailNickname = $user[0]['displayname'][0];
|
||||
}
|
||||
|
||||
$attributes = array("email"=>$emailAddress,"contact_email"=>"SMTP:" . $emailAddress,"exchange_proxyaddress"=>"SMTP:" . $emailAddress,"exchange_mailnickname" => $mailNickname);
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$mod = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
// Check to see if this is an enabled status update
|
||||
if (!$mod) { return false; }
|
||||
|
||||
// Do the update
|
||||
$result = ldap_modify($this->adldap->getLdapConnection(), $distinguishedName, $mod);
|
||||
if ($result == false) { return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Exchange Servers in the ConfigurationNamingContext of the domain
|
||||
*
|
||||
* @param array $attributes An array of the AD attributes you wish to return
|
||||
* @return array
|
||||
*/
|
||||
public function servers($attributes = array('cn','distinguishedname','serialnumber'))
|
||||
{
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
|
||||
$configurationNamingContext = $this->adldap->getRootDse(array('configurationnamingcontext'));
|
||||
$sr = @ldap_search($this->adldap->getLdapConnection(), $configurationNamingContext[0]['configurationnamingcontext'][0],'(&(objectCategory=msExchExchangeServer))', $attributes);
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Storage Groups in Exchange for a given mail server
|
||||
*
|
||||
* @param string $exchangeServer The full DN of an Exchange server. You can use exchange_servers() to find the DN for your server
|
||||
* @param array $attributes An array of the AD attributes you wish to return
|
||||
* @param bool $recursive If enabled this will automatically query the databases within a storage group
|
||||
* @return array
|
||||
*/
|
||||
public function storageGroups($exchangeServer, $attributes = array('cn','distinguishedname'), $recursive = NULL)
|
||||
{
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
if ($exchangeServer === NULL) { return "Missing compulsory field [exchangeServer]"; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); }
|
||||
|
||||
$filter = '(&(objectCategory=msExchStorageGroup))';
|
||||
$sr = @ldap_search($this->adldap->getLdapConnection(), $exchangeServer, $filter, $attributes);
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
if ($recursive === true) {
|
||||
for ($i=0; $i<$entries['count']; $i++) {
|
||||
$entries[$i]['msexchprivatemdb'] = $this->storageDatabases($entries[$i]['distinguishedname'][0]);
|
||||
}
|
||||
}
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Databases within any given storage group in Exchange for a given mail server
|
||||
*
|
||||
* @param string $storageGroup The full DN of an Storage Group. You can use exchange_storage_groups() to find the DN
|
||||
* @param array $attributes An array of the AD attributes you wish to return
|
||||
* @return array
|
||||
*/
|
||||
public function storageDatabases($storageGroup, $attributes = array('cn','distinguishedname','displayname')) {
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
if ($storageGroup === NULL) { return "Missing compulsory field [storageGroup]"; }
|
||||
|
||||
$filter = '(&(objectCategory=msExchPrivateMDB))';
|
||||
$sr = @ldap_search($this->adldap->getLdapConnection(), $storageGroup, $filter, $attributes);
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Exchange
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
|
||||
/**
|
||||
* MICROSOFT EXCHANGE FUNCTIONS
|
||||
*/
|
||||
class adLDAPExchange {
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an Exchange account
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param array $storageGroup The mailbox, Exchange Storage Group, for the user account, this must be a full CN
|
||||
* If the storage group has a different base_dn to the adLDAP configuration, set it using $base_dn
|
||||
* @param string $emailAddress The primary email address to add to this user
|
||||
* @param string $mailNickname The mail nick name. If mail nickname is blank, the username will be used
|
||||
* @param bool $mdbUseDefaults Indicates whether the store should use the default quota, rather than the per-mailbox quota.
|
||||
* @param string $baseDn Specify an alternative base_dn for the Exchange storage group
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function createMailbox($username, $storageGroup, $emailAddress, $mailNickname=NULL, $useDefaults=TRUE, $baseDn=NULL, $isGUID=false)
|
||||
{
|
||||
if ($username === NULL){ return "Missing compulsory field [username]"; }
|
||||
if ($storageGroup === NULL) { return "Missing compulsory array [storagegroup]"; }
|
||||
if (!is_array($storageGroup)) { return "[storagegroup] must be an array"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory field [emailAddress]"; }
|
||||
|
||||
if ($baseDn === NULL) {
|
||||
$baseDn = $this->adldap->getBaseDn();
|
||||
}
|
||||
|
||||
$container = "CN=" . implode(",CN=", $storageGroup);
|
||||
|
||||
if ($mailNickname === NULL) {
|
||||
$mailNickname = $username;
|
||||
}
|
||||
$mdbUseDefaults = $this->adldap->utilities()->boolToString($useDefaults);
|
||||
|
||||
$attributes = array(
|
||||
'exchange_homemdb'=>$container.",".$baseDn,
|
||||
'exchange_proxyaddress'=>'SMTP:' . $emailAddress,
|
||||
'exchange_mailnickname'=>$mailNickname,
|
||||
'exchange_usedefaults'=>$mdbUseDefaults
|
||||
);
|
||||
$result = $this->adldap->user()->modify($username, $attributes, $isGUID);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an X400 address to Exchange
|
||||
* See http://tools.ietf.org/html/rfc1685 for more information.
|
||||
* An X400 Address looks similar to this X400:c=US;a= ;p=Domain;o=Organization;s=Doe;g=John;
|
||||
*
|
||||
* @param string $username The username of the user to add the X400 to to
|
||||
* @param string $country Country
|
||||
* @param string $admd Administration Management Domain
|
||||
* @param string $pdmd Private Management Domain (often your AD domain)
|
||||
* @param string $org Organization
|
||||
* @param string $surname Surname
|
||||
* @param string $givenName Given name
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function addX400($username, $country, $admd, $pdmd, $org, $surname, $givenName, $isGUID=false)
|
||||
{
|
||||
if ($username === NULL){ return "Missing compulsory field [username]"; }
|
||||
|
||||
$proxyValue = 'X400:';
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL) { return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
// We do not have to demote an email address from the default so we can just add the new proxy address
|
||||
$attributes['exchange_proxyaddress'] = $proxyValue . 'c=' . $country . ';a=' . $admd . ';p=' . $pdmd . ';o=' . $org . ';s=' . $surname . ';g=' . $givenName . ';';
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$add = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
if (!$add) { return false; }
|
||||
|
||||
// Do the update
|
||||
// Take out the @ to see any errors, usually this error might occur because the address already
|
||||
// exists in the list of proxyAddresses
|
||||
$result = @ldap_mod_add($this->adldap->getLdapConnection(), $userDn, $add);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an address to Exchange
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param string $emailAddress The email address to add to this user
|
||||
* @param bool $default Make this email address the default address, this is a bit more intensive as we have to demote any existing default addresses
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function addAddress($username, $emailAddress, $default = FALSE, $isGUID = false)
|
||||
{
|
||||
if ($username === NULL) { return "Missing compulsory field [username]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; }
|
||||
|
||||
$proxyValue = 'smtp:';
|
||||
if ($default === true) {
|
||||
$proxyValue = 'SMTP:';
|
||||
}
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL){ return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
// We need to scan existing proxy addresses and demote the default one
|
||||
if (is_array($user[0]["proxyaddresses"]) && $default === true) {
|
||||
$modAddresses = array();
|
||||
for ($i=0;$i<sizeof($user[0]['proxyaddresses']);$i++) {
|
||||
if (strstr($user[0]['proxyaddresses'][$i], 'SMTP:') !== false) {
|
||||
$user[0]['proxyaddresses'][$i] = str_replace('SMTP:', 'smtp:', $user[0]['proxyaddresses'][$i]);
|
||||
}
|
||||
if ($user[0]['proxyaddresses'][$i] != '') {
|
||||
$modAddresses['proxyAddresses'][$i] = $user[0]['proxyaddresses'][$i];
|
||||
}
|
||||
}
|
||||
$modAddresses['proxyAddresses'][(sizeof($user[0]['proxyaddresses'])-1)] = 'SMTP:' . $emailAddress;
|
||||
|
||||
$result = @ldap_mod_replace($this->adldap->getLdapConnection(), $userDn, $modAddresses);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// We do not have to demote an email address from the default so we can just add the new proxy address
|
||||
$attributes['exchange_proxyaddress'] = $proxyValue . $emailAddress;
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$add = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
if (!$add) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do the update
|
||||
// Take out the @ to see any errors, usually this error might occur because the address already
|
||||
// exists in the list of proxyAddresses
|
||||
$result = @ldap_mod_add($this->adldap->getLdapConnection(), $userDn,$add);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an address to Exchange
|
||||
* If you remove a default address the account will no longer have a default,
|
||||
* we recommend changing the default address first
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param string $emailAddress The email address to add to this user
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteAddress($username, $emailAddress, $isGUID=false)
|
||||
{
|
||||
if ($username === NULL) { return "Missing compulsory field [username]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; }
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL) { return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
if (is_array($user[0]["proxyaddresses"])) {
|
||||
$mod = array();
|
||||
for ($i=0;$i<sizeof($user[0]['proxyaddresses']);$i++) {
|
||||
if (strstr($user[0]['proxyaddresses'][$i], 'SMTP:') !== false && $user[0]['proxyaddresses'][$i] == 'SMTP:' . $emailAddress) {
|
||||
$mod['proxyAddresses'][0] = 'SMTP:' . $emailAddress;
|
||||
}
|
||||
elseif (strstr($user[0]['proxyaddresses'][$i], 'smtp:') !== false && $user[0]['proxyaddresses'][$i] == 'smtp:' . $emailAddress) {
|
||||
$mod['proxyAddresses'][0] = 'smtp:' . $emailAddress;
|
||||
}
|
||||
}
|
||||
|
||||
$result = @ldap_mod_del($this->adldap->getLdapConnection(), $userDn,$mod);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Change the default address
|
||||
*
|
||||
* @param string $username The username of the user to add the Exchange account to
|
||||
* @param string $emailAddress The email address to make default
|
||||
* @param bool $isGUID Is the username passed a GUID or a samAccountName
|
||||
* @return bool
|
||||
*/
|
||||
public function primaryAddress($username, $emailAddress, $isGUID = false)
|
||||
{
|
||||
if ($username === NULL) { return "Missing compulsory field [username]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory fields [emailAddress]"; }
|
||||
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->user()->info($username, array("cn","proxyaddresses"), $isGUID);
|
||||
if ($user[0]["dn"] === NULL){ return false; }
|
||||
$userDn = $user[0]["dn"];
|
||||
|
||||
if (is_array($user[0]["proxyaddresses"])) {
|
||||
$modAddresses = array();
|
||||
for ($i=0;$i<sizeof($user[0]['proxyaddresses']);$i++) {
|
||||
if (strstr($user[0]['proxyaddresses'][$i], 'SMTP:') !== false) {
|
||||
$user[0]['proxyaddresses'][$i] = str_replace('SMTP:', 'smtp:', $user[0]['proxyaddresses'][$i]);
|
||||
}
|
||||
if ($user[0]['proxyaddresses'][$i] == 'smtp:' . $emailAddress) {
|
||||
$user[0]['proxyaddresses'][$i] = str_replace('smtp:', 'SMTP:', $user[0]['proxyaddresses'][$i]);
|
||||
}
|
||||
if ($user[0]['proxyaddresses'][$i] != '') {
|
||||
$modAddresses['proxyAddresses'][$i] = $user[0]['proxyaddresses'][$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = @ldap_mod_replace($this->adldap->getLdapConnection(), $userDn, $modAddresses);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Mail enable a contact
|
||||
* Allows email to be sent to them through Exchange
|
||||
*
|
||||
* @param string $distinguishedName The contact to mail enable
|
||||
* @param string $emailAddress The email address to allow emails to be sent through
|
||||
* @param string $mailNickname The mailnickname for the contact in Exchange. If NULL this will be set to the display name
|
||||
* @return bool
|
||||
*/
|
||||
public function contactMailEnable($distinguishedName, $emailAddress, $mailNickname = NULL)
|
||||
{
|
||||
if ($distinguishedName === NULL) { return "Missing compulsory field [distinguishedName]"; }
|
||||
if ($emailAddress === NULL) { return "Missing compulsory field [emailAddress]"; }
|
||||
|
||||
if ($mailNickname !== NULL) {
|
||||
// Find the dn of the user
|
||||
$user = $this->adldap->contact()->info($distinguishedName, array("cn","displayname"));
|
||||
if ($user[0]["displayname"] === NULL) { return false; }
|
||||
$mailNickname = $user[0]['displayname'][0];
|
||||
}
|
||||
|
||||
$attributes = array("email"=>$emailAddress,"contact_email"=>"SMTP:" . $emailAddress,"exchange_proxyaddress"=>"SMTP:" . $emailAddress,"exchange_mailnickname" => $mailNickname);
|
||||
|
||||
// Translate the update to the LDAP schema
|
||||
$mod = $this->adldap->adldap_schema($attributes);
|
||||
|
||||
// Check to see if this is an enabled status update
|
||||
if (!$mod) { return false; }
|
||||
|
||||
// Do the update
|
||||
$result = ldap_modify($this->adldap->getLdapConnection(), $distinguishedName, $mod);
|
||||
if ($result == false) { return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Exchange Servers in the ConfigurationNamingContext of the domain
|
||||
*
|
||||
* @param array $attributes An array of the AD attributes you wish to return
|
||||
* @return array
|
||||
*/
|
||||
public function servers($attributes = array('cn','distinguishedname','serialnumber'))
|
||||
{
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
|
||||
$configurationNamingContext = $this->adldap->getRootDse(array('configurationnamingcontext'));
|
||||
$sr = @ldap_search($this->adldap->getLdapConnection(), $configurationNamingContext[0]['configurationnamingcontext'][0],'(&(objectCategory=msExchExchangeServer))', $attributes);
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Storage Groups in Exchange for a given mail server
|
||||
*
|
||||
* @param string $exchangeServer The full DN of an Exchange server. You can use exchange_servers() to find the DN for your server
|
||||
* @param array $attributes An array of the AD attributes you wish to return
|
||||
* @param bool $recursive If enabled this will automatically query the databases within a storage group
|
||||
* @return array
|
||||
*/
|
||||
public function storageGroups($exchangeServer, $attributes = array('cn','distinguishedname'), $recursive = NULL)
|
||||
{
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
if ($exchangeServer === NULL) { return "Missing compulsory field [exchangeServer]"; }
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); }
|
||||
|
||||
$filter = '(&(objectCategory=msExchStorageGroup))';
|
||||
$sr = @ldap_search($this->adldap->getLdapConnection(), $exchangeServer, $filter, $attributes);
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
|
||||
if ($recursive === true) {
|
||||
for ($i=0; $i<$entries['count']; $i++) {
|
||||
$entries[$i]['msexchprivatemdb'] = $this->storageDatabases($entries[$i]['distinguishedname'][0]);
|
||||
}
|
||||
}
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Databases within any given storage group in Exchange for a given mail server
|
||||
*
|
||||
* @param string $storageGroup The full DN of an Storage Group. You can use exchange_storage_groups() to find the DN
|
||||
* @param array $attributes An array of the AD attributes you wish to return
|
||||
* @return array
|
||||
*/
|
||||
public function storageDatabases($storageGroup, $attributes = array('cn','distinguishedname','displayname')) {
|
||||
if (!$this->adldap->getLdapBind()){ return false; }
|
||||
if ($storageGroup === NULL) { return "Missing compulsory field [storageGroup]"; }
|
||||
|
||||
$filter = '(&(objectCategory=msExchPrivateMDB))';
|
||||
$sr = @ldap_search($this->adldap->getLdapConnection(), $storageGroup, $filter, $attributes);
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,179 +1,179 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Folders
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
|
||||
/**
|
||||
* FOLDER / OU MANAGEMENT FUNCTIONS
|
||||
*/
|
||||
class adLDAPFolders {
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a distinguished name from Active Directory
|
||||
* You should never need to call this yourself, just use the wrapper functions user_delete and contact_delete
|
||||
*
|
||||
* @param string $dn The distinguished name to delete
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($dn){
|
||||
$result = ldap_delete($this->adldap->getLdapConnection(), $dn);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a folder listing for a specific OU
|
||||
* See http://adldap.sourceforge.net/wiki/doku.php?id=api_folder_functions
|
||||
*
|
||||
* @param array $folderName An array to the OU you wish to list.
|
||||
* If set to NULL will list the root, strongly recommended to set
|
||||
* $recursive to false in that instance!
|
||||
* @param string $dnType The type of record to list. This can be ADLDAP_FOLDER or ADLDAP_CONTAINER.
|
||||
* @param bool $recursive Recursively search sub folders
|
||||
* @param bool $type Specify a type of object to search for
|
||||
* @return array
|
||||
*/
|
||||
public function listing($folderName = NULL, $dnType = adLDAP::ADLDAP_FOLDER, $recursive = NULL, $type = NULL)
|
||||
{
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$filter = '(&';
|
||||
if ($type !== NULL) {
|
||||
switch ($type) {
|
||||
case 'contact':
|
||||
$filter .= '(objectClass=contact)';
|
||||
break;
|
||||
case 'computer':
|
||||
$filter .= '(objectClass=computer)';
|
||||
break;
|
||||
case 'group':
|
||||
$filter .= '(objectClass=group)';
|
||||
break;
|
||||
case 'folder':
|
||||
$filter .= '(objectClass=organizationalUnit)';
|
||||
break;
|
||||
case 'container':
|
||||
$filter .= '(objectClass=container)';
|
||||
break;
|
||||
case 'domain':
|
||||
$filter .= '(objectClass=builtinDomain)';
|
||||
break;
|
||||
default:
|
||||
$filter .= '(objectClass=user)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$filter .= '(objectClass=*)';
|
||||
}
|
||||
// If the folder name is null then we will search the root level of AD
|
||||
// This requires us to not have an OU= part, just the base_dn
|
||||
$searchOu = $this->adldap->getBaseDn();
|
||||
if (is_array($folderName)) {
|
||||
$ou = $dnType . "=" . implode("," . $dnType . "=", $folderName);
|
||||
$filter .= '(!(distinguishedname=' . $ou . ',' . $this->adldap->getBaseDn() . ')))';
|
||||
$searchOu = $ou . ',' . $this->adldap->getBaseDn();
|
||||
}
|
||||
else {
|
||||
$filter .= '(!(distinguishedname=' . $this->adldap->getBaseDn() . ')))';
|
||||
}
|
||||
|
||||
if ($recursive === true) {
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $searchOu, $filter, array('objectclass', 'distinguishedname', 'samaccountname'));
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
if (is_array($entries)) {
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sr = ldap_list($this->adldap->getLdapConnection(), $searchOu, $filter, array('objectclass', 'distinguishedname', 'samaccountname'));
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
if (is_array($entries)) {
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an organizational unit
|
||||
*
|
||||
* @param array $attributes Default attributes of the ou
|
||||
* @return bool
|
||||
*/
|
||||
public function create($attributes)
|
||||
{
|
||||
if (!is_array($attributes)){ return "Attributes must be an array"; }
|
||||
if (!is_array($attributes["container"])) { return "Container attribute must be an array."; }
|
||||
if (!array_key_exists("ou_name",$attributes)) { return "Missing compulsory field [ou_name]"; }
|
||||
if (!array_key_exists("container",$attributes)) { return "Missing compulsory field [container]"; }
|
||||
|
||||
$attributes["container"] = array_reverse($attributes["container"]);
|
||||
|
||||
$add=array();
|
||||
$add["objectClass"] = "organizationalUnit";
|
||||
$add["OU"] = $attributes['ou_name'];
|
||||
$containers = "";
|
||||
if (count($attributes['container']) > 0) {
|
||||
$containers = "OU=" . implode(",OU=", $attributes["container"]) . ",";
|
||||
}
|
||||
|
||||
$containers = "OU=" . implode(",OU=", $attributes["container"]);
|
||||
$result = ldap_add($this->adldap->getLdapConnection(), "OU=" . $add["OU"] . ", " . $containers . $this->adldap->getBaseDn(), $add);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Folders
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
|
||||
/**
|
||||
* FOLDER / OU MANAGEMENT FUNCTIONS
|
||||
*/
|
||||
class adLDAPFolders {
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a distinguished name from Active Directory
|
||||
* You should never need to call this yourself, just use the wrapper functions user_delete and contact_delete
|
||||
*
|
||||
* @param string $dn The distinguished name to delete
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($dn){
|
||||
$result = ldap_delete($this->adldap->getLdapConnection(), $dn);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a folder listing for a specific OU
|
||||
* See http://adldap.sourceforge.net/wiki/doku.php?id=api_folder_functions
|
||||
*
|
||||
* @param array $folderName An array to the OU you wish to list.
|
||||
* If set to NULL will list the root, strongly recommended to set
|
||||
* $recursive to false in that instance!
|
||||
* @param string $dnType The type of record to list. This can be ADLDAP_FOLDER or ADLDAP_CONTAINER.
|
||||
* @param bool $recursive Recursively search sub folders
|
||||
* @param bool $type Specify a type of object to search for
|
||||
* @return array
|
||||
*/
|
||||
public function listing($folderName = NULL, $dnType = adLDAP::ADLDAP_FOLDER, $recursive = NULL, $type = NULL)
|
||||
{
|
||||
if ($recursive === NULL) { $recursive = $this->adldap->getRecursiveGroups(); } //use the default option if they haven't set it
|
||||
if (!$this->adldap->getLdapBind()) { return false; }
|
||||
|
||||
$filter = '(&';
|
||||
if ($type !== NULL) {
|
||||
switch ($type) {
|
||||
case 'contact':
|
||||
$filter .= '(objectClass=contact)';
|
||||
break;
|
||||
case 'computer':
|
||||
$filter .= '(objectClass=computer)';
|
||||
break;
|
||||
case 'group':
|
||||
$filter .= '(objectClass=group)';
|
||||
break;
|
||||
case 'folder':
|
||||
$filter .= '(objectClass=organizationalUnit)';
|
||||
break;
|
||||
case 'container':
|
||||
$filter .= '(objectClass=container)';
|
||||
break;
|
||||
case 'domain':
|
||||
$filter .= '(objectClass=builtinDomain)';
|
||||
break;
|
||||
default:
|
||||
$filter .= '(objectClass=user)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$filter .= '(objectClass=*)';
|
||||
}
|
||||
// If the folder name is null then we will search the root level of AD
|
||||
// This requires us to not have an OU= part, just the base_dn
|
||||
$searchOu = $this->adldap->getBaseDn();
|
||||
if (is_array($folderName)) {
|
||||
$ou = $dnType . "=" . implode("," . $dnType . "=", $folderName);
|
||||
$filter .= '(!(distinguishedname=' . $ou . ',' . $this->adldap->getBaseDn() . ')))';
|
||||
$searchOu = $ou . ',' . $this->adldap->getBaseDn();
|
||||
}
|
||||
else {
|
||||
$filter .= '(!(distinguishedname=' . $this->adldap->getBaseDn() . ')))';
|
||||
}
|
||||
|
||||
if ($recursive === true) {
|
||||
$sr = ldap_search($this->adldap->getLdapConnection(), $searchOu, $filter, array('objectclass', 'distinguishedname', 'samaccountname'));
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
if (is_array($entries)) {
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sr = ldap_list($this->adldap->getLdapConnection(), $searchOu, $filter, array('objectclass', 'distinguishedname', 'samaccountname'));
|
||||
$entries = @ldap_get_entries($this->adldap->getLdapConnection(), $sr);
|
||||
if (is_array($entries)) {
|
||||
return $entries;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an organizational unit
|
||||
*
|
||||
* @param array $attributes Default attributes of the ou
|
||||
* @return bool
|
||||
*/
|
||||
public function create($attributes)
|
||||
{
|
||||
if (!is_array($attributes)){ return "Attributes must be an array"; }
|
||||
if (!is_array($attributes["container"])) { return "Container attribute must be an array."; }
|
||||
if (!array_key_exists("ou_name",$attributes)) { return "Missing compulsory field [ou_name]"; }
|
||||
if (!array_key_exists("container",$attributes)) { return "Missing compulsory field [container]"; }
|
||||
|
||||
$attributes["container"] = array_reverse($attributes["container"]);
|
||||
|
||||
$add=array();
|
||||
$add["objectClass"] = "organizationalUnit";
|
||||
$add["OU"] = $attributes['ou_name'];
|
||||
$containers = "";
|
||||
if (count($attributes['container']) > 0) {
|
||||
$containers = "OU=" . implode(",OU=", $attributes["container"]) . ",";
|
||||
}
|
||||
|
||||
$containers = "OU=" . implode(",OU=", $attributes["container"]);
|
||||
$result = ldap_add($this->adldap->getLdapConnection(), "OU=" . $add["OU"] . ", " . $containers . $this->adldap->getBaseDn(), $add);
|
||||
if ($result != true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,264 +1,264 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Utils
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
|
||||
/**
|
||||
* UTILITY FUNCTIONS
|
||||
*/
|
||||
class adLDAPUtils {
|
||||
const ADLDAP_VERSION = '4.0.4';
|
||||
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Take an LDAP query and return the nice names, without all the LDAP prefixes (eg. CN, DN)
|
||||
*
|
||||
* @param array $groups
|
||||
* @return array
|
||||
*/
|
||||
public function niceNames($groups)
|
||||
{
|
||||
|
||||
$groupArray = array();
|
||||
for ($i=0; $i<$groups["count"]; $i++){ // For each group
|
||||
$line = $groups[$i];
|
||||
|
||||
if (strlen($line)>0) {
|
||||
// More presumptions, they're all prefixed with CN=
|
||||
// so we ditch the first three characters and the group
|
||||
// name goes up to the first comma
|
||||
$bits=explode(",", $line);
|
||||
$groupArray[] = substr($bits[0], 3, (strlen($bits[0])-3));
|
||||
}
|
||||
}
|
||||
return $groupArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape characters for use in an ldap_create function
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
public function escapeCharacters($str) {
|
||||
$str = str_replace(",", "\,", $str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape strings for the use in LDAP filters
|
||||
*
|
||||
* DEVELOPERS SHOULD BE DOING PROPER FILTERING IF THEY'RE ACCEPTING USER INPUT
|
||||
* Ported from Perl's Net::LDAP::Util escape_filter_value
|
||||
*
|
||||
* @param string $str The string the parse
|
||||
* @author Port by Andreas Gohr <andi@splitbrain.org>
|
||||
* @return string
|
||||
*/
|
||||
public function ldapSlashes($str){
|
||||
return preg_replace('/([\x00-\x1F\*\(\)\\\\])/e',
|
||||
'"\\\\\".join("",unpack("H2","$1"))',
|
||||
$str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string GUID to a hexdecimal value so it can be queried
|
||||
*
|
||||
* @param string $strGUID A string representation of a GUID
|
||||
* @return string
|
||||
*/
|
||||
public function strGuidToHex($strGUID)
|
||||
{
|
||||
$strGUID = str_replace('-', '', $strGUID);
|
||||
|
||||
$octet_str = '\\' . substr($strGUID, 6, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 4, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 2, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 0, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 10, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 8, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 14, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 12, 2);
|
||||
//$octet_str .= '\\' . substr($strGUID, 16, strlen($strGUID));
|
||||
for ($i=16; $i<=(strlen($strGUID)-2); $i++) {
|
||||
if (($i % 2) == 0) {
|
||||
$octet_str .= '\\' . substr($strGUID, $i, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return $octet_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a binary SID to a text SID
|
||||
*
|
||||
* @param string $binsid A Binary SID
|
||||
* @return string
|
||||
*/
|
||||
public function getTextSID($binsid) {
|
||||
$hex_sid = bin2hex($binsid);
|
||||
$rev = hexdec(substr($hex_sid, 0, 2));
|
||||
$subcount = hexdec(substr($hex_sid, 2, 2));
|
||||
$auth = hexdec(substr($hex_sid, 4, 12));
|
||||
$result = "$rev-$auth";
|
||||
|
||||
for ($x=0;$x < $subcount; $x++) {
|
||||
$subauth[$x] =
|
||||
hexdec($this->littleEndian(substr($hex_sid, 16 + ($x * 8), 8)));
|
||||
$result .= "-" . $subauth[$x];
|
||||
}
|
||||
|
||||
// Cheat by tacking on the S-
|
||||
return 'S-' . $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a little-endian hex number to one that hexdec() can convert
|
||||
*
|
||||
* @param string $hex A hex code
|
||||
* @return string
|
||||
*/
|
||||
public function littleEndian($hex)
|
||||
{
|
||||
$result = '';
|
||||
for ($x = strlen($hex) - 2; $x >= 0; $x = $x - 2) {
|
||||
$result .= substr($hex, $x, 2);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a binary attribute to a string
|
||||
*
|
||||
* @param string $bin A binary LDAP attribute
|
||||
* @return string
|
||||
*/
|
||||
public function binaryToText($bin)
|
||||
{
|
||||
$hex_guid = bin2hex($bin);
|
||||
$hex_guid_to_guid_str = '';
|
||||
for($k = 1; $k <= 4; ++$k) {
|
||||
$hex_guid_to_guid_str .= substr($hex_guid, 8 - 2 * $k, 2);
|
||||
}
|
||||
$hex_guid_to_guid_str .= '-';
|
||||
for($k = 1; $k <= 2; ++$k) {
|
||||
$hex_guid_to_guid_str .= substr($hex_guid, 12 - 2 * $k, 2);
|
||||
}
|
||||
$hex_guid_to_guid_str .= '-';
|
||||
for($k = 1; $k <= 2; ++$k) {
|
||||
$hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2);
|
||||
}
|
||||
$hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4);
|
||||
$hex_guid_to_guid_str .= '-' . substr($hex_guid, 20);
|
||||
return strtoupper($hex_guid_to_guid_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a binary GUID to a string GUID
|
||||
*
|
||||
* @param string $binaryGuid The binary GUID attribute to convert
|
||||
* @return string
|
||||
*/
|
||||
public function decodeGuid($binaryGuid)
|
||||
{
|
||||
if ($binaryGuid === null){ return "Missing compulsory field [binaryGuid]"; }
|
||||
|
||||
$strGUID = $this->binaryToText($binaryGuid);
|
||||
return $strGUID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a boolean value to a string
|
||||
* You should never need to call this yourself
|
||||
*
|
||||
* @param bool $bool Boolean value
|
||||
* @return string
|
||||
*/
|
||||
public function boolToStr($bool)
|
||||
{
|
||||
return ($bool) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert 8bit characters e.g. accented characters to UTF8 encoded characters
|
||||
*/
|
||||
public function encode8Bit(&$item, $key) {
|
||||
$encode = false;
|
||||
if (is_string($item)) {
|
||||
for ($i=0; $i<strlen($item); $i++) {
|
||||
if (ord($item[$i]) >> 7) {
|
||||
$encode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($encode === true && $key != 'password') {
|
||||
$item = utf8_encode($item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current class version number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion() {
|
||||
return self::ADLDAP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Round a Windows timestamp down to seconds and remove the seconds between 1601-01-01 and 1970-01-01
|
||||
*
|
||||
* @param long $windowsTime
|
||||
* @return long $unixTime
|
||||
*/
|
||||
public static function convertWindowsTimeToUnixTime($windowsTime) {
|
||||
$unixTime = round($windowsTime / 10000000) - 11644477200;
|
||||
return $unixTime;
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Utils
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../adLDAP.php');
|
||||
|
||||
/**
|
||||
* UTILITY FUNCTIONS
|
||||
*/
|
||||
class adLDAPUtils {
|
||||
const ADLDAP_VERSION = '4.0.4';
|
||||
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
public function __construct(adLDAP $adldap) {
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Take an LDAP query and return the nice names, without all the LDAP prefixes (eg. CN, DN)
|
||||
*
|
||||
* @param array $groups
|
||||
* @return array
|
||||
*/
|
||||
public function niceNames($groups)
|
||||
{
|
||||
|
||||
$groupArray = array();
|
||||
for ($i=0; $i<$groups["count"]; $i++){ // For each group
|
||||
$line = $groups[$i];
|
||||
|
||||
if (strlen($line)>0) {
|
||||
// More presumptions, they're all prefixed with CN=
|
||||
// so we ditch the first three characters and the group
|
||||
// name goes up to the first comma
|
||||
$bits=explode(",", $line);
|
||||
$groupArray[] = substr($bits[0], 3, (strlen($bits[0])-3));
|
||||
}
|
||||
}
|
||||
return $groupArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape characters for use in an ldap_create function
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
public function escapeCharacters($str) {
|
||||
$str = str_replace(",", "\,", $str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape strings for the use in LDAP filters
|
||||
*
|
||||
* DEVELOPERS SHOULD BE DOING PROPER FILTERING IF THEY'RE ACCEPTING USER INPUT
|
||||
* Ported from Perl's Net::LDAP::Util escape_filter_value
|
||||
*
|
||||
* @param string $str The string the parse
|
||||
* @author Port by Andreas Gohr <andi@splitbrain.org>
|
||||
* @return string
|
||||
*/
|
||||
public function ldapSlashes($str){
|
||||
return preg_replace('/([\x00-\x1F\*\(\)\\\\])/e',
|
||||
'"\\\\\".join("",unpack("H2","$1"))',
|
||||
$str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string GUID to a hexdecimal value so it can be queried
|
||||
*
|
||||
* @param string $strGUID A string representation of a GUID
|
||||
* @return string
|
||||
*/
|
||||
public function strGuidToHex($strGUID)
|
||||
{
|
||||
$strGUID = str_replace('-', '', $strGUID);
|
||||
|
||||
$octet_str = '\\' . substr($strGUID, 6, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 4, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 2, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 0, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 10, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 8, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 14, 2);
|
||||
$octet_str .= '\\' . substr($strGUID, 12, 2);
|
||||
//$octet_str .= '\\' . substr($strGUID, 16, strlen($strGUID));
|
||||
for ($i=16; $i<=(strlen($strGUID)-2); $i++) {
|
||||
if (($i % 2) == 0) {
|
||||
$octet_str .= '\\' . substr($strGUID, $i, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return $octet_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a binary SID to a text SID
|
||||
*
|
||||
* @param string $binsid A Binary SID
|
||||
* @return string
|
||||
*/
|
||||
public function getTextSID($binsid) {
|
||||
$hex_sid = bin2hex($binsid);
|
||||
$rev = hexdec(substr($hex_sid, 0, 2));
|
||||
$subcount = hexdec(substr($hex_sid, 2, 2));
|
||||
$auth = hexdec(substr($hex_sid, 4, 12));
|
||||
$result = "$rev-$auth";
|
||||
|
||||
for ($x=0;$x < $subcount; $x++) {
|
||||
$subauth[$x] =
|
||||
hexdec($this->littleEndian(substr($hex_sid, 16 + ($x * 8), 8)));
|
||||
$result .= "-" . $subauth[$x];
|
||||
}
|
||||
|
||||
// Cheat by tacking on the S-
|
||||
return 'S-' . $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a little-endian hex number to one that hexdec() can convert
|
||||
*
|
||||
* @param string $hex A hex code
|
||||
* @return string
|
||||
*/
|
||||
public function littleEndian($hex)
|
||||
{
|
||||
$result = '';
|
||||
for ($x = strlen($hex) - 2; $x >= 0; $x = $x - 2) {
|
||||
$result .= substr($hex, $x, 2);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a binary attribute to a string
|
||||
*
|
||||
* @param string $bin A binary LDAP attribute
|
||||
* @return string
|
||||
*/
|
||||
public function binaryToText($bin)
|
||||
{
|
||||
$hex_guid = bin2hex($bin);
|
||||
$hex_guid_to_guid_str = '';
|
||||
for($k = 1; $k <= 4; ++$k) {
|
||||
$hex_guid_to_guid_str .= substr($hex_guid, 8 - 2 * $k, 2);
|
||||
}
|
||||
$hex_guid_to_guid_str .= '-';
|
||||
for($k = 1; $k <= 2; ++$k) {
|
||||
$hex_guid_to_guid_str .= substr($hex_guid, 12 - 2 * $k, 2);
|
||||
}
|
||||
$hex_guid_to_guid_str .= '-';
|
||||
for($k = 1; $k <= 2; ++$k) {
|
||||
$hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2);
|
||||
}
|
||||
$hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4);
|
||||
$hex_guid_to_guid_str .= '-' . substr($hex_guid, 20);
|
||||
return strtoupper($hex_guid_to_guid_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a binary GUID to a string GUID
|
||||
*
|
||||
* @param string $binaryGuid The binary GUID attribute to convert
|
||||
* @return string
|
||||
*/
|
||||
public function decodeGuid($binaryGuid)
|
||||
{
|
||||
if ($binaryGuid === null){ return "Missing compulsory field [binaryGuid]"; }
|
||||
|
||||
$strGUID = $this->binaryToText($binaryGuid);
|
||||
return $strGUID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a boolean value to a string
|
||||
* You should never need to call this yourself
|
||||
*
|
||||
* @param bool $bool Boolean value
|
||||
* @return string
|
||||
*/
|
||||
public function boolToStr($bool)
|
||||
{
|
||||
return ($bool) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert 8bit characters e.g. accented characters to UTF8 encoded characters
|
||||
*/
|
||||
public function encode8Bit(&$item, $key) {
|
||||
$encode = false;
|
||||
if (is_string($item)) {
|
||||
for ($i=0; $i<strlen($item); $i++) {
|
||||
if (ord($item[$i]) >> 7) {
|
||||
$encode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($encode === true && $key != 'password') {
|
||||
$item = utf8_encode($item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current class version number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion() {
|
||||
return self::ADLDAP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Round a Windows timestamp down to seconds and remove the seconds between 1601-01-01 and 1970-01-01
|
||||
*
|
||||
* @param long $windowsTime
|
||||
* @return long $unixTime
|
||||
*/
|
||||
public static function convertWindowsTimeToUnixTime($windowsTime) {
|
||||
$unixTime = round($windowsTime / 10000000) - 11644477200;
|
||||
return $unixTime;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,137 +1,137 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Collection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
abstract class adLDAPCollection
|
||||
{
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
/**
|
||||
* The current object being modifed / called
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $currentObject;
|
||||
|
||||
/**
|
||||
* The raw info array from Active Directory
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $info;
|
||||
|
||||
public function __construct($info, adLDAP $adldap)
|
||||
{
|
||||
$this->setInfo($info);
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the raw info array from Active Directory
|
||||
*
|
||||
* @param array $info
|
||||
*/
|
||||
public function setInfo(array $info)
|
||||
{
|
||||
if ($this->info && sizeof($info) >= 1) {
|
||||
unset($this->info);
|
||||
}
|
||||
$this->info = $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic get method to retrieve data from the raw array in a formatted way
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($attribute)
|
||||
{
|
||||
if (isset($this->info[0]) && is_array($this->info[0])) {
|
||||
foreach ($this->info[0] as $keyAttr => $valueAttr) {
|
||||
if (strtolower($keyAttr) == strtolower($attribute)) {
|
||||
if ($this->info[0][strtolower($attribute)]['count'] == 1) {
|
||||
return $this->info[0][strtolower($attribute)][0];
|
||||
}
|
||||
else {
|
||||
$array = array();
|
||||
foreach ($this->info[0][strtolower($attribute)] as $key => $value) {
|
||||
if ((string)$key != 'count') {
|
||||
$array[$key] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic set method to update an attribute
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function __set($attribute, $value);
|
||||
|
||||
/**
|
||||
* Magic isset method to check for the existence of an attribute
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($attribute) {
|
||||
if (isset($this->info[0]) && is_array($this->info[0])) {
|
||||
foreach ($this->info[0] as $keyAttr => $valueAttr) {
|
||||
if (strtolower($keyAttr) == strtolower($attribute)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage Collection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
abstract class adLDAPCollection
|
||||
{
|
||||
/**
|
||||
* The current adLDAP connection via dependency injection
|
||||
*
|
||||
* @var adLDAP
|
||||
*/
|
||||
protected $adldap;
|
||||
|
||||
/**
|
||||
* The current object being modifed / called
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $currentObject;
|
||||
|
||||
/**
|
||||
* The raw info array from Active Directory
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $info;
|
||||
|
||||
public function __construct($info, adLDAP $adldap)
|
||||
{
|
||||
$this->setInfo($info);
|
||||
$this->adldap = $adldap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the raw info array from Active Directory
|
||||
*
|
||||
* @param array $info
|
||||
*/
|
||||
public function setInfo(array $info)
|
||||
{
|
||||
if ($this->info && sizeof($info) >= 1) {
|
||||
unset($this->info);
|
||||
}
|
||||
$this->info = $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic get method to retrieve data from the raw array in a formatted way
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($attribute)
|
||||
{
|
||||
if (isset($this->info[0]) && is_array($this->info[0])) {
|
||||
foreach ($this->info[0] as $keyAttr => $valueAttr) {
|
||||
if (strtolower($keyAttr) == strtolower($attribute)) {
|
||||
if ($this->info[0][strtolower($attribute)]['count'] == 1) {
|
||||
return $this->info[0][strtolower($attribute)][0];
|
||||
}
|
||||
else {
|
||||
$array = array();
|
||||
foreach ($this->info[0][strtolower($attribute)] as $key => $value) {
|
||||
if ((string)$key != 'count') {
|
||||
$array[$key] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic set method to update an attribute
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function __set($attribute, $value);
|
||||
|
||||
/**
|
||||
* Magic isset method to check for the existence of an attribute
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($attribute) {
|
||||
if (isset($this->info[0]) && is_array($this->info[0])) {
|
||||
foreach ($this->info[0] as $keyAttr => $valueAttr) {
|
||||
if (strtolower($keyAttr) == strtolower($attribute)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage ComputerCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPComputerCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage ComputerCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPComputerCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage ContactCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPContactCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage ContactCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPContactCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage GroupCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPGroupCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage GroupCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPGroupCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage UserCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPUserCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 4.0.4
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
* Written by Scott Barnett, Richard Hyland
|
||||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @subpackage UserCollection
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 97 $
|
||||
* @version 4.0.4
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
class adLDAPUserCollection extends adLDAPCollection
|
||||
{
|
||||
|
||||
public function __set($attribute, $value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue