intval -> (int), remove unnecessary switch statement

This commit is contained in:
Miles Lott 2003-12-14 16:50:34 +00:00
parent 0b48089323
commit e18438cdcc
2 changed files with 30 additions and 41 deletions

View File

@ -10,7 +10,7 @@
/* $Id$ */ /* $Id$ */
/** /*
* Database abstraction library * Database abstraction library
* *
* This allows eGroupWare to use multiple database backends via ADOdb * This allows eGroupWare to use multiple database backends via ADOdb
@ -210,7 +210,6 @@
*/ */
function disconnect() function disconnect()
{ {
} }
/** /**
@ -296,7 +295,7 @@
if (!$this->connect()) if (!$this->connect())
{ {
return 0; /* we already complained in connect() about that. */ return 0; /* we already complained in connect() about that. */
}; }
# New query, discard previous result. # New query, discard previous result.
if ($this->Query_ID) if ($this->Query_ID)
@ -313,7 +312,7 @@
} }
if ($num_rows > 0) if ($num_rows > 0)
{ {
$this->Query_ID = $this->Link_ID->SelectLimit($Query_String,$num_rows,intval($offset)); $this->Query_ID = $this->Link_ID->SelectLimit($Query_String,$num_rows,(int)$offset);
} }
else else
{ {
@ -709,7 +708,7 @@
/** /**
* Implodes an array of column-value pairs for the use in sql-querys. * Implodes an array of column-value pairs for the use in sql-querys.
* All data is either run through addslashes() or intval(). * All data is either run through addslashes() or (int).
* *
* @author RalfBecker<at>outdoor-training.de * @author RalfBecker<at>outdoor-training.de
* *
@ -720,7 +719,7 @@
* typicaly used to form a WHERE-clause from the primary keys * typicaly used to form a WHERE-clause from the primary keys
* @param array/boolean $column_definitions this can be set to the column-definitions-array * @param array/boolean $column_definitions this can be set to the column-definitions-array
* of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file). * of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file).
* If its set, the column-type-data determinates if intval() or addslashes is used. * If its set, the column-type-data determinates if (int) or addslashes is used.
*/ */
function column_data_implode($glue,$array,$use_key=True,$only=False,$column_definitions=False) function column_data_implode($glue,$array,$use_key=True,$only=False,$column_definitions=False)
{ {
@ -736,7 +735,7 @@
$column_type = is_array($column_definitions) ? @$colum_definitions[$key]['type'] : False; $column_type = is_array($column_definitions) ? @$colum_definitions[$key]['type'] : False;
$values[] = ($use_key ? $key.'=' : ''). $values[] = ($use_key ? $key.'=' : '').
($column_type == 'int' || $colum_type == 'auto' ? ($column_type == 'int' || $colum_type == 'auto' ?
intval($data) : "'".$this->db_addslashes($data)."'"); (int)$data : "'" . $this->db_addslashes($data) . "'");
} }
} }
return implode($glue,$values); return implode($glue,$values);
@ -749,7 +748,7 @@
* *
* @param array/boolean $column_definitions this can be set to the column-definitions-array * @param array/boolean $column_definitions this can be set to the column-definitions-array
* of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file). * of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file).
* If its set, the column-type-data determinates if intval() or addslashes is used. * If its set, the column-type-data determinates if (int) or addslashes is used.
*/ */
function set_column_definitions($column_definitions=False) function set_column_definitions($column_definitions=False)
{ {

View File

@ -56,9 +56,9 @@
} }
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) > 0) (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
{ {
$this->maxmatches = intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']); $this->maxmatches = (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
} }
else else
{ {
@ -96,21 +96,11 @@
*/ */
function set_icon($align,$img,$label) function set_icon($align,$img,$label)
{ {
switch(strtolower($GLOBALS['phpgw_info']['user']['account_lid']))
{
case 'ceb':
$border = 2;
break;
default:
$border = 0;
break;
}
$var = array( $var = array(
'align' => $align, 'align' => $align,
'img' => $GLOBALS['phpgw']->common->image('phpgwapi',$img), 'img' => $GLOBALS['phpgw']->common->image('phpgwapi',$img),
'label' => lang($label), 'label' => lang($label),
'border' => $border 'border' => 0
); );
$this->template->set_var($var); $this->template->set_var($var);
return $this->template->fp('out','link'); return $this->template->fp('out','link');
@ -159,7 +149,7 @@
{ {
// if(is_int($value)) // if(is_int($value))
// { // {
// $param = intval($value); // $param = (int)$value;
// } // }
// else // else
// { // {
@ -455,7 +445,7 @@
// Our only option is to remove it // Our only option is to remove it
if (ereg('"',$_query)) if (ereg('"',$_query))
{ {
$_query = ereg_replace('"','',$_query); $_query = str_replace('"','',$_query);
} }
$var = array $var = array
( (