Switch to foreach vs. reset/while

This commit is contained in:
Miles Lott 2004-01-02 06:04:35 +00:00
parent ff8d604036
commit cb1f65ec54

View File

@ -6,7 +6,7 @@
* Handles limiting number of rows displayed * * Handles limiting number of rows displayed *
* Copyright (C) 2000, 2001 Joseph Engo * * Copyright (C) 2000, 2001 Joseph Engo *
* Copyright (C) 2002, 2003 Joseph Engo, Bettina Gille * * Copyright (C) 2002, 2003 Joseph Engo, Bettina Gille *
* -------------------------------------------------------------------------* * ------------------------------------------------------------------------ *
* This library is part of the phpGroupWare API * * This library is part of the phpGroupWare API *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* ------------------------------------------------------------------------ * * ------------------------------------------------------------------------ *
@ -65,10 +65,7 @@
$this->maxmatches = 15; $this->maxmatches = 15;
} }
if(isset($GLOBALS['HTTP_GET_VARS']['menuaction'])) $this->action = $_GET['menuaction'] ? $_GET['menuaction'];
{
$this->action = $GLOBALS['HTTP_GET_VARS']['menuaction'];
}
} }
/*! /*!
@ -118,8 +115,7 @@
} }
elseif($extravars && is_array($extravars)) elseif($extravars && is_array($extravars))
{ {
@reset($extravars); foreach($extravars as $var => $value)
while(list($var,$value) = each($extravars))
{ {
if($var != 'menuaction') if($var != 'menuaction')
{ {
@ -143,7 +139,7 @@
function set_link($align,$img,$link,$alt,$extravars) function set_link($align,$img,$link,$alt,$extravars)
{ {
$hidden = ''; $hidden = '';
while(list($var,$value) = each($extravars)) foreach($extravars as $var => $value)
{ {
if((is_int($value) && $value == 0) || $value) if((is_int($value) && $value == 0) || $value)
{ {
@ -249,7 +245,7 @@
} }
elseif(is_array($extradata)) elseif(is_array($extradata))
{ {
while(list($var,$value) = each($extradata)) foreach($extradata as $var => $value)
{ {
if($var != 'menuaction') if($var != 'menuaction')
{ {
@ -269,8 +265,7 @@
{ {
if(is_array($extra)) if(is_array($extra))
{ {
@reset($extra); foreach($extra as $var => $value)
while(list($var,$value) = each($extra))
{ {
$t_extras[] = $var . '=' . $value; $t_extras[] = $var . '=' . $value;
} }
@ -441,9 +436,10 @@
$_query = stripslashes($GLOBALS['query']); $_query = stripslashes($GLOBALS['query']);
} }
// If the place a '"' in there search, it will mess everything up // If they place a '"' in their search, it will mess everything up
// Our only option is to remove it // Our only option is to remove it
if (ereg('"',$_query)) // if (ereg('"',$_query))
if(strstr($query,'"'))
{ {
$_query = str_replace('"','',$_query); $_query = str_replace('"','',$_query);
} }
@ -526,7 +522,7 @@
} }
else else
{ {
$filter = $GLOBALS['HTTP_POST_VARS']['filter'] ? $GLOBALS['HTTP_POST_VARS']['filter'] : $GLOBALS['HTTP_GET_VARS']['filter']; $filter = get_var('filter',array('POST','GET'));
} }
if (is_long($filter_obj)) if (is_long($filter_obj))