Stop using deprecated each(), using foreach(), key() or current() instead

This commit is contained in:
nathangray 2019-02-12 14:13:45 -07:00
parent a5c1e24a78
commit d805e9f467
36 changed files with 77 additions and 123 deletions

View File

@ -1980,7 +1980,7 @@ class addressbook_ui extends addressbook_bo
{ {
if (is_array($content)) if (is_array($content))
{ {
list($button) = @each($content['button']); $button = @key($content['button']);
unset($content['button']); unset($content['button']);
$content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p'); $content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p');
$content['owner'] = (string) (int) $content['owner']; $content['owner'] = (string) (int) $content['owner'];

View File

@ -139,7 +139,7 @@ class admin_categories
} }
else else
{ {
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
} }
unset($content['delete']); unset($content['delete']);
@ -535,17 +535,6 @@ class admin_categories
elseif($content['nm']['action']) elseif($content['nm']['action'])
{ {
$appname = $content['nm']['appname']; $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']) if (!count($content['nm']['selected']) && !$content['nm']['select_all'])
{ {
$msg = lang('You need to select some entries first!'); $msg = lang('You need to select some entries first!');

View File

@ -66,7 +66,7 @@ class admin_cmds
} }
elseif ($content['nm']['rows']['delete']) elseif ($content['nm']['rows']['delete'])
{ {
list($id) = each($content['nm']['rows']['delete']); $id = key($content['nm']['rows']['delete']);
unset($content['nm']['rows']); unset($content['nm']['rows']);
if (($cmd = admin_cmd::read($id))) if (($cmd = admin_cmd::read($id)))
@ -162,7 +162,7 @@ class admin_cmds
} }
elseif($content['remote']['button']) elseif($content['remote']['button'])
{ {
list($button) = each($content['remote']['button']); $button = key($content['remote']['button']);
unset($content['remote']['button']); unset($content['remote']['button']);
switch($button) switch($button)
{ {

View File

@ -318,7 +318,7 @@ class admin_customfields
// Update based on info returned from template // Update based on info returned from template
if (is_array($content)) if (is_array($content))
{ {
list($action) = @each($content['button']); $action = @key($content['button']);
switch($action) switch($action)
{ {
case 'delete': case 'delete':

View File

@ -41,12 +41,12 @@ class admin_customtranslation
//_debug_array($_content); //_debug_array($_content);
if (isset($_content['button'])) if (isset($_content['button']))
{ {
list($action) = each($_content['button']); $action = key($_content['button']);
unset($_content['button']); unset($_content['button']);
} }
elseif($_content['rows']['delete']) elseif($_content['rows']['delete'])
{ {
list($action) = each($_content['rows']['delete']); $action = key($_content['rows']['delete']);
unset($_content['rows']['delete']); unset($_content['rows']['delete']);
} }
switch($action) switch($action)

View File

@ -363,7 +363,7 @@ class admin_mail
{ {
if (isset($content['button'])) if (isset($content['button']))
{ {
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
switch($button) switch($button)
{ {
@ -484,7 +484,7 @@ class admin_mail
if (isset($content['button'])) if (isset($content['button']))
{ {
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
switch($button) switch($button)
{ {
@ -512,7 +512,7 @@ class admin_mail
$readonlys['button[manual]'] = true; $readonlys['button[manual]'] = true;
} }
// set default ssl and port // 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']]; if (empty($content['acc_sieve_port'])) $content['acc_sieve_port'] = $sieve_ssl2port[$content['acc_sieve_ssl']];
// check smtp connection // check smtp connection
@ -579,7 +579,7 @@ class admin_mail
// not connected, and default ssl/port --> reset again to secure settings // not connected, and default ssl/port --> reset again to secure settings
if ($data == $sieve_ssl2port) 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']]; $content['acc_sieve_port'] = $sieve_ssl2port[$content['acc_sieve_ssl']];
} }
} }
@ -621,7 +621,7 @@ class admin_mail
if (isset($content['button'])) if (isset($content['button']))
{ {
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
switch($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_username'])) $content['acc_smtp_username'] = $content['acc_imap_username'];
if (!isset($content['acc_smtp_password'])) $content['acc_smtp_password'] = $content['acc_imap_password']; if (!isset($content['acc_smtp_password'])) $content['acc_smtp_password'] = $content['acc_imap_password'];
// set default ssl // 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']]; if (empty($content['acc_smtp_port'])) $content['acc_smtp_port'] = $smtp_ssl2port[$content['acc_smtp_ssl']];
// check smtp connection // check smtp connection
@ -837,7 +837,7 @@ class admin_mail
$content['accounts'] = iterator_to_array(Mail\Account::search($content['called_for'])); $content['accounts'] = iterator_to_array(Mail\Account::search($content['called_for']));
if ($content['accounts']) if ($content['accounts'])
{ {
list($content['acc_id']) = each($content['accounts']); $content['acc_id'] = key($content['accounts']);
//error_log(__METHOD__.__LINE__.'.'.array2string($content['acc_id'])); //error_log(__METHOD__.__LINE__.'.'.array2string($content['acc_id']));
// test if the "to be selected" acccount is imap or not // test if the "to be selected" acccount is imap or not
if (count($content['accounts'])>1 && Mail\Account::is_multiple($content['acc_id'])) 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 //try to select the first account that is of type imap
if (!$account->is_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'])); //error_log(__METHOD__.__LINE__.'.'.array2string($content['acc_id']));
} }
} }
@ -951,7 +951,7 @@ class admin_mail
if (isset($content['button'])) if (isset($content['button']))
{ {
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
switch($button) switch($button)
{ {

View File

@ -44,7 +44,7 @@ class admin_messages
} }
else else
{ {
list($button) = @each($content['button']); $button = @key($content['button']);
if ($button) if ($button)
{ {

View File

@ -986,7 +986,7 @@ class Link extends Link\Storage
if (count($names) > 1) if (count($names) > 1)
{ {
$id = explode(':',$id); $id = explode(':',$id);
while (list($n,$name) = each($names)) foreach($names as $n => $name)
{ {
$view[$name] = $id[$n]; $view[$name] = $id[$n];
} }

View File

@ -245,7 +245,7 @@ class calendar_category_report extends calendar_ui{
} }
else else
{ {
list($button) = @each($content['button']); $button = @key($content['button']);
$result = $categories = $content_rows = array (); $result = $categories = $content_rows = array ();
$users = array_keys($GLOBALS['egw']->accounts->search(array('type'=>'accounts', active=>true))); $users = array_keys($GLOBALS['egw']->accounts->search(array('type'=>'accounts', active=>true)));

View File

@ -2368,7 +2368,8 @@ ORDER BY cal_user_type, cal_usre_id
{ {
return False; return False;
} }
list($alarm_id,$job) = each($jobs); $alarm_id = key($jobs);
$job = current($jobs);
$alarm = $job['data']; // text, enabled $alarm = $job['data']; // text, enabled
$alarm['id'] = $alarm_id; $alarm['id'] = $alarm_id;
$alarm['time'] = $job['next']; $alarm['time'] = $job['next'];

View File

@ -287,7 +287,7 @@ class calendar_uiforms extends calendar_ui
// (add, edit, update, delete) // (add, edit, update, delete)
$update_type = $content['id'] ? ($content['recur_type'] == MCAL_RECUR_NONE ? 'update' : 'edit') : 'add'; $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 if (!$button && $content['action']) $button = $content['action']; // action selectbox
unset($content['button']); unset($content['action']); 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!) // first participant is the one replying (our iCal parser adds owner first!)
$parts = $event['participants']; $parts = $event['participants'];
unset($parts[$existing_event['owner']]); 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; $quantity = $role = null;
calendar_so::split_status($event['ical_sender_status'], $quantity, $role); calendar_so::split_status($event['ical_sender_status'], $quantity, $role);

View File

@ -160,7 +160,7 @@ class module_calendar_list extends Module
$cat = new Api\Categories('','calendar'); $cat = new Api\Categories('','calendar');
$cats = $cat->return_array('all',0,False,'','cat_name','',True); $cats = $cat->return_array('all',0,False,'','cat_name','',True);
$cat_ids = array(); $cat_ids = array();
while (list(,$category) = @each($cats)) foreach($cats as $category)
{ {
$cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']);
} }

View File

@ -110,7 +110,7 @@ class module_calendar_month extends Module
$cat = createobject('phpgwapi.categories','','calendar'); $cat = createobject('phpgwapi.categories','','calendar');
$cats = $cat->return_array('all',0,False,'','cat_name','',True); $cats = $cat->return_array('all',0,False,'','cat_name','',True);
$cat_ids = array(); $cat_ids = array();
while (list(,$category) = @each($cats)) foreach($cats as $category)
{ {
$cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']);
} }

View File

@ -568,7 +568,7 @@ function do_editchangelog()
$revision = null; $revision = null;
if (substr($branch_url, -4) == '.git') if (substr($branch_url, -4) == '.git')
{ {
list($path) = each($modules); $path = key($modules);
$changelog .= get_changelog_from_git($path, $config['editchangelog'], $last_tag); $changelog .= get_changelog_from_git($path, $config['editchangelog'], $last_tag);
} }
else else

View File

@ -113,11 +113,11 @@ class filemanager_admin extends filemanager_ui
{ {
if (($unmount = $content['mounts']['umount'])) if (($unmount = $content['mounts']['umount']))
{ {
list($path) = @each($content['mounts']['umount']); $path = @key($content['mounts']['umount']);
} }
else else
{ {
list($path) = @each($content['mounts']['disable']); $path = @key($content['mounts']['disable']);
} }
if (!in_array($path, self::$protected_path) && $path != '/') if (!in_array($path, self::$protected_path) && $path != '/')
{ {

View File

@ -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'])); error_log(array2string($content['options-mime']));
} }
} }
elseif(isset($content['button'])) elseif(isset($content['button']))
{ {
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
switch($button) switch($button)
{ {
@ -207,7 +207,7 @@ class filemanager_select
} }
elseif(isset($content['apps'])) elseif(isset($content['apps']))
{ {
list($app) = each($content['apps']); $app = key($content['apps']);
if ($app == 'home') $content['path'] = filemanager_ui::get_home_dir(); if ($app == 'home') $content['path'] = filemanager_ui::get_home_dir();
} }

View File

@ -525,7 +525,7 @@ class filemanager_ui
{ {
if ($content['button']) if ($content['button'])
{ {
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
} }
switch($button) switch($button)
@ -1108,7 +1108,8 @@ class filemanager_ui
//_debug_array($content); //_debug_array($content);
$path =& $content['path']; $path =& $content['path'];
list($button) = @each($content['button']); unset($content['button']); $button = @key($content['button']);
unset($content['button']);
if(!$button && $content['sudo']) if(!$button && $content['sudo'])
{ {
// Button to stop sudo is not in button namespace // Button to stop sudo is not in button namespace
@ -1263,7 +1264,7 @@ class filemanager_ui
{ {
if ($content['eacl']['delete']) 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! 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!'); $msg .= Vfs::eacl($path,null,$owner) ? lang('ACL deleted.') : lang('Error deleting the ACL entry!');
} }

View File

@ -223,7 +223,7 @@ class infolog_customfields extends admin_customfields
$this->status['defaults'][$typ] = empty($default) ? $name : $default; $this->status['defaults'][$typ] = empty($default) ? $name : $default;
if (!isset($this->status[$typ][$this->status['defaults'][$typ]])) 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]);
} }
} }

View File

@ -765,7 +765,7 @@ class infolog_ui
{ {
if(isset($values['nm']['rows'][$button])) 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']['multi_action'] = $button;
$values['nm']['selected'] = array($id); $values['nm']['selected'] = array($id);
break; // Only one can come per submit 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 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) switch ($action)
{ {
case 'sp': case 'sp':
@ -1749,7 +1708,7 @@ class infolog_ui
$referer = $content['referer']; unset($content['referer']); $referer = $content['referer']; unset($content['referer']);
$no_popup = $content['no_popup']; unset($content['no_popup']); $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 if (!$button && $action) $button = $action; // action selectbox
//info_cc expects an comma separated string //info_cc expects an comma separated string
//error_log(__METHOD__.__LINE__.array2string($content)); //error_log(__METHOD__.__LINE__.array2string($content));

View File

@ -199,8 +199,7 @@ function infolog_upgrade0_9_15_003()
{ {
$links[$GLOBALS['egw_setup']->oProc->f(1)] = $GLOBALS['egw_setup']->oProc->f(0); $links[$GLOBALS['egw_setup']->oProc->f(1)] = $GLOBALS['egw_setup']->oProc->f(0);
} }
reset($links); foreach($links as $info_id => $link_id)
while (list($info_id,$link_id) = each($links))
{ {
$GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_link_id=$link_id WHERE info_id=$info_id"); $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_link_id=$link_id WHERE info_id=$info_id");
} }

View File

@ -205,7 +205,7 @@ class mail_acl
} }
else else
{ {
list($button) = @each($content['button']); $button = @key($content['button']);
if (!empty ($content['grid']['delete'])) if (!empty ($content['grid']['delete']))
{ {
$button = 'delete'; $button = 'delete';

View File

@ -152,7 +152,7 @@ class mail_sieve
else else
{ {
$this->restoreSessionData(); $this->restoreSessionData();
list($button) = @each($content['button']); $button = @key($content['button']);
unset ($content['button']); unset ($content['button']);
switch($button) switch($button)
@ -271,7 +271,7 @@ class mail_sieve
else else
{ {
$this->restoreSessionData(); $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 //$ruleID is calculated by priority from the selected rule and is an unique ID
$content['ruleID'] = $ruleID = ($this->rulesByID['priority'] -1) / 2; $content['ruleID'] = $ruleID = ($this->rulesByID['priority'] -1) / 2;
@ -583,7 +583,7 @@ class mail_sieve
else else
{ {
$this->restoreSessionData(); $this->restoreSessionData();
list($button) = @each($content['button']); $button = @key($content['button']);
unset ($content['button']); unset ($content['button']);
switch($button) switch($button)

View File

@ -312,7 +312,7 @@ class mail_ui
} }
else else
{ {
list($button) = @each($content['button']); $button = @key($content['button']);
switch ($button) switch ($button)
{ {
case 'save': case 'save':
@ -2097,7 +2097,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
$rawheaders = ""; $rawheaders = "";
// create it new, with good line breaks // create it new, with good line breaks
reset($newRawHeaders); reset($newRawHeaders);
while(list($key,$value) = @each($newRawHeaders)) { foreach($newRawHeaders as $value)
{
$rawheaders .= wordwrap($value, 90, "\n "); $rawheaders .= wordwrap($value, 90, "\n ");
} }

View File

@ -70,7 +70,7 @@ class preferences_settings
//error_log(__METHOD__."(".array2string($content).")"); //error_log(__METHOD__."(".array2string($content).")");
if ($content['button']) if ($content['button'])
{ {
list($button) = each($content['button']); $button = key($content['button']);
$appname = $content['old_appname'] ? $content['old_appname'] : 'common'; $appname = $content['old_appname'] ? $content['old_appname'] : 'common';
switch($button) switch($button)
{ {

View File

@ -180,7 +180,7 @@ class resources_acl_ui
{ {
$cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT,'resources'); $cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT,'resources');
list($button) = each($content['button']); $button = key($content['button']);
unset($content['button']); unset($content['button']);
$refresh_app = 'admin'; $refresh_app = 'admin';

View File

@ -78,7 +78,7 @@ class resources_favorite_portlet extends home_favorite_portlet
// the etemplate exec to fire again. // the etemplate exec to fire again.
if (is_array($content) && isset($content['nm']['rows']['document'])) // handle insert in default document button like an action 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']['action'] = 'document';
$content['nm']['selected'] = array($id); $content['nm']['selected'] = array($id);
} }

View File

@ -419,7 +419,7 @@ class resources_ui
{ {
if (is_array($content)) if (is_array($content))
{ {
list($button) = @each($content['button']); $button = @key($content['button']);
unset($content['button']); unset($content['button']);
switch($button) switch($button)
{ {

View File

@ -40,7 +40,7 @@ $asyncservice = new Api\Asyncservice();
// download a backup, has to be before any output !!! // download a backup, has to be before any output !!!
if ($_POST['download']) 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 $file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir
while (@ob_end_clean()) {} // end all active output buffering 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 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 // delete a backup
if ($_POST['delete']) 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 $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)); if (unlink($file)) $setup_tpl->set_var('error_msg',lang("backup '%1' deleted",$file));
@ -175,7 +175,7 @@ if ($_POST['delete'])
// rename a backup // rename a backup
if ($_POST['rename']) if ($_POST['rename'])
{ {
list($file) = each($_POST['rename']); $file = key($_POST['rename']);
$new_name = $_POST['new_name'][$file]; $new_name = $_POST['new_name'][$file];
if (!empty($new_name)) if (!empty($new_name))
{ {
@ -191,7 +191,7 @@ if ($_POST['rename'])
// restore a backup // restore a backup
if ($_POST['restore']) 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 $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))) if (is_resource($f = $db_backup->fopen_backup($file,true)))
@ -223,7 +223,7 @@ if ($_POST['schedule'])
// cancel a scheduled backup // cancel a scheduled backup
if (is_array($_POST['cancel'])) if (is_array($_POST['cancel']))
{ {
list($id) = each($_POST['cancel']); $id = key($_POST['cancel']);
$asyncservice->cancel_timer($id); $asyncservice->cancel_timer($id);
} }
// list scheduled backups // list scheduled backups

View File

@ -73,7 +73,7 @@ class setup_html
$GLOBALS['header_template']->set_var('domain',''); $GLOBALS['header_template']->set_var('domain','');
$setting = $_POST['setting']; $setting = $_POST['setting'];
while($setting && list($k,$v) = @each($setting)) foreach($setting as $k => $v)
{ {
if(strtoupper($k) == 'HEADER_ADMIN_PASSWORD') if(strtoupper($k) == 'HEADER_ADMIN_PASSWORD')
{ {
@ -258,8 +258,8 @@ class setup_html
else else
{ {
reset($GLOBALS['egw_domain']); reset($GLOBALS['egw_domain']);
$default_domain = each($GLOBALS['egw_domain']); $default_domain = key($GLOBALS['egw_domain']);
$GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain[0]); $GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain);
/* Use BLOCK B_single_domain inside of login_stage_header */ /* Use BLOCK B_single_domain inside of login_stage_header */
$GLOBALS['setup_tpl']->parse('V_single_domain','B_single_domain'); $GLOBALS['setup_tpl']->parse('V_single_domain','B_single_domain');

View File

@ -773,7 +773,7 @@ class setup_process
$sColumns = null; $sColumns = null;
$GLOBALS['egw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['egw_setup']->oProc, $tablename, $sColumns); $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; $arr .= $tbldata;
} }

View File

@ -68,7 +68,7 @@ function encryptalgo($config)
$found = False; $found = False;
$out = ''; $out = '';
while(list($key,$value) = each($algos)) foreach($algos as $key => $value)
{ {
$found = True; $found = True;
/* Only show each once - seems this is a problem in some installs */ /* Only show each once - seems this is a problem in some installs */
@ -114,7 +114,7 @@ function encryptmode($config)
$found = False; $found = False;
$out = ''; $out = '';
while(list($key,$value) = each($modes)) foreach($modes as $key => $value)
{ {
$found = True; $found = True;
/* Only show each once - seems this is a problem in some installs */ /* Only show each once - seems this is a problem in some installs */

View File

@ -96,7 +96,7 @@ else
{ {
$newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']);
list($action) = @each($_POST['action']); $action = @key($_POST['action']);
switch($action) switch($action)
{ {
case 'download': case 'download':
@ -331,7 +331,7 @@ function show_header_form($validation_errors)
} }
// set domain and password for the continue button // set domain and password for the continue button
@reset($GLOBALS['egw_domain']); @reset($GLOBALS['egw_domain']);
list($firstDomain) = @each($GLOBALS['egw_domain']); $firstDomain = @key($GLOBALS['egw_domain']);
$setup_tpl->set_var(array( $setup_tpl->set_var(array(
'FormDomain' => $firstDomain, 'FormDomain' => $firstDomain,

View File

@ -242,10 +242,13 @@
} }
$s = '<option value="">&nbsp;</option>'; $s = '<option value="">&nbsp;</option>';
while(is_array($test) && list(,$versionnumber) = each($test)) if(is_array($test))
{
foreach($test as $versionnumber)
{ {
$s .= '<option value="' . $versionnumber . '">' . $versionnumber . '</option>'; $s .= '<option value="' . $versionnumber . '">' . $versionnumber . '</option>';
} }
}
$GLOBALS['setup_tpl']->set_var('select_version',$s); $GLOBALS['setup_tpl']->set_var('select_version',$s);
if($value['name']) if($value['name'])

View File

@ -193,7 +193,7 @@ if($submit || $showall)
$tables = $setup_info[$appname]['tables']; $tables = $setup_info[$appname]['tables'];
$i = 0; $i = 0;
$tbls = count($tables); $tbls = count($tables);
while(list($key,$table) = @each($tables)) foreach($tables as $key => $table)
{ {
$i++; $i++;
if($i == $tbls) if($i == $tbls)
@ -241,7 +241,7 @@ else
} }
} }
while(list($key,$data) = @each($setup_info)) foreach($setup_info as $key => $data)
{ {
if($data['tables']) if($data['tables'])
{ {

View File

@ -98,7 +98,7 @@ class timesheet_favorite_portlet extends home_favorite_portlet
// the etemplate exec to fire again. // the etemplate exec to fire again.
if (is_array($content) && isset($content['nm']['rows']['document'])) // handle insert in default document button like an action 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']['action'] = 'document';
$content['nm']['selected'] = array($id); $content['nm']['selected'] = array($id);
} }

View File

@ -161,7 +161,7 @@ class timesheet_ui extends timesheet_bo
} }
if ($content['ts_duration'] > 0) unset($content['end_time']); if ($content['ts_duration'] > 0) unset($content['end_time']);
// now we only deal with start (date+time) and duration // now we only deal with start (date+time) and duration
list($button) = @each($content['button']); $button = @key($content['button']);
$view = $content['view']; $view = $content['view'];
$referer = $content['referer']; $referer = $content['referer'];
$content['ts_project_blur'] = $content['pm_id'] ? Link::title('projectmanager', $content['pm_id']) : ''; $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 ($_GET['msg']) $msg = $_GET['msg'];
if ($content['nm']['rows']['delete']) 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)) if ($this->delete($ts_id))
{ {
$msg = lang('Entry deleted'); $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 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']['action'] = 'document';
$content['nm']['selected'] = array($id); $content['nm']['selected'] = array($id);
} }
@ -1238,7 +1238,7 @@ class timesheet_ui extends timesheet_bo
if (is_array($content)) if (is_array($content))
{ {
list($button) = @each($content['button']); $button = @key($content['button']);
unset ($content['button']); unset ($content['button']);
switch($button) switch($button)
@ -1274,7 +1274,7 @@ class timesheet_ui extends timesheet_bo
} }
if (isset($content['statis']['delete'])) if (isset($content['statis']['delete']))
{ {
list($id) = each($content['statis']['delete']); $id = key($content['statis']['delete']);
if (isset($this->status_labels_config[$id])) if (isset($this->status_labels_config[$id]))
{ {
unset($this->status_labels_config[$id]); unset($this->status_labels_config[$id]);