diff --git a/ChangeLog b/ChangeLog index adfa7b125..157021294 100755 --- a/ChangeLog +++ b/ChangeLog @@ -23,7 +23,7 @@ $Source$ commited some cosmetic changes. * lib.inc.php3, lines 706 & 946-950; db_details.php3, lines 96 & 118; language files: thousands and decimal separators are now language - dependant. + dependant, size units also. * tbl_dump.php3, lines 78: Added a '#' before 'No tables found' so the generated dump file may be imported later even if there is no table. * db_printview.php3, line 29: Cosmetic change in column case name. diff --git a/lang/brazilian_portuguese.inc.php3 b/lang/brazilian_portuguese.inc.php3 index 12fccbb09..20c6e6cf7 100644 --- a/lang/brazilian_portuguese.inc.php3 +++ b/lang/brazilian_portuguese.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Acesso Negado"; $strAction = "Ações"; diff --git a/lang/bulgarian-win1251.inc.php3 b/lang/bulgarian-win1251.inc.php3 index 583c81af3..ea46ff958 100644 --- a/lang/bulgarian-win1251.inc.php3 +++ b/lang/bulgarian-win1251.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Îòêàçàí äîñòúï"; $strAction = "Äåéñòâèå"; diff --git a/lang/catala.inc.php3 b/lang/catala.inc.php3 index ae5c800b1..a974ea70c 100644 --- a/lang/catala.inc.php3 +++ b/lang/catala.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Access denegat"; $strAction = "Acció"; diff --git a/lang/chinese_big5.inc.php3 b/lang/chinese_big5.inc.php3 index 41dd430a6..df9fd549b 100644 --- a/lang/chinese_big5.inc.php3 +++ b/lang/chinese_big5.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "³X°Ý³Q©Úµ´"; $strAction = "°õ¦æ¾Þ§@"; diff --git a/lang/chinese_gb.inc.php3 b/lang/chinese_gb.inc.php3 index daa66198c..e508c2f12 100644 --- a/lang/chinese_gb.inc.php3 +++ b/lang/chinese_gb.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "·ÃÎʱ»¾Ü¾ø"; $strAction = "Ö´ÐвÙ×÷"; diff --git a/lang/czech-iso.inc.php3 b/lang/czech-iso.inc.php3 index 20737ba19..2665a949a 100644 --- a/lang/czech-iso.inc.php3 +++ b/lang/czech-iso.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Pøístup odepøen"; $strAction = "Akce"; diff --git a/lang/czech-win1250.inc.php3 b/lang/czech-win1250.inc.php3 index b22d42bb4..fb38612e9 100644 --- a/lang/czech-win1250.inc.php3 +++ b/lang/czech-win1250.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Pøístup odepøen"; $strAction = "Akce"; diff --git a/lang/danish.inc.php3 b/lang/danish.inc.php3 index bba03def4..f33ff95eb 100644 --- a/lang/danish.inc.php3 +++ b/lang/danish.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Adgang Nægtet"; $strAction = "Handling"; diff --git a/lang/dutch.inc.php3 b/lang/dutch.inc.php3 index 7dd3fae54..ac2d208c6 100644 --- a/lang/dutch.inc.php3 +++ b/lang/dutch.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Toegang geweigerd "; $strAction = "Aktie"; diff --git a/lang/english.inc.php3 b/lang/english.inc.php3 index e33f3f3e8..15142aade 100644 --- a/lang/english.inc.php3 +++ b/lang/english.inc.php3 @@ -6,6 +6,8 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); + $strAccessDenied = "Access denied"; $strAction = "Action"; diff --git a/lang/french.inc.php3 b/lang/french.inc.php3 index c98031627..d19c400af 100644 --- a/lang/french.inc.php3 +++ b/lang/french.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = " "; $number_decimal_separator = ","; +$byteUnits = array("Octets", "Ko", "Mo", "Go"); $strAccessDenied = "Accès refusé"; $strAction = "Action"; diff --git a/lang/german.inc.php3 b/lang/german.inc.php3 index 5f8453b78..58a31e66e 100644 --- a/lang/german.inc.php3 +++ b/lang/german.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Zugriff verweigert."; $strAction = "Aktion"; diff --git a/lang/italian.inc.php3 b/lang/italian.inc.php3 index f198637a2..4503e485d 100644 --- a/lang/italian.inc.php3 +++ b/lang/italian.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Accesso negato"; $strAction = "Azione"; diff --git a/lang/japanese.inc.php3 b/lang/japanese.inc.php3 index 50968fb6e..034b85a1a 100644 --- a/lang/japanese.inc.php3 +++ b/lang/japanese.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "¥¢¥¯¥»¥¹¤ÏµñÈݤµ¤ì¤Þ¤·¤¿¡£"; $strAction = "¼Â¹Ô"; diff --git a/lang/korean.inc.php3 b/lang/korean.inc.php3 index 53064457d..d9e7d599d 100644 --- a/lang/korean.inc.php3 +++ b/lang/korean.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Á¢±ÙÀÌ °ÅºÎµÇ¾ú½À´Ï´Ù."; $strAction = "½ÇÇà"; diff --git a/lang/norwegian.inc.php3 b/lang/norwegian.inc.php3 index 02855e704..0854a731f 100644 --- a/lang/norwegian.inc.php3 +++ b/lang/norwegian.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Ingen tilgang"; $strAction = "Handling"; diff --git a/lang/polish.inc.php3 b/lang/polish.inc.php3 index 7d587361d..4baebac5d 100644 --- a/lang/polish.inc.php3 +++ b/lang/polish.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Brak dostêpu"; $strAction = "Dzia³anie"; diff --git a/lang/portuguese.inc.php3 b/lang/portuguese.inc.php3 index 8f70db61d..2ad044f9b 100644 --- a/lang/portuguese.inc.php3 +++ b/lang/portuguese.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Acesso Negado"; $strAction = "Ações"; diff --git a/lang/russian-koi8.inc.php3 b/lang/russian-koi8.inc.php3 index 78ced845c..b50efe2e3 100644 --- a/lang/russian-koi8.inc.php3 +++ b/lang/russian-koi8.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "÷ ÄÏÓÔÕÐÅ ÏÔËÁÚÁÎÏ"; $strAction = "äÅÊÓÔ×ÉÅ"; diff --git a/lang/russian-win1251.inc.php3 b/lang/russian-win1251.inc.php3 index 2be856041..c472218bb 100644 --- a/lang/russian-win1251.inc.php3 +++ b/lang/russian-win1251.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = " äîñòóïå îòêàçàíî"; $strAction = "Äåéñòâèå"; diff --git a/lang/spanish.inc.php3 b/lang/spanish.inc.php3 index 1416fd5ab..d269ff549 100644 --- a/lang/spanish.inc.php3 +++ b/lang/spanish.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Acceso denegado "; $strAction = "Acción"; diff --git a/lang/swedish.inc.php3 b/lang/swedish.inc.php3 index 5a27f65ea..327e357cf 100644 --- a/lang/swedish.inc.php3 +++ b/lang/swedish.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "verdana, helvetica, arial, geneva, sans-serif"; $right_font_family = "helvetica, arial, geneva, sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "Åtkommst nekad"; $strAction = "Handling"; diff --git a/lang/thai.inc.php3 b/lang/thai.inc.php3 index f4e1a3eed..cbac36ea7 100644 --- a/lang/thai.inc.php3 +++ b/lang/thai.inc.php3 @@ -6,6 +6,7 @@ $left_font_family = "sans-serif"; $right_font_family = "sans-serif"; $number_thousands_separator = ","; $number_decimal_separator = "."; +$byteUnits = array("Bytes", "KB", "MB", "GB"); $strAccessDenied = "äÁè͹حҵãËéãªé§Ò¹";#Access denied"; $strAction = "¡ÃзӡÒÃ"; diff --git a/lib.inc.php3 b/lib.inc.php3 index 3de881ef5..be9e49ac5 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -922,33 +922,44 @@ function delete_bookmarks($db, $cfgBookmark, $id) { $cfgBookmark=get_bookmarks_param(); -// formats $value to byte view - staybyte - 15. June 2001 -// $comma <= how many comma -// $limes <= sensitiveness -function format_byte_down($value,$limes=6,$comma=0){ - $dh=pow(10,$comma); - $li=pow(10,$limes); - $returnvalue=$value; - $unit="Byte"; - if ($value >= $li*1000000){ - $value=round($value/(1073741824/$dh))/$dh; - $unit="GB"; +/** + * Formats $value to byte view + * + * @param double the value to format + * @param integer the sensitiveness + * @param integer the number of decimals to retain + * + * @return array the formatted value and its unit + * + * @author staybyte + * @version 1.1 - 07 July 2001 + */ +function format_byte_down($value, $limes = 6, $comma = 0) +{ + $dh = pow(10, $comma); + $li = pow(10, $limes); + $return_value = $value; + $unit = $GLOBALS['byteUnits'][0]; + if ($value >= $li*1000000) { + $value = round($value/(1073741824/$dh))/$dh; + $unit = $GLOBALS['byteUnits'][3]; } - else if ($value >= $li*1000){ - $value=round($value/(1048576/$dh))/$dh; - $unit="MB"; + else if ($value >= $li*1000) { + $value = round($value/(1048576/$dh))/$dh; + $unit = $GLOBALS['byteUnits'][2]; } - else if ($value >= $li){ - $value=round($value/(1024/$dh))/$dh; - $unit="KB"; + else if ($value >= $li) { + $value = round($value/(1024/$dh))/$dh; + $unit = $GLOBALS['byteUnits'][1]; } - if ($unit!="Byte") { + if ($unit != 'Byte') { $return_value = number_format($value, $comma, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator']); } else { $return_value = number_format($value, 0, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator']); } return array($return_value, $unit); -} +} // end of the 'format_byte_down' function + // to support special characters in db names: Lem9, 2001-06-27