Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Dec 2022 10:36:40 GMT
From:      Ronald Klop <ronald@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 05adb0bbb787 - main - net/phpldapadmin: additional fix to support for php81+
Message-ID:  <202212121036.2BCAaeVq026558@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=05adb0bbb787e824fd84aa7aed170182a55268e7

commit 05adb0bbb787e824fd84aa7aed170182a55268e7
Author:     Krzysztof <ports@bsdserwis.com>
AuthorDate: 2022-12-08 09:23:03 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2022-12-12 10:36:10 +0000

    net/phpldapadmin: additional fix to support for php81+
    
    PR:     266678 268135 264672
    Approved by: rene (mentor)
    Differential Revision: https://reviews.freebsd.org/D37633
---
 net/phpldapadmin/Makefile                          |  2 +-
 .../files/patch-lib_AttributeFactory.php           |  7 ++++-
 net/phpldapadmin/files/patch-lib_PageRender.php    | 29 ++++++++++++++++++
 net/phpldapadmin/files/patch-lib_Tree.php          |  9 ++++++
 net/phpldapadmin/files/patch-lib_common.php        | 11 +++++++
 net/phpldapadmin/files/patch-lib_ds__ldap.php      | 35 ++++++++++++++++++++--
 net/phpldapadmin/files/patch-lib_ds__ldap__pla.php | 27 +++++++++++++++++
 net/phpldapadmin/files/patch-lib_functions.php     | 29 ++++++++++++++++++
 net/phpldapadmin/files/patch-lib_xmlTemplates.php  |  9 ++++++
 9 files changed, 154 insertions(+), 4 deletions(-)

diff --git a/net/phpldapadmin/Makefile b/net/phpldapadmin/Makefile
index 62831744b9d2..140a93c19f30 100644
--- a/net/phpldapadmin/Makefile
+++ b/net/phpldapadmin/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	phpldapadmin
 PORTVERSION=	1.2.6.3
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	net www
 PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
 
