replaced all while-list-each with foreach, as requested in patch [ 1015863 ] Admin does not save ACL rights and Site Configuration

This commit is contained in:
Ralf Becker 2004-08-25 11:21:23 +00:00
parent d5b8419f8d
commit 45c0f356ef
2 changed files with 45 additions and 42 deletions

View File

@ -54,7 +54,9 @@
$this->template->set_block('app_list','link_row');
$this->template->set_block('app_list','spacer_row');
while (is_array($GLOBALS['acl_manager']) && list($app,$locations) = each($GLOBALS['acl_manager']))
if (is_array($GLOBALS['acl_manager']))
{
foreach($GLOBALS['acl_manager'] as $app => $locations)
{
$icon = $GLOBALS['phpgw']->common->image($app,array('navbar.gif',$app.'.gif'));
$this->template->set_var('icon_backcolor',$GLOBALS['phpgw_info']['theme']['row_off']);
@ -72,11 +74,13 @@
$this->template->fp('rows','app_row_noicon',True);
}
while (is_array($locations) && list($loc,$value) = each($locations))
if (is_array($locations))
{
foreach($locations as $loc => $value)
{
$link_values = array(
'menuaction' => 'admin.uiaclmanager.access_form',
'location' => urlencode($loc),
'location' => $loc,
'acl_app' => $app,
'account_id' => $this->account_id
);
@ -85,9 +89,11 @@
$this->template->set_var('lang_location',lang($value['name']));
$this->template->fp('rows','link_row',True);
}
}
$this->template->parse('rows','spacer_row',True);
}
}
$this->template->set_var(array(
'cancel_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'),
'lang_cancel' => lang('Cancel')
@ -104,10 +110,13 @@
if ($_POST['submit'])
{
$total_rights = 0;
while (is_array($_POST['acl_rights']) && list(,$rights) = each($_POST['acl_rights']))
if (is_array($_POST['acl_rights']))
{
foreach($_POST['acl_rights'] as $rights)
{
$total_rights += $rights;
}
}
if ($total_rights)
{
$GLOBALS['phpgw']->acl->add_repository($_GET['acl_app'], $location, $this->account_id, $total_rights);
@ -145,7 +154,7 @@
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php',$link_values));
$total = 0;
while (list($name,$value) = each($acl_manager['rights']))
foreach($acl_manager['rights'] as $name => $value)
{
$cb .= '<input type="checkbox" name="acl_rights[]" value="'.$value.'"'.($grants & $value ? ' checked' : '').'>&nbsp;'.lang($name)."<br>\n";
}

View File

@ -162,17 +162,11 @@
$GLOBALS['phpgw']->hooks->single('config',$appname);
while (list($null,$value) = each($vars))
foreach($vars as $value)
{
$valarray = explode('_',$value);
$type = $valarray[0];
$new = $newval = '';
while($chunk = next($valarray))
{
$new[] = $chunk;
}
$newval = implode(' ',$new);
$type = array_shift($valarray);
$newval = implode(' ',$valarray);
switch ($type)
{