RELEASE 0.9.8.1

This commit is contained in:
Deon George 2009-06-30 20:26:45 +10:00
parent fdee1bdbd1
commit abc62c7fdc
9 changed files with 149 additions and 63 deletions

View File

@ -1 +1 @@
$Name: RELEASE-0_9_8 $
$Name: RELEASE-0_9_8_1 $

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.44.2.5 2005/12/09 14:29:15 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.44.2.6 2006/02/19 02:57:01 wurley Exp $
/**
* Creates a new object.
@ -81,6 +81,10 @@ if (isset($attrs) && is_array($attrs)) {
$val = $binary_data;
$new_entry[$attr][] = $val;
} elseif (isset($_SESSION['submitform'][$attr])) {
$new_entry[$attr][] = $_SESSION['submitform'][$attr];
unset($_SESSION['submitform'][$attr]);
}
} else {

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.42.2.8 2006/01/01 11:54:09 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.42.2.9 2006/01/26 12:01:02 wurley Exp $
/**
* @package phpLDAPadmin
@ -180,6 +180,12 @@ function check_config() {
REQUIRED_PHP_VERSION,phpversion()));
}
# Make sure this PHP install has gettext, we use it for language translation
if (! extension_loaded('gettext')) {
pla_error('Your install of PHP appears to be missing GETTEXT support. GETTEXT is used for language translation. Please install GETTEXT support before using phpLDAPadmin. (Dont forget to restart your web server afterwards)');
return false;
}
# Make sure this PHP install has all our required extensions
if (! extension_loaded('ldap')) {
pla_error('Your install of PHP appears to be missing LDAP support. Please install LDAP support before using phpLDAPadmin. (Dont forget to restart your web server afterwards)');

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.26.2.26 2006/01/12 22:07:54 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.26.2.28 2006/02/19 04:15:03 wurley Exp $
/**
* Template render engine.
@ -90,10 +90,10 @@ if (isset($template['empty_attrs'])) {
printf('<input type="hidden" name="new_dn" value="%s" />',$new_dn);
} else {
echo '<form action="template_engine.php" method="post" id="template_form" name="template_form">';
echo '<form action="template_engine.php" method="post" id="template_form" name="template_form" enctype="multipart/form-data">';
}
if (isset($_REQUEST['form']))
if (isset($_REQUEST['form'])) {
foreach ($_REQUEST['form'] as $attr => $value) {
# Check for any with post actions.
@ -167,6 +167,26 @@ if (isset($template['empty_attrs'])) {
printf('<input type="hidden" name="form[%s]" value="%s" />',$attr,$value);
}
# Have we got a Binary Attribute?
if (isset($_FILES['form']['name']) && is_array($_FILES['form']['name'])) {
foreach ($_FILES['form']['name'] as $attr => $details) {
if (is_uploaded_file($_FILES['form']['tmp_name'][$attr])) {
$file = $_FILES['form']['tmp_name'][$attr];
$f = fopen($file,'r');
$binary_data = fread($f,filesize($file));
fclose($f);
// @todo: This may need to be implemented.
//if (is_binary_option_required($ldapserver,$attr))
// $attr .= ';binary';
$_SESSION['submitform'][$attr] = $binary_data;
printf('<input type="hidden" name="form[%s]" value="" />',$attr);
}
}
}
}
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="template" value="%s" />',$_REQUEST['template']);
printf('<input type="hidden" name="object_classes" value="%s" />',rawurlencode(serialize(array_values($template['objectclass']))));
@ -195,14 +215,14 @@ if (isset($template['empty_attrs'])) {
} else {
echo '<td>&nbsp;</td>';
echo '<td class="heading">Container <acronym title="Distinguished Name">DN</acronym>:</td>';
printf('<td><input type="text" name="container" size="40" value="%s" disabled /></td></tr>',
printf('<td><input type="text" name="container" size="40" value="%s" disabled />',
htmlspecialchars($_REQUEST['container']));
printf('<input type="hidden" name="container" value="%s" />',$_REQUEST['container']);
printf('<input type="hidden" name="container" value="%s" /></td></tr>',$_REQUEST['container']);
echo '<tr class="spacer"><td colspan="3"></td></tr>';
}
} else {
printf('<input type="hidden" name="container" value="%s" />',$_REQUEST['container']);
printf('<td><input type="hidden" name="container" value="%s" /></td></tr>',$_REQUEST['container']);
}
$count = 0;
@ -323,7 +343,19 @@ if (isset($template['empty_attrs'])) {
# Display the input box.
echo '<td>';
if (in_array($type,array('text','password'))) {
# Is this a binary attribute
if ($ldapserver->isAttrBinary($attr)) {
printf('<input type="file" name="form[%s]" size="20" />',$attr);
if (! ini_get('file_uploads'))
printf('<br /><small><b>%s</b></small><br />',
_('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.'));
else
printf('<br /><small><b>%s: %s</b></small><br />',
_('Maximum file size'),ini_get('upload_max_filesize'));
} elseif (in_array($type,array('text','password'))) {
printf('<input type="%s" size="%s" name="form[%s]%s" id="%s" value="%s" %s%s%s />',
$type,$size,$attr,(isset($detail['array']) && ($detail['array'] > 1) ? '[]' : ''),$attr,
(isset($detail['value']) ? $detail['value'] : ''),
@ -464,14 +496,16 @@ if (isset($template['empty_attrs'])) {
}
$attrs[] = $attr;
printf('<tr class="%s"><td colspan=2>',($counter++%2==0?'even':'odd'));
printf('<input type="hidden" name="attrs[]" value="%s" />',$attr);
if (is_array($value))
foreach ($value as $item) {
if ($item && ! isset($unique[$item])) {
$unique[$item] = 1;
printf('<tr class="%s"><td colspan=2>%s</td><td><b>%s</b></td></tr>',
($counter++%2==0?'even':'odd'),$attr,htmlspecialchars($item));
printf('<input type="hidden" name="vals[%s][]" value="%s" />',array_search($attr,$attrs),$item);
printf('<input type="hidden" name="vals[%s][]" value="%s" />',
array_search($attr,$attrs),$item);
printf('%s</td><td><b>%s</b></td></tr>',$attr,htmlspecialchars($item));
}
}
@ -481,13 +515,19 @@ if (isset($template['empty_attrs'])) {
if (obfuscate_password_display($_REQUEST['enc']))
$display = '********';
printf('<tr class="%s"><td colspan=2>%s</td><td><b>%s</b></td></tr>',
($counter++%2==0?'even':'odd'),$attr,htmlspecialchars($display));
printf('<input type="hidden" name="vals[]" value="%s" />',$value);
printf('%s</td><td><b>%s</b></td></tr>',$attr,htmlspecialchars($display));
}
}
echo '<tr class="spacer"><td colspan="3"></td></tr>';
foreach (array_keys($_SESSION['submitform']) as $attr) {
printf('<tr class="%s"><td colspan=2>%s</td><td><b>%s</b>',
($counter++%2==0?'even':'odd'),$attr,_('Binary value not displayed'));
printf('<input type="hidden" name="attrs[]" value="%s" /></td></tr>',$attr);
}
}
echo '<tr class="spacer"><td colspan="3"></td></tr>';
@ -577,7 +617,7 @@ if (isset($template['empty_attrs'])) {
$jstext .= "\t\t\telse if (id == '$attr') {\n";
if (isset($detail['must']))
$jstext .= "\t\t\t\treduceMust('$attr');\n";
$hash =& $templates->getJsHash();
$hash = $templates->getJsHash();
if (isset($hash['autoFill'.$attr])) {
$jstext .= $hash['autoFill'.$attr];
}

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.283.2.30 2006/01/15 13:05:52 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.283.2.32 2006/02/19 03:00:40 wurley Exp $
/**
* A collection of functions used throughout phpLDAPadmin.
@ -12,6 +12,7 @@ define('LANGDIR',sprintf('%s/',realpath(LIBDIR.'../locale/')));
define('CONFDIR',sprintf('%s/',realpath(LIBDIR.'../config')));
define('TMPLDIR',sprintf('%s/',realpath(LIBDIR.'../templates/')));
define('DOCDIR',sprintf('%s/',realpath(LIBDIR.'../doc/')));
define('HOOKSDIR',sprintf('%s/',realpath(LIBDIR.'../hooks/')));
define('CSSDIR','css/');
define('JSDIR','js/');
@ -1254,7 +1255,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu
if ($width > 300) {
$scale_factor = 300 / $width;
$img_width = 300;
$img_height = $height * $scale_factor;
$img_height = intval($height * $scale_factor);
} else {
$img_width = $width;

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.6 2005/04/15 13:16:59 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.6.4.1 2006/01/26 11:49:15 wurley Exp $
/**
* Functions related to hooks management.
@ -171,8 +171,8 @@ function clear_hooks ( $hook_name ) {
}
/* Evaluating user-made hooks */
if ( is_dir('hooks') ) {
$dir = dir ('hooks');
if ( is_dir(HOOKSDIR) ) {
$dir = dir (HOOKSDIR);
while (false !== ($entry = $dir -> read() ) ) {
if ( is_file ("hooks/$entry") and eregi ('php[0-9]?$', $entry) ) {

View File

@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.34.2.24 2006/01/15 13:05:52 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.34.2.28 2006/02/25 14:08:54 wurley Exp $ */
/**
* Classes and functions for LDAP server configuration and capability
@ -336,7 +336,8 @@ class LDAPserver {
if ($this->connect()) {
$r = array_pop($this->search(null,'','objectClass=*',array('namingContexts'),'base'));
$r = array_change_key_case($r);
if (is_array($r))
$r = array_change_key_case($r);
if (isset($r['namingcontexts'])) {
if (! is_array($r['namingcontexts']))
@ -414,12 +415,12 @@ class LDAPserver {
global $config;
if ($this->connect(false) && $this->haveAuthInfo() && ! $this->isReadOnly() &&
! $config->GetValue('appearance','tree_plm')) {
! $config->GetValue('appearance','tree_plm') &&
$config->GetValue('appearance','mass_delete') === true)
$config->GetValue('appearance','mass_delete') === true;
return true;
} else
else
return false;
}
@ -1135,7 +1136,7 @@ class LDAPserver {
with its name set to the alias name, and all other data copied.*/
foreach ($aliases as $alias_attr_name) {
# clone is a PHP5 function and must be used.
if (function_exists('clone'))
if (version_compare(PHP_VERSION,'5.0') > 0 )
$new_attr = clone($attr);
else
$new_attr = $attr;
@ -1435,8 +1436,12 @@ class LDAPserver {
# Delete entry from parent's children as well.
$parent = get_container($dn);
$index = array_search($dn,$tree['browser'][$parent]['children']);
unset($tree['browser'][$parent]['children'][$index]);
# If the parent hasnt been opened in the tree, then there wont be any children.
if (isset($tree['browser'][$parent]['children'])) {
$index = array_search($dn,$tree['browser'][$parent]['children']);
unset($tree['browser'][$parent]['children'][$index]);
}
# Might be worthwhile adding it to our miss list, while we are here.
$tree['misses'][$dn] = true;
@ -2433,11 +2438,14 @@ class LDAPserver {
get_class($this),$dn,$lower_case_attr_names,$deref);
$attrs = array_pop($this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref));
if ($lower_case_attr_names)
$attrs = array_change_key_case($attrs);
if (is_array($attrs))
if (is_array($attrs)) {
if ($lower_case_attr_names)
$attrs = array_change_key_case($attrs);
ksort($attrs);
}
return $attrs;
}

View File

@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.29.2.15 2005/12/31 04:26:34 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.29.2.18 2006/02/25 12:14:17 wurley Exp $ */
/**
* Classes and functions for the template engine.ation and capability
@ -441,11 +441,31 @@ class Templates {
list($command,$arg) = split(':',$value);
switch ($command) {
#autoFill:attr,string (with %attr%)
#@todo: The autofill mods need to be more flexible, so that multiple can be used eg: /T/l
/*
autoFill:string
string is a literal string, and may contain many fields like %attr|start-end/flags%
to substitute values read from other fields.
|start-end is optional, but must be present if the k flag is used.
/flags is optional.
flags may be:
T: Read display text from selection item (drop-down list), otherwise, read the value of the field
For fields that aren't selection items, /T shouldn't be used, and the field value will always be read.
k: Tokenize:
If the "k" flag is not given:
A |start-end instruction will perform a sub-string operation upon
the value of the attr, passing character positions start-end through.
start can be 0 for first character, or any other integer.
end can be 0 for last character, or any other integer for a specific position.
If the "k" flag is given:
The string read will be split into fields, using : as a delimiter
"start" indicates which field number to pass through.
l: Make the result lower case.
U: Make the result upper case.
*/
case 'autoFill' :
list($attr,$string) = split(',',$arg);
preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[lTU])?%/U',$string,$matchall);
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
if (! isset($_js_hash['autoFill'.$origin]))
@ -476,44 +496,50 @@ class Templates {
$_js_hash['autoFill'.$origin] .= sprintf(" var %s;\n",$match_attr);
if (trim($match_subst)) {
preg_match_all('/([0-9]*)-([0-9]*)/',$match_subst,$substrarray);
}
if ($match_mod == '/T') {
if (strstr($match_mod,'T')) {
$_js_hash['autoFill'.$origin] .= sprintf(
" %s = document.getElementById('%s').options[document.getElementById('%s').selectedIndex].text;\n",
$match_attr,$match_attr,$match_attr);
} else {
$_js_hash['autoFill'.$origin] .= sprintf(" %s = document.getElementById('%s').value;\n",
$match_attr,$match_attr);
}
if (strstr($match_mod,'k')) {
preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray);
if (isset($substrarray[1][0])) {
$tok_idx = $substrarray[1][0];
} else {
$tok_idx = '0';
}
$_js_hash['autoFill'.$origin] .= sprintf(" %s = %s.split(':')[%s];\n",$match_attr,$match_attr,$tok_idx);
} else {
preg_match_all('/([0-9]*)-([0-9]*)/',trim($match_subst),$substrarray);
if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) {
$_js_hash['autoFill'.$origin] .= sprintf(' %s = document.getElementById("%s").value.substr(%s,%s)',
$_js_hash['autoFill'.$origin] .= sprintf(" %s = %s.substr(%s,%s);\n",
$match_attr,$match_attr,
$substrarray[1][0] ? $substrarray[1][0] : '0',
$substrarray[2][0] ? $substrarray[2][0] : sprintf('document.getElementById("%s").value.length',$match_attr));
} else {
$_js_hash['autoFill'.$origin] .= sprintf(' %s = document.getElementById(\'%s\').value',
$match_attr,$match_attr);
$substrarray[2][0] ? $substrarray[2][0] : sprintf('%s.length',$match_attr));
}
}
switch ($match_mod) {
case '/l':
$_js_hash['autoFill'.$origin] .= '.toLowerCase()';
break;
}
$_js_hash['autoFill'.$origin] .= ";\n";
if (strstr($match_mod,'l')) {
$_js_hash['autoFill'.$origin] .= sprintf(" %s = %s.toLowerCase();\n",$match_attr,$match_attr);
}
if (strstr($match_mod,'U')) {
$_js_hash['autoFill'.$origin] .= sprintf(" %s = %s.toUpperCase();\n",$match_attr,$match_attr);
}
# Matchfor only entry without modifiers.
$formula = preg_replace('/^%('.$match_attr.')%$/U','$1 + \'\'',$formula);
# Matchfor only entry with modifiers.
$formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[lTU])?%$/U','$1 + \'\'',$formula);
$formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%$/U','$1 + \'\'',$formula);
# Matchfor begining entry.
$formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[lTU])?%/U','$1 + \'',$formula);
$formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%/U','$1 + \'',$formula);
# Matchfor ending entry.
$formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[lTU])?%$/U','\' + $1 ',$formula);
$formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%$/U','\' + $1 ',$formula);
# Match for entries not at begin/end.
$formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[lTU])?%/U','\' + $1 + \'',$formula);
$formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[:lTU]+)?%/U','\' + $1 + \'',$formula);
}
$_js_hash['autoFill'.$origin] .= sprintf(" fillRec('%s', %s);\n",$attr,$formula);
@ -562,6 +588,7 @@ class Templates {
$picklistvalues = return_ldap_hash($ldapserver,$container,$args[1],$args[2],$ldap_attrs);
$detail['value'] = sprintf('<select name="form[%s]" id="%%s" %%s %%s>',(isset($args[4]) ? $args[4] : $args[2]));
$counter = 0;
foreach ($picklistvalues as $key => $values) {
$display = $args[3];
@ -570,8 +597,8 @@ class Templates {
}
if (! isset($picklist[$display])) {
$detail['value'] .= sprintf('<option id="%s" value="%s" %s>%s</option>',
$display,$values[$args[2]],
$detail['value'] .= sprintf('<option id="%s%s" value="%s" %s>%s</option>',
(isset($args[4]) ? $args[4] : $args[2]),++$counter,$values[$args[2]],
($default == $display ? 'selected' : ''),
$display);
$picklist[$display] = true;
@ -602,8 +629,8 @@ class Templates {
$varname = $matches[1];
if (isset($_POST['form']['post'][$varname]))
$function_args[] = $_POST['form']['post'][$varname];
if (isset($_POST['form'][$varname]))
$function_args[] = $_POST['form'][$varname];
else
pla_error(sprintf(_('Your template calls php.Function for a default value, however (%s) is NOT available in the POST FORM variables. The following variables are available [%s].'),$varname,
(isset($_POST['form']) ? implode('|',array_keys($_POST['form'])) : 'NONE')));
@ -614,7 +641,7 @@ class Templates {
# Call the PHP function if exists (PHP 4 >= 4.0.4, PHP 5)
if (function_exists($function_name))
$detail['value'] = call_user_func_array($function_name,$args);
$detail['value'] = call_user_func_array($function_name,$function_args);
break;

View File

@ -3,7 +3,7 @@
msgid ""
msgstr ""
"Project-Id-Version: phpldapadmin $Name: RELEASE-0_9_8 $\n"
"Project-Id-Version: phpldapadmin $Name: RELEASE-0_9_8_1 $\n"
"Report-Msgid-Bugs-To: phpldapadmin-devel@lists.sf.net\n"
"POT-Creation-Date: 2004-01-14 17:45+0200\n"
"PO-Revision-Date: 2004-01-14 17:45+0200\n"