Mandatory function arguments must be listed before optional ones.

PHP 8 deprecates the ability to have
	function whatever($arg1, $arg2='something', $arg3)

This commit reorders arguments of functions set_cached_item() and
draw_jpeg_photo() to meet this new requirement.
This commit is contained in:
Patrick Monnerat 2022-01-14 01:41:19 +01:00 committed by Deon George
parent 3ec9c23d58
commit 3a75a32100
10 changed files with 21 additions and 21 deletions

View File

@ -19,7 +19,7 @@ $dn = get_request('dn','GET',true);
$tree = get_cached_item($app['server']->getIndex(),'tree'); $tree = get_cached_item($app['server']->getIndex(),'tree');
$entry = $tree->getEntry($dn); $entry = $tree->getEntry($dn);
$entry->close(); $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', 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())); $app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));

View File

@ -50,7 +50,7 @@ if ($request['dn']) {
} }
if ($treesave) if ($treesave)
set_cached_item($app['server']->getIndex(),'tree','null',$tree); set_cached_item($app['server']->getIndex(),$tree,'tree','null');
if ($request['dn']) if ($request['dn'])
echo $tree->draw_children($dnentry,$request['code']); echo $tree->draw_children($dnentry,$request['code']);

View File

@ -19,7 +19,7 @@ $dn = get_request('dn','GET',true);
$tree = get_cached_item($app['server']->getIndex(),'tree'); $tree = get_cached_item($app['server']->getIndex(),'tree');
$entry = $tree->getEntry($dn); $entry = $tree->getEntry($dn);
$entry->open(); $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', 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())); $app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));

View File

@ -34,7 +34,7 @@ if (get_request('purge','REQUEST')) {
$entry->open(); $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') if (get_request('meth','REQUEST') == 'ajax')

View File

@ -827,7 +827,7 @@ class PageRender extends Visitor {
if (! $attribute->getOldValue($i)) if (! $attribute->getOldValue($i))
return; 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 the attribute is modified, the new value needs to be stored in a session variable for the draw_jpeg_photo callback.
if ($attribute->hasBeenModified()) { if ($attribute->hasBeenModified()) {
$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($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);
} else } 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) { protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) {
$this->draw('HiddenValue',$attribute,$i); $this->draw('HiddenValue',$attribute,$i);
$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($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) { protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) {

View File

@ -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; return $tree;

View File

@ -1768,7 +1768,7 @@ class ldap extends DS {
ksort($return); ksort($return);
# cache the schema to prevent multiple schema fetches from LDAP server # 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) if (DEBUG_ENABLED)
@ -1953,7 +1953,7 @@ class ldap extends DS {
$return = $attrs; $return = $attrs;
# cache the schema to prevent multiple schema fetches from LDAP server # 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) if (DEBUG_ENABLED)
@ -2029,7 +2029,7 @@ class ldap extends DS {
$return = $rules; $return = $rules;
# cache the schema to prevent multiple schema fetches from LDAP server # 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) if (DEBUG_ENABLED)
@ -2078,7 +2078,7 @@ class ldap extends DS {
ksort($return); ksort($return);
# cache the schema to prevent multiple schema fetches from LDAP server # 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) if (DEBUG_ENABLED)

View File

@ -371,7 +371,7 @@ class ldap_pla extends ldap {
$tree->addEntry($dn); $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)); 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 = get_cached_item($this->index,'tree');
$tree->delEntry($dn); $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)); 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); $newdn = sprintf('%s,%s',$new_rdn,$container);
$tree->renameEntry($dn,$newdn); $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)); run_hook('post_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container));
} }

View File

@ -928,7 +928,7 @@ function get_cached_item($index,$item,$subitem='null') {
* *
* Returns true on success of false on failure. * 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')) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -2032,8 +2032,8 @@ function ldap_error_msg($msg,$errnum) {
* *
* Usage Examples: * Usage Examples:
* <code> * <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(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',null,1); * draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',1,null);
* </code> * </code>
* *
* @param object The Server to get the image from. * @param object The Server to get the image from.
@ -2046,7 +2046,7 @@ function ldap_error_msg($msg,$errnum) {
* @param array Specifies optional image and CSS style attributes for the table tag. Supported keys are * @param array Specifies optional image and CSS style attributes for the table tag. Supported keys are
* fixed_width, fixed_height, img_opts. * 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')) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);

View File

@ -140,7 +140,7 @@ abstract class xmlTemplates {
if ($changed) { if ($changed) {
masort($this->templates,'title'); masort($this->templates,'title');
set_cached_item($server_id,$class['item'],'null',$this->templates); set_cached_item($server_id,$this->templates,$class['item'],'null');
} }
} }