diff -Nru phpldapadmin-1.2.2/config/config.php.example phpldapadmin-1.2.6.3/config/config.php.example --- phpldapadmin-1.2.2/config/config.php.example 2011-10-27 02:07:09.000000000 +0000 +++ phpldapadmin-1.2.6.3/config/config.php.example 2021-12-12 02:35:51.000000000 +0000 @@ -71,6 +71,31 @@ environments. */ # $config->custom->password['no_random_crypt_salt'] = true; +/* If you want to restrict password available types (encryption algorithms) + Should be subset of: + array( + ''=>'clear', + 'bcrypt'=>'bcrypt', + 'blowfish'=>'blowfish', + 'crypt'=>'crypt', + 'ext_des'=>'ext_des', + 'md5'=>'md5', + 'k5key'=>'k5key', + 'md5crypt'=>'md5crypt', + 'sha'=>'sha', + 'smd5'=>'smd5', + 'ssha'=>'ssha', + 'sha256'=>'sha256', + 'ssha256'=>'ssha256', + 'sha384'=>'sha384', + 'ssha384'=>'ssha384', + 'sha512'=>'sha512', + 'ssha512'=>'ssha512', + 'sha256crypt'=>'sha256crypt', + 'sha512crypt'=>'sha512crypt', + )*/ +# $config->custom->password['available_types'] = array(''=>'clear','md5'=>'md5'); + /* PHP script timeout control. If php runs longer than this many seconds then PHP will stop with an Maximum Execution time error. Increase this value from the default if queries to your LDAP server are slow. The default is either @@ -173,6 +198,10 @@ // $config->custom->appearance['tree_width'] = null; # $config->custom->appearance['tree_width'] = 250; +/* Number of tree command icons to show, 0 = show all icons on 1 row. */ +// $config->custom->appearance['tree_icons'] = 0; +# $config->custom->appearance['tree_icons'] = 4; + /* Confirm create and update operations, allowing you to review the changes and optionally skip attributes during the create/update operation. */ // $config->custom->confirm['create'] = true; @@ -235,7 +264,7 @@ *********************************************/ /* Add "modify group members" link to the attribute. */ -// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid'); +// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid','sudoUser'); /* Configure filter for member search. This only applies to "modify group members" feature */ // $config->custom->modify_member['filter'] = '(objectclass=Person)'; @@ -310,6 +339,7 @@ login will be required to use phpLDAPadmin for this server. 5. 'sasl': login will be taken from the webserver's kerberos authentication. Currently only GSSAPI has been tested (using mod_auth_kerb). + 6. 'sasl_external': login will be taken from SASL external mechanism. Choose wisely to protect your authentication information appropriately for your situation. If you choose 'cookie', your cookie contents will be @@ -334,6 +364,22 @@ /* Use TLS (Transport Layer Security) to connect to the LDAP server. */ // $servers->setValue('server','tls',false); +/* TLS Certificate Authority file (overrides ldap.conf, PHP 7.1+) */ +// $servers->setValue('server','tls_cacert',null); +# $servers->setValue('server','tls_cacert','/etc/openldap/certs/ca.crt'); + +/* TLS Certificate Authority hashed directory (overrides ldap.conf, PHP 7.1+) */ +// $servers->setValue('server','tls_cacertdir',null); +# $servers->setValue('server','tls_cacertdir','/etc/openldap/certs'); + +/* TLS Client Certificate file (PHP 7.1+) */ +// $servers->setValue('server','tls_cert',null); +# $servers->setValue('server','tls_cert','/etc/pki/tls/certs/ldap_user.crt'); + +/* TLS Client Certificate Key file (PHP 7.1+) */ +// $servers->setValue('server','tls_key',null); +# $servers->setValue('server','tls_key','/etc/pki/tls/private/ldap_user.key'); + /************************************ * SASL Authentication * ************************************/ @@ -341,11 +387,19 @@ /* Enable SASL authentication LDAP SASL authentication requires PHP 5.x configured with --with-ldap-sasl=DIR. If this option is disabled (ie, set to false), then all other sasl options are ignored. */ -// $servers->setValue('login','auth_type','sasl'); +# $servers->setValue('login','auth_type','sasl'); -/* SASL auth mechanism */ +/* SASL GSSAPI auth mechanism (requires auth_type of sasl) */ // $servers->setValue('sasl','mech','GSSAPI'); +/* SASL PLAIN support... this mech converts simple binds to SASL + PLAIN binds using any auth_type (or other bind_id/pass) as credentials. + NOTE: auth_type must be simple auth compatible (ie not sasl) */ +# $servers->setValue('sasl','mech','PLAIN'); + +/* SASL EXTERNAL support... really a different auth_type */ +# $servers->setValue('login','auth_type','sasl_external'); + /* SASL authentication realm name */ // $servers->setValue('sasl','realm',''); # $servers->setValue('sasl','realm','EXAMPLE.COM'); @@ -379,7 +433,7 @@ /* Default password hashing algorithm. One of md5, ssha, sha, md5crpyt, smd5, blowfish, crypt or leave blank for now default algorithm. */ -// $servers->setValue('appearance','password_hash','md5'); +// $servers->setValue('appearance','pla_password_hash','md5'); /* If you specified 'cookie' or 'session' as the auth_type above, you can optionally specify here an attribute to use when logging in. If you enter @@ -400,6 +454,12 @@ setup. */ // $servers->setValue('login','class',array()); +/* If login_attr was set to 'dn', it is possible to specify a template string to + build the DN from. Use '%s' where user input should be inserted. A user may + still enter the complete DN. In this case the template will not be used. */ +// $servers->setValue('login','bind_dn_template',null); +# $servers->setValue('login','bind_dn_template','cn=%s,ou=people,dc=example,dc=com'); + /* If you specified something different from 'dn', for example 'uid', as the login_attr above, you can optionally specify here to fall back to authentication with dn. @@ -420,6 +480,9 @@ /* Set to true if you would like to initially open the first level of each tree. */ // $servers->setValue('appearance','open_tree',false); +/* Set to true to display authorization ID in place of login dn (PHP 7.2+) */ +// $servers->setValue('appearance','show_authz',false); + /* This feature allows phpLDAPadmin to automatically determine the next available uidNumber for a new entry. */ // $servers->setValue('auto_number','enable',true); @@ -546,7 +609,7 @@ $servers->setValue('sasl','authz_id_replacement','$1'); $servers->setValue('sasl','props',null); -$servers->setValue('appearance','password_hash','md5'); +$servers->setValue('appearance','pla_password_hash','md5'); $servers->setValue('login','attr','dn'); $servers->setValue('login','fallback_dn',false); $servers->setValue('login','class',null); @@ -573,4 +636,19 @@ $servers->setValue('server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock')); $servers->setValue('server','force_may',array('uidNumber','gidNumber','sambaSID')); */ + + +/*********************************************************************************** + * If you want to configure Google reCAPTCHA on autentication form, do so below. * + * Remove the commented lines and use this section as a template for all * + * reCAPTCHA v2 Generate on https://www.google.com/recaptcha/ * + * * + * IMPORTANT: Select reCAPTCHA v2 on Type of reCAPTCHA * + ***********************************************************************************/ + + +$config->custom->session['reCAPTCHA-enable'] = false; +$config->custom->session['reCAPTCHA-key-site'] = ''; +$config->custom->session['reCAPTCHA-key-server'] = ''; + ?> diff -Nru phpldapadmin-1.2.2/debian/changelog phpldapadmin-1.2.6.3/debian/changelog --- phpldapadmin-1.2.2/debian/changelog 2020-01-20 08:36:52.000000000 +0000 +++ phpldapadmin-1.2.6.3/debian/changelog 2022-01-27 16:56:42.000000000 +0000 @@ -1,3 +1,31 @@ +phpldapadmin (1.2.6.3-0.2) unstable; urgency=medium + + * Non-maintainer upload + * Previous changelog also closed: + * Make build reproducible (Closes: #834279) + * Update to github new upstream release (Closes: #952635) + * Fix CVE-2020-35132 (Closes: #987355) + * Add japanese translation (Closes: #717205) + - thanks victory for the patch + + -- Gianfranco Costamagna Thu, 27 Jan 2022 17:56:42 +0100 + +phpldapadmin (1.2.6.3-0.1) unstable; urgency=medium + + * Non-maintainer upload + * New upstream release (Closes: #985223 LP: #1906474). + * Update watch file to 4 + * debian/watch: track github releases. + * Drop all patches, now merged upstream + * debian/patches/149.patch: + - upstream merged change for PHP 8 compatibility + * Drop ucf version constraint + * Bump compat level to 13 + * Bump std-version to 4.6.0 + * Add R^3: no + + -- Gianfranco Costamagna Mon, 05 Apr 2021 12:47:45 +0200 + phpldapadmin (1.2.2-6.3) unstable; urgency=low [ Gianfranco Costamagna ] diff -Nru phpldapadmin-1.2.2/debian/compat phpldapadmin-1.2.6.3/debian/compat --- phpldapadmin-1.2.2/debian/compat 2020-01-20 03:46:09.000000000 +0000 +++ phpldapadmin-1.2.6.3/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -7 diff -Nru phpldapadmin-1.2.2/debian/control phpldapadmin-1.2.6.3/debian/control --- phpldapadmin-1.2.2/debian/control 2020-01-20 08:36:52.000000000 +0000 +++ phpldapadmin-1.2.6.3/debian/control 2022-01-27 16:53:18.000000000 +0000 @@ -3,12 +3,13 @@ Priority: extra Maintainer: Fabio Tranchitella Uploaders: Marcus Osdoba -Build-Depends: debhelper (>= 7.0.0), po-debconf, gettext -Standards-Version: 3.9.6 +Build-Depends: debhelper-compat (= 13), po-debconf, gettext +Standards-Version: 4.6.0 +Rules-Requires-Root: no Package: phpldapadmin Architecture: all -Depends: php, php-ldap, php-xml, ucf (>= 0.28), ${misc:Depends} +Depends: php, php-ldap, php-xml, ucf, ${misc:Depends} Description: web based interface for administering LDAP servers phpLDAPadmin is a web-based LDAP client. It provides easy, anywhere-accessible, multi-language administration for your LDAP diff -Nru phpldapadmin-1.2.2/debian/patches/149.patch phpldapadmin-1.2.6.3/debian/patches/149.patch --- phpldapadmin-1.2.2/debian/patches/149.patch 1970-01-01 00:00:00.000000000 +0000 +++ phpldapadmin-1.2.6.3/debian/patches/149.patch 2022-01-27 16:43:33.000000000 +0000 @@ -0,0 +1,2272 @@ +From 9f06205b1972788736f0b709963941a24bf465c3 Mon Sep 17 00:00:00 2001 +From: Patrick Monnerat +Date: Fri, 14 Jan 2022 01:04:56 +0100 +Subject: [PATCH 1/4] Do not call get_magic_quote_gpc() when running in PHP + version >= 5.4. + +This deprecated function has been removed in PHP 8. +--- + lib/common.php | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +Index: phpldapadmin-1.2.6.3/lib/common.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/common.php ++++ phpldapadmin-1.2.6.3/lib/common.php +@@ -296,7 +296,9 @@ + * Strip slashes from GET, POST, and COOKIE variables if this + * PHP install is configured to automatically addslashes() + */ +-if (@get_magic_quotes_gpc() && (! isset($slashes_stripped) || ! $slashes_stripped)) { ++if (@version_compare(phpversion(), '5.4.0', '<') && ++ @get_magic_quotes_gpc() && ++ (!isset($slashes_stripped) || !$slashes_stripped)) { + array_stripslashes($_REQUEST); + array_stripslashes($_GET); + array_stripslashes($_POST); +Index: phpldapadmin-1.2.6.3/htdocs/collapse.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/htdocs/collapse.php ++++ phpldapadmin-1.2.6.3/htdocs/collapse.php +@@ -19,7 +19,7 @@ + $tree = get_cached_item($app['server']->getIndex(),'tree'); + $entry = $tree->getEntry($dn); + $entry->close(); +-set_cached_item($app['server']->getIndex(),'tree','null',$tree); ++set_cached_item($app['server']->getIndex(),$tree,'tree','null'); + + header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s', + $app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param())); +Index: phpldapadmin-1.2.6.3/htdocs/draw_tree_node.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/htdocs/draw_tree_node.php ++++ phpldapadmin-1.2.6.3/htdocs/draw_tree_node.php +@@ -50,7 +50,7 @@ + } + + if ($treesave) +- set_cached_item($app['server']->getIndex(),'tree','null',$tree); ++ set_cached_item($app['server']->getIndex(),$tree,'tree','null'); + + if ($request['dn']) + echo $tree->draw_children($dnentry,$request['code']); +Index: phpldapadmin-1.2.6.3/htdocs/expand.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/htdocs/expand.php ++++ phpldapadmin-1.2.6.3/htdocs/expand.php +@@ -19,7 +19,7 @@ + $tree = get_cached_item($app['server']->getIndex(),'tree'); + $entry = $tree->getEntry($dn); + $entry->open(); +-set_cached_item($app['server']->getIndex(),'tree','null',$tree); ++set_cached_item($app['server']->getIndex(),$tree,'tree','null'); + + header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s', + $app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param())); +Index: phpldapadmin-1.2.6.3/htdocs/refresh.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/htdocs/refresh.php ++++ phpldapadmin-1.2.6.3/htdocs/refresh.php +@@ -34,7 +34,7 @@ + $entry->open(); + } + +- set_cached_item($app['server']->getIndex(),'tree','null',$tree); ++ set_cached_item($app['server']->getIndex(),$tree,'tree','null'); + } + + if (get_request('meth','REQUEST') == 'ajax') +Index: phpldapadmin-1.2.6.3/lib/PageRender.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/PageRender.php ++++ phpldapadmin-1.2.6.3/lib/PageRender.php +@@ -827,7 +827,7 @@ + if (! $attribute->getOldValue($i)) + return; + +- draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false); ++ draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false); + } + + /** +@@ -844,16 +844,16 @@ + # If the attribute is modified, the new value needs to be stored in a session variable for the draw_jpeg_photo callback. + if ($attribute->hasBeenModified()) { + $_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i); +- draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false); ++ draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false); + } else +- draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false); ++ draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false); + } + + protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) { + $this->draw('HiddenValue',$attribute,$i); + $_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i); + +- draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false); ++ draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false); + } + + protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) { +Index: phpldapadmin-1.2.6.3/lib/Tree.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/Tree.php ++++ phpldapadmin-1.2.6.3/lib/Tree.php +@@ -68,7 +68,7 @@ + } + } + +- set_cached_item($server_id,'tree','null',$tree); ++ set_cached_item($server_id,$tree,'tree','null'); + } + + return $tree; +Index: phpldapadmin-1.2.6.3/lib/ds_ldap.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/ds_ldap.php ++++ phpldapadmin-1.2.6.3/lib/ds_ldap.php +@@ -1768,7 +1768,7 @@ + ksort($return); + + # cache the schema to prevent multiple schema fetches from LDAP server +- set_cached_item($this->index,'schema','objectclasses',$return); ++ set_cached_item($this->index,$return,'schema','objectclasses'); + } + + if (DEBUG_ENABLED) +@@ -1953,7 +1953,7 @@ + $return = $attrs; + + # cache the schema to prevent multiple schema fetches from LDAP server +- set_cached_item($this->index,'schema','attributes',$return); ++ set_cached_item($this->index,$return,'schema','attributes'); + } + + if (DEBUG_ENABLED) +@@ -2029,7 +2029,7 @@ + $return = $rules; + + # cache the schema to prevent multiple schema fetches from LDAP server +- set_cached_item($this->index,'schema','matchingrules',$return); ++ set_cached_item($this->index,$return,'schema','matchingrules'); + } + + if (DEBUG_ENABLED) +@@ -2078,7 +2078,7 @@ + ksort($return); + + # cache the schema to prevent multiple schema fetches from LDAP server +- set_cached_item($this->index,'schema','syntaxes',$return); ++ set_cached_item($this->index,$return,'schema','syntaxes'); + } + + if (DEBUG_ENABLED) +Index: phpldapadmin-1.2.6.3/lib/ds_ldap_pla.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/ds_ldap_pla.php ++++ phpldapadmin-1.2.6.3/lib/ds_ldap_pla.php +@@ -371,7 +371,7 @@ + + $tree->addEntry($dn); + +- set_cached_item($this->index,'tree','null',$tree); ++ set_cached_item($this->index,$tree,'tree','null'); + + run_hook('post_entry_create',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$entry_array)); + +@@ -403,7 +403,7 @@ + $tree = get_cached_item($this->index,'tree'); + $tree->delEntry($dn); + +- set_cached_item($this->index,'tree','null',$tree); ++ set_cached_item($this->index,$tree,'tree','null'); + + run_hook('post_entry_delete',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn)); + } +@@ -430,7 +430,7 @@ + $newdn = sprintf('%s,%s',$new_rdn,$container); + $tree->renameEntry($dn,$newdn); + +- set_cached_item($this->index,'tree','null',$tree); ++ set_cached_item($this->index,$tree,'tree','null'); + + run_hook('post_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container)); + } +Index: phpldapadmin-1.2.6.3/lib/functions.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/functions.php ++++ phpldapadmin-1.2.6.3/lib/functions.php +@@ -130,12 +130,13 @@ + debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); + + /** +- * error_reporting will be 0 if the error context occurred +- * within a function call with '@' preprended (ie, @ldap_bind() ); ++ * error_reporting will be only the non-ignorable error number bits ++ * 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) ++ if (!(ini_get('error_reporting') & error_reporting() & $errno)) + return; + + $file = basename($file); +@@ -928,7 +929,7 @@ + * + * Returns true on success of false on failure. + */ +-function set_cached_item($index,$item,$subitem='null',$data) { ++function set_cached_item($index,$data,$item,$subitem='null') { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); + +@@ -2032,8 +2033,8 @@ + * + * Usage Examples: + * +- * draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',"jpegPhoto",0,true,array('img_opts'=>"border: 1px; width: 150px")); +- * draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',null,1); ++ * draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',0,"jpegPhoto",true,array('img_opts'=>"border: 1px; width: 150px")); ++ * draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',1,null); + * + * + * @param object The Server to get the image from. +@@ -2046,7 +2047,7 @@ + * @param array Specifies optional image and CSS style attributes for the table tag. Supported keys are + * fixed_width, fixed_height, img_opts. + */ +-function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$draw_delete_buttons=false,$options=array()) { ++function draw_jpeg_photo($server,$dn,$index,$attr_name='jpegphoto',$draw_delete_buttons=false,$options=array()) { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); + +Index: phpldapadmin-1.2.6.3/lib/xmlTemplates.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/xmlTemplates.php ++++ phpldapadmin-1.2.6.3/lib/xmlTemplates.php +@@ -140,7 +140,7 @@ + + if ($changed) { + masort($this->templates,'title'); +- set_cached_item($server_id,$class['item'],'null',$this->templates); ++ set_cached_item($server_id,$this->templates,$class['item'],'null'); + } + } + +Index: phpldapadmin-1.2.6.3/lib/AttributeFactory.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/AttributeFactory.php ++++ phpldapadmin-1.2.6.3/lib/AttributeFactory.php +@@ -133,7 +133,7 @@ + return $this->newGidAttribute($name,$values,$server_id,$source); + + } else { +- return new Attribute($name,$values,$server_id,$source); ++ return new PLAAttribute($name,$values,$server_id,$source); + } + } + +Index: phpldapadmin-1.2.6.3/lib/BinaryAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/BinaryAttribute.php ++++ phpldapadmin-1.2.6.3/lib/BinaryAttribute.php +@@ -12,7 +12,7 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class BinaryAttribute extends Attribute { ++class BinaryAttribute extends PLAAttribute { + protected $filepaths; + protected $filenames; + +Index: phpldapadmin-1.2.6.3/lib/DateAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/DateAttribute.php ++++ phpldapadmin-1.2.6.3/lib/DateAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class DateAttribute extends Attribute { ++class DateAttribute extends PLAAttribute { + } + ?> +Index: phpldapadmin-1.2.6.3/lib/DnAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/DnAttribute.php ++++ phpldapadmin-1.2.6.3/lib/DnAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class DnAttribute extends Attribute { ++class DnAttribute extends PLAAttribute { + } + ?> +Index: phpldapadmin-1.2.6.3/lib/GidAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/GidAttribute.php ++++ phpldapadmin-1.2.6.3/lib/GidAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class GidAttribute extends Attribute { ++class GidAttribute extends PLAAttribute { + } + ?> +Index: phpldapadmin-1.2.6.3/lib/MultiLineAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/MultiLineAttribute.php ++++ phpldapadmin-1.2.6.3/lib/MultiLineAttribute.php +@@ -12,7 +12,7 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class MultiLineAttribute extends Attribute { ++class MultiLineAttribute extends PLAAttribute { + protected $rows = 0; + protected $cols = 0; + +Index: phpldapadmin-1.2.6.3/lib/ObjectClassAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/ObjectClassAttribute.php ++++ phpldapadmin-1.2.6.3/lib/ObjectClassAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class ObjectClassAttribute extends Attribute { ++class ObjectClassAttribute extends PLAAttribute { + } + ?> +Index: phpldapadmin-1.2.6.3/lib/Attribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/Attribute.php ++++ /dev/null +@@ -1,917 +0,0 @@ +-getServer($server_id); +- +- $sattr = $server->getSchemaAttribute($name); +- if ($sattr) { +- $this->name = $sattr->getName(false); +- $this->setLDAPdetails($sattr); +- +- } else +- $this->name = $name; +- +- $this->source = $source; +- +- # XML attributes are shown by default +- switch ($source) { +- case 'XML': $this->show(); +- $this->setXML($values); +- +- break; +- +- default: +- if (! isset($values['values'])) +- debug_dump_backtrace('no index "values"',1); +- +- $this->initValue($values['values']); +- } +- +- # Should this attribute be hidden +- if ($server->isAttrHidden($this->name)) +- $this->forcehide = true; +- +- # Should this attribute value be read only +- if ($server->isAttrReadOnly($this->name)) +- $this->readonly = true; +- +- # Should this attribute value be unique +- if ($server->isAttrUnique($this->name)) +- $this->unique = true; +- } +- +- /** +- * Return the name of the attribute. +- * +- * @param boolean $lower - Return the attribute in normal or lower case (default lower) +- * @param boolean $real - Return the real attribute name (with ;binary, or just the name) +- * @return string Attribute name +- */ +- public function getName($lower=true,$real=false) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->name); +- +- if ($real) +- return $lower ? strtolower($this->name) : $this->name; +- else +- return $lower ? strtolower($this->real_attr_name()) : $this->real_attr_name(); +- } +- +- public function getValues() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->values); +- +- return $this->values; +- } +- +- public function getOldValues() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->oldvalues); +- +- return $this->oldvalues; +- } +- +- public function getValueCount() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->values); +- +- return count($this->values); +- } +- +- public function getSource() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->source); +- +- return $this->source; +- } +- +- /** +- * Autovalue is called after the attribute is initialised, and thus the values from the ldap server will be set. +- */ +- public function autoValue($new_val) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($this->values) +- return; +- +- $this->values = $new_val; +- } +- +- public function initValue($new_val) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($this->values || $this->oldvalues) { +- debug_dump(array('new_val'=>$new_val,'this'=>$this)); +- debug_dump_backtrace('new and/or old values are set',1); +- } +- +- $this->values = $new_val; +- } +- +- public function clearValue() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->values = array(); +- } +- +- public function setOldValue($val) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->oldvalues = $val; +- } +- +- public function setValue($new_val) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($this->values) { +- if ($this->values == $new_val) +- return; +- +- if ($this->oldvalues) { +- debug_dump($this); +- debug_dump_backtrace('old values are set',1); +- } else +- $this->oldvalues = $this->values; +- } +- +- if ($new_val == $this->values) +- return; +- +- $this->values = $new_val; +- $this->justModified(); +- } +- +- public function addValue($new_val,$i=-1) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($i < 0) +- $i = $this->getValueCount(); +- +- $old_val = $this->getValue($i); +- if (is_null($old_val) || ($old_val != $new_val)) +- $this->justModified(); +- +- $this->values[$i] = $new_val; +- } +- +- public function delValue($i=-1) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($i < 0) +- $this->setValue(array()); +- +- if (! $this->hasBeenModified()) +- $this->oldvalues = $this->values; +- +- if (isset($this->values[$i])) { +- unset($this->values[$i]); +- $this->values = array_values($this->values); +- $this->justModified(); +- } +- } +- +- public function getValue($i) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if (isset($this->values[$i])) +- return $this->values[$i]; +- else +- return null; +- } +- +- public function getOldValue($i) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if (isset($this->oldvalues[$i])) +- return $this->oldvalues[$i]; +- else +- return null; +- } +- +- public function getMinValueCount() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->min_value_count); +- +- return $this->min_value_count; +- } +- +- public function setMinValueCount($min) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->min_value_count = $min; +- } +- +- public function getMaxValueCount() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->max_value_count); +- +- return $this->max_value_count; +- } +- +- public function setMaxValueCount($max) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->max_value_count = $max; +- } +- +- public function haveMoreValues() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($this->getMaxValueCount() < 0 || ($this->getValueCount() < $this->getMaxValueCount())) +- return true; +- else +- return false; +- } +- +- public function justModified() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->modified = true; +- } +- +- public function hasBeenModified() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->modified); +- +- return $this->modified; +- } +- +- public function isForceDelete() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->forcedelete); +- +- return $this->forcedelete; +- } +- +- public function setForceDelete() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->forcedelete = true; +- $this->oldvalues = $this->values; +- $this->values = array(); +- $this->justModified(); +- } +- +- public function isInternal() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->internal); +- +- return $this->internal; +- } +- +- public function setInternal() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->internal = true; +- } +- +- public function isRequired() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($this->getMinValueCount() > 0) +- return true; +- elseif ($this->ldaptype == 'must') +- return true; +- elseif ($this->isRDN()) +- return true; +- else +- return false; +- } +- +- public function isMay() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if (($this->ldaptype == 'may') && ! $this->isRequired()) +- return true; +- else +- return false; +- } +- +- public function setType($type) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->type = strtolower($type); +- } +- +- public function getType() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->type); +- +- return $this->type; +- } +- +- public function setLDAPtype($type) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->ldaptype = strtolower($type); +- } +- +- public function getLDAPtype() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->ldaptype); +- +- return $this->ldaptype; +- } +- +- public function setProperties($properties) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- foreach ($properties as $index => $value) { +- if ($index == 'maxvalnb') { +- $this->setMaxValueCount($value); +- continue; +- +- } elseif ($index == 'minvalnb') { +- $this->setMinValueCount($value); +- continue; +- +- } elseif ($index == 'maxlength') { +- $this->setMinValueCount($value); +- continue; +- +- } elseif ($index == 'hidden') { +- $this->visible = $value; +- continue; +- +- } elseif (in_array($index,array('cols','rows'))) { +- # @todo To be implemented +- continue; +- } +- +- if (isset($this->$index)) +- $this->$index = $value; +- else { +- debug_dump($this); +- debug_dump_backtrace(sprintf('Unknown property (%s) with value (%s) for (%s)',$index,$value,$this->getName()),1); +- } +- } +- } +- +- public function setRequired() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if ($this->getMinValueCount() <= 0) +- $this->setMinValueCount(1); +- } +- +- public function setOptional() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->setMinValueCount(0); +- } +- +- public function isReadOnly() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->readonly); +- +- return $this->readonly; +- } +- +- public function setReadOnly() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->readonly = true; +- } +- +- public function isMultiple() { +- return false; +- } +- +- public function isVisible() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- return $this->visible && (! $this->forcehide); +- } +- +- public function hide() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->visible = false; +- } +- +- public function show() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->visible = true; +- } +- +- public function haveFriendlyName() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- return $_SESSION[APPCONFIG]->haveFriendlyName($this); +- } +- +- public function getFriendlyName() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->display); +- +- if ($this->display) +- return $this->display; +- else +- return $_SESSION[APPCONFIG]->getFriendlyName($this); +- } +- +- public function setDescription($description) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->description = $description; +- } +- +- public function getDescription() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->description); +- +- return $this->description; +- } +- +- public function setIcon($icon) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->icon = $icon; +- } +- +- public function getIcon() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->icon); +- +- return $this->icon ? sprintf('%s/%s',IMGDIR,$this->icon) : ''; +- } +- +- public function getHint() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->hint); +- +- return $this->hint; +- } +- +- public function setHint($hint) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->hint = $hint; +- } +- +- public function getMaxLength() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->maxlength); +- +- return $this->maxlength; +- } +- +- public function setMaxLength($maxlength) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->maxlength = $maxlength; +- } +- +- public function getSize() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->size); +- +- return $this->size; +- } +- +- public function setSize($size) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->size = $size; +- } +- +- public function getSpacer() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->spacer); +- +- return $this->spacer; +- } +- +- public function getPage() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->page); +- +- return $this->page; +- } +- public function setPage($page) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->page = $page; +- } +- +- public function getOnChange() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->onchange); +- +- return $this->onchange; +- } +- +- public function getHelper() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helper); +- +- return $this->helper; +- } +- +- public function getHelperValue() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helpervalue); +- +- return $this->helpervalue; +- } +- +- public function getVerify() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->verify); +- +- return $this->verify; +- } +- +- public function setRDN($rdn) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->rdn = $rdn; +- } +- +- /** +- * Return if this attribute is an RDN attribute +- * +- * @return boolean +- */ +- public function isRDN() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->rdn); +- +- return $this->rdn; +- } +- +- /** +- * Capture all the LDAP details we are interested in +- * +- * @param sattr Schema Attribute +- */ +- private function setLDAPdetails($sattr) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- # By default, set this as a MAY attribute, later processing should make it a MUST attribute if it is. +- if (! $this->ldaptype) +- $this->ldaptype = 'may'; +- +- # Store our Aliases +- foreach ($sattr->getAliases() as $alias) +- array_push($this->aliases,strtolower($alias)); +- +- if ($sattr->getIsSingleValue()) +- $this->setMaxValueCount(1); +- } +- +- /** +- * Return a list of aliases for this Attribute (as defined by the schema) +- * This list will be lowercase. +- */ +- public function getAliases() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->aliases); +- +- return $this->aliases; +- } +- +- public function getAutoValue() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->autovalue); +- +- return $this->autovalue; +- } +- +- public function getPostValue() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->postvalue); +- +- return $this->postvalue; +- } +- +- public function setPostValue($postvalue) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $this->postvalue = $postvalue; +- } +- +- public function setXML($values) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- # Mostly all the time, this should be an array +- if (is_array($values)) +- foreach ($values as $index => $value) +- switch ($index) { +- # Helpers should be accompanied with a attribute. +- case 'helper': +- if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) +- system_message(array( +- 'title'=>sprintf('%s [%s]',_('Missing [post] setting in XML file'),$index), +- 'body'=>_('[helper] needs an accompanying [post] action.'), +- 'type'=>'warn')); +- +- if (isset($value['value']) && ! is_array($value['value']) && preg_match('/^=php\.(\w+)\((.*)\)$/',$value['value'],$matches)) { +- $this->helpervalue['function'] = $matches[1]; +- $this->helpervalue['args'] = $matches[2]; +- +- unset ($value['value']); +- } +- +- foreach ($value as $i => $detail) { +- if (! in_array($i,array('default','display','id','value'))) { +- if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) +- system_message(array( +- 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$i), +- 'body'=>sprintf('%s [%s]',_('Unknown XML type setting for helper will be ignored.'),$detail), +- 'type'=>'warn')); +- +- unset($value[$i]); +- } +- } +- +- $this->$index = $value; +- +- break; +- +- case 'hidden': $value ? $this->visible = false : $this->visible = true; +- break; +- +- case 'spacer': $value ? $this->$index = true : $this->$index = false; +- break; +- +- # Essentially, we ignore type, it is used to select an Attribute type in the Factory. But we'll generated a warning if there is an unknown type. +- case 'type': +- if (! in_array($value,array('password','multiselect','select','textarea')) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) +- system_message(array( +- 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$index), +- 'body'=>sprintf('%s [%s]',_('Unknown XML type setting will be ignored.'),$value), +- 'type'=>'warn')); +- +- break; +- +- case 'post': +- if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) { +- $this->postvalue['function'] = $matches[1]; +- $this->postvalue['args'] = $matches[2]; +- +- } else +- if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) +- system_message(array( +- 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$index), +- 'body'=>sprintf('%s [%s]',_('Unknown XML type setting will be ignored.'),$value), +- 'type'=>'warn')); +- +- case 'value': +- if (is_array($value)) +- foreach ($value as $x => $y) { +- if (! $this->haveMoreValues()) { +- system_message(array( +- 'title'=>_('Automatically removed attribute values from template'), +- 'body'=>sprintf('%s [%s]',_('Template defines more values than can be accepted by attribute.'),$this->getName(true)), +- 'type'=>'warn')); +- +- $this->clearValue(); +- +- break; +- +- } else +- $this->addValue($x,$y); +- } +- +- else +- # Check to see if the value is auto generated. +- if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) { +- $this->autovalue['function'] = $matches[1]; +- $this->autovalue['args'] = $matches[2]; +- +- # We'll add a hint too +- if (! $this->hint) +- $this->hint = _('Automatically determined'); +- +- } else +- $this->addValue($value); +- +- break; +- +- # Queries +- case 'ordersort': +- +- # Creation/Editing Templates +- case 'cols': +- case 'default': +- case 'display': +- case 'hint': +- case 'icon': +- case 'maxlength': +- case 'onchange': +- case 'order': +- case 'page': +- case 'readonly': +- case 'rows': +- case 'size': +- case 'values': +- case 'verify': $this->$index = $value; +- break; +- +- case 'max': +- if ($this->getMaxValueCount() == -1) +- $this->setMaxValueCount($value); +- +- default: +- if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) +- system_message(array( +- 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$index), +- 'body'=>sprintf('%s [%s]',_('Unknown attribute setting will be ignored.'),serialize($value)), +- 'type'=>'warn')); +- } +- +- elseif (is_string($values) && (strlen($values) > 0)) +- $this->values = array($values); +- } +- +- /** +- * Display the values removed in an attribute. +- */ +- public function getRemovedValues() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- return array_diff($this->getOldValues(),$this->getValues()); +- } +- +- /** +- * Display the values removed in an attribute. +- */ +- public function getAddedValues() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- return array_diff($this->getValues(),$this->getOldValues()); +- } +- +- /** +- * Prunes off anything after the ";" in an attr name. This is useful for +- * attributes that may have ";binary" appended to their names. With +- * real_attr_name(), you can more easily fetch these attributes' schema +- * with their "real" attribute name. +- * +- * @param string $attr_name The name of the attribute to examine. +- * @return string +- */ +- private function real_attr_name() { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name); +- +- return preg_replace('/;.*$/U','',$this->name); +- } +- +- /** +- * Does this attribute need supporting JS +- */ +- public function needJS($type=null) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- if (is_null($type)) { +- foreach (array('focus','blur','validate') as $type) +- if ($this->needJS($type)) +- return true; +- +- return false; +- +- } elseif ($type == 'focus') { +- # We dont have any focus javascript routines. +- return false; +- +- } elseif ($type == 'blur') { +- if ($this->onchange || $this->isRequired()) +- return true; +- else +- return false; +- +- } elseif ($type == 'validate') { +- if ($this->isRequired()) +- return true; +- else +- return false; +- +- } else +- debug_dump_backtrace(sprintf('Unknown JS request %s',$type),1); +- } +-} +-?> +Index: phpldapadmin-1.2.6.3/lib/PLAAttribute.php +=================================================================== +--- /dev/null ++++ phpldapadmin-1.2.6.3/lib/PLAAttribute.php +@@ -0,0 +1,917 @@ ++getServer($server_id); ++ ++ $sattr = $server->getSchemaAttribute($name); ++ if ($sattr) { ++ $this->name = $sattr->getName(false); ++ $this->setLDAPdetails($sattr); ++ ++ } else ++ $this->name = $name; ++ ++ $this->source = $source; ++ ++ # XML attributes are shown by default ++ switch ($source) { ++ case 'XML': $this->show(); ++ $this->setXML($values); ++ ++ break; ++ ++ default: ++ if (! isset($values['values'])) ++ debug_dump_backtrace('no index "values"',1); ++ ++ $this->initValue($values['values']); ++ } ++ ++ # Should this attribute be hidden ++ if ($server->isAttrHidden($this->name)) ++ $this->forcehide = true; ++ ++ # Should this attribute value be read only ++ if ($server->isAttrReadOnly($this->name)) ++ $this->readonly = true; ++ ++ # Should this attribute value be unique ++ if ($server->isAttrUnique($this->name)) ++ $this->unique = true; ++ } ++ ++ /** ++ * Return the name of the attribute. ++ * ++ * @param boolean $lower - Return the attribute in normal or lower case (default lower) ++ * @param boolean $real - Return the real attribute name (with ;binary, or just the name) ++ * @return string Attribute name ++ */ ++ public function getName($lower=true,$real=false) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->name); ++ ++ if ($real) ++ return $lower ? strtolower($this->name) : $this->name; ++ else ++ return $lower ? strtolower($this->real_attr_name()) : $this->real_attr_name(); ++ } ++ ++ public function getValues() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->values); ++ ++ return $this->values; ++ } ++ ++ public function getOldValues() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->oldvalues); ++ ++ return $this->oldvalues; ++ } ++ ++ public function getValueCount() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->values); ++ ++ return count($this->values); ++ } ++ ++ public function getSource() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->source); ++ ++ return $this->source; ++ } ++ ++ /** ++ * Autovalue is called after the attribute is initialised, and thus the values from the ldap server will be set. ++ */ ++ public function autoValue($new_val) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($this->values) ++ return; ++ ++ $this->values = $new_val; ++ } ++ ++ public function initValue($new_val) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($this->values || $this->oldvalues) { ++ debug_dump(array('new_val'=>$new_val,'this'=>$this)); ++ debug_dump_backtrace('new and/or old values are set',1); ++ } ++ ++ $this->values = $new_val; ++ } ++ ++ public function clearValue() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->values = array(); ++ } ++ ++ public function setOldValue($val) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->oldvalues = $val; ++ } ++ ++ public function setValue($new_val) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($this->values) { ++ if ($this->values == $new_val) ++ return; ++ ++ if ($this->oldvalues) { ++ debug_dump($this); ++ debug_dump_backtrace('old values are set',1); ++ } else ++ $this->oldvalues = $this->values; ++ } ++ ++ if ($new_val == $this->values) ++ return; ++ ++ $this->values = $new_val; ++ $this->justModified(); ++ } ++ ++ public function addValue($new_val,$i=-1) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($i < 0) ++ $i = $this->getValueCount(); ++ ++ $old_val = $this->getValue($i); ++ if (is_null($old_val) || ($old_val != $new_val)) ++ $this->justModified(); ++ ++ $this->values[$i] = $new_val; ++ } ++ ++ public function delValue($i=-1) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($i < 0) ++ $this->setValue(array()); ++ ++ if (! $this->hasBeenModified()) ++ $this->oldvalues = $this->values; ++ ++ if (isset($this->values[$i])) { ++ unset($this->values[$i]); ++ $this->values = array_values($this->values); ++ $this->justModified(); ++ } ++ } ++ ++ public function getValue($i) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if (isset($this->values[$i])) ++ return $this->values[$i]; ++ else ++ return null; ++ } ++ ++ public function getOldValue($i) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if (isset($this->oldvalues[$i])) ++ return $this->oldvalues[$i]; ++ else ++ return null; ++ } ++ ++ public function getMinValueCount() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->min_value_count); ++ ++ return $this->min_value_count; ++ } ++ ++ public function setMinValueCount($min) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->min_value_count = $min; ++ } ++ ++ public function getMaxValueCount() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->max_value_count); ++ ++ return $this->max_value_count; ++ } ++ ++ public function setMaxValueCount($max) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->max_value_count = $max; ++ } ++ ++ public function haveMoreValues() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($this->getMaxValueCount() < 0 || ($this->getValueCount() < $this->getMaxValueCount())) ++ return true; ++ else ++ return false; ++ } ++ ++ public function justModified() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->modified = true; ++ } ++ ++ public function hasBeenModified() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->modified); ++ ++ return $this->modified; ++ } ++ ++ public function isForceDelete() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->forcedelete); ++ ++ return $this->forcedelete; ++ } ++ ++ public function setForceDelete() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->forcedelete = true; ++ $this->oldvalues = $this->values; ++ $this->values = array(); ++ $this->justModified(); ++ } ++ ++ public function isInternal() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->internal); ++ ++ return $this->internal; ++ } ++ ++ public function setInternal() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->internal = true; ++ } ++ ++ public function isRequired() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($this->getMinValueCount() > 0) ++ return true; ++ elseif ($this->ldaptype == 'must') ++ return true; ++ elseif ($this->isRDN()) ++ return true; ++ else ++ return false; ++ } ++ ++ public function isMay() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if (($this->ldaptype == 'may') && ! $this->isRequired()) ++ return true; ++ else ++ return false; ++ } ++ ++ public function setType($type) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->type = strtolower($type); ++ } ++ ++ public function getType() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->type); ++ ++ return $this->type; ++ } ++ ++ public function setLDAPtype($type) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->ldaptype = strtolower($type); ++ } ++ ++ public function getLDAPtype() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->ldaptype); ++ ++ return $this->ldaptype; ++ } ++ ++ public function setProperties($properties) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ foreach ($properties as $index => $value) { ++ if ($index == 'maxvalnb') { ++ $this->setMaxValueCount($value); ++ continue; ++ ++ } elseif ($index == 'minvalnb') { ++ $this->setMinValueCount($value); ++ continue; ++ ++ } elseif ($index == 'maxlength') { ++ $this->setMinValueCount($value); ++ continue; ++ ++ } elseif ($index == 'hidden') { ++ $this->visible = $value; ++ continue; ++ ++ } elseif (in_array($index,array('cols','rows'))) { ++ # @todo To be implemented ++ continue; ++ } ++ ++ if (isset($this->$index)) ++ $this->$index = $value; ++ else { ++ debug_dump($this); ++ debug_dump_backtrace(sprintf('Unknown property (%s) with value (%s) for (%s)',$index,$value,$this->getName()),1); ++ } ++ } ++ } ++ ++ public function setRequired() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if ($this->getMinValueCount() <= 0) ++ $this->setMinValueCount(1); ++ } ++ ++ public function setOptional() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->setMinValueCount(0); ++ } ++ ++ public function isReadOnly() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->readonly); ++ ++ return $this->readonly; ++ } ++ ++ public function setReadOnly() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->readonly = true; ++ } ++ ++ public function isMultiple() { ++ return false; ++ } ++ ++ public function isVisible() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ return $this->visible && (! $this->forcehide); ++ } ++ ++ public function hide() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->visible = false; ++ } ++ ++ public function show() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->visible = true; ++ } ++ ++ public function haveFriendlyName() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ return $_SESSION[APPCONFIG]->haveFriendlyName($this); ++ } ++ ++ public function getFriendlyName() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->display); ++ ++ if ($this->display) ++ return $this->display; ++ else ++ return $_SESSION[APPCONFIG]->getFriendlyName($this); ++ } ++ ++ public function setDescription($description) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->description = $description; ++ } ++ ++ public function getDescription() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->description); ++ ++ return $this->description; ++ } ++ ++ public function setIcon($icon) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->icon = $icon; ++ } ++ ++ public function getIcon() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->icon); ++ ++ return $this->icon ? sprintf('%s/%s',IMGDIR,$this->icon) : ''; ++ } ++ ++ public function getHint() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->hint); ++ ++ return $this->hint; ++ } ++ ++ public function setHint($hint) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->hint = $hint; ++ } ++ ++ public function getMaxLength() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->maxlength); ++ ++ return $this->maxlength; ++ } ++ ++ public function setMaxLength($maxlength) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->maxlength = $maxlength; ++ } ++ ++ public function getSize() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->size); ++ ++ return $this->size; ++ } ++ ++ public function setSize($size) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->size = $size; ++ } ++ ++ public function getSpacer() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->spacer); ++ ++ return $this->spacer; ++ } ++ ++ public function getPage() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->page); ++ ++ return $this->page; ++ } ++ public function setPage($page) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->page = $page; ++ } ++ ++ public function getOnChange() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->onchange); ++ ++ return $this->onchange; ++ } ++ ++ public function getHelper() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helper); ++ ++ return $this->helper; ++ } ++ ++ public function getHelperValue() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helpervalue); ++ ++ return $this->helpervalue; ++ } ++ ++ public function getVerify() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->verify); ++ ++ return $this->verify; ++ } ++ ++ public function setRDN($rdn) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->rdn = $rdn; ++ } ++ ++ /** ++ * Return if this attribute is an RDN attribute ++ * ++ * @return boolean ++ */ ++ public function isRDN() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->rdn); ++ ++ return $this->rdn; ++ } ++ ++ /** ++ * Capture all the LDAP details we are interested in ++ * ++ * @param sattr Schema Attribute ++ */ ++ private function setLDAPdetails($sattr) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ # By default, set this as a MAY attribute, later processing should make it a MUST attribute if it is. ++ if (! $this->ldaptype) ++ $this->ldaptype = 'may'; ++ ++ # Store our Aliases ++ foreach ($sattr->getAliases() as $alias) ++ array_push($this->aliases,strtolower($alias)); ++ ++ if ($sattr->getIsSingleValue()) ++ $this->setMaxValueCount(1); ++ } ++ ++ /** ++ * Return a list of aliases for this Attribute (as defined by the schema) ++ * This list will be lowercase. ++ */ ++ public function getAliases() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->aliases); ++ ++ return $this->aliases; ++ } ++ ++ public function getAutoValue() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->autovalue); ++ ++ return $this->autovalue; ++ } ++ ++ public function getPostValue() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->postvalue); ++ ++ return $this->postvalue; ++ } ++ ++ public function setPostValue($postvalue) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $this->postvalue = $postvalue; ++ } ++ ++ public function setXML($values) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ # Mostly all the time, this should be an array ++ if (is_array($values)) ++ foreach ($values as $index => $value) ++ switch ($index) { ++ # Helpers should be accompanied with a attribute. ++ case 'helper': ++ if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) ++ system_message(array( ++ 'title'=>sprintf('%s [%s]',_('Missing [post] setting in XML file'),$index), ++ 'body'=>_('[helper] needs an accompanying [post] action.'), ++ 'type'=>'warn')); ++ ++ if (isset($value['value']) && ! is_array($value['value']) && preg_match('/^=php\.(\w+)\((.*)\)$/',$value['value'],$matches)) { ++ $this->helpervalue['function'] = $matches[1]; ++ $this->helpervalue['args'] = $matches[2]; ++ ++ unset ($value['value']); ++ } ++ ++ foreach ($value as $i => $detail) { ++ if (! in_array($i,array('default','display','id','value'))) { ++ if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) ++ system_message(array( ++ 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$i), ++ 'body'=>sprintf('%s [%s]',_('Unknown XML type setting for helper will be ignored.'),$detail), ++ 'type'=>'warn')); ++ ++ unset($value[$i]); ++ } ++ } ++ ++ $this->$index = $value; ++ ++ break; ++ ++ case 'hidden': $value ? $this->visible = false : $this->visible = true; ++ break; ++ ++ case 'spacer': $value ? $this->$index = true : $this->$index = false; ++ break; ++ ++ # Essentially, we ignore type, it is used to select an Attribute type in the Factory. But we'll generated a warning if there is an unknown type. ++ case 'type': ++ if (! in_array($value,array('password','multiselect','select','textarea')) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) ++ system_message(array( ++ 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$index), ++ 'body'=>sprintf('%s [%s]',_('Unknown XML type setting will be ignored.'),$value), ++ 'type'=>'warn')); ++ ++ break; ++ ++ case 'post': ++ if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) { ++ $this->postvalue['function'] = $matches[1]; ++ $this->postvalue['args'] = $matches[2]; ++ ++ } else ++ if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) ++ system_message(array( ++ 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$index), ++ 'body'=>sprintf('%s [%s]',_('Unknown XML type setting will be ignored.'),$value), ++ 'type'=>'warn')); ++ ++ case 'value': ++ if (is_array($value)) ++ foreach ($value as $x => $y) { ++ if (! $this->haveMoreValues()) { ++ system_message(array( ++ 'title'=>_('Automatically removed attribute values from template'), ++ 'body'=>sprintf('%s [%s]',_('Template defines more values than can be accepted by attribute.'),$this->getName(true)), ++ 'type'=>'warn')); ++ ++ $this->clearValue(); ++ ++ break; ++ ++ } else ++ $this->addValue($x,$y); ++ } ++ ++ else ++ # Check to see if the value is auto generated. ++ if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) { ++ $this->autovalue['function'] = $matches[1]; ++ $this->autovalue['args'] = $matches[2]; ++ ++ # We'll add a hint too ++ if (! $this->hint) ++ $this->hint = _('Automatically determined'); ++ ++ } else ++ $this->addValue($value); ++ ++ break; ++ ++ # Queries ++ case 'ordersort': ++ ++ # Creation/Editing Templates ++ case 'cols': ++ case 'default': ++ case 'display': ++ case 'hint': ++ case 'icon': ++ case 'maxlength': ++ case 'onchange': ++ case 'order': ++ case 'page': ++ case 'readonly': ++ case 'rows': ++ case 'size': ++ case 'values': ++ case 'verify': $this->$index = $value; ++ break; ++ ++ case 'max': ++ if ($this->getMaxValueCount() == -1) ++ $this->setMaxValueCount($value); ++ ++ default: ++ if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) ++ system_message(array( ++ 'title'=>sprintf('%s [%s]',_('Unknown XML setting'),$index), ++ 'body'=>sprintf('%s [%s]',_('Unknown attribute setting will be ignored.'),serialize($value)), ++ 'type'=>'warn')); ++ } ++ ++ elseif (is_string($values) && (strlen($values) > 0)) ++ $this->values = array($values); ++ } ++ ++ /** ++ * Display the values removed in an attribute. ++ */ ++ public function getRemovedValues() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ return array_diff($this->getOldValues(),$this->getValues()); ++ } ++ ++ /** ++ * Display the values removed in an attribute. ++ */ ++ public function getAddedValues() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ return array_diff($this->getValues(),$this->getOldValues()); ++ } ++ ++ /** ++ * Prunes off anything after the ";" in an attr name. This is useful for ++ * attributes that may have ";binary" appended to their names. With ++ * real_attr_name(), you can more easily fetch these attributes' schema ++ * with their "real" attribute name. ++ * ++ * @param string $attr_name The name of the attribute to examine. ++ * @return string ++ */ ++ private function real_attr_name() { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name); ++ ++ return preg_replace('/;.*$/U','',$this->name); ++ } ++ ++ /** ++ * Does this attribute need supporting JS ++ */ ++ public function needJS($type=null) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ if (is_null($type)) { ++ foreach (array('focus','blur','validate') as $type) ++ if ($this->needJS($type)) ++ return true; ++ ++ return false; ++ ++ } elseif ($type == 'focus') { ++ # We dont have any focus javascript routines. ++ return false; ++ ++ } elseif ($type == 'blur') { ++ if ($this->onchange || $this->isRequired()) ++ return true; ++ else ++ return false; ++ ++ } elseif ($type == 'validate') { ++ if ($this->isRequired()) ++ return true; ++ else ++ return false; ++ ++ } else ++ debug_dump_backtrace(sprintf('Unknown JS request %s',$type),1); ++ } ++} ++?> +Index: phpldapadmin-1.2.6.3/lib/PasswordAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/PasswordAttribute.php ++++ phpldapadmin-1.2.6.3/lib/PasswordAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class PasswordAttribute extends Attribute { ++class PasswordAttribute extends PLAAttribute { + } + ?> +Index: phpldapadmin-1.2.6.3/lib/SelectionAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/SelectionAttribute.php ++++ phpldapadmin-1.2.6.3/lib/SelectionAttribute.php +@@ -12,7 +12,7 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class SelectionAttribute extends Attribute { ++class SelectionAttribute extends PLAAttribute { + protected $selection = array(); + protected $multiple; + protected $default; +Index: phpldapadmin-1.2.6.3/lib/ShadowAttribute.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/ShadowAttribute.php ++++ phpldapadmin-1.2.6.3/lib/ShadowAttribute.php +@@ -12,7 +12,7 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class ShadowAttribute extends Attribute { ++class ShadowAttribute extends PLAAttribute { + public $shadow_before_today_attrs = array('shadowLastChange','shadowMin'); + public $shadow_after_today_attrs = array('shadowMax','shadowExpire','shadowWarning','shadowInactive'); + } +Index: phpldapadmin-1.2.6.3/lib/Visitor.php +=================================================================== +--- phpldapadmin-1.2.6.3.orig/lib/Visitor.php ++++ phpldapadmin-1.2.6.3/lib/Visitor.php +@@ -22,6 +22,15 @@ + protected $server_id; + + public function __call($method,$args) { ++ # This mapping array allows to map effective class names to ++ # function name suffixes. ++ # It has been introduced when class Attribute has been renamed ++ # to PLAAttribute to avoid a name clash with the built-in ++ # class of PHP 8. ++ # Entering a class name mapping here allows to rename the ++ # class without having to rename the methods too. ++ static $classmap = array('PLAAttribute' => 'Attribute'); ++ + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs); + +@@ -33,19 +42,14 @@ + $fnct = array_shift($args); + + $object = $args[0]; +- $class = get_class($object); +- +- $call = "$method$fnct$class"; +- +- array_push($methods,$call); + +- while ($class && ! method_exists($this,$call)) { ++ for ($class = get_class($object); $class; $class = get_parent_class($class)) { ++ $call = isset($classmap[$class])? "$method$fnct$classmap[$class]": "$method$fnct$class"; ++ array_push($methods,$call); ++ if (method_exists($this,$call)) ++ break; + if (defined('DEBUGTMP') && DEBUGTMP) + printf('Class (%s): Method doesnt exist (%s,%s)
',$class,get_class($this),$call); +- +- $class = get_parent_class($class); +- $call = "$method$fnct$class"; +- array_push($methods,$call); + } + + if (defined('DEBUGTMP') && DEBUGTMP) diff -Nru phpldapadmin-1.2.2/debian/patches/CVE-2017-11107.patch phpldapadmin-1.2.6.3/debian/patches/CVE-2017-11107.patch --- phpldapadmin-1.2.2/debian/patches/CVE-2017-11107.patch 2020-01-13 21:48:01.000000000 +0000 +++ phpldapadmin-1.2.6.3/debian/patches/CVE-2017-11107.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -Index: phpldapadmin-1.2.2/htdocs/entry_chooser.php -=================================================================== ---- phpldapadmin-1.2.2.orig/htdocs/entry_chooser.php -+++ phpldapadmin-1.2.2/htdocs/entry_chooser.php -@@ -15,9 +15,9 @@ $www['page'] = new page(); - - $request = array(); - $request['container'] = get_request('container','GET'); --$request['form'] = get_request('form','GET'); --$request['element'] = get_request('element','GET'); --$request['rdn'] = get_request('rdn','GET'); -+$request['form'] = htmlspecialchars(addslashes(get_request('form','GET'))); -+$request['element'] = htmlspecialchars(addslashes(get_request('element','GET'))); -+$request['rdn'] = htmlspecialchars(addslashes(get_request('rdn','GET'))); - - echo '