RELEASE 0.9.8.4

This commit is contained in:
Deon George
2009-06-30 20:28:19 +10:00
parent a01f7c8289
commit c131e8b479
34 changed files with 208 additions and 178 deletions

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.76.2.7 2006/04/29 06:31:27 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.76.2.8 2007/01/27 13:21:35 wurley Exp $
/**
* Contains code to be executed at the top of each phpLDAPadmin page.
@@ -107,6 +107,7 @@ 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');
@@ -127,6 +128,7 @@ 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');

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.16.2.5 2005/12/08 19:54:38 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.16.2.6 2007/01/27 13:25:49 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'=>false);
'default'=>true);
$this->default->appearance['show_clear_password'] = array(
'desc'=>'Whether to show clear passwords if we dont obfuscate them',

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.32.2.8 2005/12/10 12:04:37 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.32.2.10 2007/01/27 13:28:06 wurley Exp $
/**
* Fuctions and classes for exporting ldap entries to others formats

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.283.2.36 2006/05/07 05:25:56 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.283.2.39 2007/03/18 03:12:10 wurley Exp $
/**
* A collection of functions used throughout phpLDAPadmin.
@@ -420,15 +420,16 @@ 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();
@@ -500,8 +501,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) );
}
}
@@ -1088,15 +1089,16 @@ 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( 0 == ini_get( 'error_reporting' ) || 0 == error_reporting() )
/* 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)
return;
$file = basename( $file );
@@ -1216,7 +1218,8 @@ 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 = array_pop($ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base'));
$jpeg_data = $ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base');
$jpeg_data = array_pop($jpeg_data);
if (! $jpeg_data) {
printf(_('Could not fetch jpeg data from LDAP server for attribute %s.'),htmlspecialchars($attr_name));
return;
@@ -1719,7 +1722,7 @@ function dn_unescape($dn) {
*/
function get_href($type,$extra_info='') {
$sf = 'https://sourceforge.net';
$pla = 'http://wiki.pldapadmin.com';
$pla = 'http://wiki.phpldapadmin.info';
$group_id = '61828';
$bug_atid = '498546';
$rfe_atid = '498549';
@@ -2680,7 +2683,7 @@ function password_generate() {
$leftover = array_merge($leftover,$llower,$lupper,$numbers,$punc);
shuffle($leftover);
$outarray = array_merge($outarray, a_array_rand($leftover, $criteria['num'] - $num_spec));
$outarray = array_merge($outarray, a_array_rand($leftover,$length-$num_spec));
}
shuffle($outarray);
@@ -2814,4 +2817,14 @@ 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']);
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.6.4.1 2006/01/26 11:49:15 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.6.4.2 2007/01/27 13:53:20 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() ) ) {
if ( is_file ("hooks/$entry") and eregi ('php[0-9]?$', $entry) ) {
require_once "hooks/$entry";
}
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";
}
$dir -> close();

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.23.2.2 2005/12/08 12:06:58 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.23.2.3 2006/10/28 05:56:56 wurley Exp $
/**
* @package phpLDAPadmin
@@ -87,6 +87,12 @@ 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>

View File

@@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.34.2.29 2006/05/07 05:25:56 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.34.2.32 2007/03/18 01:57:18 wurley Exp $ */
/**
* Classes and functions for LDAP server configuration and capability
@@ -148,7 +148,7 @@ class LDAPserver {
# Quick return if we have already connected.
$resource = $this->_connect($connect_id);
if ($resource && ! $reconnect)
if (is_resource($resource) && ! $reconnect)
return $resource;
if (DEBUG_ENABLED)
@@ -219,7 +219,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 ($resource && ! $reconnect)
if (is_resource($resource) && ! $reconnect)
return $resource;
run_hook('pre_connect',array('server_id'=>$this->server_id,'connect_id'=>$connect_id));
@@ -335,7 +335,8 @@ class LDAPserver {
debug_log('%s::getBaseDN(): Connect to LDAP to find BaseDN',80,get_class($this));
if ($this->connect()) {
$r = array_pop($this->search(null,'','objectClass=*',array('namingContexts'),'base'));
$r = $this->search(null,'','objectClass=*',array('namingContexts'),'base');
$r = array_pop($r);
if (is_array($r))
$r = array_change_key_case($r);
@@ -1670,13 +1671,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=true,$deref=LDAP_DEREF_NEVER,$size_limit=0) {
function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=false,$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);
@@ -1719,6 +1720,10 @@ 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))
@@ -1758,8 +1763,6 @@ 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);
@@ -2440,7 +2443,8 @@ class LDAPserver {
debug_log('%s:getDNAttrs(): Entered with (%s,%s,%s)',17,
get_class($this),$dn,$lower_case_attr_names,$deref);
$attrs = array_pop($this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref));
$attrs = $this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref);
$attrs = array_pop($attrs);
if (is_array($attrs)) {
if ($lower_case_attr_names)

View File

@@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.29.2.19 2006/04/27 12:33:17 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.29.2.20 2007/03/21 23:12:03 wurley Exp $ */
/**
* Classes and functions for the template engine.ation and capability
@@ -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)) {

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/tree_functions.php,v 1.20.2.21 2006/05/07 05:25:56 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/tree_functions.php,v 1.20.2.23 2007/03/18 03:21:18 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('<nobr>%s ',htmlspecialchars($ldapserver->name));
printf('<span style="white-space: nowrap;">%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 '</nobr></td></tr>';
echo '</span></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 '<nobr>';
echo '<span style="white-space: nowrap;">';
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 ' )</nobr></td></tr>';
echo ' )</span></td></tr>';
if ($ldapserver->auth_type != 'config') {
$logged_in_dn = $ldapserver->getLoggedInDN();
echo '<tr><td class="links" colspan="100"><nobr>'._('Logged in as: ');
echo '<tr><td class="links" colspan="100"><span style="white-space: nowrap;">'._('Logged in as: ');
if ($ldapserver->getDNBase($logged_in_dn) == $logged_in_dn) {
$logged_in_branch = '';
@@ -86,7 +86,7 @@ function draw_server_tree() {
} else {
$logged_in_branch = preg_replace('/,'.$ldapserver->getDNBase($logged_in_dn).'$/','',$logged_in_dn);
$logged_in_dn_array = explode(',',$logged_in_branch);
$logged_in_dn_array = pla_explode_dn($logged_in_branch);
}
$bases = $ldapserver->getDNBase($logged_in_dn);
@@ -110,11 +110,11 @@ function draw_server_tree() {
} else
echo 'Anonymous';
echo '</nobr></td></tr>';
echo '</span></td></tr>';
}
if ($ldapserver->isReadOnly())
printf('<tr><td class="links" colspan="100"><nobr>(%s)</nobr></td></tr>',_('read only'));
printf('<tr><td class="links" colspan="100"><span style="white-space: nowrap;">(%s)</span></td></tr>',_('read only'));
$javascript_forms = '';
$javascript_id = 0;
@@ -206,12 +206,12 @@ function draw_server_tree() {
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"><nobr><a href="%s" target="right_frame">%s</a>',$edit_href,pretty_print_dn($base_dn));
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));
if ($child_count)
printf(' <span class="count">(%s)</span>',$child_count);
echo '</nobr></td>';
echo '</span></td>';
echo '</tr>';
}
@@ -336,9 +336,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"><nobr><img src="images/minus.png" alt="-" /></nobr></td>';
echo '<td class="expander"><span style="white-space: nowrap;"><img src="images/minus.png" alt="-" /></span></td>';
else
printf('<td class="expander"><nobr><a href="%s"><img src="images/minus.png" alt="-" /></a></nobr></td>',$collapse_href);
printf('<td class="expander"><span style="white-space: nowrap;"><a href="%s"><img src="images/minus.png" alt="-" /></a></span></td>',$collapse_href);
} else {
$size_limit = $config->GetValue('search','size_limit');
@@ -354,21 +354,21 @@ function draw_tree_html($dn,$ldapserver,$level=0) {
}
if ((! $child_count) && (! $ldapserver->isShowCreateEnabled()))
echo '<td class="expander"><nobr><img src="images/minus.png" alt="-" /></nobr></td>';
echo '<td class="expander"><span style="white-space: nowrap;"><img src="images/minus.png" alt="-" /></span></td>';
else
printf('<td class="expander"><nobr><a href="%s"><img src="images/plus.png" alt="+" /></a></nobr></td>',$expand_href);
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="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"><nobr>',97-$level);
printf('<td class="rdn" colspan="%s"><span style="white-space: nowrap;">',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 '</nobr></td></tr>';
echo '</span></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