From d805e9f467d927104411b850ee268d6ec265ebf6 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 12 Feb 2019 14:13:45 -0700 Subject: [PATCH] Stop using deprecated each(), using foreach(), key() or current() instead --- addressbook/inc/class.addressbook_ui.inc.php | 2 +- admin/inc/class.admin_categories.inc.php | 13 +----- admin/inc/class.admin_cmds.inc.php | 4 +- admin/inc/class.admin_customfields.inc.php | 2 +- .../inc/class.admin_customtranslation.inc.php | 4 +- admin/inc/class.admin_mail.inc.php | 18 ++++---- admin/inc/class.admin_messages.inc.php | 2 +- api/src/Link.php | 2 +- .../class.calendar_category_report.inc.php | 2 +- calendar/inc/class.calendar_so.inc.php | 3 +- calendar/inc/class.calendar_uiforms.inc.php | 5 ++- .../class.module_calendar_list.inc.php | 2 +- .../class.module_calendar_month.inc.php | 2 +- doc/rpm-build/checkout-build-archives.php | 2 +- .../inc/class.filemanager_admin.inc.php | 4 +- .../inc/class.filemanager_select.inc.php | 6 +-- filemanager/inc/class.filemanager_ui.inc.php | 7 +-- .../inc/class.infolog_customfields.inc.php | 2 +- infolog/inc/class.infolog_ui.inc.php | 45 +------------------ infolog/setup/tables_update.inc.php | 3 +- mail/inc/class.mail_acl.inc.php | 2 +- mail/inc/class.mail_sieve.inc.php | 6 +-- mail/inc/class.mail_ui.inc.php | 5 ++- .../inc/class.preferences_settings.inc.php | 2 +- resources/inc/class.resources_acl_ui.inc.php | 2 +- .../class.resources_favorite_portlet.inc.php | 2 +- resources/inc/class.resources_ui.inc.php | 2 +- setup/db_backup.php | 10 ++--- setup/inc/class.setup_html.inc.php | 6 +-- setup/inc/class.setup_process.inc.php | 2 +- setup/inc/hook_config.inc.php | 4 +- setup/manageheader.php | 4 +- setup/schematoy.php | 7 ++- setup/sqltoarray.php | 4 +- .../class.timesheet_favorite_portlet.inc.php | 2 +- timesheet/inc/class.timesheet_ui.inc.php | 10 ++--- 36 files changed, 77 insertions(+), 123 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 3f88d7f1b8..552b829483 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -1980,7 +1980,7 @@ class addressbook_ui extends addressbook_bo { if (is_array($content)) { - list($button) = @each($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']; diff --git a/admin/inc/class.admin_categories.inc.php b/admin/inc/class.admin_categories.inc.php index 74c0d91484..77eab0988e 100644 --- a/admin/inc/class.admin_categories.inc.php +++ b/admin/inc/class.admin_categories.inc.php @@ -139,7 +139,7 @@ class admin_categories } else { - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); } unset($content['delete']); @@ -535,17 +535,6 @@ class admin_categories elseif($content['nm']['action']) { $appname = $content['nm']['appname']; - // Old buttons - foreach(array('delete') as $button) - { - if(isset($content['nm']['rows'][$button])) - { - list($id) = @each($content['nm']['rows'][$button]); - $content['nm']['action'] = $button; - $content['nm']['selected'] = array($id); - break; // Only one can come per submit - } - } if (!count($content['nm']['selected']) && !$content['nm']['select_all']) { $msg = lang('You need to select some entries first!'); diff --git a/admin/inc/class.admin_cmds.inc.php b/admin/inc/class.admin_cmds.inc.php index e40f6a0501..4238e05c7f 100644 --- a/admin/inc/class.admin_cmds.inc.php +++ b/admin/inc/class.admin_cmds.inc.php @@ -66,7 +66,7 @@ class admin_cmds } elseif ($content['nm']['rows']['delete']) { - list($id) = each($content['nm']['rows']['delete']); + $id = key($content['nm']['rows']['delete']); unset($content['nm']['rows']); if (($cmd = admin_cmd::read($id))) @@ -162,7 +162,7 @@ class admin_cmds } elseif($content['remote']['button']) { - list($button) = each($content['remote']['button']); + $button = key($content['remote']['button']); unset($content['remote']['button']); switch($button) { diff --git a/admin/inc/class.admin_customfields.inc.php b/admin/inc/class.admin_customfields.inc.php index 2387bb9503..808fc3f1be 100644 --- a/admin/inc/class.admin_customfields.inc.php +++ b/admin/inc/class.admin_customfields.inc.php @@ -318,7 +318,7 @@ class admin_customfields // Update based on info returned from template if (is_array($content)) { - list($action) = @each($content['button']); + $action = @key($content['button']); switch($action) { case 'delete': diff --git a/admin/inc/class.admin_customtranslation.inc.php b/admin/inc/class.admin_customtranslation.inc.php index 72e827dff0..b0c68b073f 100644 --- a/admin/inc/class.admin_customtranslation.inc.php +++ b/admin/inc/class.admin_customtranslation.inc.php @@ -41,12 +41,12 @@ class admin_customtranslation //_debug_array($_content); if (isset($_content['button'])) { - list($action) = each($_content['button']); + $action = key($_content['button']); unset($_content['button']); } elseif($_content['rows']['delete']) { - list($action) = each($_content['rows']['delete']); + $action = key($_content['rows']['delete']); unset($_content['rows']['delete']); } switch($action) diff --git a/admin/inc/class.admin_mail.inc.php b/admin/inc/class.admin_mail.inc.php index 56d6e3c7b0..ccfc613a01 100644 --- a/admin/inc/class.admin_mail.inc.php +++ b/admin/inc/class.admin_mail.inc.php @@ -363,7 +363,7 @@ class admin_mail { if (isset($content['button'])) { - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); switch($button) { @@ -484,7 +484,7 @@ class admin_mail if (isset($content['button'])) { - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); switch($button) { @@ -512,7 +512,7 @@ class admin_mail $readonlys['button[manual]'] = true; } // set default ssl and port - if (!isset($content['acc_sieve_ssl'])) list($content['acc_sieve_ssl']) = each(self::$ssl_types); + if (!isset($content['acc_sieve_ssl'])) $content['acc_sieve_ssl'] = key(self::$ssl_types); if (empty($content['acc_sieve_port'])) $content['acc_sieve_port'] = $sieve_ssl2port[$content['acc_sieve_ssl']]; // check smtp connection @@ -579,7 +579,7 @@ class admin_mail // not connected, and default ssl/port --> reset again to secure settings if ($data == $sieve_ssl2port) { - list($content['acc_sieve_ssl']) = each(self::$ssl_types); + $content['acc_sieve_ssl'] = key(self::$ssl_types); $content['acc_sieve_port'] = $sieve_ssl2port[$content['acc_sieve_ssl']]; } } @@ -621,7 +621,7 @@ class admin_mail if (isset($content['button'])) { - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); switch($button) { @@ -643,7 +643,7 @@ class admin_mail if (!isset($content['acc_smtp_username'])) $content['acc_smtp_username'] = $content['acc_imap_username']; if (!isset($content['acc_smtp_password'])) $content['acc_smtp_password'] = $content['acc_imap_password']; // set default ssl - if (!isset($content['acc_smtp_ssl'])) list($content['acc_smtp_ssl']) = each(self::$ssl_types); + if (!isset($content['acc_smtp_ssl'])) $content['acc_smtp_ssl'] = key(self::$ssl_types); if (empty($content['acc_smtp_port'])) $content['acc_smtp_port'] = $smtp_ssl2port[$content['acc_smtp_ssl']]; // check smtp connection @@ -837,7 +837,7 @@ class admin_mail $content['accounts'] = iterator_to_array(Mail\Account::search($content['called_for'])); if ($content['accounts']) { - list($content['acc_id']) = each($content['accounts']); + $content['acc_id'] = key($content['accounts']); //error_log(__METHOD__.__LINE__.'.'.array2string($content['acc_id'])); // test if the "to be selected" acccount is imap or not if (count($content['accounts'])>1 && Mail\Account::is_multiple($content['acc_id'])) @@ -847,7 +847,7 @@ class admin_mail //try to select the first account that is of type imap if (!$account->is_imap()) { - list($content['acc_id']) = each($content['accounts']); + $content['acc_id'] = key($content['accounts']); //error_log(__METHOD__.__LINE__.'.'.array2string($content['acc_id'])); } } @@ -951,7 +951,7 @@ class admin_mail if (isset($content['button'])) { - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); switch($button) { diff --git a/admin/inc/class.admin_messages.inc.php b/admin/inc/class.admin_messages.inc.php index 0ce4645745..23b475b9ea 100644 --- a/admin/inc/class.admin_messages.inc.php +++ b/admin/inc/class.admin_messages.inc.php @@ -44,7 +44,7 @@ class admin_messages } else { - list($button) = @each($content['button']); + $button = @key($content['button']); if ($button) { diff --git a/api/src/Link.php b/api/src/Link.php index f23692ed88..882daa3327 100644 --- a/api/src/Link.php +++ b/api/src/Link.php @@ -986,7 +986,7 @@ class Link extends Link\Storage if (count($names) > 1) { $id = explode(':',$id); - while (list($n,$name) = each($names)) + foreach($names as $n => $name) { $view[$name] = $id[$n]; } diff --git a/calendar/inc/class.calendar_category_report.inc.php b/calendar/inc/class.calendar_category_report.inc.php index c24587f6b1..9562fc3ca9 100644 --- a/calendar/inc/class.calendar_category_report.inc.php +++ b/calendar/inc/class.calendar_category_report.inc.php @@ -245,7 +245,7 @@ class calendar_category_report extends calendar_ui{ } else { - list($button) = @each($content['button']); + $button = @key($content['button']); $result = $categories = $content_rows = array (); $users = array_keys($GLOBALS['egw']->accounts->search(array('type'=>'accounts', active=>true))); diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index 171726e36c..86b1a64d38 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -2368,7 +2368,8 @@ ORDER BY cal_user_type, cal_usre_id { return False; } - list($alarm_id,$job) = each($jobs); + $alarm_id = key($jobs); + $job = current($jobs); $alarm = $job['data']; // text, enabled $alarm['id'] = $alarm_id; $alarm['time'] = $job['next']; diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 6d27bd265a..1598703b74 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -287,7 +287,7 @@ class calendar_uiforms extends calendar_ui // (add, edit, update, delete) $update_type = $content['id'] ? ($content['recur_type'] == MCAL_RECUR_NONE ? 'update' : 'edit') : 'add'; - list($button) = @each($content['button']); + $button = @key($content['button']); if (!$button && $content['action']) $button = $content['action']; // action selectbox unset($content['button']); unset($content['action']); @@ -2042,7 +2042,8 @@ class calendar_uiforms extends calendar_ui // first participant is the one replying (our iCal parser adds owner first!) $parts = $event['participants']; unset($parts[$existing_event['owner']]); - list($event['ical_sender_uid'], $event['ical_sender_status']) = each($parts); + $event['ical_sender_uid'] = key($parts); + $event['ical_sender_status'] = current($parts); $quantity = $role = null; calendar_so::split_status($event['ical_sender_status'], $quantity, $role); diff --git a/calendar/sitemgr/class.module_calendar_list.inc.php b/calendar/sitemgr/class.module_calendar_list.inc.php index d0d094bf16..74a5b71a84 100644 --- a/calendar/sitemgr/class.module_calendar_list.inc.php +++ b/calendar/sitemgr/class.module_calendar_list.inc.php @@ -160,7 +160,7 @@ class module_calendar_list extends Module $cat = new Api\Categories('','calendar'); $cats = $cat->return_array('all',0,False,'','cat_name','',True); $cat_ids = array(); - while (list(,$category) = @each($cats)) + foreach($cats as $category) { $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); } diff --git a/calendar/sitemgr/class.module_calendar_month.inc.php b/calendar/sitemgr/class.module_calendar_month.inc.php index f74164f22a..b577f072f0 100644 --- a/calendar/sitemgr/class.module_calendar_month.inc.php +++ b/calendar/sitemgr/class.module_calendar_month.inc.php @@ -110,7 +110,7 @@ class module_calendar_month extends Module $cat = createobject('phpgwapi.categories','','calendar'); $cats = $cat->return_array('all',0,False,'','cat_name','',True); $cat_ids = array(); - while (list(,$category) = @each($cats)) + foreach($cats as $category) { $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); } diff --git a/doc/rpm-build/checkout-build-archives.php b/doc/rpm-build/checkout-build-archives.php index bec49bbb7f..0c04db1f65 100755 --- a/doc/rpm-build/checkout-build-archives.php +++ b/doc/rpm-build/checkout-build-archives.php @@ -568,7 +568,7 @@ function do_editchangelog() $revision = null; if (substr($branch_url, -4) == '.git') { - list($path) = each($modules); + $path = key($modules); $changelog .= get_changelog_from_git($path, $config['editchangelog'], $last_tag); } else diff --git a/filemanager/inc/class.filemanager_admin.inc.php b/filemanager/inc/class.filemanager_admin.inc.php index 81c825ccd4..690845225d 100644 --- a/filemanager/inc/class.filemanager_admin.inc.php +++ b/filemanager/inc/class.filemanager_admin.inc.php @@ -113,11 +113,11 @@ class filemanager_admin extends filemanager_ui { if (($unmount = $content['mounts']['umount'])) { - list($path) = @each($content['mounts']['umount']); + $path = @key($content['mounts']['umount']); } else { - list($path) = @each($content['mounts']['disable']); + $path = @key($content['mounts']['disable']); } if (!in_array($path, self::$protected_path) && $path != '/') { diff --git a/filemanager/inc/class.filemanager_select.inc.php b/filemanager/inc/class.filemanager_select.inc.php index 3f98f70890..3da1b20f0a 100644 --- a/filemanager/inc/class.filemanager_select.inc.php +++ b/filemanager/inc/class.filemanager_select.inc.php @@ -106,13 +106,13 @@ class filemanager_select } } - list($content['mime']) = each($sel_options['mime']); + $content['mime'] = key($sel_options['mime']); error_log(array2string($content['options-mime'])); } } elseif(isset($content['button'])) { - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); switch($button) { @@ -207,7 +207,7 @@ class filemanager_select } elseif(isset($content['apps'])) { - list($app) = each($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 e048d3bee2..811cccb37f 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -525,7 +525,7 @@ class filemanager_ui { if ($content['button']) { - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); } switch($button) @@ -1108,7 +1108,8 @@ class filemanager_ui //_debug_array($content); $path =& $content['path']; - list($button) = @each($content['button']); unset($content['button']); + $button = @key($content['button']); + unset($content['button']); if(!$button && $content['sudo']) { // Button to stop sudo is not in button namespace @@ -1263,7 +1264,7 @@ class filemanager_ui { if ($content['eacl']['delete']) { - list($ino_owner) = each($content['eacl']['delete']); + $ino_owner = key($content['eacl']['delete']); list(, $owner) = explode('-',$ino_owner,2); // $owner is a group and starts with a minus! $msg .= Vfs::eacl($path,null,$owner) ? lang('ACL deleted.') : lang('Error deleting the ACL entry!'); } diff --git a/infolog/inc/class.infolog_customfields.inc.php b/infolog/inc/class.infolog_customfields.inc.php index c281f989fa..ba9297741c 100644 --- a/infolog/inc/class.infolog_customfields.inc.php +++ b/infolog/inc/class.infolog_customfields.inc.php @@ -223,7 +223,7 @@ class infolog_customfields extends admin_customfields $this->status['defaults'][$typ] = empty($default) ? $name : $default; if (!isset($this->status[$typ][$this->status['defaults'][$typ]])) { - list($this->status['defaults'][$typ]) = @each($this->status[$typ]); + $this->status['defaults'][$typ] = @key($this->status[$typ]); } } diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 5c94afd00e..ced2a20cbe 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -765,7 +765,7 @@ class infolog_ui { if(isset($values['nm']['rows'][$button])) { - list($id) = @each($values['nm']['rows'][$button]); + $id = @key($values['nm']['rows'][$button]); $values['nm']['multi_action'] = $button; $values['nm']['selected'] = array($id); break; // Only one can come per submit @@ -885,47 +885,6 @@ class infolog_ui } unset($values['nm']['rows']['checked']); // not longer used, but hides button actions - if ($values['add'] || $values['cancel'] || isset($values['main'])) - { - if ($values['add']) - { - $type = key($values['add']); - return $this->edit(0,$action,$action_id,$type,$called_as); - } - elseif ($values['cancel'] && $own_referer) - { - unset($values['nm']['multi_action']); - unset($values['nm']['action_id']); - unset($values['nm']['rows']); - Api\Cache::setSession('infolog', $values['nm']['session_for'].'session_data', $values['nm']); - $this->tmpl->location($own_referer); - } - else - { - list($do,$do2) = each($values['main']); - $do = key($values['main']); - $do2 = current($values['main']); - $do_id = @key($do2); - switch((string)$do) - { - case 'close': - $closesingle=true; - case 'close_all': - $this->close($do_id,$called_as,$closesingle); - break; - case 'view': - $value = array(); - $action = 'sp'; - $action_id = $do_id; - break; - default: - $value = array(); - $action = ''; - $action_id = 0; - break; - } - } - } switch ($action) { case 'sp': @@ -1749,7 +1708,7 @@ class infolog_ui $referer = $content['referer']; unset($content['referer']); $no_popup = $content['no_popup']; unset($content['no_popup']); - list($button) = @each($content['button']); + $button = @key($content['button']); if (!$button && $action) $button = $action; // action selectbox //info_cc expects an comma separated string //error_log(__METHOD__.__LINE__.array2string($content)); diff --git a/infolog/setup/tables_update.inc.php b/infolog/setup/tables_update.inc.php index 6cb79cd80c..98253ff912 100644 --- a/infolog/setup/tables_update.inc.php +++ b/infolog/setup/tables_update.inc.php @@ -199,8 +199,7 @@ function infolog_upgrade0_9_15_003() { $links[$GLOBALS['egw_setup']->oProc->f(1)] = $GLOBALS['egw_setup']->oProc->f(0); } - reset($links); - while (list($info_id,$link_id) = each($links)) + foreach($links as $info_id => $link_id) { $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_link_id=$link_id WHERE info_id=$info_id"); } diff --git a/mail/inc/class.mail_acl.inc.php b/mail/inc/class.mail_acl.inc.php index d927d8638f..b594c4e8c2 100644 --- a/mail/inc/class.mail_acl.inc.php +++ b/mail/inc/class.mail_acl.inc.php @@ -205,7 +205,7 @@ class mail_acl } else { - list($button) = @each($content['button']); + $button = @key($content['button']); if (!empty ($content['grid']['delete'])) { $button = 'delete'; diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index dcc91fe8fc..90cef69ee5 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -152,7 +152,7 @@ class mail_sieve else { $this->restoreSessionData(); - list($button) = @each($content['button']); + $button = @key($content['button']); unset ($content['button']); switch($button) @@ -271,7 +271,7 @@ class mail_sieve else { $this->restoreSessionData(); - list($button) = @each($content['button']); + $button = @key($content['button']); //$ruleID is calculated by priority from the selected rule and is an unique ID $content['ruleID'] = $ruleID = ($this->rulesByID['priority'] -1) / 2; @@ -583,7 +583,7 @@ class mail_sieve else { $this->restoreSessionData(); - list($button) = @each($content['button']); + $button = @key($content['button']); unset ($content['button']); switch($button) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 7e52e28639..3b372b27b4 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -312,7 +312,7 @@ class mail_ui } else { - list($button) = @each($content['button']); + $button = @key($content['button']); switch ($button) { case 'save': @@ -2097,7 +2097,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $rawheaders = ""; // create it new, with good line breaks reset($newRawHeaders); - while(list($key,$value) = @each($newRawHeaders)) { + foreach($newRawHeaders as $value) + { $rawheaders .= wordwrap($value, 90, "\n "); } diff --git a/preferences/inc/class.preferences_settings.inc.php b/preferences/inc/class.preferences_settings.inc.php index c2222f0cf9..22ef2b7596 100644 --- a/preferences/inc/class.preferences_settings.inc.php +++ b/preferences/inc/class.preferences_settings.inc.php @@ -70,7 +70,7 @@ class preferences_settings //error_log(__METHOD__."(".array2string($content).")"); if ($content['button']) { - list($button) = each($content['button']); + $button = key($content['button']); $appname = $content['old_appname'] ? $content['old_appname'] : 'common'; switch($button) { diff --git a/resources/inc/class.resources_acl_ui.inc.php b/resources/inc/class.resources_acl_ui.inc.php index fb6d000383..e57d5b68ef 100755 --- a/resources/inc/class.resources_acl_ui.inc.php +++ b/resources/inc/class.resources_acl_ui.inc.php @@ -180,7 +180,7 @@ class resources_acl_ui { $cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT,'resources'); - list($button) = each($content['button']); + $button = key($content['button']); unset($content['button']); $refresh_app = 'admin'; diff --git a/resources/inc/class.resources_favorite_portlet.inc.php b/resources/inc/class.resources_favorite_portlet.inc.php index 8c44935fe1..a9c6240597 100644 --- a/resources/inc/class.resources_favorite_portlet.inc.php +++ b/resources/inc/class.resources_favorite_portlet.inc.php @@ -78,7 +78,7 @@ class resources_favorite_portlet extends home_favorite_portlet // the etemplate exec to fire again. if (is_array($content) && 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']['selected'] = array($id); } diff --git a/resources/inc/class.resources_ui.inc.php b/resources/inc/class.resources_ui.inc.php index a209ce0213..9484d58cf5 100755 --- a/resources/inc/class.resources_ui.inc.php +++ b/resources/inc/class.resources_ui.inc.php @@ -419,7 +419,7 @@ class resources_ui { if (is_array($content)) { - list($button) = @each($content['button']); + $button = @key($content['button']); unset($content['button']); switch($button) { diff --git a/setup/db_backup.php b/setup/db_backup.php index b8b99cbc4e..4dfd303229 100644 --- a/setup/db_backup.php +++ b/setup/db_backup.php @@ -40,7 +40,7 @@ $asyncservice = new Api\Asyncservice(); // download a backup, has to be before any output !!! if ($_POST['download']) { - list($file) = each($_POST['download']); + $file = key($_POST['download']); $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir while (@ob_end_clean()) {} // end all active output buffering ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit @@ -167,7 +167,7 @@ if ($_POST['upload'] && is_array($_FILES['uploaded']) && !$_FILES['uploaded']['e // delete a backup if ($_POST['delete']) { - list($file) = each($_POST['delete']); + $file = key($_POST['delete']); $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file)); @@ -175,7 +175,7 @@ if ($_POST['delete']) // rename a backup if ($_POST['rename']) { - list($file) = each($_POST['rename']); + $file = key($_POST['rename']); $new_name = $_POST['new_name'][$file]; if (!empty($new_name)) { @@ -191,7 +191,7 @@ if ($_POST['rename']) // restore a backup if ($_POST['restore']) { - list($file) = each($_POST['restore']); + $file = key($_POST['restore']); $file = $db_backup->backup_dir.'/'.basename($file); // basename to not allow to change the dir if (is_resource($f = $db_backup->fopen_backup($file,true))) @@ -223,7 +223,7 @@ if ($_POST['schedule']) // cancel a scheduled backup if (is_array($_POST['cancel'])) { - list($id) = each($_POST['cancel']); + $id = key($_POST['cancel']); $asyncservice->cancel_timer($id); } // list scheduled backups diff --git a/setup/inc/class.setup_html.inc.php b/setup/inc/class.setup_html.inc.php index 7956b81af6..afb3ef0ad9 100644 --- a/setup/inc/class.setup_html.inc.php +++ b/setup/inc/class.setup_html.inc.php @@ -73,7 +73,7 @@ class setup_html $GLOBALS['header_template']->set_var('domain',''); $setting = $_POST['setting']; - while($setting && list($k,$v) = @each($setting)) + foreach($setting as $k => $v) { if(strtoupper($k) == 'HEADER_ADMIN_PASSWORD') { @@ -258,8 +258,8 @@ class setup_html else { reset($GLOBALS['egw_domain']); - $default_domain = each($GLOBALS['egw_domain']); - $GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain[0]); + $default_domain = key($GLOBALS['egw_domain']); + $GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain); /* Use BLOCK B_single_domain inside of login_stage_header */ $GLOBALS['setup_tpl']->parse('V_single_domain','B_single_domain'); diff --git a/setup/inc/class.setup_process.inc.php b/setup/inc/class.setup_process.inc.php index 6d456dae6e..5498b168b1 100755 --- a/setup/inc/class.setup_process.inc.php +++ b/setup/inc/class.setup_process.inc.php @@ -773,7 +773,7 @@ class setup_process $sColumns = null; $GLOBALS['egw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['egw_setup']->oProc, $tablename, $sColumns); - while(list($key,$tbldata) = each($GLOBALS['egw_setup']->oProc->m_oTranslator->sCol)) + foreach($GLOBALS['egw_setup']->oProc->m_oTranslator->sCol as $key => $tbldata) { $arr .= $tbldata; } diff --git a/setup/inc/hook_config.inc.php b/setup/inc/hook_config.inc.php index 33bccb70dc..f5177178b0 100644 --- a/setup/inc/hook_config.inc.php +++ b/setup/inc/hook_config.inc.php @@ -68,7 +68,7 @@ function encryptalgo($config) $found = False; $out = ''; - while(list($key,$value) = each($algos)) + foreach($algos as $key => $value) { $found = True; /* Only show each once - seems this is a problem in some installs */ @@ -114,7 +114,7 @@ function encryptmode($config) $found = False; $out = ''; - while(list($key,$value) = each($modes)) + foreach($modes as $key => $value) { $found = True; /* Only show each once - seems this is a problem in some installs */ diff --git a/setup/manageheader.php b/setup/manageheader.php index b0bce68601..241d2c5808 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -96,7 +96,7 @@ else { $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); - list($action) = @each($_POST['action']); + $action = @key($_POST['action']); switch($action) { case 'download': @@ -331,7 +331,7 @@ function show_header_form($validation_errors) } // set domain and password for the continue button @reset($GLOBALS['egw_domain']); - list($firstDomain) = @each($GLOBALS['egw_domain']); + $firstDomain = @key($GLOBALS['egw_domain']); $setup_tpl->set_var(array( 'FormDomain' => $firstDomain, diff --git a/setup/schematoy.php b/setup/schematoy.php index 0bba7b3057..fbb03ebbf4 100644 --- a/setup/schematoy.php +++ b/setup/schematoy.php @@ -242,9 +242,12 @@ } $s = ''; - while(is_array($test) && list(,$versionnumber) = each($test)) + if(is_array($test)) { - $s .= ''; + foreach($test as $versionnumber) + { + $s .= ''; + } } $GLOBALS['setup_tpl']->set_var('select_version',$s); diff --git a/setup/sqltoarray.php b/setup/sqltoarray.php index 937a5b8813..6080e8b899 100644 --- a/setup/sqltoarray.php +++ b/setup/sqltoarray.php @@ -193,7 +193,7 @@ if($submit || $showall) $tables = $setup_info[$appname]['tables']; $i = 0; $tbls = count($tables); - while(list($key,$table) = @each($tables)) + foreach($tables as $key => $table) { $i++; if($i == $tbls) @@ -241,7 +241,7 @@ else } } - while(list($key,$data) = @each($setup_info)) + foreach($setup_info as $key => $data) { if($data['tables']) { diff --git a/timesheet/inc/class.timesheet_favorite_portlet.inc.php b/timesheet/inc/class.timesheet_favorite_portlet.inc.php index d5b0c22c63..d2d63c0d3e 100644 --- a/timesheet/inc/class.timesheet_favorite_portlet.inc.php +++ b/timesheet/inc/class.timesheet_favorite_portlet.inc.php @@ -98,7 +98,7 @@ class timesheet_favorite_portlet extends home_favorite_portlet // the etemplate exec to fire again. if (is_array($content) && 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']['selected'] = array($id); } diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index 0776507036..6847ec7064 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -161,7 +161,7 @@ class timesheet_ui extends timesheet_bo } if ($content['ts_duration'] > 0) unset($content['end_time']); // now we only deal with start (date+time) and duration - list($button) = @each($content['button']); + $button = @key($content['button']); $view = $content['view']; $referer = $content['referer']; $content['ts_project_blur'] = $content['pm_id'] ? Link::title('projectmanager', $content['pm_id']) : ''; @@ -878,7 +878,7 @@ class timesheet_ui extends timesheet_bo if ($_GET['msg']) $msg = $_GET['msg']; if ($content['nm']['rows']['delete']) { - list($ts_id) = each($content['nm']['rows']['delete']); + $ts_id = key($content['nm']['rows']['delete']); if ($this->delete($ts_id)) { $msg = lang('Entry deleted'); @@ -890,7 +890,7 @@ class timesheet_ui extends timesheet_bo } if (is_array($content) && 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']['selected'] = array($id); } @@ -1238,7 +1238,7 @@ class timesheet_ui extends timesheet_bo if (is_array($content)) { - list($button) = @each($content['button']); + $button = @key($content['button']); unset ($content['button']); switch($button) @@ -1274,7 +1274,7 @@ class timesheet_ui extends timesheet_bo } if (isset($content['statis']['delete'])) { - list($id) = each($content['statis']['delete']); + $id = key($content['statis']['delete']); if (isset($this->status_labels_config[$id])) { unset($this->status_labels_config[$id]);