Fix some more PHP 7.2 warnings

Remove some calls to deprecated each()
This commit is contained in:
nathangray 2018-12-18 10:20:23 -07:00
parent 19ead4c1cc
commit 6bf8f6bb26
6 changed files with 20 additions and 18 deletions

View File

@ -132,13 +132,13 @@ class addressbook_ui extends addressbook_bo
if (isset($_content['nm']['rows']['delete'])) // handle a single delete like delete with the checkboxes if (isset($_content['nm']['rows']['delete'])) // handle a single delete like delete with the checkboxes
{ {
list($id) = @each($_content['nm']['rows']['delete']); $id = @key($_content['nm']['rows']['delete']);
$_content['nm']['action'] = 'delete'; $_content['nm']['action'] = 'delete';
$_content['nm']['selected'] = array($id); $_content['nm']['selected'] = array($id);
} }
if (isset($_content['nm']['rows']['document'])) // handle insert in default document button like an action if (isset($_content['nm']['rows']['document'])) // handle insert in default document button like an action
{ {
list($id) = @each($_content['nm']['rows']['document']); $id = @key($_content['nm']['rows']['document']);
$_content['nm']['action'] = 'document'; $_content['nm']['action'] = 'document';
$_content['nm']['selected'] = array($id); $_content['nm']['selected'] = array($id);
} }
@ -172,12 +172,12 @@ class addressbook_ui extends addressbook_bo
} }
if ($_content['nm']['rows']['infolog']) if ($_content['nm']['rows']['infolog'])
{ {
list($org) = each($_content['nm']['rows']['infolog']); $org = key($_content['nm']['rows']['infolog']);
return $this->infolog_org_view($org); return $this->infolog_org_view($org);
} }
if ($_content['nm']['rows']['view']) // show all contacts of an organisation if ($_content['nm']['rows']['view']) // show all contacts of an organisation
{ {
list($grouped_view) = each($_content['nm']['rows']['view']); $grouped_view = key($_content['nm']['rows']['view']);
} }
else else
{ {
@ -2315,7 +2315,7 @@ class addressbook_ui extends addressbook_bo
if ($content['id']) if ($content['id'])
{ {
// last and next calendar date // last and next calendar date
list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); $dates = current($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false));
if(is_array($dates)) $content += $dates; if(is_array($dates)) $content += $dates;
} }
@ -2651,7 +2651,7 @@ class addressbook_ui extends addressbook_bo
if(is_array($content)) if(is_array($content))
{ {
list($button) = each($content['button']); $button = key($content['button']);
switch ($content['toolbar'] ? $content['toolbar'] : $button) switch ($content['toolbar'] ? $content['toolbar'] : $button)
{ {
case 'vcard': case 'vcard':
@ -2836,7 +2836,7 @@ class addressbook_ui extends addressbook_bo
if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0;
// last and next calendar date // last and next calendar date
if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); if (!empty($content['id'])) $dates = current($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false));
if(is_array($dates)) $content += $dates; if(is_array($dates)) $content += $dates;
// Disable importexport // Disable importexport

View File

@ -889,7 +889,7 @@ class calendar_bo
// check if the caller gave us enough information and if not read it from the DB // check if the caller gave us enough information and if not read it from the DB
if (!isset($event['participants']) || !isset($event['start']) || !isset($event['end'])) if (!isset($event['participants']) || !isset($event['start']) || !isset($event['end']))
{ {
list(,$event_read) = each($this->so->read($event['id'])); $event_read = current($this->so->read($event['id']));
if (!isset($event['participants'])) if (!isset($event['participants']))
{ {
$event['participants'] = $event_read['participants']; $event['participants'] = $event_read['participants'];

View File

@ -292,7 +292,7 @@ class calendar_uiforms extends calendar_ui
// delete a recur-exception // delete a recur-exception
if ($content['recur_exception']['delete_exception']) if ($content['recur_exception']['delete_exception'])
{ {
list($date) = each($content['recur_exception']['delete_exception']); $date = key($content['recur_exception']['delete_exception']);
// eT2 converts time to // eT2 converts time to
if (!is_numeric($date)) $date = Api\DateTime::to (str_replace('Z','', $date), 'ts'); if (!is_numeric($date)) $date = Api\DateTime::to (str_replace('Z','', $date), 'ts');
unset($content['recur_exception']['delete_exception']); unset($content['recur_exception']['delete_exception']);
@ -317,7 +317,7 @@ class calendar_uiforms extends calendar_ui
// delete an alarm // delete an alarm
if ($content['alarm']['delete_alarm']) if ($content['alarm']['delete_alarm'])
{ {
list($id) = each($content['alarm']['delete_alarm']); $id = key($content['alarm']['delete_alarm']);
//echo "delete alarm $id"; _debug_array($content['alarm']['delete_alarm']); //echo "delete alarm $id"; _debug_array($content['alarm']['delete_alarm']);
if ($content['id']) if ($content['id'])
@ -2097,7 +2097,7 @@ class calendar_uiforms extends calendar_ui
else else
{ {
//_debug_array($event); //_debug_array($event);
list($button) = each($event['button']); $button = key($event['button']);
unset($event['button']); unset($event['button']);
// clear notification errors // clear notification errors
@ -2718,7 +2718,7 @@ class calendar_uiforms extends calendar_ui
} }
if ($_content) if ($_content)
{ {
list($button) = each($_content['button']); $button = key($_content['button']);
unset($_content['button']); unset($_content['button']);
if ($button != 'cancel') // store changed Acl if ($button != 'cancel') // store changed Acl
{ {

View File

@ -95,7 +95,7 @@ class calendar_uilist extends calendar_ui
{ {
if ($_content['nm']['rows'][$button]) if ($_content['nm']['rows'][$button])
{ {
list($id) = each($_content['nm']['rows'][$button]); $id = key($_content['nm']['rows'][$button]);
$_content['nm']['action'] = $button; $_content['nm']['action'] = $button;
$_content['nm']['selected'] = array($id); $_content['nm']['selected'] = array($id);
} }

View File

@ -96,7 +96,7 @@ class infolog_customfields extends admin_customfields
if ($fields['delete']) if ($fields['delete'])
{ {
list($delete) = each($fields['delete']); $delete = key($fields['delete']);
unset($fields['delete']); unset($fields['delete']);
} }
@ -180,7 +180,7 @@ class infolog_customfields extends admin_customfields
if ($status['delete']) if ($status['delete'])
{ {
list($delete) = each($status['delete']); $delete = key($status['delete']);
unset($status['delete']); unset($status['delete']);
} }
@ -254,7 +254,7 @@ class infolog_customfields extends admin_customfields
unset($this->status[$content['type2']]); unset($this->status[$content['type2']]);
unset($this->status['defaults'][$content['type2']]); unset($this->status['defaults'][$content['type2']]);
unset($this->group_owners[$content['type2']]); unset($this->group_owners[$content['type2']]);
list($content['type2']) = each($this->content_types); $content['type2'] = key($this->content_types);
// save changes to repository // save changes to repository
$this->save_repository(); $this->save_repository();

View File

@ -887,7 +887,7 @@ class infolog_ui
{ {
if ($values['add']) if ($values['add'])
{ {
list($type) = each($values['add']); $type = key($values['add']);
return $this->edit(0,$action,$action_id,$type,$called_as); return $this->edit(0,$action,$action_id,$type,$called_as);
} }
elseif ($values['cancel'] && $own_referer) elseif ($values['cancel'] && $own_referer)
@ -901,7 +901,9 @@ class infolog_ui
else else
{ {
list($do,$do2) = each($values['main']); list($do,$do2) = each($values['main']);
list($do_id) = @each($do2); $do = key($values['main']);
$do2 = current($values['main']);
$do_id = @key($do2);
switch((string)$do) switch((string)$do)
{ {
case 'close': case 'close':