diff --git a/net/phpldapadmin/files/patch-lib_AttributeFactory.php b/net/phpldapadmin/files/patch-lib_AttributeFactory.php
index 12488014c85c..7f53c65e6b79 100644
--- a/net/phpldapadmin/files/patch-lib_AttributeFactory.php
+++ b/net/phpldapadmin/files/patch-lib_AttributeFactory.php
@@ -39,7 +39,7 @@
  			return $this->newShadowAttribute($name,$values,$server_id,$source);
  
  		} elseif ($app['server']->isAttrBoolean($name)) {
-@@ -129,7 +129,7 @@ class AttributeFactory {
+@@ -129,11 +129,11 @@ class AttributeFactory {
  		} elseif ($app['server']->isMultiLineAttr($name)) {
  			return $this->newMultiLineAttribute($name,$values,$server_id,$source);
  
@@ -48,3 +48,8 @@
  			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/net/phpldapadmin/files/patch-lib_PageRender.php b/net/phpldapadmin/files/patch-lib_PageRender.php
index f97df7e2ebaf..eaafb0cfc1f6 100644
--- a/net/phpldapadmin/files/patch-lib_PageRender.php
+++ b/net/phpldapadmin/files/patch-lib_PageRender.php
@@ -59,6 +59,35 @@
  			return sprintf('<acronym title="%s: \'%s\' %s \'%s\'">%s</acronym>',
  				_('Note'),$friendly_name,_('is an alias for'),$attribute->getName(false),_('alias'));
  		else
+@@ -827,7 +827,7 @@ class PageRender extends Visitor {
+ 		if (! $attribute->getOldValue($i))
+ 			return;
+ 
+-		draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false);
++		draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false);
+ 	}
+ 
+ 	/**
+@@ -844,16 +844,16 @@ 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);
+ 	}
+ 
+ 	protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) {
+ 		$this->draw('HiddenValue',$attribute,$i);
+ 		$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);
+ 
+-		draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false);
++		draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false);
+ 	}
+ 
+ 	protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) {
 @@ -954,7 +954,7 @@ class PageRender extends Visitor {
  		$server = $this->getServer();
  		$val = $attribute->getValue($i);
diff --git a/net/phpldapadmin/files/patch-lib_Tree.php b/net/phpldapadmin/files/patch-lib_Tree.php
index 17113e51bee1..59e1ecbdcc1e 100644
--- a/net/phpldapadmin/files/patch-lib_Tree.php
+++ b/net/phpldapadmin/files/patch-lib_Tree.php
@@ -1,5 +1,14 @@
 --- lib/Tree.php.orig	2021-12-12 02:35:51 UTC
 +++ 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;
 @@ -132,7 +132,7 @@ abstract class Tree {
  		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
  			debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
diff --git a/net/phpldapadmin/files/patch-lib_common.php b/net/phpldapadmin/files/patch-lib_common.php
index 9e464a0fd2a1..33b76dae081a 100644
--- a/net/phpldapadmin/files/patch-lib_common.php
+++ b/net/phpldapadmin/files/patch-lib_common.php
@@ -12,3 +12,14 @@
  		}
  
  		$app['lang_http'] = array_unique($app['lang_http']);
+@@ -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/net/phpldapadmin/files/patch-lib_ds__ldap.php b/net/phpldapadmin/files/patch-lib_ds__ldap.php
index 8ed7f9831b50..389cf1128878 100644
--- a/net/phpldapadmin/files/patch-lib_ds__ldap.php
+++ b/net/phpldapadmin/files/patch-lib_ds__ldap.php
@@ -182,7 +182,7 @@
  					continue;
  
  				$object_class = new ObjectClass($line,$this);
-@@ -1762,8 +1765,8 @@ class ldap extends DS {
+@@ -1762,13 +1765,13 @@ class ldap extends DS {
  			# Now go through and reference the parent/child relationships
  			foreach ($return as $oclass)
  				foreach ($oclass->getSupClasses() as $parent_name)
@@ -193,6 +193,12 @@
  
  			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)
 @@ -1816,7 +1819,7 @@ class ldap extends DS {
  			 */
  			$attrs_oid = array();
@@ -241,7 +247,7 @@
  
  							/* Since this attribute's superior attribute does not have another superior
  							 * attribute, clone its properties for this attribute. Then, replace
-@@ -1936,18 +1939,18 @@ class ldap extends DS {
+@@ -1936,24 +1939,24 @@ class ldap extends DS {
  
  				# Add Used In.
  				foreach ($oclass_attrs as $attr_name)
@@ -266,6 +272,13 @@
  			}
  
  			$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)
 @@ -1987,7 +1990,7 @@ class ldap extends DS {
  			$rules = array();
  
@@ -293,6 +306,15 @@
  
  						if (isset($rules[$rule_key]))
  							$rules[$rule_key]->addUsedByAttr($attr->getName(false));
+@@ -2029,7 +2032,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)
 @@ -2063,11 +2066,11 @@ class ldap extends DS {
  			$return = array();
  
@@ -307,6 +329,15 @@
  
  				if (! $key)
  					continue;
+@@ -2078,7 +2081,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)
 @@ -2097,7 +2100,7 @@ class ldap extends DS {
  		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
  			debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
diff --git a/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php b/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
index 2de761e9e9c4..fc33585335fc 100644
--- a/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
+++ b/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
@@ -29,6 +29,33 @@
  				return true;
  
  		return false;
+@@ -371,7 +371,7 @@ class ldap_pla extends ldap {
+ 
+ 				$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));
+ 			}
 @@ -674,7 +674,7 @@ class ldap_pla extends ldap {
  		if ($this->getValue('appearance', 'show_authz') && function_exists('ldap_exop_whoami')) {
  			$result = @ldap_exop_whoami($this->connect($method));
diff --git a/net/phpldapadmin/files/patch-lib_functions.php b/net/phpldapadmin/files/patch-lib_functions.php
index d97a5febf06e..91951e3ca8b5 100644
--- a/net/phpldapadmin/files/patch-lib_functions.php
+++ b/net/phpldapadmin/files/patch-lib_functions.php
@@ -113,6 +113,15 @@
  
  	if ($length > 0) { // str_repeat doesn't like negatives
  		if ($pad_type == STR_PAD_RIGHT) { // STR_PAD_RIGHT == 1
+@@ -928,7 +929,7 @@ function get_cached_item($index,$item,$subitem='null')
+  *
+  * Returns true on success of false on failure.
+  */
+-function set_cached_item($index,$item,$subitem='null',$data) {
++function set_cached_item($index,$data,$item,$subitem='null') {
+ 	if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 		debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
 @@ -1090,7 +1091,7 @@ function masort(&$data,$sortby,$rev=0) {
  			$code .= "	\$a = array_change_key_case(\$a);\n";
  			$code .= "	\$b = array_change_key_case(\$b);\n";
@@ -254,6 +263,26 @@
  			}
  		}
  	}
+@@ -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);
+ 
 @@ -2164,7 +2165,7 @@ function pla_password_hash($password_clear,$enc_type) 
  	if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
  		debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
diff --git a/net/phpldapadmin/files/patch-lib_xmlTemplates.php b/net/phpldapadmin/files/patch-lib_xmlTemplates.php
index 9088d3297f1e..64602daf25fe 100644
--- a/net/phpldapadmin/files/patch-lib_xmlTemplates.php
+++ b/net/phpldapadmin/files/patch-lib_xmlTemplates.php
@@ -18,6 +18,15 @@
  					$this->templates[$counter] = new $class['name']($this->server_id,$templatename,$filename,$type,$counter);
  					$counter++;
  				}
+@@ -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');
+ 		}
+ 	}
+ 
 @@ -304,7 +304,7 @@ abstract class xmlTemplate {
  			debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202212121036.2BCAaeVq026558>