forked from extern/egroupware
intval -> (int), replace gettype() and ereg_replace() where possible
This commit is contained in:
parent
8afddf6b17
commit
4f612cbbde
@ -61,10 +61,10 @@
|
||||
*/
|
||||
function acl($account_id = '')
|
||||
{
|
||||
$this->db = $GLOBALS['phpgw']->db;
|
||||
if (!($this->account_id = intval($account_id)))
|
||||
copyobj($GLOBALS['phpgw']->db,$this->db);
|
||||
if ((int)$this->account_id != (int)$account_id)
|
||||
{
|
||||
$this->account_id = get_account_id($account_id,@$GLOBALS['phpgw_info']['user']['account_id']);
|
||||
$this->account_id = get_account_id((int)$account_id,@$GLOBALS['phpgw_info']['user']['account_id']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@
|
||||
{
|
||||
reset($this->data);
|
||||
|
||||
$sql = 'delete from phpgw_acl where acl_account = '. intval($this->account_id);
|
||||
$sql = 'delete from phpgw_acl where acl_account = '. (int)$this->account_id;
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
|
||||
$count = count($this->data);
|
||||
@ -534,7 +534,7 @@
|
||||
}
|
||||
$sql = 'SELECT acl_appname, acl_rights from phpgw_acl ';
|
||||
$sql .= "where acl_location = '" . $this->db->db_addslashes($location) . "' ";
|
||||
$sql .= 'AND acl_account = ' . intval($account_id);
|
||||
$sql .= 'AND acl_account = ' . (int)$account_id;
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
$rights = 0;
|
||||
if ($this->db->num_rows() == 0 )
|
||||
@ -579,7 +579,7 @@
|
||||
}
|
||||
$sql = 'SELECT acl_location, acl_rights ';
|
||||
$sql .= "FROM phpgw_acl where acl_appname = '" . $this->db->db_addslashes($app) . "' ";
|
||||
$sql .= 'AND acl_account =' . intval($account_id);
|
||||
$sql .= 'AND acl_account =' . (int)$account_id;
|
||||
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
$rights = 0;
|
||||
@ -627,7 +627,7 @@
|
||||
$rights |= $this->db->f('acl_rights');
|
||||
if (!!($rights & $required) == True)
|
||||
{
|
||||
$accounts[] = intval($this->db->f('acl_account'));
|
||||
$accounts[] = (int)$this->db->f('acl_account');
|
||||
}
|
||||
}
|
||||
@reset($accounts);
|
||||
|
@ -118,7 +118,7 @@
|
||||
//
|
||||
if (!is_array($times))
|
||||
{
|
||||
$next = intval($times);
|
||||
$next = (int)$times;
|
||||
|
||||
return $next > $now ? $next : False;
|
||||
}
|
||||
@ -194,7 +194,7 @@
|
||||
|
||||
return False;
|
||||
}
|
||||
for ($i = intval($min); $i <= $max; ++$i)
|
||||
for ($i = (int)$min; $i <= $max; ++$i)
|
||||
{
|
||||
$times[$u][$i] = True;
|
||||
}
|
||||
@ -214,7 +214,7 @@
|
||||
}
|
||||
if (count($arr) == 1)
|
||||
{
|
||||
$times[$u][intval($one)] = True;
|
||||
$times[$u][(int)$one] = True;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -260,8 +260,8 @@
|
||||
|
||||
foreach($units as $u => $date_pattern)
|
||||
{
|
||||
$unit_now = $u != 'dow' ? intval(date($date_pattern)) :
|
||||
intval(date($date_pattern,mktime(12,0,0,$found['month'],$found['day'],$found['year'])));
|
||||
$unit_now = $u != 'dow' ? (int)date($date_pattern) :
|
||||
(int)date($date_pattern,mktime(12,0,0,$found['month'],$found['day'],$found['year']));
|
||||
|
||||
if (isset($found[$u]))
|
||||
{
|
||||
@ -509,8 +509,8 @@
|
||||
{
|
||||
$job['times'] = $this->db->db_addslashes(serialize($job['times']));
|
||||
$job['data'] = $this->db->db_addslashes(serialize($job['data']));
|
||||
$job['next'] = intval($job['next']);
|
||||
$job['account_id'] = intval($job['account_id']);
|
||||
$job['next'] = (int)$job['next'];
|
||||
$job['account_id'] = (int)$job['account_id'];
|
||||
|
||||
if ($exists || $this->read($job['id']))
|
||||
{
|
||||
|
@ -136,7 +136,7 @@
|
||||
.", '". $db->db_addslashes($err->msg) . "'"
|
||||
.", '". $db->db_addslashes((count($err->parms) > 1?implode('|',$err->parms):$err->parms[1])). "'"
|
||||
.", '". $err->fname . "'"
|
||||
.", " . intval($err->line)
|
||||
.", " . (int)$err->line
|
||||
.")"
|
||||
,__LINE__,__FILE__
|
||||
);
|
||||
|
@ -49,11 +49,11 @@
|
||||
|
||||
function delete($record_id)
|
||||
{
|
||||
$appname = intval($record_id) ? $this->appname : $record_id;
|
||||
$record_id = intval($record_id);
|
||||
$this->db->query('DELETE FROM phpgw_history_log WHERE'.
|
||||
($record_id ? " history_record_id='$record_id' AND" : '').
|
||||
" history_appname='$appname'",__LINE__,__FILE__);
|
||||
$appname = (int)$record_id ? $this->appname : $record_id;
|
||||
$record_id = (int)$record_id;
|
||||
$this->db->query('DELETE FROM phpgw_history_log WHERE'
|
||||
. ($record_id ? " history_record_id='$record_id' AND" : '')
|
||||
. " history_appname='$appname'",__LINE__,__FILE__);
|
||||
|
||||
return $this->db->affected_rows();
|
||||
}
|
||||
@ -64,7 +64,7 @@
|
||||
{
|
||||
$this->db->query("insert into phpgw_history_log (history_record_id,"
|
||||
. "history_appname,history_owner,history_status,history_new_value,history_old_value,history_timestamp) "
|
||||
. "values ('".intval($record_id)."','" . $this->appname . "','"
|
||||
. "values ('".(int)$record_id."','" . $this->appname . "','"
|
||||
. $GLOBALS['phpgw_info']['user']['account_id'] . "','$status','"
|
||||
. addslashes($new_value) . "','" . addslashes($old_value) . "','" . $this->db->to_timestamp(time())
|
||||
. "')",__LINE__,__FILE__);
|
||||
@ -105,7 +105,7 @@
|
||||
}
|
||||
|
||||
$this->db->query("select * from phpgw_history_log where history_appname='"
|
||||
. $this->appname . "' and history_record_id='".intval($record_id)."' $filter $only_show_filter "
|
||||
. $this->appname . "' and history_record_id='".(int)$record_id."' $filter $only_show_filter "
|
||||
. "$orderby",__LINE__,__FILE__);
|
||||
while ($this->db->next_record())
|
||||
{
|
||||
@ -114,7 +114,7 @@
|
||||
'record_id' => $this->db->f('history_record_id'),
|
||||
'owner' => $GLOBALS['phpgw']->accounts->id2name($this->db->f('history_owner')),
|
||||
// 'status' => lang($this->types[$this->db->f('history_status')]),
|
||||
'status' => ereg_replace(' ','',$this->db->f('history_status')),
|
||||
'status' => str_replace(' ','',$this->db->f('history_status')),
|
||||
'new_value' => $this->db->f('history_new_value'),
|
||||
'old_value' => $this->db->f('history_old_value'),
|
||||
'datetime' => $this->db->from_timestamp($this->db->f('history_timestamp'))
|
||||
@ -185,5 +185,4 @@
|
||||
}
|
||||
return $this->template->fp('out','list');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ class html
|
||||
var $prefered_img_title;
|
||||
|
||||
function html()
|
||||
{ // should be Ok for all HTML 4 compatible browsers
|
||||
{
|
||||
// should be Ok for all HTML 4 compatible browsers
|
||||
if (!eregi('compatible; ([a-z_]+)[/ ]+([0-9.]+)',$_SERVER['HTTP_USER_AGENT'],$parts))
|
||||
{
|
||||
eregi('^([a-z_]+)/([0-9.]+)',$_SERVER['HTTP_USER_AGENT'],$parts);
|
||||
@ -55,9 +56,9 @@ class html
|
||||
{
|
||||
$arr = array('no','yes');
|
||||
}
|
||||
if (intval($multiple) > 0)
|
||||
if ((int)$multiple > 0)
|
||||
{
|
||||
$options .= ' MULTIPLE SIZE="'.intval($multiple).'"';
|
||||
$options .= ' MULTIPLE SIZE="'.(int)$multiple.'"';
|
||||
if (substr($name,-2) != '[]')
|
||||
{
|
||||
$name .= '[]';
|
||||
|
@ -261,7 +261,7 @@
|
||||
if(IsSet($arguments['PostValues']))
|
||||
{
|
||||
$values = $arguments['PostValues'];
|
||||
if(GetType($values) != 'array')
|
||||
if(!@is_array($values))
|
||||
{
|
||||
return('5 it was not specified a valid POST method values array');
|
||||
}
|
||||
@ -294,7 +294,7 @@
|
||||
{
|
||||
$header_name = Key($headers);
|
||||
$header_value = $headers[$header_name];
|
||||
if(GetType($header_value)=='array')
|
||||
if(@is_array($header_value))
|
||||
{
|
||||
for(Reset($header_value),$value=0;$value<count($header_value);Next($header_value),$value++)
|
||||
{
|
||||
@ -402,7 +402,7 @@
|
||||
for(;;)
|
||||
{
|
||||
$line = $this->GetLine();
|
||||
if(GetType($line) != 'string')
|
||||
if(!is_string($line))
|
||||
{
|
||||
return('4 could not read request reply');
|
||||
}
|
||||
@ -415,7 +415,7 @@
|
||||
$header_value = Trim(Chop(strtok("\r\n")));
|
||||
if(IsSet($headers[$header_name]))
|
||||
{
|
||||
if(GetType($headers[$header_name]) == 'string')
|
||||
if(is_string($headers[$header_name]))
|
||||
{
|
||||
$headers[$header_name] = array($headers[$header_name]);
|
||||
}
|
||||
@ -428,7 +428,7 @@
|
||||
switch($header_name)
|
||||
{
|
||||
case 'content-length':
|
||||
$this->content_length = intval($headers[$header_name]);
|
||||
$this->content_length = (int)$headers[$header_name];
|
||||
$this->content_length_set = 1;
|
||||
break;
|
||||
case 'set-cookie':
|
||||
@ -461,7 +461,7 @@
|
||||
case 'expires':
|
||||
if(ereg("^((Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday|Sun|Sunday), )?([0-9]{2})\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-([0-9]{2,4}) ([0-9]{2})\\:([0-9]{2})\\:([0-9]{2}) GMT$",$value,$matches))
|
||||
{
|
||||
$year = intval($matches[5]);
|
||||
$year = (int)$matches[5];
|
||||
if($year<1900)
|
||||
{
|
||||
$year += ($year<70 ? 2000 : 1900);
|
||||
|
@ -59,9 +59,9 @@ class jscalendar
|
||||
|
||||
if ($date && (is_int($date) || is_numeric($date)))
|
||||
{
|
||||
$year = intval($GLOBALS['phpgw']->common->show_date($date,'Y'));
|
||||
$month = intval($GLOBALS['phpgw']->common->show_date($date,'n'));
|
||||
$day = intval($GLOBALS['phpgw']->common->show_date($date,'d'));
|
||||
$year = (int)$GLOBALS['phpgw']->common->show_date($date,'Y');
|
||||
$month = (int)$GLOBALS['phpgw']->common->show_date($date,'n');
|
||||
$day = (int)$GLOBALS['phpgw']->common->show_date($date,'d');
|
||||
}
|
||||
if ($year && $month && $day)
|
||||
{
|
||||
@ -128,7 +128,7 @@ class jscalendar
|
||||
}
|
||||
$field = 'm';
|
||||
}
|
||||
$date[$field] = intval($fields[$n]);
|
||||
$date[$field] = (int)$fields[$n];
|
||||
}
|
||||
$ret = array(
|
||||
$year => $date['Y'],
|
||||
|
@ -423,7 +423,7 @@
|
||||
{
|
||||
//echo "<br>adding - insert into phpgw_lang values ('$message_id','$app_name','$lang','$content')";
|
||||
$result = $this->db->query("INSERT INTO phpgw_lang (message_id,app_name,lang,content) VALUES('$message_id','$app_name','$lang','$content')",__LINE__,__FILE__);
|
||||
if (intval($result) <= 0)
|
||||
if ((int)$result <= 0)
|
||||
{
|
||||
echo "<br>Error inserting record: phpgw_lang values ('$message_id','$app_name','$lang','$content')";
|
||||
}
|
||||
@ -464,7 +464,7 @@
|
||||
if (file_exists($fname))
|
||||
{
|
||||
$ctime = filectime($fname);
|
||||
$ltime = intval($GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app]);
|
||||
$ltime = (int)$GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app];
|
||||
//echo "checking lang='$lang', app='$app', ctime='$ctime', ltime='$ltime'<br>\n";
|
||||
|
||||
if ($ctime != $ltime)
|
||||
|
Loading…
Reference in New Issue
Block a user