Commit edaa7c5d authored by tbrehm's avatar tbrehm

- Fixed: FS#2502 - Problem in web traffic accounting for large integers

- Added intval function from interface functions library to server system library.
parent 2a031752
......@@ -478,7 +478,7 @@ if ($app->dbmaster == $app->db) {
//* get the traffic
$tmp = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) As total_traffic_bytes FROM web_traffic WHERE traffic_date like '$current_month%' AND hostname = '$domain'");
$web_traffic = (int)$tmp['total_traffic_bytes']/1024/1024;
$web_traffic = round($tmp['total_traffic_bytes']/1024/1024);
//* Website is over quota, we will disable it
/*if( ($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) ||
......
......@@ -1527,6 +1527,16 @@ class system{
unset($shadow_file_array);
}
}
function intval($string, $force_numeric = false) {
if(intval($string) == 2147483647) {
if($force_numeric == true) return floatval($string);
elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
else return 0;
} else {
return intval($string);
}
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment