RELEASE 0.9.7.1

This commit is contained in:
Deon George
2009-06-30 19:40:37 +10:00
parent bbcd2cb3b6
commit b443271175
203 changed files with 13623 additions and 2767 deletions

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/blowfish.php,v 1.3 2005/02/25 13:44:05 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/blowfish.php,v 1.3 2005/02/25 13:44:05 wurley Exp $
/**
* The Cipher_blowfish:: class implements the Cipher interface enryption data

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/common.php,v 1.68 2005/09/25 16:11:44 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.68.2.6 2005/10/22 04:42:40 wurley Exp $
/**
* Contains code to be executed at the top of each phpLDAPadmin page.
@@ -16,18 +16,7 @@
* @package phpLDAPadmin
*/
@DEFINE(LIBDIR,'./');
# Turn on all notices and warnings. This helps us write cleaner code (we hope at least)
if (phpversion() >= "5") {
# Work-around to get PLA to work in PHP5
ini_set( "zend.ze1_compatibility_mode", 1 );
# E_DEBUG is PHP5 specific and prevents warnings about using 'var' to declar class members
error_reporting( 'E_DEBUG' );
} else
# For PHP4
error_reporting( E_ALL );
@define('LIBDIR','../lib/');
# For PHP5 backward/forward compatibility
if (! defined('E_STRICT'))
@@ -41,6 +30,8 @@ ob_end_clean();
/* Our custom error handler receives all error notices that pass the error_reporting()
level set above. */
set_error_handler('pla_error_handler');
# Disable error reporting until all our required functions are loaded.
error_reporting(0);
/* Creates the language array which will be populated with localized strings
based on the user-configured language. */
@@ -61,6 +52,18 @@ foreach ($pla_function_files as $file_name) {
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") {
# Work-around to get PLA to work in PHP5
ini_set( "zend.ze1_compatibility_mode", 1 );
# 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 );
/**
* At this point we have read all our additional function PHP files and our configuration.
*/
@@ -75,7 +78,13 @@ if (pla_session_start())
* Language configuration. Auto or specified?
* Shall we attempt to auto-determine the language?
*/
$language = $config->GetValue('appearance','language');
# Get english by default, in case there are tags that are missing.
ob_start();
include LANGDIR."recoded/en.php";
ob_end_clean();
if ($language == "auto") {
# Make sure their browser correctly reports language. If not, skip this.
@@ -92,10 +101,11 @@ if ($language == "auto") {
$HTTP_LANGS = array_merge ($HTTP_LANGS1, $HTTP_LANGS2);
foreach( $HTTP_LANGS as $HTTP_LANG) {
# try to grab one after the other the language file
if( file_exists( realpath( "lang/recoded/$HTTP_LANG.php" ) ) &&
is_readable( realpath( "lang/recoded/$HTTP_LANG.php" ) ) ) {
$language_file = LANGDIR."recoded/$HTTP_LANG.php";
if( file_exists($language_file) &&
is_readable($language_file)) {
ob_start();
include realpath( "lang/recoded/$HTTP_LANG.php" );
include $language_file;
ob_end_clean();
break;
}
@@ -107,14 +117,15 @@ if ($language == "auto") {
if( $language != null ) {
if( 0 == strcmp( $language, 'english' ) )
$language = 'en';
if( file_exists( realpath( "lang/recoded/$language.php" ) ) &&
is_readable( realpath( "lang/recoded/$language.php" ) ) ) {
$language_file = LANGDIR."recoded/$language.php";
if( file_exists($language_file) &&
is_readable($language_file)) {
ob_start();
include realpath( "lang/recoded/$language.php" );
include $language_file;
ob_end_clean();
} else {
pla_error( "Could not read language file 'lang/recoded/$language.php'. Either the file
does not exist, or its permissions do not allow phpLDAPadmin to read it." );
pla_error(sprintf('Could not read language file "%s". Either the file does not exist, or its permissions do not allow phpLDAPadmin to read it.',$language_file));
}
}
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/config_default.php,v 1.11 2005/09/25 16:11:44 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.11.2.5 2005/10/22 11:34:07 wurley Exp $
/**
* Configuration processing and defaults.
@@ -9,7 +9,7 @@
*/
# The minimum version of PHP required to run phpLDAPadmin.
@define( 'REQUIRED_PHP_VERSION', '4.1.0' );
define('REQUIRED_PHP_VERSION','4.1.0');
class Config {
var $custom;
@@ -45,6 +45,10 @@ class Config {
'default'=>'%A %e %B %Y');
//$date_format = "%A %e %B %Y";
$this->default->appearance['date_attrs'] = array(
'desc'=>'Array of attributes that should show a jscalendar',
'default'=>array('shadowExpire'=>'%es','shadowInactive'=>'%es','shadowLastChange'=>'%es'));
$this->default->appearance['hide_configuration_management'] = array(
'desc'=>'Hide the Sourceforge related links',
'default'=>false);
@@ -198,6 +202,10 @@ class Config {
$this->default->debug['syslog'] = array(
'desc'=>'Whether to send debug messages to syslog',
'default'=>false);
$this->default->debug['file'] = array(
'desc'=>'Name of file to send debug output to',
'default'=>null);
//$use_syslog
/** Temp Directories
@@ -314,7 +322,8 @@ class Config {
$value = null;
if (! isset($this->default->$key))
pla_error("A call was made to GetValue requesting [$key] that isnt predefined.");
pla_error(sprintf('A call was made in [%s] to GetValue requesting [%s] that isnt predefined.',
basename($_SERVER['PHP_SELF']),$key));
else
$default = $this->default->$key;
@@ -373,4 +382,9 @@ class Config {
# Define our configuration variable.
$config = new Config;
require (CONFDIR.'config.php');
if (($config->GetValue('debug','syslog') || $config->GetValue('debug','file')) && $config->GetValue('debug','level'))
define('DEBUG_ENABLED',1);
else
define('DEBUG_ENABLED',0);
?>

520
lib/createlm.php Normal file
View File

@@ -0,0 +1,520 @@
<?php
/*
$Id: createlm.php,v 1.1.2.1 2005/10/22 14:22:48 wurley Exp $
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2004 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This class provides functions to calculate Samba NT and LM hashes.
*
* The code is a conversion from createntlm.pl (Benjamin Kuit) and smbdes.c/md4.c (Andrew Tridgell).
*
* @author Roland Gruber
*
* @package modules
*/
/**
* Calculates NT and LM hashes.
*
* The important functions are lmhash($password) and nthash($password).
*
* @package modules
*/
class smbHash {
# Contants used in lanlam hash calculations
# Ported from SAMBA/source/libsmb/smbdes.c:perm1[56]
var $perm1 = array(57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4);
# Ported from SAMBA/source/libsmb/smbdes.c:perm2[48]
var $perm2 = array(14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32);
# Ported from SAMBA/source/libsmb/smbdes.c:perm3[64]
var $perm3 = array(58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7);
# Ported from SAMBA/source/libsmb/smbdes.c:perm4[48]
var $perm4 = array(32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1);
# Ported from SAMBA/source/libsmb/smbdes.c:perm5[32]
var $perm5 = array(16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25);
# Ported from SAMBA/source/libsmb/smbdes.c:perm6[64]
var $perm6 = array(40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25);
# Ported from SAMBA/source/libsmb/smbdes.c:sc[16]
var $sc = array(1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1);
# Ported from SAMBA/source/libsmb/smbdes.c:sbox[8][4][16]
# Side note, I used cut and paste for all these numbers, I did NOT
# type them all in =)
var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7),
array( 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8),
array( 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0),
array(15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13)),
array(array(15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10),
array( 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5),
array( 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15),
array(13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9)),
array(array(10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8),
array(13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1),
array(13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7),
array( 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12)),
array(array( 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15),
array(13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9),
array(10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4),
array( 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14)),
array(array( 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9),
array(14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6),
array( 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14),
array(11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3)),
array(array(12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11),
array(10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8),
array( 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6),
array( 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13)),
array(array( 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1),
array(13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6),
array( 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2),
array( 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12)),
array(array(13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7),
array( 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2),
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)));
/**
* @param integer count
* @param array $data
* @return array
*/
function lshift($count, $data) {
$ret = array();
for ($i = 0; $i < sizeof($data); $i++) {
$ret[$i] = $data[($i + $count)%sizeof($data)];
}
return $ret;
}
/**
* @param array in input data
* @param array p permutation
* @return array
*/
function permute($in, $p, $n) {
$ret = array();
for ($i = 0; $i < $n; $i++) {
$ret[$i] = $in[$p[$i] - 1]?1:0;
}
return $ret;
}
/**
* @param array $in1
* @param array $in2
* @return array
*/
function mxor($in1, $in2) {
$ret = array();
for ($i = 0; $i < sizeof($in1); $i++) {
$ret[$i] = $in1[$i] ^ $in2[$i];
}
return $ret;
}
/**
* @param array $in
* @param array $key
* @param boolean $forw
* @return array
*/
function doHash($in, $key, $forw) {
$ki = array();
$pk1 = $this->permute($key, $this->perm1, 56);
$c = array();
$d = array();
for ($i = 0; $i < 28; $i++) {
$c[$i] = $pk1[$i];
$d[$i] = $pk1[28 + $i];
}
for ($i = 0; $i < 16; $i++) {
$c = $this->lshift($this->sc[$i], $c);
$d = $this->lshift($this->sc[$i], $d);
$cd = $c;
for ($k = 0; $k < sizeof($d); $k++) $cd[] = $d[$k];
$ki[$i] = $this->permute($cd, $this->perm2, 48);
}
$pd1 = $this->permute($in, $this->perm3, 64);
$l = array();
$r = array();
for ($i = 0; $i < 32; $i++) {
$l[$i] = $pd1[$i];
$r[$i] = $pd1[32 + $i];
}
for ($i = 0; $i < 16; $i++) {
$er = $this->permute($r, $this->perm4, 48);
if ($forw) $erk = $this->mxor($er, $ki[$i]);
else $erk = $this->mxor($er, $ki[15 - $i]);
for ($j = 0; $j < 8; $j++) {
for ($k = 0; $k < 6; $k++) {
$b[$j][$k] = $erk[($j * 6) + $k];
}
}
for ($j = 0; $j < 8; $j++) {
$m = array();
$n = array();
$m = ($b[$j][0] << 1) | $b[$j][5];
$n = ($b[$j][1] << 3) | ($b[$j][2] << 2) | ($b[$j][3] << 1) | $b[$j][4];
for ($k = 0; $k < 4; $k++) {
$b[$j][$k]=($this->sbox[$j][$m][$n] & (1 << (3-$k)))?1:0;
}
}
for ($j = 0; $j < 8; $j++) {
for ($k = 0; $k < 4; $k++) {
$cb[($j * 4) + $k] = $b[$j][$k];
}
}
$pcb = $this->permute($cb, $this->perm5, 32);
$r2 = $this->mxor($l, $pcb);
for ($k = 0; $k < 32; $k++) $l[$k] = $r[$k];
for ($k = 0; $k < 32; $k++) $r[$k] = $r2[$k];
}
$rl = $r;
for ($i = 0; $i < sizeof($l); $i++) $rl[] = $l[$i];
return $this->permute($rl, $this->perm6, 64);
}
function str_to_key($str) {
$key[0] = $this->unsigned_shift_r($str[0], 1);
$key[1] = (($str[0]&0x01)<<6) | $this->unsigned_shift_r($str[1], 2);
$key[2] = (($str[1]&0x03)<<5) | $this->unsigned_shift_r($str[2], 3);
$key[3] = (($str[2]&0x07)<<4) | $this->unsigned_shift_r($str[3], 4);
$key[4] = (($str[3]&0x0F)<<3) | $this->unsigned_shift_r($str[4], 5);
$key[5] = (($str[4]&0x1F)<<2) | $this->unsigned_shift_r($str[5], 6);
$key[6] = (($str[5]&0x3F)<<1) | $this->unsigned_shift_r($str[6], 7);
$key[7] = $str[6]&0x7F;
for ($i = 0; $i < 8; $i++) {
$key[$i] = ($key[$i] << 1);
}
return $key;
}
function smb_hash($in, $key, $forw){
$key2 = $this->str_to_key($key);
for ($i = 0; $i < 64; $i++) {
$inb[$i] = ($in[$i/8] & (1<<(7-($i%8)))) ? 1:0;
$keyb[$i] = ($key2[$i/8] & (1<<(7-($i%8)))) ? 1:0;
$outb[$i] = 0;
}
$outb = $this->dohash($inb, $keyb, $forw);
for ($i = 0; $i < 8; $i++) {
$out[$i] = 0;
}
for ($i = 0; $i < 65; $i++) {
if ( isset($outb[$i]) && $outb[$i] ) {
$out[$i/8] |= (1<<(7-($i%8)));
}
}
return $out;
}
function E_P16($in) {
$p14 = array_values(unpack("C*",$in));
$sp8 = array(0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25);
$p14_1 = array();
$p14_2 = array();
for ($i = 0; $i < 7; $i++) {
$p14_1[$i] = $p14[$i];
$p14_2[$i] = $p14[$i + 7];
}
$p16_1 = $this->smb_hash($sp8, $p14_1, true);
$p16_2 = $this->smb_hash($sp8, $p14_2, true);
$p16 = $p16_1;
for ($i = 0; $i < sizeof($p16_2); $i++) {
$p16[] = $p16_2[$i];
}
return $p16;
}
/**
* Calculates the LM hash of a given password.
*
* @param string $password password
* @return string hash value
*/
function lmhash($password = "") {
$password = strtoupper($password);
$password = substr($password,0,14);
$password = str_pad($password, 14, chr(0));
$p16 = $this->E_P16($password);
for ($i = 0; $i < sizeof($p16); $i++) {
$p16[$i] = sprintf("%02X", $p16[$i]);
}
return join("", $p16);
}
/**
* Calculates the NT hash of a given password.
*
* @param string $password password
* @return string hash value
*/
function nthash($password = "") {
$password = substr($password,0,128);
$password2 = "";
for ($i = 0; $i < strlen($password); $i++) $password2 .= $password[$i] . chr(0);
$password = $password2;
$hex = $this->mdfour($password);
for ($i = 0; $i < sizeof($hex); $i++) {
$hex[$i] = sprintf("%02X", $hex[$i]);
}
return join("", $hex);
}
# Support functions
# Ported from SAMBA/source/lib/md4.c:F,G and H respectfully
function F($X, $Y, $Z) {
return ($X&$Y) | ((~$X)&$Z);
}
function G($X, $Y, $Z) {
return ($X&$Y) | ($X&$Z) | ($Y&$Z);
}
function H($X, $Y, $Z) {
return $X^$Y^$Z;
}
# Ported from SAMBA/source/lib/md4.c:mdfour
function mdfour($in) {
$in = unpack("C*",$in);
$in = array_values($in);
$b = sizeof($in) * 8;
$A = array(0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476);
while (sizeof($in) > 64 ) {
$M = $this->copy64($in);
$this->mdfour64($A[0], $A[1], $A[2], $A[3], $M);
$new_in = array();
for ($i = 64; $i < sizeof($in); $i++) $new_in[] = $in[$i];
$in = $new_in;
}
$buf = $in;
$buf[] = 0x80;
for ($i = sizeof($buf) - 1; $i < 127; $i++) $buf[] = 0;
if ( sizeof($in) <= 55 ) {
$temp = $this->copy4($b);
$buf[56] = $temp[0];
$buf[57] = $temp[1];
$buf[58] = $temp[2];
$buf[59] = $temp[3];
$M = $this->copy64($buf);
$this->mdfour64($A[0], $A[1], $A[2], $A[3], $M);
}
else {
$temp = $this->copy4($b);
$buf[120] = $temp[0];
$buf[121] = $temp[1];
$buf[122] = $temp[2];
$buf[123] = $temp[3];
$M = $this->copy64($buf);
$this->mdfour64($A[0], $A[1], $A[2], $A[3], $M);
$temp = array();
for ($i = 64; $i < sizeof($buf); $i++) $temp[] = $buf[$i];
$M = $this->copy64($temp);
$this->mdfour64($A[0], $A[1], $A[2], $A[3], $M);
}
$out = array();
$temp = $this->copy4($A[0]);
for ($i = 0; $i < 4; $i++) $out[] = $temp[$i];
$temp = $this->copy4($A[1]);
for ($i = 0; $i < 4; $i++) $out[] = $temp[$i];
$temp = $this->copy4($A[2]);
for ($i = 0; $i < 4; $i++) $out[] = $temp[$i];
$temp = $this->copy4($A[3]);
for ($i = 0; $i < 4; $i++) $out[] = $temp[$i];
return $out;
}
# Ported from SAMBA/source/lib/md4.c:copy4
function copy4($x) {
$out = array();
$out[0] = $x&0xFF;
$out[1] = $this->unsigned_shift_r($x, 8)&0xFF;
$out[2] = $this->unsigned_shift_r($x, 16)&0xFF;
$out[3] = $this->unsigned_shift_r($x, 24)&0xFF;
return $out;
}
# Ported from SAMBA/source/lib/md4.c:copy64
function copy64($in) {
for ($i = 0; $i < 16; $i++) {
$M[$i] = ($in[$i*4+3]<<24) | ($in[$i*4+2]<<16) | ($in[$i*4+1]<<8) | ($in[$i*4+0]<<0);
}
return $M;
}
# Ported from SAMBA/source/lib/md4.c:mdfour64
function mdfour64(&$A, &$B, &$C, &$D, $M) {
$X = array();
for ($i = 0; $i < 16; $i++) $X[] = $M[$i];
$AA=$A;
$BB=$B;
$CC=$C;
$DD=$D;
$this->ROUND1($A,$B,$C,$D, 0, 3, $X);
$this->ROUND1($D,$A,$B,$C, 1, 7, $X);
$this->ROUND1($C,$D,$A,$B, 2, 11, $X);
$this->ROUND1($B,$C,$D,$A, 3, 19, $X);
$this->ROUND1($A,$B,$C,$D, 4, 3, $X); $this->ROUND1($D,$A,$B,$C, 5, 7, $X);
$this->ROUND1($C,$D,$A,$B, 6, 11, $X); $this->ROUND1($B,$C,$D,$A, 7, 19, $X);
$this->ROUND1($A,$B,$C,$D, 8, 3, $X); $this->ROUND1($D,$A,$B,$C, 9, 7, $X);
$this->ROUND1($C,$D,$A,$B, 10, 11, $X); $this->ROUND1($B,$C,$D,$A, 11, 19, $X);
$this->ROUND1($A,$B,$C,$D, 12, 3, $X); $this->ROUND1($D,$A,$B,$C, 13, 7, $X);
$this->ROUND1($C,$D,$A,$B, 14, 11, $X); $this->ROUND1($B,$C,$D,$A, 15, 19, $X);
$this->ROUND2($A,$B,$C,$D, 0, 3, $X); $this->ROUND2($D,$A,$B,$C, 4, 5, $X);
$this->ROUND2($C,$D,$A,$B, 8, 9, $X); $this->ROUND2($B,$C,$D,$A, 12, 13, $X);
$this->ROUND2($A,$B,$C,$D, 1, 3, $X); $this->ROUND2($D,$A,$B,$C, 5, 5, $X);
$this->ROUND2($C,$D,$A,$B, 9, 9, $X); $this->ROUND2($B,$C,$D,$A, 13, 13, $X);
$this->ROUND2($A,$B,$C,$D, 2, 3, $X); $this->ROUND2($D,$A,$B,$C, 6, 5, $X);
$this->ROUND2($C,$D,$A,$B, 10, 9, $X); $this->ROUND2($B,$C,$D,$A, 14, 13, $X);
$this->ROUND2($A,$B,$C,$D, 3, 3, $X); $this->ROUND2($D,$A,$B,$C, 7, 5, $X);
$this->ROUND2($C,$D,$A,$B, 11, 9, $X); $this->ROUND2($B,$C,$D,$A, 15, 13, $X);
$this->ROUND3($A,$B,$C,$D, 0, 3, $X); $this->ROUND3($D,$A,$B,$C, 8, 9, $X);
$this->ROUND3($C,$D,$A,$B, 4, 11, $X); $this->ROUND3($B,$C,$D,$A, 12, 15, $X);
$this->ROUND3($A,$B,$C,$D, 2, 3, $X); $this->ROUND3($D,$A,$B,$C, 10, 9, $X);
$this->ROUND3($C,$D,$A,$B, 6, 11, $X); $this->ROUND3($B,$C,$D,$A, 14, 15, $X);
$this->ROUND3($A,$B,$C,$D, 1, 3, $X); $this->ROUND3($D,$A,$B,$C, 9, 9, $X);
$this->ROUND3($C,$D,$A,$B, 5, 11, $X); $this->ROUND3($B,$C,$D,$A, 13, 15, $X);
$this->ROUND3($A,$B,$C,$D, 3, 3, $X); $this->ROUND3($D,$A,$B,$C, 11, 9, $X);
$this->ROUND3($C,$D,$A,$B, 7, 11, $X); $this->ROUND3($B,$C,$D,$A, 15, 15, $X);
$A = $this->add32(array($A, $AA)); $B = $this->add32(array($B, $BB));
$C = $this->add32(array($C, $CC)); $D = $this->add32(array($D, $DD));
}
# Needed? because perl seems to choke on overflowing when doing bitwise
# operations on numbers larger than 32 bits. Well, it did on my machine =)
function add32($v) {
$sum = array();
for ($i = 0; $i < sizeof($v); $i++) {
$v[$i] = array($this->unsigned_shift_r(($v[$i]&0xffff0000), 16), ($v[$i]&0xffff));
}
for ($i = 0; $i < sizeof($v); $i++) {
@$sum[0] += $v[$i][0];
@$sum[1] += $v[$i][1];
}
$sum[0] += ($sum[1]&0xffff0000)>>16;
$sum[1] &= 0xffff;
$sum[0] &= 0xffff;
$ret = ($sum[0]<<16) | $sum[1];
return $ret;
}
# Ported from SAMBA/source/lib/md4.c:ROUND1
function ROUND1(&$a,$b,$c,$d,$k,$s,$X) {
$a = $this->md4lshift($this->add32(array($a, $this->F($b,$c,$d), $X[$k])), $s);
return $a;
}
# Ported from SAMBA/source/lib/md4.c:ROUND2
function ROUND2(&$a,$b,$c,$d,$k,$s,$X) {
$a = $this->md4lshift($this->add32(array($a, $this->G($b,$c,$d), $X[$k] + 0x5A827999)), $s);
return $a;
}
# Ported from SAMBA/source/lib/md4.c:ROUND3
function ROUND3(&$a,$b,$c,$d,$k,$s,$X) {
$a = $this->md4lshift($this->add32(array($a + $this->H($b,$c,$d) + $X[$k] + 0x6ED9EBA1)), $s);
return $a;
}
# Ported from SAMBA/source/lib/md4.c:lshift
# Renamed to prevent clash with SAMBA/source/libsmb/smbdes.c:lshift
function md4lshift($x, $s) {
$x &= 0xFFFFFFFF;
return ((($x<<$s)&0xFFFFFFFF) | $this->unsigned_shift_r($x, (32-$s)));
}
/**
* Unsigned shift operation for 32bit values.
*
* PHP 4 only supports signed shifts by default.
*/
function unsigned_shift_r($a, $b) {
$z = 0x80000000;
if ($z & $a) {
$a = ($a >> 1);
$a &= (~$z);
$a |= 0x40000000;
$a = ($a >> ($b - 1));
}
else {
$a = ($a >> $b);
}
return $a;
}
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/custom_functions.php,v 1.8 2005/03/05 06:27:06 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/custom_functions.php,v 1.8 2005/03/05 06:27:06 wurley Exp $
/**
* CUSTOM_FUCTIONS has been DEPRECIATED, please use the hooks functions now.

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/emuhash_functions.php,v 1.6 2005/03/25 00:59:48 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/emuhash_functions.php,v 1.6 2005/03/25 00:59:48 wurley Exp $
/**
* @package other

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_functions.php,v 1.30 2005/09/04 16:17:08 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.30.2.2 2005/10/23 01:19:27 wurley Exp $
/**
* Fuctions and classes for exporting ldap entries to others formats
@@ -203,7 +203,7 @@ class PlaExporter extends PlaAbstractExporter{
}
/**
* May be call when the processing is finished
* May be called when the processing is finished
* and to free some ressources.
* @return bool false if any errors are encountered,false otherwise
*/
@@ -310,7 +310,7 @@ class PlaLdapExporter extends PlaAbstractExporter{
/**
* Return the entry as an array
* @return array an entry as an array
*/
*/
function pla_fetch_entry_array(){
return $this->entry_array;
}
@@ -355,7 +355,7 @@ class PlaLdapExporter extends PlaAbstractExporter{
//iterate over the attributes
while( $attr ){
if( is_attr_binary( $this,$attr ) ){
if( is_attr_binary( $this->ldap_info->ldapserver,$attr ) ){
$this->entry_array[$attr] = @ldap_get_values_len( $this->ds,$this->entry_id,$attr );
}
else{
@@ -378,7 +378,7 @@ class PlaLdapExporter extends PlaAbstractExporter{
}
/**
* May be call when the processing is finished
* May be called when the processing is finished
* and to free some ressources.
* @return bool true or false if any errors is encountered
* @todo This could break something, so need to add a method to LDAPServer to close connection and reset $connected.
@@ -520,7 +520,7 @@ class PlaDsmlExporter extends PlaExporter{
/**
* Export the entries to DSML
*/
function export(){
function export(){
global $lang;
$pla_ldap_info = $this->pla_get_ldap_info();
// not very elegant, but do the job for the moment as we have just 4 level
@@ -597,18 +597,18 @@ class PlaVcardExporter extends PlaExporter{
// mappping one to one attribute
var $vcardMapping = array('cn' => 'FN',
'title' => 'TITLE',
'homePhone' => 'TEL;HOME',
'mobile' => 'TEL;CELL',
'mail' => 'EMAIL;Internet',
'labeledURI' =>'URL',
'o' => 'ORG',
'audio' => 'SOUND',
'facsmileTelephoneNumber' =>'TEL;WORK;HOME;VOICE;FAX',
'jpegPhoto' => 'PHOTO;ENCODING=BASE64',
'businessCategory' => 'ROLE',
'description' => 'NOTE'
);
'title' => 'TITLE',
'homePhone' => 'TEL;HOME',
'mobile' => 'TEL;CELL',
'mail' => 'EMAIL;Internet',
'labeledURI' =>'URL',
'o' => 'ORG',
'audio' => 'SOUND',
'facsmileTelephoneNumber' =>'TEL;WORK;HOME;VOICE;FAX',
'jpegPhoto' => 'PHOTO;ENCODING=BASE64',
'businessCategory' => 'ROLE',
'description' => 'NOTE'
);
var $deliveryAddress = array("postOfficeBox",
"street",
@@ -824,7 +824,7 @@ class PlaCSVExporter extends PlaExporter{
class MyCustomExporter extends PlaExporter{
function MyCutsomExporter($exporter){
function MyCustomExporter($exporter){
$this->exporter = $exporter;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/hooks.php,v 1.6 2005/04/15 13:16:59 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.6 2005/04/15 13:16:59 wurley Exp $
/**
* Functions related to hooks management.

View File

@@ -1,4 +1,4 @@
# $Header: /cvsroot/phpldapadmin/phpldapadmin/ldap_supported_oids.txt,v 1.3 2005/09/11 14:59:47 wurley Exp $
# $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/ldap_supported_oids.txt,v 1.3 2005/09/11 14:59:47 wurley Exp $
# If you find some reliable and more meaningful descriptions to this OIDS,
# then please let the phpldapadmin development know so that this file can be

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/ldif_functions.php,v 1.26 2005/02/25 13:44:06 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/ldif_functions.php,v 1.26.2.1 2005/10/09 09:07:22 wurley Exp $
/**
* @todo put the display_parse_error method in ldif_import here
@@ -541,7 +541,7 @@ class LdifReaderException{
* @param String currentLine the line wich raised an exception
* @param String the message associated the exception
*/
function LdifReaderException($lineNumber,$currentLine,$message){
function LdifReaderException($lineNumber,$currentLine,$message){
$this->lineNumber = $lineNumber;
$this->currentLine =$currentLine;
$this->message = $message;
@@ -675,7 +675,7 @@ class LdifReader extends FileReader{
* @param String $path2File path of the ldif file to read
* @param boolean $continuous_mode 1 if continuous mode operation, 0 otherwise
*/
function LdifReader( $path2File , $continuous_mode = 0 ){
function LdifReader( $path2File , $continuous_mode = 0 ){
parent::FileReader( $path2File );
$this->continuous_mode = $continuous_mode;
$this->_LdifReader();

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/search_form_advanced.php,v 1.22 2005/07/16 03:13:54 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.22.2.1 2005/10/09 09:07:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -9,11 +9,12 @@
<script>
<?php foreach ($server_info_list as $i => $ignore) { ?>
<?php foreach ($server_info_list as $i => $ignore) {
foreach ($server_info_list[$i]['base_dns'] as $base_dn) { ?>
addToServersList(new server(<?php echo $i; ?>,"<?php echo $server_info_list[$i]['name']; ?>","<?php echo $server_info_list[$i]['base_dn']; ?>"));
addToServersList(new server(<?php echo $i; ?>,"<?php echo $server_info_list[$i]['name']; ?>","<?php echo $base_dn; ?>"));
<?php } ?>
<?php } } ?>
function focus_filter() {
document.advanced_search_form.filter.focus();

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/search_form_predefined.php,v 1.8 2005/07/16 03:13:54 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.8 2005/07/16 03:13:54 wurley Exp $
/**
* @package phpLDAPadmin

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/search_form_simple.php,v 1.14 2005/07/16 03:13:54 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_simple.php,v 1.14 2005/07/16 03:13:54 wurley Exp $
/**
* @package phpLDAPadmin

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/search_results_list.php,v 1.5 2005/04/29 11:24:15 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_list.php,v 1.5 2005/04/29 11:24:15 wurley Exp $
/**
* @package phpLDAPadmin

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/search_results_table.php,v 1.7 2005/04/29 11:24:15 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_table.php,v 1.7 2005/04/29 11:24:15 wurley Exp $
/**
* Incoming variables (among others)

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/session_functions.php,v 1.14 2005/07/16 03:13:54 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/session_functions.php,v 1.14.2.2 2005/10/17 10:03:39 wurley Exp $
/**
* A collection of functions to handle sessions throughout phpLDAPadmin.
@@ -8,7 +8,7 @@
*/
/** The session ID that phpLDAPadmin will use for all sessions */
@define( 'PLA_SESSION_ID', 'PLASESSID' );
define('PLA_SESSION_ID','PLASESSID');
/** Enables session paranoia, which causes SIDs to change each page load (EXPERIMENTAL!) */
define('pla_session_id_paranoid', false);
/** Flag to indicate whether the session has already been initialized (this constant gets stored in $_SESSION) */
@@ -24,7 +24,8 @@ define('pla_session_id_ses_max', 36);
* @return string the new session ID string
*/
function pla_session_get_id() {
debug_log(sprintf('pla_session_get_id(): Entered with ()'),2);
if (DEBUG_ENABLED)
debug_log('pla_session_get_id(): Entered with ()',2);
$id_md5 = md5(rand(1,1000000));
$ip_md5 = md5($_SERVER['REMOTE_ADDR']);
@@ -48,7 +49,8 @@ function pla_session_get_id() {
* @return bool True, if the session is valid
*/
function pla_session_verify_id() {
debug_log(sprintf('pla_session_verify_id(): Entered with ()'),2);
if (DEBUG_ENABLED)
debug_log('pla_session_verify_id(): Entered with ()',2);
$check_id = session_id();
$ip_md5 = md5($_SERVER['REMOTE_ADDR']);
@@ -73,7 +75,8 @@ function pla_session_verify_id() {
* @return bool Returns true if the session was started the first time
*/
function pla_session_start() {
debug_log(sprintf('pla_session_start(): Entered with ()'),2);
if (DEBUG_ENABLED)
debug_log('pla_session_start(): Entered with ()',2);
// If session.auto_start is on in the server's PHP configuration (php.ini), then
// we will have problems loading our schema cache since the session will have started

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/syslog.php,v 1.11 2005/08/10 06:07:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/syslog.php,v 1.11 2005/08/10 06:07:32 wurley Exp $
/**
* Functions related to syslog logging.

View File

@@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/template_functions.php,v 1.25 2005/09/25 16:11:44 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.25.2.8 2005/10/25 12:50:29 wurley Exp $ */
/**
* Classes and functions for the template engine.ation and capability
@@ -71,7 +71,7 @@ class xml2array {
} else {
$this->stack_ref[$name]=array();
if (isset($attrs))
if (isset($attrs))
$this->stack_ref[$name]=$attrs;
$this->push_pos($this->stack_ref[$name]);
@@ -94,16 +94,17 @@ class xml2array {
}
class Templates {
var $_template = array();
function Templates($server_id) {
debug_log(sprintf('%s::init(): Entered with ()',get_class($this)),2);
if (DEBUG_ENABLED)
debug_log('%s::__construct(): Entered with ()',2,get_class($this));
if ($this->_template = get_cached_item($server_id,'template','all')) {
debug_log(sprintf('%s::init(): Using CACHED [%s]',get_class($this),'templates'),3);
} else {
if (DEBUG_ENABLED)
debug_log('%s::init(): Using CACHED [%s]',3,get_class($this),'templates');
} else {
$dir = opendir(TMPLDIR);
$this->template_num = 0;
@@ -123,12 +124,16 @@ class Templates {
}
function storeTemplate($template,$xmldata) {
debug_log(sprintf('%s::storeTemplate(): Entered with (%s,%s)',get_class($this),$template,serialize($xmldata)),2);
if (DEBUG_ENABLED)
debug_log('%s::storeTemplate(): Entered with (%s,%s)',2,
get_class($this),$template,serialize($xmldata));
global $ldapserver, $lang;
foreach ($xmldata['template'] as $xml_key => $xml_value) {
debug_log(sprintf('%s::storeTemplate(): Foreach loop Key [%s] Value [%s]',get_class($this),$xml_key,is_array($xml_value)),9);
if (DEBUG_ENABLED)
debug_log('%s::storeTemplate(): Foreach loop Key [%s] Value [%s]',9,
get_class($this),$xml_key,is_array($xml_value));
switch ($xml_key) {
# Build our object Classes from the DN and Template.
@@ -155,7 +160,8 @@ class Templates {
# Build our attribute list from the DN and Template.
case ('attributes') :
debug_log(sprintf('%s::storeTemplate(): Case [%s]',get_class($this),'attributes'),8);
if (DEBUG_ENABLED)
debug_log('%s::storeTemplate(): Case [%s]',8,get_class($this),'attributes');
if (isset($xmldata['template']['attributes']) && is_array($xmldata['template']['attributes'])) {
$this->_template[$template]['attribute'] = array();
@@ -163,21 +169,25 @@ class Templates {
foreach ($xmldata['template']['attributes'] as $tattrs) {
foreach ($tattrs as $index => $attr_details) {
debug_log(sprintf('%s::storeTemplate(): Foreach tattrs Key [%s] Value [%s]',get_class($this),$index,is_array($attr_details)),9);
if (DEBUG_ENABLED)
debug_log('%s::storeTemplate(): Foreach tattrs Key [%s] Value [%s]',9,
get_class($this),$index,is_array($attr_details));
# Single attribute XML files are not indexed.
if (! is_numeric($index)) {
$this->_template[$template]['attribute'][$tattrs['ID']][$index] = $this->_parseXML($index,$attr_details);
if (is_numeric($index)) {
$this->_template[$template]['attribute'][$attr_details['ID']] = $this->_parseXML($index,$attr_details);
} else {
foreach ($attr_details as $key => $values) {
if (preg_match('/^@/',$key))
continue;
if (isset($values['ID']))
$key = $values['ID'];
if (is_array($values) && isset($values['ID'])) {
$this->_template[$template]['attribute'][$tattrs['ID']][$index]['_KEY:'.$values['ID']] = $this->_parseXML($key,$values);
} elseif (is_array($values) && isset($values['#text'])) {
$this->_template[$template]['attribute'][$tattrs['ID']][$index][] = $values['#text'];
$this->_template[$template]['attribute'][$attr_details['ID']][$key] = $this->_parseXML($key,$values);
} else {
$this->_template[$template]['attribute'][$tattrs['ID']][$index] = $this->_parseXML($key,$values);
}
}
}
}
@@ -191,7 +201,6 @@ class Templates {
$this->_template[$template]['attribute'][$key] = $data['override'];
}
}
#if (isset($this->_template[$template]['attribute']);
}
break;
@@ -213,37 +222,57 @@ class Templates {
$supclass = true;
$enherited = false;
while ($supclass == true) {
$schema_object = get_schema_objectclass( $ldapserver, $oclass);
$schema_object = $ldapserver->getSchemaObjectClass($oclass);
# Test that this is a valid objectclass - disable if an invalid one found.
if (! $schema_object)
if (! $schema_object) {
$this->_template[$template]['invalid'] = 1;
$supclass = false;
continue;
}
if ($schema_object->type == 'structural' && (! $enherited))
if ($schema_object->getType() == 'structural' && (! $enherited))
$this->_template[$template]['structural'][] = $oclass;
if ($schema_object->must_attrs )
foreach ($schema_object->must_attrs as $index => $detail)
if (! in_array($detail->name,$this->_template[$template]['must']) && $detail->name != 'objectClass') {
if (isset($this->_template[$template]['attribute'][$detail->name]) &&
! is_array($this->_template[$template]['attribute'][$detail->name]))
if ($schema_object->getMustAttrs() )
foreach ($schema_object->getMustAttrs() as $index => $detail) {
if (! in_array($detail->getName(),$this->_template[$template]['must']) && $detail->getName() != 'objectClass') {
# Go through the aliases, and ignore any that are already defined.
$ignore = false;
$attr = $ldapserver->getSchemaAttribute($detail->GetName());
foreach ($attr->aliases as $alias) {
if (in_array($alias,$this->_template[$template]['must'])) {
$ignore = true;
break;
}
}
if ($ignore)
continue;
if (isset($this->_template[$template]['attribute'][$detail->getName()]) &&
! is_array($this->_template[$template]['attribute'][$detail->getName()]))
$this->_template[$template]['must'][] =
$this->_template[$template]['attribute'][$detail->name];
else
$this->_template[$template]['must'][] = $detail->name;
}
$this->_template[$template]['attribute'][$detail->getName()];
if ($schema_object->may_attrs )
foreach ($schema_object->may_attrs as $index => $detail)
if (! in_array($detail->name,$this->_template[$template]['may']))
$this->_template[$template]['may'][] = $detail->name;
else
$this->_template[$template]['must'][] = $detail->getName();
}
}
if ($schema_object->getMayAttrs() )
foreach ($schema_object->getMayAttrs() as $index => $detail)
if (! in_array($detail->getName(),$this->_template[$template]['may']))
$this->_template[$template]['may'][] = $detail->getName();
# Keep a list to objectclasses we have processed, so we dont get into a loop.
$oclass_processed[] = $oclass;
if ((count($schema_object->sup_classes)) || count($superclasslist)) {
foreach ($schema_object->sup_classes as $supoclass) {
if ((count($schema_object->getSupClasses())) || count($superclasslist)) {
foreach ($schema_object->getSupClasses() as $supoclass) {
if (! in_array($supoclass,$oclass_processed))
$supoclasslist[] = $supoclass;
}
@@ -336,16 +365,34 @@ class Templates {
}
function _parseXML($index,$attr_details) {
debug_log(sprintf('%s::_parseXML(): Entered with (%s,%s)',get_class($this),$index,serialize($attr_details)),2);
if (DEBUG_ENABLED)
debug_log('%s::_parseXML(): Entered with (%s,%s)',2,
get_class($this),$index,serialize($attr_details));
if (! $attr_details) {
return "";
return '';
} elseif (! is_array($attr_details)) {
return $attr_details;
} elseif (isset($attr_details['#text'])) {
# If index is numeric, then this is part of an array...
return $attr_details['#text'];
}
foreach ($attr_details as $key => $values) {
if (($key == 'ID') && ! is_array($values))
continue;
elseif (isset($values['ID']) && (! $key['#text'])) {
$key = '_KEY:'.$values['ID'];
unset($values['ID']);
} elseif (isset($values['ID']) && ($values['#text'])) {
$key = '_KEY:'.$values['ID'];
}
$parseXML[$key] = $this->_parseXML($index,$values);
}
@@ -356,8 +403,13 @@ class Templates {
return isset($this->_template[$template]) ? $this->_template[$template] : null;
}
function getTemplates() {
return $this->_template;
}
function OnChangeAdd($function) {
debug_log(sprintf('%s::OnChangeAdd(): Entered with (%s)',get_class($this),$function),2);
if (DEBUG_ENABLED)
debug_log('%s::OnChangeAdd(): Entered with (%s)',2,get_class($this),$function);
global $js;
@@ -396,13 +448,13 @@ class Templates {
} else {
if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) {
$js["autoFill".$attr] .= sprintf(" %s = form.%s.value.substr(%s,%s)",
$js["autoFill".$attr] .= sprintf(' %s = form.%s.value.substr(%s,%s)',
$matchall[1][$index],$matchall[1][$index],
$substrarray[1][0] ? $substrarray[1][0] : '0',
$substrarray[2][0] ? $substrarray[2][0] : sprintf('form.%s.value.length',$matchall[1][$index]));
} else {
$js["autoFill".$attr] .= sprintf(" %s = form.%s.value",$matchall[1][$index],$matchall[1][$index]);
$js["autoFill".$attr] .= sprintf(' %s = form.%s.value',$matchall[1][$index],$matchall[1][$index]);
}
switch ($matchall[3][$index]) {
@@ -413,6 +465,7 @@ class Templates {
$js["autoFill".$attr] .= ";\n";
}
$formula = preg_replace('/^%('.$matchall[1][$index].')%$/U','$1 + \'\'',$formula);
$formula = preg_replace('/^%('.$matchall[1][$index].')(\|[0-9]*-[0-9]*)?(\/[lTU])?%/U','$1 + \'',$formula);
$formula = preg_replace('/%('.$matchall[1][$index].')(\|[0-9]*-[0-9]*)?(\/[lTU])?%$/U','\' + $1 ',$formula);
$formula = preg_replace('/%('.$matchall[1][$index].')(\|[0-9]*-[0-9]*)?(\/[lTU])?%/U','\' + $1 + \'',$formula);
@@ -435,24 +488,25 @@ class Templates {
return (isset($js) ? implode("\n",$js) : '');
}
function EvaluateDefault($ldapserver,$default,$container,$counter='') {
debug_log(sprintf('%s::EvaluateDefault(): Entered with (%s,%s,%s,%s)',
get_class($this),$ldapserver->server_id,$default,$container,$counter),2);
function EvaluateDefault($ldapserver,$value,$container,$counter='',$default=null) {
if (DEBUG_ENABLED)
debug_log('%s::EvaluateDefault(): Entered with (%s,%s,%s,%s)',2,
get_class($this),$ldapserver->server_id,$value,$container,$counter);
global $lang;
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$default,$matches)) {
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) {
$args = preg_split('/,/',$matches[2]);
switch($matches[1]) {
case 'GetNextNumber' :
$container = get_container_parent ($container, $args[0]);
$container = get_container_parent($ldapserver,$container,$args[0]);
$detail['default'] = get_next_uid_number($ldapserver, $container, $args[1]);
$detail['value'] = get_next_uid_number($ldapserver,$container,$args[1]);
break;
case 'PickList' :
$container = get_container_parent ($container, $args[0]);
$container = get_container_parent($ldapserver,$container,$args[0]);
preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',$args[3],$matchall);
//print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod
@@ -460,7 +514,7 @@ class Templates {
array_push($ldap_attrs,$args[2]);
$picklistvalues = return_ldap_hash($ldapserver,$container,$args[1],$args[2],$ldap_attrs);
$detail['default'] = sprintf('<select name="form[%s]" id="%%s" %%s %%s/>',$args[2]);
$detail['value'] = sprintf('<select name="form[%s]" id="%%s" %%s %%s/>',(isset($args[4]) ? $args[4] : $args[2]));
foreach ($picklistvalues as $key => $values) {
$display = $args[3];
@@ -469,22 +523,25 @@ class Templates {
}
if (! isset($picklist[$display])) {
$detail['default'] .= sprintf('<option name="%s" value="%s">%s</option>',$display,$values[$args[2]],$display);
$detail['value'] .= sprintf('<option name="%s" value="%s" %s>%s</option>',
$display,$values[$args[2]],
($default == $display ? 'selected' : ''),
$display);
$picklist[$display] = true;
}
}
$detail['default'] .= '</select>';
$detail['value'] .= '</select>';
break;
case 'RandomPassword' :
$detail['default'] = password_generate();
$detail['value'] = password_generate();
printf('<script language="javascript">alert(\'%s:\n%s\')</script>',
$lang['random_password'],$detail['default']);
$lang['random_password'],$detail['value']);
break;
case 'DrawChooserLink' :
$detail['default'] = draw_chooser_link(sprintf("template_form.%s%s",$args[0],$counter),$args[1]);
$detail['value'] = draw_chooser_link(sprintf("template_form.%s%s",$args[0],$counter),$args[1]);
break;
@@ -494,31 +551,36 @@ class Templates {
# Call the PHP function if exists (PHP 4 >= 4.0.4, PHP 5)
if (function_exists($function_name))
$detail['default'] = call_user_func_array($function_name,$args);
$detail['value'] = call_user_func_array($function_name,$args);
break;
default : $detail['default'] = 'UNKNOWN';
default : $detail['value'] = 'UNKNOWN';
}
$return = $detail['default'];
$return = $detail['value'];
} else {
$return = $default;
$return = $value;
}
debug_log(sprintf('%s::EvaluateDefault(): Returning (%s)',get_class($this),serialize($return)),1);
if (DEBUG_ENABLED)
debug_log('%s::EvaluateDefault(): Returning (%s)',1,get_class($this),serialize($return));
return $return;
}
function HelperValue($helper,$id='',$container='',$ldapserver='',$counter='',$default='') {
debug_log(sprintf('%s::HelperValue(): Entered with (%s,%s,%s,%s,%s,%s)',
get_class($this),count($helper),$id,$container,$ldapserver->server_id,$counter,$default),2);
$html = '';
if (DEBUG_ENABLED)
debug_log('%s::HelperValue(): Entered with (%s,%s,%s,%s,%s,%s)',2,
get_class($this),serialize($helper),$id,$container,$ldapserver->server_id,$counter,$default);
if ($container && $ldapserver && ! is_array($helper)) {
return $this->EvaluateDefault($ldapserver,$helper,$container,$counter);
if (preg_match('/^=php./',$helper))
return $this->EvaluateDefault($ldapserver,$helper,$container,$counter);
else
# @todo: Enable size and width configuration in template
$html = sprintf('<input type="text" name="%s" size="8">',$id);
} else {
if (is_array($helper)) {

View File

@@ -17,7 +17,8 @@
* @return bool
*/
function set_lastactivity( $ldapserver ) {
debug_log(sprintf('set_lastactivity(): Entered with (%s)',$ldapserver->server_id),2);
if (DEBUG_ENABLED)
debug_log('set_lastactivity(): Entered with (%s)',2,$ldapserver->server_id);
$_SESSION['activity']['server'][$ldapserver->server_id] = time();
$_SESSION['activity']['rightframe_server_id'] = $ldapserver->server_id;
@@ -31,7 +32,8 @@ function set_lastactivity( $ldapserver ) {
* @param object $ldapserver The LDAPServer object of the server which the user has logged in.
*/
function unset_lastactivity( $ldapserver ) {
debug_log(sprintf('unset_lastactivity(): Entered with (%s)',$ldapserver->server_id),2);
if (DEBUG_ENABLED)
debug_log('unset_lastactivity(): Entered with (%s)',2,$ldapserver->server_id);
if (isset($_SESSION['activity']['server'][$ldapserver->server_id])) {
unset($_SESSION['activity']['server'][$ldapserver->server_id]);
@@ -51,7 +53,8 @@ function unset_lastactivity( $ldapserver ) {
* @return bool true on success, false on failure.
*/
function session_timed_out( $ldapserver ) {
debug_log(sprintf('session_timed_out(): Entered with (%s)',$ldapserver->server_id),2);
if (DEBUG_ENABLED)
debug_log('session_timed_out(): Entered with (%s)',2,$ldapserver->server_id);
global $lang;

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/tree_functions.php,v 1.19 2005/09/25 16:11:44 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/tree_functions.php,v 1.19.2.1 2005/10/09 09:07:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -16,7 +16,8 @@
* tree.php#3_dc%3Dexample%2Cdc%3Dcom
*/
function draw_server_tree() {
debug_log(sprintf('draw_server_tree(): Entered with ()'),2);
if (DEBUG_ENABLED)
debug_log('draw_server_tree(): Entered with ()',2);
global $lang;
global $tree;