RELEASE 1.0.0
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.76.2.8 2007/01/27 13:21:35 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.78 2006/01/03 20:39:59 wurley Exp $
|
||||
|
||||
/**
|
||||
* Contains code to be executed at the top of each phpLDAPadmin page.
|
||||
@@ -29,6 +29,10 @@ ob_start();
|
||||
require_once realpath(LIBDIR.'functions.php');
|
||||
ob_end_clean();
|
||||
|
||||
# Turn on all notices and warnings. This helps us write cleaner code (we hope at least)
|
||||
if (phpversion() < 5)
|
||||
pla_error('Sorry, PLA is now a PHP5 application.<BR>For a PHP4 application, please use a 0.9.x version.');
|
||||
|
||||
/* Our custom error handler receives all error notices that pass the error_reporting()
|
||||
level set above. */
|
||||
set_error_handler('pla_error_handler');
|
||||
@@ -51,13 +55,7 @@ require_once realpath(LIBDIR.'config_default.php');
|
||||
ob_end_clean();
|
||||
|
||||
# We are now ready for error reporting.
|
||||
# Turn on all notices and warnings. This helps us write cleaner code (we hope at least)
|
||||
if (phpversion() >= '5') {
|
||||
# E_DEBUG is PHP5 specific and prevents warnings about using 'var' to declare class members
|
||||
error_reporting(E_DEBUG);
|
||||
} else
|
||||
# For PHP4
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_DEBUG);
|
||||
|
||||
/**
|
||||
* At this point we have read all our additional function PHP files and our configuration.
|
||||
@@ -107,7 +105,6 @@ if ($language == 'auto') {
|
||||
|
||||
# Set language
|
||||
putenv('LANG='.$HTTP_LANG); # e.g. LANG=de_DE
|
||||
$HTTP_LANG .= '.UTF-8';
|
||||
setlocale(LC_ALL,$HTTP_LANG); # set LC_ALL to de_DE
|
||||
bindtextdomain('messages',LANGDIR);
|
||||
bind_textdomain_codeset('messages','UTF-8');
|
||||
@@ -128,7 +125,6 @@ if ($language == 'auto') {
|
||||
|
||||
# Set language
|
||||
putenv('LANG='.$language); # e.g. LANG=de_DE
|
||||
$language .= '.UTF-8';
|
||||
setlocale(LC_ALL,$language); # set LC_ALL to de_DE
|
||||
bindtextdomain('messages',LANGDIR);
|
||||
bind_textdomain_codeset('messages','UTF-8');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.16.2.6 2007/01/27 13:25:49 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.17 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* Configuration processing and defaults.
|
||||
@@ -94,7 +94,7 @@ class Config {
|
||||
*/
|
||||
$this->default->appearance['obfuscate_password_display'] = array(
|
||||
'desc'=>'Obfuscate the display of passwords',
|
||||
'default'=>true);
|
||||
'default'=>false);
|
||||
|
||||
$this->default->appearance['show_clear_password'] = array(
|
||||
'desc'=>'Whether to show clear passwords if we dont obfuscate them',
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
$Id: createlm.php,v 1.2.2.1 2006/04/29 07:31:08 wurley Exp $
|
||||
$Id: createlm.php,v 1.2 2005/10/23 01:05:41 wurley Exp $
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
||||
Copyright (C) 2004 Roland Gruber
|
||||
@@ -133,14 +133,6 @@ var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5
|
||||
array( 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8),
|
||||
array( 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11)));
|
||||
|
||||
/**
|
||||
* Fixes too large numbers
|
||||
*/
|
||||
function x($i) {
|
||||
if ($i < 0) return 4294967296 - $i;
|
||||
else return $i;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer count
|
||||
* @param array $data
|
||||
@@ -343,11 +335,7 @@ var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5
|
||||
# Support functions
|
||||
# Ported from SAMBA/source/lib/md4.c:F,G and H respectfully
|
||||
function F($X, $Y, $Z) {
|
||||
$ret = (($X&$Y) | ((~((int)$X))&$Z));
|
||||
if ($this->x($ret) > 4294967296) {
|
||||
$ret = (2*4294967296) - $this->x($ret);
|
||||
}
|
||||
return $ret;
|
||||
return ($X&$Y) | ((~$X)&$Z);
|
||||
}
|
||||
|
||||
function G($X, $Y, $Z) {
|
||||
@@ -480,9 +468,6 @@ var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5
|
||||
$sum[1] &= 0xffff;
|
||||
$sum[0] &= 0xffff;
|
||||
$ret = ($sum[0]<<16) | $sum[1];
|
||||
if ($this->x($ret) > 4294967296) {
|
||||
$ret = (2*4294967296) - $this->x($ret);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -508,14 +493,7 @@ var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5
|
||||
# Renamed to prevent clash with SAMBA/source/libsmb/smbdes.c:lshift
|
||||
function md4lshift($x, $s) {
|
||||
$x &= 0xFFFFFFFF;
|
||||
if ($this->x($x) > 4294967296) {
|
||||
$x = (2*4294967296) - $this->x($x);
|
||||
}
|
||||
$ret = ((($x<<$s)&0xFFFFFFFF) | $this->unsigned_shift_r($x, (32-$s)));
|
||||
if ($this->x($ret) > 4294967296) {
|
||||
$ret = (2*4294967296) - $this->x($ret);
|
||||
}
|
||||
return $ret;
|
||||
return ((($x<<$s)&0xFFFFFFFF) | $this->unsigned_shift_r($x, (32-$s)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.32.2.10 2007/01/27 13:28:06 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.34 2005/12/17 00:00:12 wurley Exp $
|
||||
|
||||
/**
|
||||
* Fuctions and classes for exporting ldap entries to others formats
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.283.2.42 2008/11/28 14:21:37 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.290 2006/02/25 13:12:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* A collection of functions used throughout phpLDAPadmin.
|
||||
@@ -85,9 +85,6 @@ function pretty_print_dn( $dn ) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('pretty_print_dn(): Entered with (%s)',1,$dn);
|
||||
|
||||
if (! is_dn_string($dn))
|
||||
pla_error(sprintf(_('DN "%s" is not an LDAP distinguished name.'),htmlspecialchars($dn)));
|
||||
|
||||
$dn = pla_explode_dn( $dn );
|
||||
foreach( $dn as $i => $element ) {
|
||||
$element = htmlspecialchars($element);
|
||||
@@ -316,10 +313,6 @@ function pla_compare_dns($dn1,$dn2) {
|
||||
|
||||
$dn1_parts = pla_explode_dn(pla_reverse_dn($dn1));
|
||||
$dn2_parts = pla_explode_dn(pla_reverse_dn($dn2));
|
||||
|
||||
if (! $dn1_parts || ! $dn2_parts)
|
||||
return;
|
||||
|
||||
assert(is_array($dn1_parts));
|
||||
assert(is_array($dn2_parts));
|
||||
|
||||
@@ -424,16 +417,15 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid') {
|
||||
|
||||
if (is_null($base_dn))
|
||||
pla_error(sprintf(_('You specified the "auto_uid_number_mechanism" as "search" in your
|
||||
configuration for server <b>%s</b>, but you did not specify the
|
||||
"auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name));
|
||||
configuration for server <b>%s</b>, but you did not specify the
|
||||
"auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name));
|
||||
|
||||
} else {
|
||||
$base_dn = $startbase;
|
||||
}
|
||||
|
||||
if (! $ldapserver->dnExists($base_dn))
|
||||
pla_error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'),
|
||||
$ldapserver->name));
|
||||
pla_error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'),$ldapserver->name));
|
||||
|
||||
$filter = '(|(uidNumber=*)(gidNumber=*))';
|
||||
$results = array();
|
||||
@@ -505,8 +497,8 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid') {
|
||||
# No other cases allowed. The user has an error in the configuration
|
||||
default :
|
||||
pla_error( sprintf( _('You specified an invalid value for auto_uid_number_mechanism ("%s")
|
||||
in your configration. Only "uidpool" and "search" are valid.
|
||||
Please correct this problem.') , $mechanism) );
|
||||
in your configration. Only "uidpool" and "search" are valid.
|
||||
Please correct this problem.') , $mechanism) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1020,7 +1012,7 @@ function pla_error( $msg, $ldap_err_msg=null, $ldap_err_no=-1, $fatal=true ) {
|
||||
|
||||
?>
|
||||
<center>
|
||||
<table class="error"><tr><td class="img"><img src="images/warning.png" alt="Warning" /></td>
|
||||
<table class="error"><tr><td class="img"><img src="images/warning.png" /></td>
|
||||
<td><center><h2><?php echo _('Error');?></h2></center>
|
||||
<?php echo $msg; ?>
|
||||
<br />
|
||||
@@ -1093,16 +1085,15 @@ function pla_error( $msg, $ldap_err_msg=null, $ldap_err_no=-1, $fatal=true ) {
|
||||
*
|
||||
* @see set_error_handler
|
||||
*/
|
||||
function pla_error_handler($errno,$errstr,$file,$lineno) {
|
||||
function pla_error_handler( $errno, $errstr, $file, $lineno ) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('pla_error_handler(): Entered with (%s,%s,%s,%s)',1,$errno,$errstr,$file,$lineno);
|
||||
|
||||
/* error_reporting will be 0 if the error context occurred
|
||||
* within a function call with '@' preprended (ie, @ldap_bind() );
|
||||
* So, don't report errors if the caller has specifically
|
||||
* disabled them with '@'
|
||||
*/
|
||||
if (ini_get('error_reporting') == 0 || error_reporting() == 0)
|
||||
// error_reporting will be 0 if the error context occurred
|
||||
// within a function call with '@' preprended (ie, @ldap_bind() );
|
||||
// So, don't report errors if the caller has specifically
|
||||
// disabled them with '@'
|
||||
if( 0 == ini_get( 'error_reporting' ) || 0 == error_reporting() )
|
||||
return;
|
||||
|
||||
$file = basename( $file );
|
||||
@@ -1127,7 +1118,7 @@ function pla_error_handler($errno,$errstr,$file,$lineno) {
|
||||
|
||||
$errstr = preg_replace("/\s+/"," ",$errstr);
|
||||
if( $errno == E_NOTICE ) {
|
||||
echo sprintf(_('<center><table class=\'notice\'><tr><td colspan=\'2\'><center><img src=\'images/warning.png\' height=\'12\' width=\'13\' alt="Warning" />
|
||||
echo sprintf(_('<center><table class=\'notice\'><tr><td colspan=\'2\'><center><img src=\'images/warning.png\' height=\'12\' width=\'13\' />
|
||||
<b>You found a non-fatal phpLDAPadmin bug!</b></td></tr><tr><td>Error:</td><td><b>%s</b> (<b>%s</b>)</td></tr><tr><td>File:</td>
|
||||
<td><b>%s</b> line <b>%s</b>, caller <b>%s</b></td></tr><tr><td>Versions:</td><td>PLA: <b>%s</b>, PHP: <b>%s</b>, SAPI: <b>%s</b>
|
||||
</td></tr><tr><td>Web server:</td><td><b>%s</b></td></tr>
|
||||
@@ -1222,8 +1213,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu
|
||||
if (isset($table_html_attrs) && trim($table_html_attrs) )
|
||||
printf('<table %s><tr><td><center>',$table_html_attrs);
|
||||
|
||||
$jpeg_data = $ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base');
|
||||
$jpeg_data = array_pop($jpeg_data);
|
||||
$jpeg_data = array_pop($ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base'));
|
||||
if (! $jpeg_data) {
|
||||
printf(_('Could not fetch jpeg data from LDAP server for attribute %s.'),htmlspecialchars($attr_name));
|
||||
return;
|
||||
@@ -1272,7 +1262,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu
|
||||
$img_height = $height;
|
||||
}
|
||||
|
||||
printf('<img %s%s%s src="view_jpeg_photo.php?file=%s" alt="Photo" /><br />',
|
||||
printf('<img %s%s%s src="view_jpeg_photo.php?file=%s" /><br />',
|
||||
($fixed_width ? '' : 'width="'.$img_width.'" '),
|
||||
($fixed_height ? '' : 'height="'.$img_height.'"'),
|
||||
($img_html_attrs ? $img_html_attrs : ''),basename($jpeg_filename));
|
||||
@@ -1647,7 +1637,7 @@ function draw_chooser_link( $form_element, $include_choose_text=true, $rdn="none
|
||||
|
||||
$title = _('Click to popup a dialog to select an entry (DN) graphically');
|
||||
|
||||
printf('<a href="%s" title="%s"><img class="chooser" src="images/find.png" alt="Find" /></a>',$href,$title);
|
||||
printf('<a href="%s" title="%s"><img class="chooser" src="images/find.png" /></a>',$href,$title);
|
||||
if ($include_choose_text)
|
||||
printf('<span class="x-small"><a href="%s" title="%s">%s</a></span>',$href,$title,_('browse'));
|
||||
}
|
||||
@@ -1669,8 +1659,6 @@ function draw_chooser_link( $form_element, $include_choose_text=true, $rdn="none
|
||||
* </code>
|
||||
*/
|
||||
function pla_explode_dn($dn,$with_attributes=0) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('pla_explode_dn(): Entered with (%s,%s)',1,$dn,$with_attributes);
|
||||
$dn = addcslashes(dn_escape($dn),'<>');
|
||||
|
||||
# split the dn
|
||||
@@ -1692,41 +1680,17 @@ function pla_explode_dn($dn,$with_attributes=0) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a DN and escape any special characters (rfc2253)
|
||||
* Parse a DN and escape any special characters
|
||||
*/
|
||||
function dn_escape($dn) {
|
||||
$olddn = $dn;
|
||||
#
|
||||
# http://rfc.net/rfc2253.html
|
||||
# special = '"' / "," / "=" / "+" / "<" / ">" / "#" / ";"
|
||||
# Check if the RDN has special chars escape them.
|
||||
# - only simplest cases are dealt with
|
||||
# TODO: '=' unhandled
|
||||
# ';' may be used instead of ',' but its use is discouraged
|
||||
while (preg_match('/([^\\\\])[;,](\s*[^=]*\s*)([;,]|$)/',$dn)) {
|
||||
$dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([;,]|$)/','$1\\\\2c$2$3',$dn);
|
||||
$dn = preg_replace('/([^\\\\]);(\s*[^=]*\s*)([;,]|$)/','$1\\\\3b$2$3',$dn);
|
||||
}
|
||||
$dn = preg_replace('/([^\\\\])\+/','$1\\\\2b',$dn);
|
||||
$dn = preg_replace('/([^\\\\])"/','$1\\\\22',$dn);
|
||||
$dn = preg_replace('/([^\\\\])#([^0-9a-f]|$)/i','$1\\\\23$2',$dn);
|
||||
$dn = preg_replace('/([^\\\\])>/','$1\\\\3e',$dn);
|
||||
$dn = preg_replace('/([^\\\\])</','$1\\\\3c',$dn);
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('dn_escape(): Entered with (%s), Returning (%s)',1,$olddn,$dn);
|
||||
# Check if the RDN has a comma and escape it.
|
||||
while (preg_match('/([^\\\\]),(\s*[^=]*\s*),/',$dn))
|
||||
$dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*),/','$1\\\\2C$2,',$dn);
|
||||
|
||||
return $dn;
|
||||
}
|
||||
$dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',$dn);
|
||||
|
||||
/**
|
||||
* Parse a DN and escape any special characters for use in javascript selection
|
||||
*/
|
||||
function dn_js_escape($dn) {
|
||||
$olddn = $dn;
|
||||
#
|
||||
$dn = preg_replace('/([^\\\\])\'/','$1\\\\\'',$dn);
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('dn_js_escape(): Entered with (%s), Returning (%s)',1,$olddn,$dn);
|
||||
debug_log('dn_escape(): Entered with (%s), Returning (%s)',1,$dn,$dn);
|
||||
|
||||
return $dn;
|
||||
}
|
||||
@@ -1748,7 +1712,7 @@ function dn_unescape($dn) {
|
||||
*/
|
||||
function get_href($type,$extra_info='') {
|
||||
$sf = 'https://sourceforge.net';
|
||||
$pla = 'http://wiki.phpldapadmin.info';
|
||||
$pla = 'http://wiki.pldapadmin.com';
|
||||
$group_id = '61828';
|
||||
$bug_atid = '498546';
|
||||
$rfe_atid = '498549';
|
||||
@@ -1861,7 +1825,6 @@ function pla_reverse_dn($dn) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('pla_reverse_dn(): Entered with (%s)',1,$dn);
|
||||
|
||||
$rev = '';
|
||||
foreach (pla_explode_dn($dn) as $key => $branch) {
|
||||
|
||||
// pla_expode_dn returns the array with an extra count attribute, we can ignore that.
|
||||
@@ -2301,8 +2264,8 @@ function shadow_date( $attrs, $attr) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('shadow_date(): Entered with (%s,%s)',1,$attrs,$attr);
|
||||
|
||||
$shadowLastChange = isset($attrs['shadowLastChange']) ? $attrs['shadowLastChange'] : null;
|
||||
$shadowMax = isset($attrs['shadowMax']) ? $attrs['shadowMax'] : null;
|
||||
$shadowLastChange = isset($attrs['shadowLastChange']) ? $attrs['shadowLastChange'][0] : null;
|
||||
$shadowMax = isset($attrs['shadowMax']) ? $attrs['shadowMax'][0] : null;
|
||||
|
||||
if( 0 == strcasecmp( $attr, 'shadowLastChange' ) && $shadowLastChange)
|
||||
$shadow_date = $shadowLastChange;
|
||||
@@ -2538,20 +2501,6 @@ function binSIDtoText($binsid) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (! function_exists('session_cache_expire')) {
|
||||
|
||||
/**
|
||||
* session_cache_expire is a php 4.2.0 function, we'll emulate it if we are using php <4.2.0
|
||||
*/
|
||||
|
||||
function session_cache_expire() {
|
||||
if (defined('DEBUG_ENABLED') && (DEBUG_ENABLED))
|
||||
debug_log('session_cache_expire(): Entered with ()',1);
|
||||
|
||||
return 180;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort a multi dimensional array.
|
||||
* @param array $data Multi demension array passed by reference
|
||||
@@ -2710,7 +2659,7 @@ function password_generate() {
|
||||
$leftover = array_merge($leftover,$llower,$lupper,$numbers,$punc);
|
||||
|
||||
shuffle($leftover);
|
||||
$outarray = array_merge($outarray, a_array_rand($leftover,$length-$num_spec));
|
||||
$outarray = array_merge($outarray, a_array_rand($leftover, $criteria['num'] - $num_spec));
|
||||
}
|
||||
|
||||
shuffle($outarray);
|
||||
@@ -2834,7 +2783,7 @@ function draw_date_selector_link( $attr ) {
|
||||
|
||||
$href = "javascript:dateSelector('$attr');";
|
||||
$title = _('Click to popup a dialog to select a date graphically');
|
||||
printf('<a href="%s" title="%s"><img class="chooser" src="images/calendar.png" id="f_trigger_%s" style="cursor: pointer;" alt="Calendar" /></a>',$href,$title,$attr);
|
||||
printf('<a href="%s" title="%s"><img class="chooser" src="images/calendar.png" id="f_trigger_%s" style="cursor: pointer;" /></a>',$href,$title,$attr);
|
||||
}
|
||||
|
||||
function no_expire_header() {
|
||||
@@ -2844,14 +2793,4 @@ function no_expire_header() {
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
}
|
||||
|
||||
/**
|
||||
* This is for Opera. By putting "random junk" in the query string, it thinks
|
||||
* that it does not have a cached version of the page, and will thus
|
||||
* fetch the page rather than display the cached version
|
||||
*/
|
||||
function random_junk() {
|
||||
$time = gettimeofday();
|
||||
return md5(strtotime('now').$time['usec']);
|
||||
}
|
||||
?>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.6.4.2 2007/01/27 13:53:20 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.7 2006/02/25 13:12:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* Functions related to hooks management.
|
||||
@@ -171,13 +171,13 @@ function clear_hooks ( $hook_name ) {
|
||||
}
|
||||
|
||||
/* Evaluating user-made hooks */
|
||||
if (is_dir(HOOKSDIR)) {
|
||||
$dir = dir(HOOKSDIR);
|
||||
if ( is_dir(HOOKSDIR) ) {
|
||||
$dir = dir (HOOKSDIR);
|
||||
|
||||
while (false !== ($entry = $dir->read())) {
|
||||
$filename = sprintf('%s/%s',HOOKSDIR,$entry);
|
||||
if (is_file($filename) and eregi('php[0-9]?$',$entry))
|
||||
require_once "hooks/$entry";
|
||||
while (false !== ($entry = $dir -> read() ) ) {
|
||||
if ( is_file ("hooks/$entry") and eregi ('php[0-9]?$', $entry) ) {
|
||||
require_once "hooks/$entry";
|
||||
}
|
||||
}
|
||||
|
||||
$dir -> close();
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/ldif_functions.php,v 1.27.2.3 2005/12/10 08:25:32 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/ldif_functions.php,v 1.28 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* @todo put the display_parse_error method in ldif_import here
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/schema_functions.php,v 1.88.2.6 2006/03/08 08:22:56 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/schema_functions.php,v 1.90 2006/01/03 20:39:59 wurley Exp $
|
||||
|
||||
/**
|
||||
* Classes and functions for fetching and parsing schema from an LDAP server.
|
||||
@@ -145,7 +145,6 @@ class ObjectClass extends SchemaItem {
|
||||
|
||||
/**
|
||||
* Creates a new ObjectClass object given a raw LDAP objectClass string.
|
||||
* @todo: Unfortunately, some schemas are not well defined - eg: dNSDomain. Where the schema definition is not case consistent with the attribute definitions. This causes us some problems, which we need to resolve.
|
||||
*/
|
||||
function ObjectClass($raw_ldap_schema_string,$ldapserver) {
|
||||
if (DEBUG_ENABLED)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.23.2.3 2006/10/28 05:56:56 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.24 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
@@ -87,12 +87,6 @@ if( isset( $base_dn_does_not_exist ) && $base_dn_does_not_exist )
|
||||
join(', ',$config->GetValue('search','result_attributes')); ?>" />
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><small><acronym title="<?php echo htmlspecialchars(_('Order by').'...'); ?>">
|
||||
<?php echo _('Order by'); ?></acronym></small></td>
|
||||
|
||||
<td><input type="text" name="orderby" id="orderby" style="width: 200px" value="<?php echo $filter ? htmlspecialchars($orderby) : ''; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><br /><center><input type="submit" value="<?php echo _('Search'); ?>" /></center></td>
|
||||
</tr>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.8.4.2 2005/12/08 12:06:58 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.9 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_simple.php,v 1.14.4.4 2005/12/09 14:31:27 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_simple.php,v 1.15 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_list.php,v 1.5.4.4 2005/12/09 14:31:27 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_list.php,v 1.6 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_table.php,v 1.7.4.5 2005/12/09 14:31:27 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_table.php,v 1.8 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* Incoming variables (among others)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.34.2.33 2008/11/28 14:21:37 wurley Exp $ */
|
||||
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.44 2006/02/25 14:04:12 wurley Exp $ */
|
||||
|
||||
/**
|
||||
* Classes and functions for LDAP server configuration and capability
|
||||
@@ -26,6 +26,16 @@ class LDAPserver {
|
||||
var $login_dn;
|
||||
/** Server Authentication Password as defined in config.php */
|
||||
var $login_pass;
|
||||
|
||||
/** SASL auth */
|
||||
var $sasl_auth = false;
|
||||
var $sasl_mech = "PLAIN";
|
||||
var $sasl_realm = "";
|
||||
var $sasl_authz_id = "";
|
||||
var $sasl_authz_id_regex = null;
|
||||
var $sasl_authz_id_replacement = null;
|
||||
var $sasl_props = null;
|
||||
|
||||
/** Array of our connections to this LDAP server */
|
||||
var $connections = array();
|
||||
/** Server Base Dn */
|
||||
@@ -148,7 +158,7 @@ class LDAPserver {
|
||||
|
||||
# Quick return if we have already connected.
|
||||
$resource = $this->_connect($connect_id);
|
||||
if (is_resource($resource) && ! $reconnect)
|
||||
if ($resource && ! $reconnect)
|
||||
return $resource;
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
@@ -204,6 +214,20 @@ class LDAPserver {
|
||||
}
|
||||
}
|
||||
|
||||
# SASL auth
|
||||
if ($this->sasl_auth) {
|
||||
$this->connections[$connect_id]['sasl_auth'] = true;
|
||||
$this->connections[$connect_id]['sasl_mech'] = $this->sasl_mech;
|
||||
$this->connections[$connect_id]['sasl_realm'] = $this->sasl_realm;
|
||||
$this->connections[$connect_id]['sasl_authz_id'] = $this->sasl_authz_id;
|
||||
$this->connections[$connect_id]['sasl_authz_id_regex'] = $this->sasl_authz_id_regex;
|
||||
$this->connections[$connect_id]['sasl_authz_id_replacement'] = $this->sasl_authz_id_replacement;
|
||||
$this->connections[$connect_id]['sasl_props'] = $this->sasl_props;
|
||||
|
||||
} else {
|
||||
$this->connections[$connect_id]['sasl_auth'] = false;
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::connect(): Config settings, DN [%s], PASS [%s]',80,
|
||||
get_class($this),$this->connections[$connect_id]['login_dn'],
|
||||
@@ -219,7 +243,7 @@ class LDAPserver {
|
||||
|
||||
# Now that we have worked out the connect_id, lets just check and see if we have already connected.
|
||||
$resource = $this->_connect($connect_id);
|
||||
if (is_resource($resource) && ! $reconnect)
|
||||
if ($resource && ! $reconnect)
|
||||
return $resource;
|
||||
|
||||
run_hook('pre_connect',array('server_id'=>$this->server_id,'connect_id'=>$connect_id));
|
||||
@@ -247,8 +271,68 @@ class LDAPserver {
|
||||
@ldap_start_tls($resource) or pla_error(_('Could not start TLS. Please check your LDAP server configuration.'),ldap_error($resource));
|
||||
}
|
||||
|
||||
$bind_result = @ldap_bind($resource,$this->connections[$connect_id]['login_dn'],
|
||||
$this->connections[$connect_id]['login_pass']);
|
||||
$bind_result = false;
|
||||
|
||||
/**
|
||||
* Implementation of SASL ldap_bind()
|
||||
* This option requires PHP 5.x compiled with --with-ldap-sasl=DIR
|
||||
*/
|
||||
if (isset($this->connections[$connect_id]['sasl_auth']) && # admin marked this server to use SASL auth
|
||||
$this->connections[$connect_id]['sasl_auth'] == true) {
|
||||
|
||||
# No support for ldap_sasl_bind?
|
||||
if (! function_exists('ldap_sasl_bind'))
|
||||
pla_error(_('Your PHP installation does not support ldap_sasl_bind() function. This function is present in PHP 5.x when compiled with --with-ldap-sasl.'));
|
||||
|
||||
# Fill variables
|
||||
$props = $this->connections[$connect_id]['sasl_props'];
|
||||
$mech = $this->connections[$connect_id]['sasl_mech'];
|
||||
$realm = $this->connections[$connect_id]['sasl_realm'];
|
||||
$authz_id = null;
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::connect(): Resource [%s], Using SASL bind method. Bind DN [%s]',9,
|
||||
get_class($this),$resource,$this->connections[$connect_id]['login_dn']);
|
||||
|
||||
# do we need to rewrite authz_id?
|
||||
if (isset($this->connections[$connect_id]['sasl_authz_id']) &&
|
||||
strlen($this->connections[$connect_id]['sasl_authz_id']) > 0)
|
||||
|
||||
$authz_id = $this->connections[$connect_id]['sasl_authz_id'];
|
||||
|
||||
else {
|
||||
|
||||
# ok, here we go
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::connect(): Resource [%s], Rewriting bind DN [%s] -> authz_id with regex [%s] and replacement [%s].',9,
|
||||
get_class($this),$resource,$this->connections[$connect_id]['login_dn'],
|
||||
$this->connections[$connect_id]['sasl_authz_id_regex'],
|
||||
$this->connections[$connect_id]['sasl_authz_id_replacement']);
|
||||
|
||||
$authz_id = @preg_replace($this->connections[$connect_id]['sasl_authz_id_regex'],
|
||||
$this->connections[$connect_id]['sasl_authz_id_replacement'],
|
||||
$this->connections[$connect_id]['login_dn']);
|
||||
|
||||
# invalid regex?
|
||||
if (is_null($authz_id)) {
|
||||
pla_error(sprintf(_('It seems that sasl_authz_id_regex "%s"." contains invalid PCRE regular expression.'),
|
||||
$this->connections[$connect_id]['sasl_authz_id_regex']).
|
||||
((isset($php_errormsg)) ? ' Error message: '.$php_errormsg : ''));
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::connect(): Resource [%s], SASL OPTIONS: mech [%s], realm [%s], authz_id [%s], props [%s]',9,
|
||||
get_class($this),$resource,$mech,$realm,$authz_id,$props);
|
||||
|
||||
$bind_result = @ldap_sasl_bind($resource,
|
||||
$this->connections[$connect_id]['login_dn'],$this->connections[$connect_id]['login_pass'],
|
||||
$mech,$realm,$authz_id,$props);
|
||||
|
||||
} else {
|
||||
$bind_result = @ldap_bind($resource,$this->connections[$connect_id]['login_dn'],
|
||||
$this->connections[$connect_id]['login_pass']);
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::connect(): Resource [%s], Bind Result [%s]',16,get_class($this),$resource,$bind_result);
|
||||
@@ -335,8 +419,7 @@ class LDAPserver {
|
||||
debug_log('%s::getBaseDN(): Connect to LDAP to find BaseDN',80,get_class($this));
|
||||
|
||||
if ($this->connect()) {
|
||||
$r = $this->search(null,'','objectClass=*',array('namingContexts'),'base');
|
||||
$r = array_pop($r);
|
||||
$r = array_pop($this->search(null,'','objectClass=*',array('namingContexts'),'base'));
|
||||
if (is_array($r))
|
||||
$r = array_change_key_case($r);
|
||||
|
||||
@@ -1671,13 +1754,13 @@ class LDAPserver {
|
||||
* @param array $attrs An array of attributes to include in the search result (example: array( "objectClass", "uid", "sn" )).
|
||||
* @param string $scope The LDAP search scope. Must be one of "base", "one", or "sub". Standard LDAP search scope.
|
||||
* @param bool $sort_results Specify false to not sort results by DN or true to have the
|
||||
* returned array sorted by DN (uses ksort)
|
||||
* returned array sorted by DN (uses ksort)
|
||||
* @param int $deref When handling aliases or referrals, this specifies whether to follow referrals. Must be one of
|
||||
* LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, or LDAP_DEREF_FINDING. See the PHP LDAP API for details.
|
||||
* LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, or LDAP_DEREF_FINDING. See the PHP LDAP API for details.
|
||||
* @param int $size_limit Size limit for search
|
||||
* @todo: Add entries to tree cache.
|
||||
*/
|
||||
function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=false,$deref=LDAP_DEREF_NEVER,$size_limit=0) {
|
||||
function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=true,$deref=LDAP_DEREF_NEVER,$size_limit=0) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::search(): Entered with (%s,%s,%s,%s,%s,%s,%s)',17,
|
||||
get_class($this),is_resource($this),$base_dn,$filter,$attrs,$scope,$sort_results,$deref);
|
||||
@@ -1698,16 +1781,16 @@ class LDAPserver {
|
||||
|
||||
switch ($scope) {
|
||||
case 'base':
|
||||
$search = @ldap_read($resource,dn_escape($base_dn),$filter,$attrs,0,$size_limit,0,$deref);
|
||||
$search = @ldap_read($resource,$base_dn,$filter,$attrs,0,$size_limit,0,$deref);
|
||||
break;
|
||||
|
||||
case 'one':
|
||||
$search = @ldap_list($resource,dn_escape($base_dn),$filter,$attrs,0,$size_limit,0,$deref);
|
||||
$search = @ldap_list($resource,$base_dn,$filter,$attrs,0,$size_limit,0,$deref);
|
||||
break;
|
||||
|
||||
case 'sub':
|
||||
default:
|
||||
$search = @ldap_search($resource,dn_escape($base_dn),$filter,$attrs,0,$size_limit,0,$deref);
|
||||
$search = @ldap_search($resource,$base_dn,$filter,$attrs,0,$size_limit,0,$deref);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1720,10 +1803,6 @@ class LDAPserver {
|
||||
|
||||
$return = array();
|
||||
|
||||
if ($sort_results && is_array($return))
|
||||
if (version_compare(phpversion(),'4.2.0','>='))
|
||||
ldap_sort($resource, $search,$sort_results);
|
||||
|
||||
# Get the first entry identifier
|
||||
if ($entry_id = ldap_first_entry($resource,$search))
|
||||
|
||||
@@ -1763,6 +1842,8 @@ class LDAPserver {
|
||||
|
||||
} # End while entry_id
|
||||
|
||||
if ($sort_results && is_array($return))
|
||||
ksort($return);
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::search(): Returning (%s)',17,get_class($this),$return);
|
||||
@@ -2253,7 +2334,7 @@ class LDAPserver {
|
||||
*/
|
||||
function getLoggedInPass() {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::getLoggedInPass(): Entered with ()',17,get_class($this));
|
||||
debug_log('%s:getLoggedInPass(): Entered with ()',17,get_class($this));
|
||||
|
||||
if (! $this->auth_type)
|
||||
return false;
|
||||
@@ -2306,9 +2387,6 @@ class LDAPserver {
|
||||
# Set default return
|
||||
$return = false;
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::getLoggedInDN(): auth_type is [%s]',66,get_class($this),$this->auth_type);
|
||||
|
||||
if ($this->auth_type) {
|
||||
switch ($this->auth_type) {
|
||||
case 'cookie':
|
||||
@@ -2341,7 +2419,7 @@ class LDAPserver {
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('%s::getLoggedInDN(): Entered with (), Returning (%s)',17,get_class($this),$return);
|
||||
debug_log('%s:getLoggedInDN(): Entered with (), Returning (%s)',17,get_class($this),$return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
@@ -2443,8 +2521,7 @@ class LDAPserver {
|
||||
debug_log('%s:getDNAttrs(): Entered with (%s,%s,%s)',17,
|
||||
get_class($this),$dn,$lower_case_attr_names,$deref);
|
||||
|
||||
$attrs = $this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref);
|
||||
$attrs = array_pop($attrs);
|
||||
$attrs = array_pop($this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref));
|
||||
|
||||
if (is_array($attrs)) {
|
||||
if ($lower_case_attr_names)
|
||||
@@ -2944,6 +3021,40 @@ class LDAPservers {
|
||||
'desc'=>'Path to custom pages',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->server['sasl_auth'] = array(
|
||||
'desc' => 'Use SASL authentication when binding LDAP server',
|
||||
'var' => 'sasl_auth',
|
||||
'default' => false);
|
||||
|
||||
$this->default->server['sasl_mech'] = array(
|
||||
'desc' => 'SASL mechanism used while binding LDAP server',
|
||||
'var' => 'sasl_mech',
|
||||
'default' => 'PLAIN');
|
||||
|
||||
$this->default->server['sasl_realm'] = array(
|
||||
'desc' => 'SASL realm name',
|
||||
'var' => 'sasl_realm',
|
||||
'default' => '');
|
||||
|
||||
$this->default->server['sasl_authz_id'] = array(
|
||||
'desc' => 'SASL authorization id',
|
||||
'var' => 'sasl_authz_id',
|
||||
'default' => '');
|
||||
|
||||
$this->default->server['sasl_authz_id_regex'] = array(
|
||||
'desc' => 'SASL authorization id PCRE regular expression',
|
||||
'var' => 'sasl_authz_id_regex',
|
||||
'default' => null);
|
||||
|
||||
$this->default->server['sasl_authz_id_replacement'] = array(
|
||||
'desc' => 'SASL authorization id PCRE regular expression replacement string',
|
||||
'var' => 'sasl_authz_id_replacement',
|
||||
'default' => null);
|
||||
|
||||
$this->default->server['sasl_props'] = array(
|
||||
'desc' => 'SASL properties',
|
||||
'var' => 'sasl_props',
|
||||
'default' => null);
|
||||
}
|
||||
|
||||
function SetValue($server_id,$key,$index,$value) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/session_functions.php,v 1.16.2.1 2005/12/31 03:06:15 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/session_functions.php,v 1.17 2006/01/03 20:39:59 wurley Exp $
|
||||
|
||||
/**
|
||||
* A collection of functions to handle sessions throughout phpLDAPadmin.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/syslog.php,v 1.11.4.1 2005/12/09 14:32:13 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/syslog.php,v 1.12 2005/12/10 10:34:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* Functions related to syslog logging.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.29.2.20 2007/03/21 23:12:03 wurley Exp $ */
|
||||
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.34 2006/02/25 12:47:57 wurley Exp $ */
|
||||
|
||||
/**
|
||||
* Classes and functions for the template engine.ation and capability
|
||||
@@ -464,7 +464,7 @@ class Templates {
|
||||
U: Make the result upper case.
|
||||
*/
|
||||
case 'autoFill' :
|
||||
list($attr,$string) = preg_split('(([^,]+),(.*))',$arg,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
list($attr,$string) = split(',',$arg);
|
||||
preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%/U',$string,$matchall);
|
||||
//print"<PRE>";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod
|
||||
|
||||
@@ -670,7 +670,7 @@ class Templates {
|
||||
|
||||
else
|
||||
# @todo: Enable size and width configuration in template
|
||||
$html = sprintf('<input type="text" name="%s" size="8" />',$id);
|
||||
$html = sprintf('<input type="text" name="%s" size="8">',$id);
|
||||
|
||||
} else {
|
||||
if (is_array($helper)) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/timeout_functions.php,v 1.6.2.5 2005/12/31 03:06:15 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/timeout_functions.php,v 1.9 2006/01/03 20:39:59 wurley Exp $
|
||||
|
||||
/**
|
||||
* A collection of functions used throughout phpLDAPadmin for the timeout and automatic logout feature
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Attic/tree_functions.php,v 1.20.2.23 2007/03/18 03:21:18 wurley Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/tree_functions.php,v 1.23 2006/01/03 20:39:59 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
@@ -39,13 +39,13 @@ function draw_server_tree() {
|
||||
echo '<tr class="server">';
|
||||
printf('<td class="icon"><img src="images/server.png" alt="%s" /></td>',_('Server'));
|
||||
printf('<td colspan="99"><a name="%s"></a>',$ldapserver->server_id);
|
||||
printf('<span style="white-space: nowrap;">%s ',htmlspecialchars($ldapserver->name));
|
||||
printf('<nobr>%s ',htmlspecialchars($ldapserver->name));
|
||||
|
||||
if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config')
|
||||
printf('<acronym title="%s"><img width=14 height=14 src="images/timeout.png" alt="timeout" /></acronym>',
|
||||
sprintf(_('Inactivity will log you off at %s'),strftime('%H:%M',time()+($ldapserver->session_timeout*60))));
|
||||
|
||||
echo '</span></td></tr>';
|
||||
echo '</nobr></td></tr>';
|
||||
|
||||
/* do we have what it takes to authenticate here, or do we need to
|
||||
present the user with a login link (for 'cookie' and 'session' auth_types)? */
|
||||
@@ -62,7 +62,7 @@ function draw_server_tree() {
|
||||
|
||||
# Draw the quick-links below the server name:
|
||||
echo '<tr><td colspan="100" class="links">';
|
||||
echo '<span style="white-space: nowrap;">';
|
||||
echo '<nobr>';
|
||||
echo '( ';
|
||||
printf('<a title="%s %s" href="%s">%s</a> | ',_('View schema for'),$ldapserver->name,$schema_href,_('schema'));
|
||||
printf('<a title="%s %s" href="%s">%s</a> | ',_('search'),$ldapserver->name,$search_href,_('search'));
|
||||
@@ -74,11 +74,11 @@ function draw_server_tree() {
|
||||
if ($ldapserver->auth_type != 'config')
|
||||
printf(' | <a title="%s" href="%s" target="right_frame">%s</a>',_('Logout of this server'),$logout_href,_('logout'));
|
||||
|
||||
echo ' )</span></td></tr>';
|
||||
echo ' )</nobr></td></tr>';
|
||||
|
||||
if ($ldapserver->auth_type != 'config') {
|
||||
$logged_in_dn = $ldapserver->getLoggedInDN();
|
||||
echo '<tr><td class="links" colspan="100"><span style="white-space: nowrap;">'._('Logged in as: ');
|
||||
echo '<tr><td class="links" colspan="100"><nobr>'._('Logged in as: ');
|
||||
|
||||
if ($ldapserver->getDNBase($logged_in_dn) == $logged_in_dn) {
|
||||
$logged_in_branch = '';
|
||||
@@ -86,12 +86,10 @@ function draw_server_tree() {
|
||||
|
||||
} else {
|
||||
$logged_in_branch = preg_replace('/,'.$ldapserver->getDNBase($logged_in_dn).'$/','',$logged_in_dn);
|
||||
$logged_in_dn_array = pla_explode_dn($logged_in_branch);
|
||||
$logged_in_dn_array = explode(',',$logged_in_branch);
|
||||
}
|
||||
|
||||
$bases = $ldapserver->getDNBase($logged_in_dn);
|
||||
if (is_array($bases) && count($bases))
|
||||
$logged_in_dn_array[] = $bases;
|
||||
$logged_in_dn_array[] = $ldapserver->getDNBase($logged_in_dn);
|
||||
|
||||
$rdn = $logged_in_dn;
|
||||
|
||||
@@ -110,11 +108,11 @@ function draw_server_tree() {
|
||||
} else
|
||||
echo 'Anonymous';
|
||||
|
||||
echo '</span></td></tr>';
|
||||
echo '</nobr></td></tr>';
|
||||
}
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
printf('<tr><td class="links" colspan="100"><span style="white-space: nowrap;">(%s)</span></td></tr>',_('read only'));
|
||||
printf('<tr><td class="links" colspan="100"><nobr>(%s)</nobr></td></tr>',_('read only'));
|
||||
|
||||
$javascript_forms = '';
|
||||
$javascript_id = 0;
|
||||
@@ -192,6 +190,9 @@ function draw_server_tree() {
|
||||
|
||||
$icon = isset($tree['browser'][$base_dn]['icon']) ? $tree['browser'][$base_dn]['icon'] : get_icon($ldapserver,$base_dn);
|
||||
|
||||
# Shall we draw the "mass-delete" checkbox?
|
||||
if ($ldapserver->isMassDeleteEnabled())
|
||||
printf('<td><input type="checkbox" name="mass_delete[%s]" /></td>',htmlspecialchars($base_dn));
|
||||
|
||||
if ($config->GetValue('appearance','tree_plm')) {
|
||||
$tree_plm .= sprintf(".|%s|%s|%s|%s|%s|%s\n",
|
||||
@@ -199,19 +200,14 @@ function draw_server_tree() {
|
||||
|
||||
} else {
|
||||
echo '<tr>';
|
||||
|
||||
# Shall we draw the "mass-delete" checkbox?
|
||||
if ($ldapserver->isMassDeleteEnabled())
|
||||
printf('<td><input type="checkbox" name="mass_delete[%s]" /></td>',htmlspecialchars($base_dn));
|
||||
|
||||
printf('<td class="expander"><a href="%s"><img src="%s" alt="%s" /></a></td>',$expand_href,$expand_img,$expand_alt);
|
||||
printf('<td class="icon"><a href="%s" target="right_frame"><img src="images/%s" alt="img" /></a></td>',$edit_href,$icon);
|
||||
printf('<td class="rdn" colspan="98"><span style="white-space: nowrap;"><a href="%s" target="right_frame">%s</a>',$edit_href,pretty_print_dn($base_dn));
|
||||
printf('<td class="rdn" colspan="98"><nobr><a href="%s" target="right_frame">%s</a>',$edit_href,pretty_print_dn($base_dn));
|
||||
|
||||
if ($child_count)
|
||||
printf(' <span class="count">(%s)</span>',$child_count);
|
||||
|
||||
echo '</span></td>';
|
||||
echo '</nobr></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
@@ -336,9 +332,9 @@ function draw_tree_html($dn,$ldapserver,$level=0) {
|
||||
$child_count = number_format(count($tree['browser'][$dn]['children']));
|
||||
|
||||
if ((! $child_count) && (! $ldapserver->isShowCreateEnabled()))
|
||||
echo '<td class="expander"><span style="white-space: nowrap;"><img src="images/minus.png" alt="-" /></span></td>';
|
||||
echo '<td class="expander"><nobr><img src="images/minus.png" alt="-" /></nobr></td>';
|
||||
else
|
||||
printf('<td class="expander"><span style="white-space: nowrap;"><a href="%s"><img src="images/minus.png" alt="-" /></a></span></td>',$collapse_href);
|
||||
printf('<td class="expander"><nobr><a href="%s"><img src="images/minus.png" alt="-" /></a></nobr></td>',$collapse_href);
|
||||
|
||||
} else {
|
||||
$size_limit = $config->GetValue('search','size_limit');
|
||||
@@ -354,21 +350,21 @@ function draw_tree_html($dn,$ldapserver,$level=0) {
|
||||
}
|
||||
|
||||
if ((! $child_count) && (! $ldapserver->isShowCreateEnabled()))
|
||||
echo '<td class="expander"><span style="white-space: nowrap;"><img src="images/minus.png" alt="-" /></span></td>';
|
||||
echo '<td class="expander"><nobr><img src="images/minus.png" alt="-" /></nobr></td>';
|
||||
else
|
||||
printf('<td class="expander"><span style="white-space: nowrap;"><a href="%s"><img src="images/plus.png" alt="+" /></a></span></td>',$expand_href);
|
||||
printf('<td class="expander"><nobr><a href="%s"><img src="images/plus.png" alt="+" /></a></nobr></td>',$expand_href);
|
||||
}
|
||||
|
||||
printf('<td class="icon"><a href="%s" target="right_frame" name="%s_%s"><img src="%s" alt="img" /></a></td>',
|
||||
$edit_href,$ldapserver->server_id,$encoded_dn,$img_src);
|
||||
|
||||
printf('<td class="rdn" colspan="%s"><span style="white-space: nowrap;">',97-$level);
|
||||
printf('<td class="rdn" colspan="%s"><nobr>',97-$level);
|
||||
printf('<a href="%s" target="right_frame">%s</a>',$edit_href,draw_formatted_dn($ldapserver,$dn));
|
||||
|
||||
if ($child_count)
|
||||
printf(' <span class="count">(%s)</span>',$child_count);
|
||||
|
||||
echo '</span></td></tr>';
|
||||
echo '</nobr></td></tr>';
|
||||
|
||||
if (isset($tree['browser'][$dn]['open']) && $tree['browser'][$dn]['open']) {
|
||||
/* Draw the "create new" link at the top of the tree list if there are more than 10
|
||||
|
Reference in New Issue
Block a user