cvs: phpweb /include layout.inc
| From: | Gabor Hojtsy | Date: | Mon, 22 Jul 2002 19:27:46 +0000 |
| Subject: | cvs: phpweb /include layout.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-11448@lists.php.net to get a copy of this message | ||
goba Mon Jul 22 15:27:46 2002 EDT
Modified files:
/phpweb/include layout.inc
Log:
Adding support for mirror site specification for download links
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.91 phpweb/include/layout.inc:1.92
--- phpweb/include/layout.inc:1.91 Tue Jun 18 20:46:09 2002
+++ phpweb/include/layout.inc Mon Jul 22 15:27:46 2002
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.91 2002/06/19 00:46:09 cortesi Exp $ */
+/* $Id: layout.inc,v 1.92 2002/07/22 19:27:46 goba Exp $ */
# spacer()
# print a IMG tag for a sized spacer GIF
@@ -152,7 +152,7 @@
# print a link for a downloadable file (including filesize)
#
-function download_link($file, $title) {
+function download_link($file, $title, $mirror = '') {
if ($tmp = strrchr($file, "/")) {
$local_file = substr($tmp, 1, strlen($tmp));
@@ -162,9 +162,14 @@
$size = @filesize($local_file);
//echo("<!-- file=$file localfile=$local_file size-$size -->\n");
+
+ $download_link = "/do_download.php?download_file=$file";
+ if ($mirror != '') {
+ $download_link = "http://$mirror" .
$download_link;
+ }
- print_link("/do_download.php?download_file=$file", $title);
-# print_link("/distributions/$file", $title);
+ print_link($download_link, $title);
+# print_link("/distributions/$file", $title);
// Print out size in bytes (if size is less the 1Kb, or else in Kb)
if ($size) {