Skip to content

Commit 3a75a32

Browse files
monneratleenooks
authored andcommitted
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.
1 parent 3ec9c23 commit 3a75a32

File tree

10 files changed

+21
-21
lines changed

10 files changed

+21
-21
lines changed

htdocs/collapse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
$tree = get_cached_item($app['server']->getIndex(),'tree');
2020
$entry = $tree->getEntry($dn);
2121
$entry->close();
22-
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
22+
set_cached_item($app['server']->getIndex(),$tree,'tree','null');
2323

2424
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
2525
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));

htdocs/draw_tree_node.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
}
5151

5252
if ($treesave)
53-
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
53+
set_cached_item($app['server']->getIndex(),$tree,'tree','null');
5454

5555
if ($request['dn'])
5656
echo $tree->draw_children($dnentry,$request['code']);

htdocs/expand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
$tree = get_cached_item($app['server']->getIndex(),'tree');
2020
$entry = $tree->getEntry($dn);
2121
$entry->open();
22-
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
22+
set_cached_item($app['server']->getIndex(),$tree,'tree','null');
2323

2424
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
2525
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));

htdocs/refresh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$entry->open();
3535
}
3636

37-
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
37+
set_cached_item($app['server']->getIndex(),$tree,'tree','null');
3838
}
3939

4040
if (get_request('meth','REQUEST') == 'ajax')

lib/PageRender.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ final protected function drawOldValueJpegAttribute($attribute,$i) {
827827
if (! $attribute->getOldValue($i))
828828
return;
829829

830-
draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false);
830+
draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false);
831831
}
832832

833833
/**
@@ -844,16 +844,16 @@ final protected function drawCurrentValueJpegAttribute($attribute,$i) {
844844
# If the attribute is modified, the new value needs to be stored in a session variable for the draw_jpeg_photo callback.
845845
if ($attribute->hasBeenModified()) {
846846
$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);
847-
draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false);
847+
draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false);
848848
} else
849-
draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false);
849+
draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false);
850850
}
851851

852852
protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) {
853853
$this->draw('HiddenValue',$attribute,$i);
854854
$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);
855855

856-
draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false);
856+
draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false);
857857
}
858858

859859
protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) {

lib/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static public function getInstance($server_id) {
6868
}
6969
}
7070

71-
set_cached_item($server_id,'tree','null',$tree);
71+
set_cached_item($server_id,$tree,'tree','null');
7272
}
7373

7474
return $tree;

lib/ds_ldap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ public function SchemaObjectClasses($method=null,$dn='') {
17681768
ksort($return);
17691769

17701770
# cache the schema to prevent multiple schema fetches from LDAP server
1771-
set_cached_item($this->index,'schema','objectclasses',$return);
1771+
set_cached_item($this->index,$return,'schema','objectclasses');
17721772
}
17731773

17741774
if (DEBUG_ENABLED)
@@ -1953,7 +1953,7 @@ public function SchemaAttributes($method=null,$dn='') {
19531953
$return = $attrs;
19541954

19551955
# cache the schema to prevent multiple schema fetches from LDAP server
1956-
set_cached_item($this->index,'schema','attributes',$return);
1956+
set_cached_item($this->index,$return,'schema','attributes');
19571957
}
19581958

19591959
if (DEBUG_ENABLED)
@@ -2029,7 +2029,7 @@ public function MatchingRules($method=null,$dn='') {
20292029
$return = $rules;
20302030

20312031
# cache the schema to prevent multiple schema fetches from LDAP server
2032-
set_cached_item($this->index,'schema','matchingrules',$return);
2032+
set_cached_item($this->index,$return,'schema','matchingrules');
20332033
}
20342034

20352035
if (DEBUG_ENABLED)
@@ -2078,7 +2078,7 @@ public function SchemaSyntaxes($method=null,$dn='') {
20782078
ksort($return);
20792079

20802080
# cache the schema to prevent multiple schema fetches from LDAP server
2081-
set_cached_item($this->index,'schema','syntaxes',$return);
2081+
set_cached_item($this->index,$return,'schema','syntaxes');
20822082
}
20832083

20842084
if (DEBUG_ENABLED)

lib/ds_ldap_pla.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public function add($dn,$entry_array,$method=null) {
371371

372372
$tree->addEntry($dn);
373373

374-
set_cached_item($this->index,'tree','null',$tree);
374+
set_cached_item($this->index,$tree,'tree','null');
375375

376376
run_hook('post_entry_create',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$entry_array));
377377

@@ -403,7 +403,7 @@ public function delete($dn,$method=null) {
403403
$tree = get_cached_item($this->index,'tree');
404404
$tree->delEntry($dn);
405405

406-
set_cached_item($this->index,'tree','null',$tree);
406+
set_cached_item($this->index,$tree,'tree','null');
407407

408408
run_hook('post_entry_delete',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn));
409409
}
@@ -430,7 +430,7 @@ public function rename($dn,$new_rdn,$container,$deleteoldrdn,$method=null) {
430430
$newdn = sprintf('%s,%s',$new_rdn,$container);
431431
$tree->renameEntry($dn,$newdn);
432432

433-
set_cached_item($this->index,'tree','null',$tree);
433+
set_cached_item($this->index,$tree,'tree','null');
434434

435435
run_hook('post_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container));
436436
}

lib/functions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ function get_cached_item($index,$item,$subitem='null') {
928928
*
929929
* Returns true on success of false on failure.
930930
*/
931-
function set_cached_item($index,$item,$subitem='null',$data) {
931+
function set_cached_item($index,$data,$item,$subitem='null') {
932932
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
933933
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
934934

@@ -2032,8 +2032,8 @@ function ldap_error_msg($msg,$errnum) {
20322032
*
20332033
* Usage Examples:
20342034
* <code>
2035-
* draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',"jpegPhoto",0,true,array('img_opts'=>"border: 1px; width: 150px"));
2036-
* draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',null,1);
2035+
* draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',0,"jpegPhoto",true,array('img_opts'=>"border: 1px; width: 150px"));
2036+
* draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',1,null);
20372037
* </code>
20382038
*
20392039
* @param object The Server to get the image from.
@@ -2046,7 +2046,7 @@ function ldap_error_msg($msg,$errnum) {
20462046
* @param array Specifies optional image and CSS style attributes for the table tag. Supported keys are
20472047
* fixed_width, fixed_height, img_opts.
20482048
*/
2049-
function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$draw_delete_buttons=false,$options=array()) {
2049+
function draw_jpeg_photo($server,$dn,$index,$attr_name='jpegphoto',$draw_delete_buttons=false,$options=array()) {
20502050
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
20512051
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
20522052

lib/xmlTemplates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function __construct($server_id) {
140140

141141
if ($changed) {
142142
masort($this->templates,'title');
143-
set_cached_item($server_id,$class['item'],'null',$this->templates);
143+
set_cached_item($server_id,$this->templates,$class['item'],'null');
144144
}
145145
}
146146

0 commit comments

Comments
 (0)