use ->server()

This commit is contained in:
Roland Gruber 2007-07-08 10:51:01 +00:00
parent 9bbe7bfd3e
commit f1dda8d924
21 changed files with 33 additions and 33 deletions

View File

@ -293,7 +293,7 @@ function search_domains() {
"sambaNextUserRid", "sambaAlgorithmicRidBase"); "sambaNextUserRid", "sambaAlgorithmicRidBase");
$sr = @ldap_search($_SESSION['ldap']->server(), $suffix, "objectClass=sambaDomain", $attr); $sr = @ldap_search($_SESSION['ldap']->server(), $suffix, "objectClass=sambaDomain", $attr);
if ($sr) { if ($sr) {
$units = ldap_get_entries($_SESSION['ldap']->server, $sr); $units = ldap_get_entries($_SESSION['ldap']->server(), $sr);
// delete count entry // delete count entry
unset($units['count']); unset($units['count']);
// extract attributes // extract attributes

View File

@ -277,7 +277,7 @@ class PlaLdapExporter extends PlaAbstractExporter{
$this->attributes = $attributes; $this->attributes = $attributes;
$this->ds = $_SESSION['ldap']->server; $this->ds = $_SESSION['ldap']->server();
// get the data to be exported // get the data to be exported
if( $this->scope == 'base' ) if( $this->scope == 'base' )

View File

@ -708,7 +708,7 @@ class lamList {
StatusMessage("WARN", _("LDAP sizelimit exceeded, not all entries are shown."), _("See README.openldap.txt to solve this problem.")); StatusMessage("WARN", _("LDAP sizelimit exceeded, not all entries are shown."), _("See README.openldap.txt to solve this problem."));
} }
if ($sr) { if ($sr) {
$info = ldap_get_entries($_SESSION["ldap"]->server, $sr); $info = ldap_get_entries($_SESSION["ldap"]->server(), $sr);
ldap_free_result($sr); ldap_free_result($sr);
// delete first array entry which is "count" // delete first array entry which is "count"
unset($info['count']); unset($info['count']);

View File

@ -1502,13 +1502,13 @@ class posixAccount extends baseModule {
// add users to groups // add users to groups
elseif ($temp['counter'] < sizeof($temp['groups'])) { elseif ($temp['counter'] < sizeof($temp['groups'])) {
if (isset($temp['dn'][$temp['groups'][$temp['counter']]])) { if (isset($temp['dn'][$temp['groups'][$temp['counter']]])) {
$success = @ldap_mod_add($_SESSION['ldap']->server, $temp['dn'][$temp['groups'][$temp['counter']]], array('memberUID' => $temp['members'][$temp['groups'][$temp['counter']]])); $success = @ldap_mod_add($_SESSION['ldap']->server(), $temp['dn'][$temp['groups'][$temp['counter']]], array('memberUID' => $temp['members'][$temp['groups'][$temp['counter']]]));
$errors = array(); $errors = array();
if (!$success) { if (!$success) {
$errors[] = array( $errors[] = array(
"ERROR", "ERROR",
_("LAM was unable to modify group memberships for group: %s"), _("LAM was unable to modify group memberships for group: %s"),
ldap_errno($_SESSION[ldap]->server) . ": " . ldap_error($_SESSION[ldap]->server), ldap_errno($_SESSION['ldap']->server()) . ": " . ldap_error($_SESSION['ldap']->server()),
array($temp['groups'][$temp['counter']]) array($temp['groups'][$temp['counter']])
); );
} }

View File

@ -1267,7 +1267,7 @@ class MatchingRuleUse extends SchemaItem
function _get_schema_dn($dn, $debug=false ) function _get_schema_dn($dn, $debug=false )
{ {
if( $debug ) echo "<pre>"; if( $debug ) echo "<pre>";
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$search = @ldap_read( $ds, $dn, 'objectClass=*', array( 'subschemaSubentry' ) ); $search = @ldap_read( $ds, $dn, 'objectClass=*', array( 'subschemaSubentry' ) );
if( $debug ) { echo "Search result (ldap_read): "; var_dump( $search ); echo "\n"; } if( $debug ) { echo "Search result (ldap_read): "; var_dump( $search ); echo "\n"; }
@ -1337,7 +1337,7 @@ function _get_raw_schema($schema_to_fetch, $dn='' )
// Swith to true to enable verbose output of schema fetching progress // Swith to true to enable verbose output of schema fetching progress
$debug = false; $debug = false;
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
// error checking // error checking
$schema_to_fetch = strtolower( $schema_to_fetch ); $schema_to_fetch = strtolower( $schema_to_fetch );

View File

@ -248,9 +248,9 @@ if ($_POST['delete']) {
*/ */
function getChildCount($dn) { function getChildCount($dn) {
$return = 0; $return = 0;
$sr = @ldap_search($_SESSION['ldap']->server, $dn, 'objectClass=*', array('dn'), 0); $sr = @ldap_search($_SESSION['ldap']->server(), $dn, 'objectClass=*', array('dn'), 0);
if ($sr) { if ($sr) {
$entries = ldap_get_entries($_SESSION['ldap']->server, $sr); $entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
$return = $entries['count'] - 1; $return = $entries['count'] - 1;
} }
return $return; return $return;
@ -264,9 +264,9 @@ function getChildCount($dn) {
*/ */
function deleteDN($dn) { function deleteDN($dn) {
$errors = array(); $errors = array();
$sr = @ldap_list($_SESSION['ldap']->server, $dn, 'objectClass=*', array('dn'), 0); $sr = @ldap_list($_SESSION['ldap']->server(), $dn, 'objectClass=*', array('dn'), 0);
if ($sr) { if ($sr) {
$entries = ldap_get_entries($_SESSION['ldap']->server, $sr); $entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
for ($i = 0; $i < $entries['count']; $i++) { for ($i = 0; $i < $entries['count']; $i++) {
// delete recursively // delete recursively
$subErrors = deleteDN($entries[$i]['dn']); $subErrors = deleteDN($entries[$i]['dn']);

View File

@ -54,8 +54,8 @@ if ($_POST['add_suff'] || $_POST['cancel']) {
// add entries // add entries
for ($i = 0; $i < sizeof($new_suff); $i++) { for ($i = 0; $i < sizeof($new_suff); $i++) {
// check if entry is already present // check if entry is already present
$info = @ldap_search($_SESSION['ldap']->server, $new_suff[$i], "", array()); $info = @ldap_search($_SESSION['ldap']->server(), $new_suff[$i], "", array());
$res = @ldap_get_entries($_SESSION['ldap']->server, $info); $res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
if ($res) continue; if ($res) continue;
$suff = $new_suff[$i]; $suff = $new_suff[$i];
// generate DN and attributes // generate DN and attributes
@ -96,8 +96,8 @@ if ($_POST['add_suff'] || $_POST['cancel']) {
// create missing entries // create missing entries
for ($k = sizeof($subsuffs) - 1; $k >= 0; $k--) { for ($k = sizeof($subsuffs) - 1; $k >= 0; $k--) {
// check if subsuffix is present // check if subsuffix is present
$info = @ldap_search($_SESSION['ldap']->server, $subsuffs[$k], "", array()); $info = @ldap_search($_SESSION['ldap']->server(), $subsuffs[$k], "", array());
$res = @ldap_get_entries($_SESSION['ldap']->server, $info); $res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
if (!$res) { if (!$res) {
$suffarray = explode(",", $subsuffs[$k]); $suffarray = explode(",", $subsuffs[$k]);
$headarray = explode("=", $suffarray[0]); $headarray = explode("=", $suffarray[0]);

View File

@ -77,9 +77,9 @@ else {
function search_username($name) { function search_username($name) {
$filter = "(uid=$name)"; $filter = "(uid=$name)";
$attrs = array(); $attrs = array();
$sr = @ldap_search($_SESSION['ldap']->server, $_SESSION['config']->get_Suffix('user'), $filter, $attrs); $sr = @ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_Suffix('user'), $filter, $attrs);
if ($sr) { if ($sr) {
$info = ldap_get_entries($_SESSION['ldap']->server, $sr); $info = ldap_get_entries($_SESSION['ldap']->server(), $sr);
// return only first DN entry // return only first DN entry
$ret = $info[0]["dn"]; $ret = $info[0]["dn"];
ldap_free_result($sr); ldap_free_result($sr);

View File

@ -49,8 +49,8 @@ $new_suffs = array();
// get list of active types // get list of active types
$types = $_SESSION['config']->get_ActiveTypes(); $types = $_SESSION['config']->get_ActiveTypes();
for ($i = 0; $i < sizeof($types); $i++) { for ($i = 0; $i < sizeof($types); $i++) {
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_Suffix($types[$i]), "(objectClass=*)", array('objectClass')); $info = @ldap_search($_SESSION['ldap']->server(), $conf->get_Suffix($types[$i]), "(objectClass=*)", array('objectClass'));
$res = @ldap_get_entries($_SESSION['ldap']->server, $info); $res = @ldap_get_entries($_SESSION['ldap']->server(), $info);
if (!$res && !in_array($conf->get_Suffix($types[$i]), $new_suffs)) $new_suffs[] = $conf->get_Suffix($types[$i]); if (!$res && !in_array($conf->get_Suffix($types[$i]), $new_suffs)) $new_suffs[] = $conf->get_Suffix($types[$i]);
} }

View File

@ -80,12 +80,12 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
$attrs = $accounts[$_SESSION['mass_counter']]; $attrs = $accounts[$_SESSION['mass_counter']];
$dn = $attrs['dn']; $dn = $attrs['dn'];
unset($attrs['dn']); unset($attrs['dn']);
$success = @ldap_add($_SESSION['ldap']->server, $dn, $attrs); $success = @ldap_add($_SESSION['ldap']->server(), $dn, $attrs);
if (!$success) { if (!$success) {
$errorMessage = array( $errorMessage = array(
"ERROR", "ERROR",
_("LAM was unable to create account %s! An LDAP error occured."), _("LAM was unable to create account %s! An LDAP error occured."),
ldap_errno($_SESSION[ldap]->server) . ": " . ldap_error($_SESSION[ldap]->server), ldap_errno($_SESSION['ldap']->server()) . ": " . ldap_error($_SESSION['ldap']->server()),
array($_SESSION['mass_counter'])); array($_SESSION['mass_counter']));
$_SESSION['mass_errors'][] = $errorMessage; $_SESSION['mass_errors'][] = $errorMessage;
$_SESSION['mass_failed'][] = $_SESSION['mass_counter']; $_SESSION['mass_failed'][] = $_SESSION['mass_counter'];

View File

@ -115,7 +115,7 @@ elseif (0 == strcasecmp( $attr , 'sambantpassword' )) {
$val = ntPassword($val); $val = ntPassword($val);
} }
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$new_entry = array( $attr => $val ); $new_entry = array( $attr => $val );
$result = @ldap_mod_add( $ds, $dn, $new_entry ); $result = @ldap_mod_add( $ds, $dn, $new_entry );

View File

@ -77,7 +77,7 @@ if( is_array( $new_attrs ) && count( $new_attrs ) > 0 )
$new_entry[ $attr ] = $val; $new_entry[ $attr ] = $val;
} }
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$add_res = @ldap_mod_add( $ds, $dn, $new_entry ); $add_res = @ldap_mod_add( $ds, $dn, $new_entry );
if( ! $add_res ) if( ! $add_res )

View File

@ -148,7 +148,7 @@ if( count( $needed_attrs ) > 0 )
} }
else else
{ {
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$add_res = @ldap_mod_add( $ds, $dn, array( 'objectClass' => $new_oclass ) ); $add_res = @ldap_mod_add( $ds, $dn, array( 'objectClass' => $new_oclass ) );
if( ! $add_res ) { if( ! $add_res ) {
echo $_SESSION['header']; echo $_SESSION['header'];

View File

@ -68,7 +68,7 @@ $encoded_attr = rawurlencode( $attr );
$new_value = $_POST['new_value']; $new_value = $_POST['new_value'];
$is_binary_val = isset( $_POST['binary'] ) ? true : false; $is_binary_val = isset( $_POST['binary'] ) ? true : false;
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
// special case for binary attributes: // special case for binary attributes:
// we must go read the data from the file. // we must go read the data from the file.

View File

@ -126,7 +126,7 @@ foreach( $new_entry as $attr => $vals ) {
//echo "<pre>"; var_dump( $new_dn );print_r( $new_entry ); echo "</pre>"; //echo "<pre>"; var_dump( $new_dn );print_r( $new_entry ); echo "</pre>";
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
// Check the user-defined custom call back first // Check the user-defined custom call back first
$add_result = @ldap_add( $ds, $new_dn, $new_entry ); $add_result = @ldap_add( $ds, $new_dn, $new_entry );

View File

@ -71,7 +71,7 @@ if( $template == 'custom' ) {
$template_id = $template; $template_id = $template;
$template = isset( $templates[$template] ) ? $templates[$template_id] : null; $template = isset( $templates[$template] ) ? $templates[$template_id] : null;
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
echo $_SESSION['header']; echo $_SESSION['header'];

View File

@ -66,7 +66,7 @@ echo "<body>";
$dn = $_POST['dn']; $dn = $_POST['dn'];
$encoded_dn = rawurlencode( $dn ); $encoded_dn = rawurlencode( $dn );
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$del_result = @ldap_delete( $ds, $dn ); $del_result = @ldap_delete( $ds, $dn );

View File

@ -62,7 +62,7 @@ $attr = $_POST['attr'];
$update_array = array(); $update_array = array();
$update_array[$attr] = array(); $update_array[$attr] = array();
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$res = @ldap_modify( $ds, $dn, $update_array ); $res = @ldap_modify( $ds, $dn, $update_array );
if( $res ) { if( $res ) {
$redirect_url = "edit.php?dn=$encoded_dn"; $redirect_url = "edit.php?dn=$encoded_dn";

View File

@ -60,7 +60,7 @@ $attr = $_GET['attr'];
// if there are multiple values in this attribute, which one do you want to see? // if there are multiple values in this attribute, which one do you want to see?
$value_num = isset( $_GET['value_num'] ) ? $_GET['value_num'] : 0; $value_num = isset( $_GET['value_num'] ) ? $_GET['value_num'] : 0;
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$search = @ldap_read( $ds, $dn, "(objectClass=*)", array($attr)); $search = @ldap_read( $ds, $dn, "(objectClass=*)", array($attr));
if( ! $search ) { if( ! $search ) {

View File

@ -65,7 +65,7 @@ $dn = $_POST['dn'];
$encoded_dn = rawurlencode( $dn ); $encoded_dn = rawurlencode( $dn );
$rdn = get_rdn( $dn ); $rdn = get_rdn( $dn );
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
echo "<body>\n"; echo "<body>\n";
echo "<h3 class=\"tree_title\">" . sprintf( _('Deleting %s'), htmlspecialchars($rdn) ) . "</h3>\n"; echo "<h3 class=\"tree_title\">" . sprintf( _('Deleting %s'), htmlspecialchars($rdn) ) . "</h3>\n";
@ -127,7 +127,7 @@ function pla_rdelete( $dn )
{ {
$children = get_container_contents( $dn ); $children = get_container_contents( $dn );
global $ds; global $ds;
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
if( ! is_array( $children ) || count( $children ) == 0 ) { if( ! is_array( $children ) || count( $children ) == 0 ) {
echo "<nobr>" . sprintf( _('Deleting %s'), htmlspecialchars( $dn ) ) . "..."; echo "<nobr>" . sprintf( _('Deleting %s'), htmlspecialchars( $dn ) ) . "...";

View File

@ -86,7 +86,7 @@ foreach( $update_array as $attr => $val )
} }
} }
$ds = $_SESSION['ldap']->server; $ds = $_SESSION['ldap']->server();
$res = @ldap_modify( $ds, $dn, $update_array ); $res = @ldap_modify( $ds, $dn, $update_array );
if( $res ) if( $res )
{ {