From 3bfd55de08319a1c298faaa230089f5e6d1711a7 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 2 Apr 2023 09:12:36 +1000 Subject: [PATCH] Revert "Mandatory function arguments must be listed before optional ones." This reverts commit 3a75a321000150e9af89bf45fc5f60d8198e9157. Since calls to those functions had the arguements fully populated, just remove the default configured arg values. --- htdocs/collapse.php | 2 +- htdocs/draw_tree_node.php | 2 +- htdocs/expand.php | 2 +- htdocs/refresh.php | 2 +- lib/PageRender.php | 8 ++++---- lib/Tree.php | 2 +- lib/ds_ldap.php | 8 ++++---- lib/ds_ldap_pla.php | 6 +++--- lib/functions.php | 8 ++++---- lib/xmlTemplates.php | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/collapse.php b/htdocs/collapse.php index c1ec07f..8fb2731 100644 --- a/htdocs/collapse.php +++ b/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,'tree','null'); +set_cached_item($app['server']->getIndex(),'tree','null',$tree); 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/htdocs/draw_tree_node.php b/htdocs/draw_tree_node.php index 12ed6ee..7311e2d 100644 --- a/htdocs/draw_tree_node.php +++ b/htdocs/draw_tree_node.php @@ -50,7 +50,7 @@ if ($request['dn']) { } if ($treesave) - set_cached_item($app['server']->getIndex(),$tree,'tree','null'); + set_cached_item($app['server']->getIndex(),'tree','null',$tree); if ($request['dn']) echo $tree->draw_children($dnentry,$request['code']); diff --git a/htdocs/expand.php b/htdocs/expand.php index 3600f00..d0647d0 100644 --- a/htdocs/expand.php +++ b/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,'tree','null'); +set_cached_item($app['server']->getIndex(),'tree','null',$tree); 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/htdocs/refresh.php b/htdocs/refresh.php index 120ce7a..385c4c6 100644 --- a/htdocs/refresh.php +++ b/htdocs/refresh.php @@ -34,7 +34,7 @@ if (get_request('purge','REQUEST')) { $entry->open(); } - set_cached_item($app['server']->getIndex(),$tree,'tree','null'); + set_cached_item($app['server']->getIndex(),'tree','null',$tree); } if (get_request('meth','REQUEST') == 'ajax') diff --git a/lib/PageRender.php b/lib/PageRender.php index 971dc51..2b598c1 100644 --- a/lib/PageRender.php +++ b/lib/PageRender.php @@ -827,7 +827,7 @@ class PageRender extends Visitor { if (! $attribute->getOldValue($i)) return; - draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false); + draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,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(),$i,$attribute->getName(),false,false); + draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false); } else - draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false); + draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,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(),$i,$attribute->getName(),false,false); + draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false); } protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) { diff --git a/lib/Tree.php b/lib/Tree.php index f18ba36..e7542fc 100644 --- a/lib/Tree.php +++ b/lib/Tree.php @@ -68,7 +68,7 @@ abstract class Tree { } } - set_cached_item($server_id,$tree,'tree','null'); + set_cached_item($server_id,'tree','null',$tree); } return $tree; diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php index 9bc2951..8a4d3e0 100644 --- a/lib/ds_ldap.php +++ b/lib/ds_ldap.php @@ -1770,7 +1770,7 @@ class ldap extends DS { ksort($return); # cache the schema to prevent multiple schema fetches from LDAP server - set_cached_item($this->index,$return,'schema','objectclasses'); + set_cached_item($this->index,'schema','objectclasses',$return); } if (DEBUG_ENABLED) @@ -1955,7 +1955,7 @@ class ldap extends DS { $return = $attrs; # cache the schema to prevent multiple schema fetches from LDAP server - set_cached_item($this->index,$return,'schema','attributes'); + set_cached_item($this->index,'schema','attributes',$return); } if (DEBUG_ENABLED) @@ -2031,7 +2031,7 @@ class ldap extends DS { $return = $rules; # cache the schema to prevent multiple schema fetches from LDAP server - set_cached_item($this->index,$return,'schema','matchingrules'); + set_cached_item($this->index,'schema','matchingrules',$return); } if (DEBUG_ENABLED) @@ -2080,7 +2080,7 @@ class ldap extends DS { ksort($return); # cache the schema to prevent multiple schema fetches from LDAP server - set_cached_item($this->index,$return,'schema','syntaxes'); + set_cached_item($this->index,'schema','syntaxes',$return); } if (DEBUG_ENABLED) diff --git a/lib/ds_ldap_pla.php b/lib/ds_ldap_pla.php index 8a10905..fdc8048 100644 --- a/lib/ds_ldap_pla.php +++ b/lib/ds_ldap_pla.php @@ -371,7 +371,7 @@ class ldap_pla extends ldap { $tree->addEntry($dn); - set_cached_item($this->index,$tree,'tree','null'); + set_cached_item($this->index,'tree','null',$tree); 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,'tree','null'); + set_cached_item($this->index,'tree','null',$tree); 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,'tree','null'); + set_cached_item($this->index,'tree','null',$tree); run_hook('post_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container)); } diff --git a/lib/functions.php b/lib/functions.php index 592dece..60984e7 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -955,7 +955,7 @@ function get_cached_item($index,$item,$subitem='null') { * * Returns true on success of false on failure. */ -function set_cached_item($index,$data,$item,$subitem='null') { +function set_cached_item($index,$item,$subitem='null',$data) { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); @@ -2065,8 +2065,8 @@ function ldap_error_msg($msg,$errnum) { * * Usage Examples: * - * 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); + * 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); * * * @param object The Server to get the image from. @@ -2079,7 +2079,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,$index,$attr_name='jpegphoto',$draw_delete_buttons=false,$options=array()) { +function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$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/lib/xmlTemplates.php b/lib/xmlTemplates.php index 68725f8..4a40ba8 100644 --- a/lib/xmlTemplates.php +++ b/lib/xmlTemplates.php @@ -140,7 +140,7 @@ abstract class xmlTemplates { if ($changed) { masort($this->templates,'title'); - set_cached_item($server_id,$this->templates,$class['item'],'null'); + set_cached_item($server_id,$class['item'],'null',$this->templates); } }