Add default space in byte string format, only read enable ea data

read only enabled edit access data fields
add default space between the converted byte data and the label
This commit is contained in:
Clemens Schwaighofer
2016-08-02 14:38:23 +09:00
parent 20b134231e
commit 31bef7a531
2 changed files with 4 additions and 4 deletions

View File

@@ -1049,17 +1049,17 @@
}
// METHOD: ByteStringFormat
// PARAMS: int
// PARAMS: int bytes, boolean for space, default is set
// RETURN: string
// DESC: converts bytes into formated string with KB, MB, etc
public static function ByteStringFormat($number)
public static function ByteStringFormat($number, $space = true)
{
if (is_numeric($number) && $number > 0)
{
// labels in order of size
$labels = array('B', 'KB', 'MB', 'GB', 'TB');
// calc file size, round down too two digits, add label based max change
return round($number / pow(1024, ($i = floor(log($number, 1024)))), 2).''.$labels[$i];
return round($number / pow(1024, ($i = floor(log($number, 1024)))), 2).($space ? ' ' : '').$labels[$i];
}
return $number;
}

View File

@@ -405,7 +405,7 @@
while ($res = $this->db_return($q))
{
// read edit access data fields and drop them into the unit access array
$q_sub ="SELECT name, value FROM edit_access_data WHERE edit_access_id = ".$res['edit_access_id'];
$q_sub ="SELECT name, value FROM edit_access_data WHERE enabled = 1 edit_access_id = ".$res['edit_access_id'];
$ea_data = array ();
while ($res_sub = $this->db_return($q_sub))
{