diff options
author | khorben <khorben@pkgsrc.org> | 2022-04-16 03:11:28 +0000 |
---|---|---|
committer | khorben <khorben@pkgsrc.org> | 2022-04-16 03:11:28 +0000 |
commit | 9142a78b32ca8e9986068ef144bd393b67a78279 (patch) | |
tree | 10cb2b8a241dd763fca17667b184ed9b1cf13dea | |
parent | 8a55a0d6c8226eda19bbd4a148323ef4b80a2e94 (diff) | |
download | pkgsrc-9142a78b32ca8e9986068ef144bd393b67a78279.tar.gz |
phpldapadmin: package version 1.2.6.3
This changes the upstream to leenooks/phpLDAPadmin on GitHub.
This also includes a patch from Debian at
https://packages.debian.org/source/sid/phpldapadmin
(phpldapadmin_1.2.6.3-0.2.debian.tar.xz) in order to support newer
versions of PHP. This package had become unusable with the version
of PHP shipped by pkgsrc by default (7.4 as of today).
Tested on NetBSD/amd64, Darwin/amd64.
31 files changed, 2276 insertions, 246 deletions
diff --git a/databases/phpldapadmin/Makefile b/databases/phpldapadmin/Makefile index 6730d6aa745..8fc13c51891 100644 --- a/databases/phpldapadmin/Makefile +++ b/databases/phpldapadmin/Makefile @@ -1,10 +1,11 @@ -# $NetBSD: Makefile,v 1.46 2021/03/07 13:08:47 taca Exp $ +# $NetBSD: Makefile,v 1.47 2022/04/16 03:11:28 khorben Exp $ DISTNAME= phpldapadmin-${VERSION} PKGNAME= ${PHP_PKG_PREFIX}-${DISTNAME} CATEGORIES= databases www -MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=phpldapadmin/} -EXTRACT_SUFX= .tgz +MASTER_SITES= ${MASTER_SITE_GITHUB:=leenooks/} +GITHUB_PROJECT= phpLDAPadmin +GITHUB_TAG= ${VERSION} MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= http://phpldapadmin.sourceforge.net/ @@ -19,7 +20,7 @@ DEPENDS+= ${PHP_PKG_PREFIX}-gettext>=4.1.2:../../devel/php-gettext USE_TOOLS+= pax -VERSION= 1.2.3 +VERSION= 1.2.6.3 NO_BUILD= YES CONF_FILES+= ${PREFIX}/share/examples/phpldapadmin/config.php.example \ @@ -51,7 +52,7 @@ do-install: cd ${WRKSRC}/${i:Q} && ${FIND} . -type f \! -name '*.orig' -print | \ pax -rwppm ${DESTDIR}${PREFIX}/share/phpldapadmin/${i:Q} .endfor - ${INSTALL_DATA} ${WRKSRC}/INSTALL \ + ${INSTALL_DATA} ${WRKSRC}/INSTALL.md \ ${DESTDIR}${PREFIX}/share/doc/phpldapadmin ${INSTALL_DATA} ${WRKSRC}/LICENSE \ ${DESTDIR}${PREFIX}/share/doc/phpldapadmin diff --git a/databases/phpldapadmin/PLIST b/databases/phpldapadmin/PLIST index 3f0c28e6818..a43cfe22232 100644 --- a/databases/phpldapadmin/PLIST +++ b/databases/phpldapadmin/PLIST @@ -1,5 +1,5 @@ -@comment $NetBSD: PLIST,v 1.11 2013/04/02 16:00:10 taca Exp $ -share/doc/phpldapadmin/INSTALL +@comment $NetBSD: PLIST,v 1.12 2022/04/16 03:11:28 khorben Exp $ +share/doc/phpldapadmin/INSTALL.md share/doc/phpldapadmin/LICENSE share/examples/phpldapadmin/config.php.example share/examples/phpldapadmin/phpldapadmin.conf @@ -514,7 +514,6 @@ share/phpldapadmin/htdocs/view_jpeg_photo.php share/phpldapadmin/htdocs/welcome.php share/phpldapadmin/index.php share/phpldapadmin/lib/AJAXTree.php -share/phpldapadmin/lib/Attribute.php share/phpldapadmin/lib/AttributeFactory.php share/phpldapadmin/lib/BinaryAttribute.php share/phpldapadmin/lib/DateAttribute.php @@ -525,6 +524,7 @@ share/phpldapadmin/lib/JpegAttribute.php share/phpldapadmin/lib/MassRender.php share/phpldapadmin/lib/MultiLineAttribute.php share/phpldapadmin/lib/ObjectClassAttribute.php +share/phpldapadmin/lib/PLAAttribute.php share/phpldapadmin/lib/PageRender.php share/phpldapadmin/lib/PasswordAttribute.php share/phpldapadmin/lib/Query.php diff --git a/databases/phpldapadmin/distinfo b/databases/phpldapadmin/distinfo index c5bc59a34ae..1bb0ade83de 100644 --- a/databases/phpldapadmin/distinfo +++ b/databases/phpldapadmin/distinfo @@ -1,13 +1,29 @@ -$NetBSD: distinfo,v 1.19 2021/10/26 10:09:45 nia Exp $ +$NetBSD: distinfo,v 1.20 2022/04/16 03:11:28 khorben Exp $ -BLAKE2s (phpldapadmin-1.2.3.tgz) = 87fad8e94727f824af91ed9576a85009d5bd7a69ab8ed2d8f805147a8c7a2cdd -SHA512 (phpldapadmin-1.2.3.tgz) = 58a57ca577586685ebd0d7fde7e299b8945d1693018c7803e19239b79f4b9d72a4d207d53c9f284268e32398108038efafcdb434e634619bfe87db3524d267b6 -Size (phpldapadmin-1.2.3.tgz) = 1115707 bytes -SHA1 (patch-config_config.php.example) = c6cdc8e62ec8c06ae99f219f1a20694502d6fe0d -SHA1 (patch-htdocs_index.php) = 4788ea606b6aa0cc93bb319c8d6b180ccf3010e6 -SHA1 (patch-lib_PageRender.php) = 198e637024c01b164017a15b5449782ce8829996 -SHA1 (patch-lib_QueryRender.php) = 806e3d2f874aca0ff8c0c07d4f4db57a2008185c -SHA1 (patch-lib_TemplateRender.php) = 766981b0a31221d2580e7f592140dd95601caf40 -SHA1 (patch-lib_ds__ldap.php) = 55563684fba16c1fbebbfa88ff1ce506f6c947fc -SHA1 (patch-lib_ds__ldap__pla.php) = 5331d8410ace331a5924f96e3f90a991866b9345 -SHA1 (patch-lib_functions.php) = 06be1a704070e5466278dfc3003f5c015fcc93c9 +BLAKE2s (phpldapadmin-1.2.6.3.tar.gz) = 357714bc52f95ce722eb85b008b395ce22843b223e312e9ec22e5ecb7304a2e9 +SHA512 (phpldapadmin-1.2.6.3.tar.gz) = 66aeb81c812830968df5d3a2f0ccdd479fe5d7ed3bb729c0fb9991d3efa20263a493b38bfe48c99ad2c93c2ee549f51f53e064fb1381bc7e126ca2ad2bfc3167 +Size (phpldapadmin-1.2.6.3.tar.gz) = 1130061 bytes +SHA1 (patch-htdocs_collapse.php) = 2ba096f8ba5c8304e27f3d10818605da667be72c +SHA1 (patch-htdocs_draw__tree__node.php) = 63ec819e6fdc7be05188df9a4d603e0d01261b2e +SHA1 (patch-htdocs_expand.php) = 06b83f5093e23f1628cb1be7a741b0eabe5e0e97 +SHA1 (patch-htdocs_refresh.php) = ea724a89cd540191ec4c2e2adbb3c25b359cdbe6 +SHA1 (patch-lib_Attribute.php) = e0d95fc787e19da0b779dc0b974a2755f0d1c0e7 +SHA1 (patch-lib_AttributeFactory.php) = 7db91e50bc649ee0a4bea6a63cb9f055be3f9340 +SHA1 (patch-lib_BinaryAttribute.php) = 108b6fdca6f0013513adc81c6f092ef85c821a2b +SHA1 (patch-lib_DateAttribute.php) = 051ebe274fa7ebb53955464d7b6a63d34c334d4b +SHA1 (patch-lib_DnAttribute.php) = 8014cf8e8fe278298979197aaf8370b31adf65cb +SHA1 (patch-lib_GidAttribute.php) = 483c4a5ad673a2244cbdf5efd008395174520544 +SHA1 (patch-lib_MultiLineAttribute.php) = e5ac91a1d20b1103fd708c463b3bab1b42cc3b4d +SHA1 (patch-lib_ObjectClassAttribute.php) = 710741d4938345b4548c7fdc7b281c7f50c18eab +SHA1 (patch-lib_PLAAttribute.php) = 4ea90a667d341789a825f2d3a022d47e0c31f582 +SHA1 (patch-lib_PageRender.php) = b9dfb3a1eb7d7170fc054b46ce78a333a5693047 +SHA1 (patch-lib_PasswordAttribute.php) = 6c75b2e79c185ab213f4b5b12838c457b56641fc +SHA1 (patch-lib_SelectionAttribute.php) = 541fa3d50c0d971d86eb57c53c2cafbb2ed79076 +SHA1 (patch-lib_ShadowAttribute.php) = f75dbda7c48172381d786d170cde674232673798 +SHA1 (patch-lib_Tree.php) = 3a19a78e12c125d86e5c61abcceee40e620f2558 +SHA1 (patch-lib_Visitor.php) = fa7606271887feaa94eb74f80933d6c2f572f21b +SHA1 (patch-lib_common.php) = e039f34c44640022cb3501cc0e625b1dfc348268 +SHA1 (patch-lib_ds__ldap.php) = 5ef5eabcbca6b4c4d877f864e8beae3cb6d84c41 +SHA1 (patch-lib_ds__ldap__pla.php) = 69f1fd2e6b019ed741595099f6acfe5052a65833 +SHA1 (patch-lib_functions.php) = 1a2fa831a150d84b67dd3c9e5dde9d153d5e6383 +SHA1 (patch-lib_xmlTemplates.php) = f58ea751b9d2c9f5adfc968a73dcb94a3fe121c2 diff --git a/databases/phpldapadmin/patches/patch-config_config.php.example b/databases/phpldapadmin/patches/patch-config_config.php.example deleted file mode 100644 index 24cb904500a..00000000000 --- a/databases/phpldapadmin/patches/patch-config_config.php.example +++ /dev/null @@ -1,24 +0,0 @@ -$NetBSD: patch-config_config.php.example,v 1.1 2021/02/21 22:22:22 khorben Exp $ - -Fix for PHP >= 5.5 - ---- config/config.php.example.orig 2012-10-01 06:54:14.000000000 +0000 -+++ config/config.php.example -@@ -379,7 +379,7 @@ $servers->setValue('server','name','My L - - /* 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 -@@ -546,7 +546,7 @@ $servers->setValue('sasl','authz_id_rege - $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); diff --git a/databases/phpldapadmin/patches/patch-htdocs_collapse.php b/databases/phpldapadmin/patches/patch-htdocs_collapse.php new file mode 100644 index 00000000000..b5a09c85dd3 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-htdocs_collapse.php @@ -0,0 +1,13 @@ +$NetBSD: patch-htdocs_collapse.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- htdocs/collapse.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ htdocs/collapse.php +@@ -19,7 +19,7 @@ $dn = get_request('dn','GET',true); + $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())); diff --git a/databases/phpldapadmin/patches/patch-htdocs_draw__tree__node.php b/databases/phpldapadmin/patches/patch-htdocs_draw__tree__node.php new file mode 100644 index 00000000000..98439b7a185 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-htdocs_draw__tree__node.php @@ -0,0 +1,13 @@ +$NetBSD: patch-htdocs_draw__tree__node.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- htdocs/draw_tree_node.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ htdocs/draw_tree_node.php +@@ -50,7 +50,7 @@ if ($request['dn']) { + } + + 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']); diff --git a/databases/phpldapadmin/patches/patch-htdocs_expand.php b/databases/phpldapadmin/patches/patch-htdocs_expand.php new file mode 100644 index 00000000000..9c22b13645c --- /dev/null +++ b/databases/phpldapadmin/patches/patch-htdocs_expand.php @@ -0,0 +1,13 @@ +$NetBSD: patch-htdocs_expand.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- htdocs/expand.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ htdocs/expand.php +@@ -19,7 +19,7 @@ $dn = get_request('dn','GET',true); + $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())); diff --git a/databases/phpldapadmin/patches/patch-htdocs_index.php b/databases/phpldapadmin/patches/patch-htdocs_index.php deleted file mode 100644 index 728005d7915..00000000000 --- a/databases/phpldapadmin/patches/patch-htdocs_index.php +++ /dev/null @@ -1,18 +0,0 @@ -$NetBSD: patch-htdocs_index.php,v 1.1 2021/02/21 22:22:22 khorben Exp $ - -Bail out if the configuration file is missing - ---- htdocs/index.php.orig 2012-10-01 06:54:14.000000000 +0000 -+++ htdocs/index.php -@@ -57,6 +57,11 @@ if (defined('CONFDIR')) - else - $app['config_file'] = 'config.php'; - -+if (! is_readable($app['config_file'])) { -+ if (ob_get_level()) ob_end_clean(); -+ die(sprintf("Missing configuration file <b>%s</b> - have you created it?",$app['config_file'])); -+} -+ - # Make sure this PHP install has session support - if (! extension_loaded('session')) - error('<p>Your install of PHP appears to be missing php-session support.</p><p>Please install php-session support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>','error',null,true); diff --git a/databases/phpldapadmin/patches/patch-htdocs_refresh.php b/databases/phpldapadmin/patches/patch-htdocs_refresh.php new file mode 100644 index 00000000000..b1099f8498c --- /dev/null +++ b/databases/phpldapadmin/patches/patch-htdocs_refresh.php @@ -0,0 +1,13 @@ +$NetBSD: patch-htdocs_refresh.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- htdocs/refresh.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ htdocs/refresh.php +@@ -34,7 +34,7 @@ if (get_request('purge','REQUEST')) { + $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') diff --git a/databases/phpldapadmin/patches/patch-lib_Attribute.php b/databases/phpldapadmin/patches/patch-lib_Attribute.php new file mode 100644 index 00000000000..e16cf8dbd54 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_Attribute.php @@ -0,0 +1,922 @@ +$NetBSD: patch-lib_Attribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/Attribute.php.orig 2022-04-15 22:51:57.000000000 +0000 ++++ lib/Attribute.php +@@ -1,917 +0,0 @@ +-<?php +-/** +- * Classes and functions for the template engine. +- * +- * @author The phpLDAPadmin development team +- * @package phpLDAPadmin +- */ +- +-/** +- * Represents an attribute of a template. +- * +- * @package phpLDAPadmin +- * @subpackage Templates +- */ +-class Attribute { +- # Attribute Name +- public $name; +- # Source of this attribute definition +- protected $source; +- +- # Current and Old Values +- protected $oldvalues = array(); +- protected $values = array(); +- +- # MIN/MAX number of values +- protected $min_value_count = -1; +- protected $max_value_count = -1; +- +- # Is the attribute internal +- protected $internal = false; +- # Has the attribute been modified +- protected $modified = false; +- # Is the attribute being deleted because of an object class removal +- protected $forcedelete = false; +- # Is the attribute visible +- protected $visible = false; +- protected $forcehide = false; +- # Is the attribute modifiable +- protected $readonly = false; +- # LDAP attribute type MUST/MAY +- protected $ldaptype = null; +- # Attribute property type (eg password, select, multiselect) +- protected $type = ''; +- # Attribute value to keep unique +- protected $unique = false; +- +- # Display parameters +- protected $display = ''; +- protected $icon = ''; +- protected $hint = ''; +- # Helper details +- protected $helper = array(); +- protected $helpervalue = array(); +- # Onchange details +- protected $onchange = array(); +- # Show spacer after this attribute is rendered +- protected $spacer = false; +- protected $verify = false; +- +- # Component size +- protected $size = 0; +- # Value max length +- protected $maxlength = 0; +- # Text Area sizings +- protected $cols = 0; +- protected $rows = 0; +- +- # Public for sorting +- public $page = 1; +- public $order = 255; +- public $ordersort = 255; +- public $rdn = false; +- +- # Schema Aliases for this attribute (stored in lowercase) +- protected $aliases = array(); +- +- # Configuration for automatically generated values +- protected $autovalue = array(); +- protected $postvalue = array(); +- +- public function __construct($name,$values,$server_id,$source=null) { +- if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) +- debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); +- +- $server = $_SESSION[APPCONFIG]->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 <post> attribute. +- case 'helper': +- if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) +- system_message(array( +- 'title'=>sprintf('%s [<i>%s</i>]',_('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 [<i>%s</i>]',_('Unknown XML setting'),$i), +- 'body'=>sprintf('%s <small>[%s]</small>',_('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 [<i>%s</i>]',_('Unknown XML setting'),$index), +- 'body'=>sprintf('%s <small>[%s]</small>',_('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 [<i>%s</i>]',_('Unknown XML setting'),$index), +- 'body'=>sprintf('%s <small>[%s]</small>',_('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 <small>[%s]</small>',_('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 [<i>%s</i>]',_('Unknown XML setting'),$index), +- 'body'=>sprintf('%s <small>[%s]</small>',_('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); +- } +-} +-?> diff --git a/databases/phpldapadmin/patches/patch-lib_AttributeFactory.php b/databases/phpldapadmin/patches/patch-lib_AttributeFactory.php new file mode 100644 index 00000000000..542f7aa53e4 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_AttributeFactory.php @@ -0,0 +1,13 @@ +$NetBSD: patch-lib_AttributeFactory.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/AttributeFactory.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/AttributeFactory.php +@@ -133,7 +133,7 @@ class AttributeFactory { + 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); + } + } + diff --git a/databases/phpldapadmin/patches/patch-lib_BinaryAttribute.php b/databases/phpldapadmin/patches/patch-lib_BinaryAttribute.php new file mode 100644 index 00000000000..61c93346766 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_BinaryAttribute.php @@ -0,0 +1,13 @@ +$NetBSD: patch-lib_BinaryAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/BinaryAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/BinaryAttribute.php +@@ -12,7 +12,7 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class BinaryAttribute extends Attribute { ++class BinaryAttribute extends PLAAttribute { + protected $filepaths; + protected $filenames; + diff --git a/databases/phpldapadmin/patches/patch-lib_DateAttribute.php b/databases/phpldapadmin/patches/patch-lib_DateAttribute.php new file mode 100644 index 00000000000..8d4997635cb --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_DateAttribute.php @@ -0,0 +1,12 @@ +$NetBSD: patch-lib_DateAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/DateAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/DateAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class DateAttribute extends Attribute { ++class DateAttribute extends PLAAttribute { + } + ?> diff --git a/databases/phpldapadmin/patches/patch-lib_DnAttribute.php b/databases/phpldapadmin/patches/patch-lib_DnAttribute.php new file mode 100644 index 00000000000..bbfdd008c62 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_DnAttribute.php @@ -0,0 +1,12 @@ +$NetBSD: patch-lib_DnAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/DnAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/DnAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class DnAttribute extends Attribute { ++class DnAttribute extends PLAAttribute { + } + ?> diff --git a/databases/phpldapadmin/patches/patch-lib_GidAttribute.php b/databases/phpldapadmin/patches/patch-lib_GidAttribute.php new file mode 100644 index 00000000000..d5990244ac9 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_GidAttribute.php @@ -0,0 +1,12 @@ +$NetBSD: patch-lib_GidAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/GidAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/GidAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class GidAttribute extends Attribute { ++class GidAttribute extends PLAAttribute { + } + ?> diff --git a/databases/phpldapadmin/patches/patch-lib_MultiLineAttribute.php b/databases/phpldapadmin/patches/patch-lib_MultiLineAttribute.php new file mode 100644 index 00000000000..c70fc044635 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_MultiLineAttribute.php @@ -0,0 +1,13 @@ +$NetBSD: patch-lib_MultiLineAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/MultiLineAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ 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; + diff --git a/databases/phpldapadmin/patches/patch-lib_ObjectClassAttribute.php b/databases/phpldapadmin/patches/patch-lib_ObjectClassAttribute.php new file mode 100644 index 00000000000..092fdfe7c26 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_ObjectClassAttribute.php @@ -0,0 +1,12 @@ +$NetBSD: patch-lib_ObjectClassAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/ObjectClassAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/ObjectClassAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class ObjectClassAttribute extends Attribute { ++class ObjectClassAttribute extends PLAAttribute { + } + ?> diff --git a/databases/phpldapadmin/patches/patch-lib_PLAAttribute.php b/databases/phpldapadmin/patches/patch-lib_PLAAttribute.php new file mode 100644 index 00000000000..f4dfb739b9e --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_PLAAttribute.php @@ -0,0 +1,922 @@ +$NetBSD: patch-lib_PLAAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/PLAAttribute.php.orig 2022-04-15 22:53:04.000000000 +0000 ++++ lib/PLAAttribute.php +@@ -0,0 +1,917 @@ ++<?php ++/** ++ * Classes and functions for the template engine. ++ * ++ * @author The phpLDAPadmin development team ++ * @package phpLDAPadmin ++ */ ++ ++/** ++ * Represents an attribute of a template. ++ * ++ * @package phpLDAPadmin ++ * @subpackage Templates ++ */ ++class PLAAttribute { ++ # Attribute Name ++ public $name; ++ # Source of this attribute definition ++ protected $source; ++ ++ # Current and Old Values ++ protected $oldvalues = array(); ++ protected $values = array(); ++ ++ # MIN/MAX number of values ++ protected $min_value_count = -1; ++ protected $max_value_count = -1; ++ ++ # Is the attribute internal ++ protected $internal = false; ++ # Has the attribute been modified ++ protected $modified = false; ++ # Is the attribute being deleted because of an object class removal ++ protected $forcedelete = false; ++ # Is the attribute visible ++ protected $visible = false; ++ protected $forcehide = false; ++ # Is the attribute modifiable ++ protected $readonly = false; ++ # LDAP attribute type MUST/MAY ++ protected $ldaptype = null; ++ # Attribute property type (eg password, select, multiselect) ++ protected $type = ''; ++ # Attribute value to keep unique ++ protected $unique = false; ++ ++ # Display parameters ++ protected $display = ''; ++ protected $icon = ''; ++ protected $hint = ''; ++ # Helper details ++ protected $helper = array(); ++ protected $helpervalue = array(); ++ # Onchange details ++ protected $onchange = array(); ++ # Show spacer after this attribute is rendered ++ protected $spacer = false; ++ protected $verify = false; ++ ++ # Component size ++ protected $size = 0; ++ # Value max length ++ protected $maxlength = 0; ++ # Text Area sizings ++ protected $cols = 0; ++ protected $rows = 0; ++ ++ # Public for sorting ++ public $page = 1; ++ public $order = 255; ++ public $ordersort = 255; ++ public $rdn = false; ++ ++ # Schema Aliases for this attribute (stored in lowercase) ++ protected $aliases = array(); ++ ++ # Configuration for automatically generated values ++ protected $autovalue = array(); ++ protected $postvalue = array(); ++ ++ public function __construct($name,$values,$server_id,$source=null) { ++ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) ++ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); ++ ++ $server = $_SESSION[APPCONFIG]->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 <post> attribute. ++ case 'helper': ++ if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) ++ system_message(array( ++ 'title'=>sprintf('%s [<i>%s</i>]',_('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 [<i>%s</i>]',_('Unknown XML setting'),$i), ++ 'body'=>sprintf('%s <small>[%s]</small>',_('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 [<i>%s</i>]',_('Unknown XML setting'),$index), ++ 'body'=>sprintf('%s <small>[%s]</small>',_('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 [<i>%s</i>]',_('Unknown XML setting'),$index), ++ 'body'=>sprintf('%s <small>[%s]</small>',_('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 <small>[%s]</small>',_('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 [<i>%s</i>]',_('Unknown XML setting'),$index), ++ 'body'=>sprintf('%s <small>[%s]</small>',_('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); ++ } ++} ++?> diff --git a/databases/phpldapadmin/patches/patch-lib_PageRender.php b/databases/phpldapadmin/patches/patch-lib_PageRender.php index b1eddb5b3fd..99e4dac4c1b 100644 --- a/databases/phpldapadmin/patches/patch-lib_PageRender.php +++ b/databases/phpldapadmin/patches/patch-lib_PageRender.php @@ -1,33 +1,35 @@ -$NetBSD: patch-lib_PageRender.php,v 1.1 2021/02/21 22:22:22 khorben Exp $ +$NetBSD: patch-lib_PageRender.php,v 1.2 2022/04/16 03:11:28 khorben Exp $ Fix for PHP >= 5.5 ---- lib/PageRender.php.orig 2012-10-01 06:54:14.000000000 +0000 +--- lib/PageRender.php.orig 2022-04-15 22:45:43.000000000 +0000 +++ lib/PageRender.php -@@ -287,7 +287,7 @@ class PageRender extends Visitor { - break; +@@ -827,7 +827,7 @@ class PageRender extends Visitor { + if (! $attribute->getOldValue($i)) + return; - default: -- $vals[$i] = password_hash($passwordvalue,$enc); -+ $vals[$i] = pla_password_hash($passwordvalue,$enc); - } +- 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); + } - $vals = array_unique($vals); -@@ -957,7 +957,7 @@ class PageRender extends Visitor { - if (trim($val)) - $enc_type = get_enc_type($val); - else -- $enc_type = $server->getValue('appearance','password_hash'); -+ $enc_type = $server->getValue('appearance','pla_password_hash'); + /** +@@ -844,16 +844,16 @@ class PageRender extends Visitor { + # 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); + } - $obfuscate_password = obfuscate_password_display($enc_type); + protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) { + $this->draw('HiddenValue',$attribute,$i); + $_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i); -@@ -982,7 +982,7 @@ class PageRender extends Visitor { - if (trim($val)) - $enc_type = get_enc_type($val); - else -- $enc_type = $server->getValue('appearance','password_hash'); -+ $enc_type = $server->getValue('appearance','pla_password_hash'); - - echo '<table cellspacing="0" cellpadding="0"><tr><td valign="top">'; +- 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) { diff --git a/databases/phpldapadmin/patches/patch-lib_PasswordAttribute.php b/databases/phpldapadmin/patches/patch-lib_PasswordAttribute.php new file mode 100644 index 00000000000..18140f611ec --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_PasswordAttribute.php @@ -0,0 +1,12 @@ +$NetBSD: patch-lib_PasswordAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/PasswordAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/PasswordAttribute.php +@@ -12,6 +12,6 @@ + * @package phpLDAPadmin + * @subpackage Templates + */ +-class PasswordAttribute extends Attribute { ++class PasswordAttribute extends PLAAttribute { + } + ?> diff --git a/databases/phpldapadmin/patches/patch-lib_QueryRender.php b/databases/phpldapadmin/patches/patch-lib_QueryRender.php deleted file mode 100644 index a64946500f8..00000000000 --- a/databases/phpldapadmin/patches/patch-lib_QueryRender.php +++ /dev/null @@ -1,15 +0,0 @@ -$NetBSD: patch-lib_QueryRender.php,v 1.4 2021/02/21 22:22:22 khorben Exp $ - -Fix for PHP >= 7.3 - ---- lib/QueryRender.php.orig 2012-10-01 06:54:14.000000000 +0000 -+++ lib/QueryRender.php -@@ -321,7 +321,7 @@ class QueryRender extends PageRender { - if (! $results) { - echo _('Search returned no results'); - -- continue; -+ continue 2; - } - - printf('<form action="cmd.php" method="post" id="massform_%s">',$counter); diff --git a/databases/phpldapadmin/patches/patch-lib_SelectionAttribute.php b/databases/phpldapadmin/patches/patch-lib_SelectionAttribute.php new file mode 100644 index 00000000000..1c7baf76578 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_SelectionAttribute.php @@ -0,0 +1,13 @@ +$NetBSD: patch-lib_SelectionAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/SelectionAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ 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; diff --git a/databases/phpldapadmin/patches/patch-lib_ShadowAttribute.php b/databases/phpldapadmin/patches/patch-lib_ShadowAttribute.php new file mode 100644 index 00000000000..1750d3d4246 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_ShadowAttribute.php @@ -0,0 +1,13 @@ +$NetBSD: patch-lib_ShadowAttribute.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/ShadowAttribute.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ 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'); + } diff --git a/databases/phpldapadmin/patches/patch-lib_TemplateRender.php b/databases/phpldapadmin/patches/patch-lib_TemplateRender.php deleted file mode 100644 index 362a9962ddd..00000000000 --- a/databases/phpldapadmin/patches/patch-lib_TemplateRender.php +++ /dev/null @@ -1,15 +0,0 @@ -$NetBSD: patch-lib_TemplateRender.php,v 1.1 2021/02/21 22:22:22 khorben Exp $ - -Fix for PHP >= 5.5 - ---- lib/TemplateRender.php.orig 2012-10-01 06:54:14.000000000 +0000 -+++ lib/TemplateRender.php -@@ -2466,7 +2466,7 @@ function deleteAttribute(attrName,friend - if ($val = $attribute->getValue($i)) - $default = get_enc_type($val); - else -- $default = $this->getServer()->getValue('appearance','password_hash'); -+ $default = $this->getServer()->getValue('appearance','pla_password_hash'); - - if (! $attribute->getPostValue()) - printf('<input type="hidden" name="post_value[%s][]" value="%s" />',$attribute->getName(),$i); diff --git a/databases/phpldapadmin/patches/patch-lib_Tree.php b/databases/phpldapadmin/patches/patch-lib_Tree.php new file mode 100644 index 00000000000..5f54b4b29a9 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_Tree.php @@ -0,0 +1,13 @@ +$NetBSD: patch-lib_Tree.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/Tree.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/Tree.php +@@ -68,7 +68,7 @@ abstract class Tree { + } + } + +- set_cached_item($server_id,'tree','null',$tree); ++ set_cached_item($server_id,$tree,'tree','null'); + } + + return $tree; diff --git a/databases/phpldapadmin/patches/patch-lib_Visitor.php b/databases/phpldapadmin/patches/patch-lib_Visitor.php new file mode 100644 index 00000000000..6575a823212 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_Visitor.php @@ -0,0 +1,45 @@ +$NetBSD: patch-lib_Visitor.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/Visitor.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/Visitor.php +@@ -22,6 +22,15 @@ abstract class Visitor { + 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 @@ abstract class Visitor { + $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('<font size=-2><i>Class (%s): Method doesnt exist (%s,%s)</i></font><br />',$class,get_class($this),$call); +- +- $class = get_parent_class($class); +- $call = "$method$fnct$class"; +- array_push($methods,$call); + } + + if (defined('DEBUGTMP') && DEBUGTMP) diff --git a/databases/phpldapadmin/patches/patch-lib_common.php b/databases/phpldapadmin/patches/patch-lib_common.php new file mode 100644 index 00000000000..55c59de5d04 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_common.php @@ -0,0 +1,15 @@ +$NetBSD: patch-lib_common.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/common.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/common.php +@@ -296,7 +296,9 @@ if ($app['language'] == 'auto') { + * 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); diff --git a/databases/phpldapadmin/patches/patch-lib_ds__ldap.php b/databases/phpldapadmin/patches/patch-lib_ds__ldap.php index 1b2b8632e95..22856824059 100644 --- a/databases/phpldapadmin/patches/patch-lib_ds__ldap.php +++ b/databases/phpldapadmin/patches/patch-lib_ds__ldap.php @@ -1,24 +1,43 @@ -$NetBSD: patch-lib_ds__ldap.php,v 1.1 2015/11/29 11:25:53 taca Exp $ +$NetBSD: patch-lib_ds__ldap.php,v 1.2 2022/04/16 03:11:28 khorben Exp $ Fix for PHP 5.5 and later: https://bugzilla.redhat.com/show_bug.cgi?id=974928 ---- lib/ds_ldap.php.orig 2012-10-01 06:54:14.000000000 +0000 +--- lib/ds_ldap.php.orig 2022-04-15 22:45:43.000000000 +0000 +++ lib/ds_ldap.php -@@ -1117,12 +1117,14 @@ class ldap extends DS { - if (is_array($dn)) { - $a = array(); - foreach ($dn as $key => $rdn) -- $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn); -+ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($matches) { return chr(hexdec($matches[1])); }, $rdn); - - return $a; - - } else -- return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn); -+ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($matches) { return chr(hexdec($matches[1])); }, $dn); - } - - public function getRootDSE($method=null) { +@@ -1768,7 +1768,7 @@ class ldap extends DS { + 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 @@ class ldap extends DS { + $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 @@ class ldap extends DS { + $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 @@ class ldap extends DS { + 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) diff --git a/databases/phpldapadmin/patches/patch-lib_ds__ldap__pla.php b/databases/phpldapadmin/patches/patch-lib_ds__ldap__pla.php index bb09f4cda1e..b8d2816822e 100644 --- a/databases/phpldapadmin/patches/patch-lib_ds__ldap__pla.php +++ b/databases/phpldapadmin/patches/patch-lib_ds__ldap__pla.php @@ -1,15 +1,33 @@ -$NetBSD: patch-lib_ds__ldap__pla.php,v 1.1 2021/02/21 22:22:22 khorben Exp $ +$NetBSD: patch-lib_ds__ldap__pla.php,v 1.2 2022/04/16 03:11:28 khorben Exp $ Fix for PHP >= 5.5 ---- lib/ds_ldap_pla.php.orig 2012-10-01 06:54:14.000000000 +0000 +--- lib/ds_ldap_pla.php.orig 2022-04-15 22:45:43.000000000 +0000 +++ lib/ds_ldap_pla.php -@@ -16,7 +16,7 @@ class ldap_pla extends ldap { - function __construct($index) { - parent::__construct($index); +@@ -371,7 +371,7 @@ class ldap_pla extends ldap { -- $this->default->appearance['password_hash'] = array( -+ $this->default->appearance['pla_password_hash'] = array( - 'desc'=>'Default HASH to use for passwords', - 'default'=>'md5'); + $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 @@ class ldap_pla extends ldap { + $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 @@ class ldap_pla extends ldap { + $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)); + } diff --git a/databases/phpldapadmin/patches/patch-lib_functions.php b/databases/phpldapadmin/patches/patch-lib_functions.php index 35675e0c62e..68786c2e9f7 100644 --- a/databases/phpldapadmin/patches/patch-lib_functions.php +++ b/databases/phpldapadmin/patches/patch-lib_functions.php @@ -1,114 +1,53 @@ -$NetBSD: patch-lib_functions.php,v 1.4 2021/02/21 22:22:22 khorben Exp $ +$NetBSD: patch-lib_functions.php,v 1.5 2022/04/16 03:11:28 khorben Exp $ Fix for PHP 5.5 and later: https://bugzilla.redhat.com/show_bug.cgi?id=974928 ---- lib/functions.php.orig 2012-10-01 06:54:14.000000000 +0000 +--- lib/functions.php.orig 2022-04-15 22:45:43.000000000 +0000 +++ lib/functions.php -@@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom - /** - * Loads class definition - */ --function __autoload($className) { -+function pla_autoload($className) { - if (file_exists(HOOKSDIR."classes/$className.php")) - require_once(HOOKSDIR."classes/$className.php"); - elseif (file_exists(LIBDIR."$className.php")) -@@ -66,6 +66,12 @@ function __autoload($className) { - 'type'=>'error')); - } - -+if (version_compare(phpversion(), '7.0', '>=')) { -+ spl_autoload_register('pla_autoload'); -+} else { -+ eval('function __autoload($className) {pla_autoload($className);}'); -+} -+ - /** - * Strips all slashes from the specified array in place (pass by ref). - * @param Array The array to strip slashes from, typically one of -@@ -994,6 +1000,22 @@ function get_custom_file($index,$filenam - } +@@ -130,12 +130,13 @@ function app_error_handler($errno,$errst + debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); - /** -+ * Replacement for create_function() which is deprecated as of PHP 7.2 -+ * -+ * @param string The function arguments -+ * @param string The function code -+ */ -+function pla_create_function($args, $code) { -+ if (version_compare(phpversion(), '7.0', '>=')) { -+ # anonymous functions were introduced in PHP 5.3.0 -+ return eval("return function(".$args."){".$code."};"); -+ } else { -+ # create_function is deprecated in PHP 7.2 -+ return create_function($args, $code); -+ } -+} -+ -+/** - * Sort a multi dimensional array. + /** +- * 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 @@ function get_cached_item($index,$item,$s * - * @param array Multi demension array passed by reference -@@ -1080,7 +1102,7 @@ function masort(&$data,$sortby,$rev=0) { - - $code .= 'return $c;'; - -- $CACHE[$sortby] = create_function('$a, $b',$code); -+ $CACHE[$sortby] = pla_create_function('$a, $b',$code); - } - - uasort($data,$CACHE[$sortby]); -@@ -2127,7 +2149,7 @@ function password_types() { - * crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear. - * @return string The hashed password. + * Returns true on success of false on failure. */ --function password_hash($password_clear,$enc_type) { -+function pla_password_hash($password_clear,$enc_type) { +-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); -@@ -2318,7 +2340,7 @@ function password_check($cryptedpassword - - # SHA crypted passwords - case 'sha': -- if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0) -+ if (strcasecmp(pla_password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0) - return true; - else - return false; -@@ -2327,7 +2349,7 @@ function password_check($cryptedpassword - - # MD5 crypted passwords - case 'md5': -- if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0) -+ if( strcasecmp(pla_password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0) - return true; - else - return false; -@@ -2392,7 +2414,7 @@ function password_check($cryptedpassword - - # SHA512 crypted passwords - case 'sha512': -- if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0) -+ if (strcasecmp(pla_password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0) - return true; - else - return false; -@@ -2565,12 +2587,14 @@ function dn_unescape($dn) { - $a = array(); - - foreach ($dn as $key => $rdn) -- $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn); -+ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($matches) { return chr(hexdec($matches[1])); }, $rdn ); - - return $a; - - } else { -- return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn); -+ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($matches) { return chr(hexdec($matches[1])); }, $dn); - } - } +@@ -2032,8 +2033,8 @@ function ldap_error_msg($msg,$errnum) { + * + * Usage Examples: + * <code> +- * 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); + * </code> + * + * @param object The Server to get the image from. +@@ -2046,7 +2047,7 @@ function ldap_error_msg($msg,$errnum) { + * @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); diff --git a/databases/phpldapadmin/patches/patch-lib_xmlTemplates.php b/databases/phpldapadmin/patches/patch-lib_xmlTemplates.php new file mode 100644 index 00000000000..a5f19344147 --- /dev/null +++ b/databases/phpldapadmin/patches/patch-lib_xmlTemplates.php @@ -0,0 +1,13 @@ +$NetBSD: patch-lib_xmlTemplates.php,v 1.1 2022/04/16 03:11:28 khorben Exp $ + +--- lib/xmlTemplates.php.orig 2012-10-01 06:54:14.000000000 +0000 ++++ lib/xmlTemplates.php +@@ -140,7 +140,7 @@ abstract class xmlTemplates { + + 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'); + } + } + |