cvs: phpweb /include layout.inc
| From: | Gabor Hojtsy | Date: | Tue, 14 May 2002 21:21:32 +0000 |
| Subject: | cvs: phpweb /include layout.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-10176@lists.php.net to get a copy of this message | ||
goba Tue May 14 17:21:32 2002 EDT
Modified files:
/phpweb/include layout.inc
Log:
Friendlier size printout
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.84 phpweb/include/layout.inc:1.85
--- phpweb/include/layout.inc:1.84 Tue May 14 17:15:55 2002
+++ phpweb/include/layout.inc Tue May 14 17:21:32 2002
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.84 2002/05/14 21:15:55 goba Exp $ */
+/* $Id: layout.inc,v 1.85 2002/05/14 21:21:32 goba Exp $ */
# spacer()
# print a IMG tag for a sized spacer GIF
@@ -153,7 +153,6 @@
#
function download_link($file, $title) {
- global $filesizes;
if ($tmp = strrchr($file, "/")) {
$local_file = substr($tmp, 1, strlen($tmp));
@@ -161,13 +160,18 @@
$local_file = "distributions/$file";
}
- $size = @filesize($local_file)/1024;
+ $size = @filesize($local_file);
//echo("<!-- file=$file localfile=$local_file size-$size -->\n");
- print_link("/do_download.php?download_file=$file", $title);
+ print_link("/do_download.php?download_file=$file", $title);
- if (!$size && isset($filesizes[$local_file])) { $size = $filesizes[$local_file]; }
- if ($size) { echo " [" . number_format($size, 0, ".", ",") .
"Kb]"; }
+ // Print out size in bytes (if size is less the 1Kb, or else in Kb)
+ if ($size) {
+ echo " [";
+ if ($size < 1024) { echo number_format($size, 0, ".", ",") .
"b"; }
+ else { echo number_format($size/1024, 0, ".", ",") . "Kb"; }
+ echo "]";
+ }
}
$enclosed = 0;