diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 638c98b30a..3f50d10406 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -183,12 +183,12 @@ class addressbook_ui extends addressbook_bo $msg = ''; } } - if ($_content['nm']['rows']['infolog']) + if (!empty($_content['nm']['rows']['infolog'])) { $org = key($_content['nm']['rows']['infolog']); return $this->infolog_org_view($org); } - if ($_content['nm']['rows']['view']) // show all contacts of an organisation + if (!empty($_content['nm']['rows']['view'])) // show all contacts of an organisation { $grouped_view = key($_content['nm']['rows']['view']); } @@ -2260,7 +2260,7 @@ class addressbook_ui extends addressbook_bo // remove invalid shared-with entries (should not happen, as we validate already on client-side) $this->check_shared_with($content['shared']); - $button = @key($content['button']); + $button = @key($content['button'] ?? []); unset($content['button']); $content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p'); $content['owner'] = (string) (int) $content['owner']; @@ -2988,7 +2988,7 @@ class addressbook_ui extends addressbook_bo if(is_array($content)) { - $button = key($content['button']); + $button = key($content['button'] ?? []); switch ($button) { case 'vcard': @@ -3071,7 +3071,7 @@ class addressbook_ui extends addressbook_bo $_GET['contact_id'] = array_shift($rows); $_GET['index'] = 0; } - $contact_id = $_GET['contact_id'] ? $_GET['contact_id'] : ((int)$_GET['account_id'] ? 'account:'.(int)$_GET['account_id'] : 0); + $contact_id = $_GET['contact_id'] ?? ((int)$_GET['account_id'] ? 'account:'.(int)$_GET['account_id'] : 0); if(!$contact_id || !is_array($content = $this->read($contact_id))) { Egw::redirect_link('/index.php',array( diff --git a/admin/inc/class.admin_categories.inc.php b/admin/inc/class.admin_categories.inc.php index 0ee6634d6d..3dbfa81af8 100644 --- a/admin/inc/class.admin_categories.inc.php +++ b/admin/inc/class.admin_categories.inc.php @@ -139,7 +139,7 @@ class admin_categories $button = 'delete'; $delete_subs = $content['delete']['subs']?true:false; } - else + elseif (!empty($content['button'])) { $button = key($content['button']); unset($content['button']); @@ -564,7 +564,7 @@ class admin_categories { $content = array_merge($content,$content[$action.'_popup']); } - $content['nm']['action'] .= '_' . key($content[$action . '_action']); + $content['nm']['action'] .= '_' . key($content[$action . '_action'] ?? []); if(is_array($content[$action])) { @@ -680,7 +680,7 @@ class admin_categories { $cmd = new admin_cmd_delete_category( $cat_id, - key($content['button']) == 'delete_sub', + key($content['button'] ?? []) == 'delete_sub', $content['admin_cmd'] ); $cmd->run(); diff --git a/admin/inc/class.admin_cmds.inc.php b/admin/inc/class.admin_cmds.inc.php index 8dc65e060a..2836f772a3 100644 --- a/admin/inc/class.admin_cmds.inc.php +++ b/admin/inc/class.admin_cmds.inc.php @@ -70,7 +70,7 @@ class admin_cmds } $content['nm']['actions'] = self::cmd_actions(); } - elseif ($content['nm']['rows']['delete']) + elseif (!empty($content['nm']['rows']['delete'])) { $id = key($content['nm']['rows']['delete']); unset($content['nm']['rows']); diff --git a/admin/inc/class.admin_mail.inc.php b/admin/inc/class.admin_mail.inc.php index 7c05a0946b..f8539e40f5 100644 --- a/admin/inc/class.admin_mail.inc.php +++ b/admin/inc/class.admin_mail.inc.php @@ -212,7 +212,7 @@ class admin_mail public function autoconfig(array $content) { // user pressed [Skip IMAP] --> jump to SMTP config - if ($content['button'] && key($content['button']) == 'skip_imap') + if (!empty($content['button']) && key($content['button']) === 'skip_imap') { unset($content['button']); if (!isset($content['acc_smtp_host'])) $content['acc_smtp_host'] = ''; // do manual mode right away @@ -361,7 +361,7 @@ class admin_mail */ public function folder(array $content, $msg='', Horde_Imap_Client_Socket $imap=null) { - if (isset($content['button'])) + if (!empty($content['button'])) { $button = key($content['button']); unset($content['button']); @@ -482,7 +482,7 @@ class admin_mail ); $content['msg'] = $msg; - if (isset($content['button'])) + if (!empty($content['button'])) { $button = key($content['button']); unset($content['button']); @@ -619,7 +619,7 @@ class admin_mail ); $content['msg'] = $msg; - if (isset($content['button'])) + if (!empty($content['button'])) { $button = key($content['button']); unset($content['button']); @@ -835,7 +835,7 @@ class admin_mail { $content['called_for'] = (int)$_GET['account_id']; $content['accounts'] = iterator_to_array(Mail\Account::search($content['called_for'])); - if ($content['accounts']) + if (!empty($content['accounts'])) { $content['acc_id'] = key($content['accounts']); //error_log(__METHOD__.__LINE__.'.'.array2string($content['acc_id'])); @@ -949,7 +949,7 @@ class admin_mail $tpl->disableElement('notify_save_default', !$is_multiple || !$edit_access); $tpl->disableElement('notify_use_default', !$is_multiple); - if (isset($content['button'])) + if (!empty($content['button'])) { $button = key($content['button']); unset($content['button']); diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index dc75632cea..f4f67e5054 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -313,7 +313,7 @@ class calendar_uiforms extends calendar_ui $msg = $this->export($content['id'],true); } // delete a recur-exception - if ($content['recur_exception']['delete_exception']) + if (!empty($content['recur_exception']['delete_exception'])) { $date = key($content['recur_exception']['delete_exception']); // eT2 converts time to @@ -338,7 +338,7 @@ class calendar_uiforms extends calendar_ui $update_type = 'edit'; } // delete an alarm - if ($content['alarm']['delete_alarm']) + if (!empty($content['alarm']['delete_alarm'])) { $id = key($content['alarm']['delete_alarm']); //echo "delete alarm $id"; _debug_array($content['alarm']['delete_alarm']); @@ -2250,7 +2250,7 @@ class calendar_uiforms extends calendar_ui $readonlys['button[reject]'] = $readonlys['button[cancel]'] = true; } } - else + elseif (!empty($event['button'])) { //_debug_array($event); $button = key($event['button']); @@ -2908,7 +2908,7 @@ class calendar_uiforms extends calendar_ui { throw new Api\Exception\NoPermission\Admin(); } - if ($_content) + if (!empty($_content['button'])) { $button = key($_content['button']); unset($_content['button']); diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index f154ed6753..2379c1c7c8 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -93,7 +93,7 @@ class calendar_uilist extends calendar_ui // handle a single button like actions foreach(array('delete','timesheet','document') as $button) { - if ($_content['nm']['rows'][$button]) + if (!empty($_content['nm']['rows'][$button])) { $id = key($_content['nm']['rows'][$button]); $_content['nm']['action'] = $button; diff --git a/filemanager/inc/class.filemanager_select.inc.php b/filemanager/inc/class.filemanager_select.inc.php index 98097a5eb6..ae79076865 100644 --- a/filemanager/inc/class.filemanager_select.inc.php +++ b/filemanager/inc/class.filemanager_select.inc.php @@ -106,11 +106,11 @@ class filemanager_select } } - $content['mime'] = key($sel_options['mime']); + $content['mime'] = key($sel_options['mime'] ?? []); error_log(array2string($content['options-mime'])); } } - elseif(isset($content['button'])) + elseif(!empty($content['button'])) { $button = key($content['button']); unset($content['button']); @@ -205,7 +205,7 @@ class filemanager_select $sel_options['mime'] = $content['options-mime']; } - elseif(isset($content['apps'])) + elseif(!empty($content['apps'])) { $app = key($content['apps']); if ($app == 'home') $content['path'] = filemanager_ui::get_home_dir(); diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 3d124a7f2a..df5ca6eca1 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -573,13 +573,11 @@ class filemanager_ui { $content['nm']['path'] = urldecode($content['nm']['path']); } - if ($content['button']) + if (!empty($content['button'])) { - if ($content['button']) - { - $button = key($content['button']); - unset($content['button']); - } + $button = key($content['button']); + unset($content['button']); + switch ($button) { case 'upload': @@ -1347,9 +1345,9 @@ class filemanager_ui } } } - elseif ($content['eacl'] && $content['is_owner']) + elseif (!empty($content['eacl']) && !empty($content['is_owner'])) { - if ($content['eacl']['delete']) + if (!empty($content['eacl']['delete'])) { $ino_owner = key($content['eacl']['delete']); list(, $owner) = explode('-',$ino_owner,2); // $owner is a group and starts with a minus! diff --git a/infolog/inc/class.infolog_customfields.inc.php b/infolog/inc/class.infolog_customfields.inc.php index 1a618bbb0e..b880a70c43 100644 --- a/infolog/inc/class.infolog_customfields.inc.php +++ b/infolog/inc/class.infolog_customfields.inc.php @@ -94,7 +94,7 @@ class infolog_customfields extends admin_customfields $create = $fields['create']; unset($fields['create']); - if ($fields['delete']) + if (!empty($fields['delete'])) { $delete = key($fields['delete']); unset($fields['delete']); @@ -178,7 +178,7 @@ class infolog_customfields extends admin_customfields $create = $status['create']; unset($status['create']); - if ($status['delete']) + if (!empty($status['delete'])) { $delete = key($status['delete']); unset($status['delete']); @@ -276,7 +276,7 @@ class infolog_customfields extends admin_customfields unset($this->status[$content['type2']]); unset($this->status['defaults'][$content['type2']]); unset($this->group_owners[$content['type2']]); - $content['type2'] = key($this->content_types); + $content['type2'] = key($this->content_types ?? []); // save changes to repository $this->save_repository(); diff --git a/infolog/inc/class.infolog_favorite_portlet.inc.php b/infolog/inc/class.infolog_favorite_portlet.inc.php index 2857ee1234..e2da50e276 100644 --- a/infolog/inc/class.infolog_favorite_portlet.inc.php +++ b/infolog/inc/class.infolog_favorite_portlet.inc.php @@ -116,7 +116,7 @@ class infolog_favorite_portlet extends home_favorite_portlet { $popup =& $values; } - $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action']); + $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action'] ?? []); if($multi_action == 'link') { $popup[$multi_action] = $popup['link']['app'] . ':'.$popup['link']['id']; diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 11083a3162..15956d3c66 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -831,7 +831,7 @@ class infolog_ui { $popup =& $values; } - $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action']); + $values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action'] ?? []); if($multi_action == 'link') { $popup[$multi_action] = $popup['link']['app'] . ':'.$popup['link']['id']; @@ -2498,7 +2498,7 @@ class infolog_ui if($content) { // Save - $button = key($content['button']); + $button = key($content['button'] ?? []); if($button == 'save' || $button == 'apply') { $this->bo->responsible_edit = array('info_status','info_percent','info_datecompleted'); diff --git a/preferences/inc/class.preferences_settings.inc.php b/preferences/inc/class.preferences_settings.inc.php index 8326b94640..c9636b19c6 100644 --- a/preferences/inc/class.preferences_settings.inc.php +++ b/preferences/inc/class.preferences_settings.inc.php @@ -68,7 +68,7 @@ class preferences_settings { $is_admin = $content['is_admin'] || $content['type'] != 'user'; //error_log(__METHOD__."(".array2string($content).")"); - if ($content['button']) + if (!empty($content['button'])) { $button = key($content['button']); $appname = $content['old_appname'] ? $content['old_appname'] : 'common'; diff --git a/resources/inc/class.resources_acl_ui.inc.php b/resources/inc/class.resources_acl_ui.inc.php index b8c010a815..0d8cb908d5 100755 --- a/resources/inc/class.resources_acl_ui.inc.php +++ b/resources/inc/class.resources_acl_ui.inc.php @@ -176,7 +176,7 @@ class resources_acl_ui $content = array('data' => array()); } } - elseif ($content['button']) + elseif (!empty($content['button'])) { $cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT,'resources'); diff --git a/resources/inc/class.resources_reserve.inc.php b/resources/inc/class.resources_reserve.inc.php index c5c94442c7..2bb464232c 100644 --- a/resources/inc/class.resources_reserve.inc.php +++ b/resources/inc/class.resources_reserve.inc.php @@ -32,7 +32,8 @@ class resources_reserve { $display_days = $_GET['planner_days'] ? $_GET['planner_days'] : 3; $planner_date = $_GET['date'] ? $_GET['date'] : strtotime('yesterday',$content['date'] ? $content['date'] : time()); - if($_GET['confirm']) { + if(!empty($_GET['confirm'])) + { $register_code = ($_GET['confirm'] && preg_match('/^[0-9a-f]{32}$/',$_GET['confirm'])) ? $_GET['confirm'] : false; if($register_code && $registration = registration_bo::confirm($register_code)) { // Get calendar through link @@ -48,17 +49,19 @@ class resources_reserve { $planner_date = mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start'])); $readonlys['__ALL__'] = true; $content = array( - 'resource' => key($data['participant_types']['r']), + 'resource' => key($data['participant_types']['r'] ?? []), 'date' => $data['start'], 'time' => $data['start'] - mktime(0,0,0,date('m',$data['start']),date('d',$data['start']),date('Y',$data['start'])), 'quantity' => 0 ); calendar_so::split_status($data['participant_types']['r'][$content['resource']], $content['quantity'],$role); $data['msg']= '