cvs: phpweb /include do-download.inc

From: Date: Sun, 07 Sep 2003 08:28:42 +0000
Subject: cvs: phpweb /include do-download.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-20873@lists.php.net to get a copy of this message
goba Sun Sep 7 04:28:42 2003 EDT Modified files: /phpweb/include do-download.inc Log: Include filename and server name in the error message, so we would know this instantly in case one copy-paster submits this as an error report to us. Index: phpweb/include/do-download.inc diff -u phpweb/include/do-download.inc:1.4 phpweb/include/do-download.inc:1.5 --- phpweb/include/do-download.inc:1.4 Sun Sep 7 04:15:25 2003 +++ phpweb/include/do-download.inc Sun Sep 7 04:28:42 2003 @@ -1,6 +1,6 @@ <?php -// $Id: do-download.inc,v 1.4 2003/09/07 08:15:25 goba Exp $ +// $Id: do-download.inc,v 1.5 2003/09/07 08:28:42 goba Exp $ /* This code redirects the user to the exact file to @@ -11,20 +11,22 @@ // Download a file from a mirror site function download_file($mirror, $file) { + global $MYSITE; + // Could be a normal download or a manual download file $possible_files = array($file => TRUE, "manual/$file" => FALSE); // Find out what is the exact file requested - $file = FALSE; + $found = FALSE; foreach ($possible_files as $name => $log) { if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $name)) { - $file = $name; + $found = $name; break; } } // No downloadable file found - if ($file === FALSE) { + if ($found === FALSE) { site_header("Download not found"); // If user comes from a mirror selection page, provide a backlink @@ -35,7 +37,8 @@ echo <<<EOT <h1>Download not found</h1> <p> - The file you requested is not found on this server. If this file is a + The file you requested (<strong>{$file}</strong>) is not found on + this server (<strong>{$MYSITE}</strong>). If this file is a recent addition to our downloads, then it is possible that this particular server is not yet updated to host that file for download. Please come back to this server later{$moreinfo}. @@ -47,7 +50,7 @@ // Redirect to the particular file if (!headers_sent()) { - header('Location: ' . $mirror . 'distributions/' . $file); + header('Location: ' . $mirror . 'distributions/' . $found); } else { exit("Unable to serve you the requested file for download"); } @@ -60,7 +63,7 @@ // Log download on master server (may be a registered // shutdown function to really run after the file is // started to download) - if ($log) { download_log($mirror, $file); } + if ($log) { download_log($mirror, $found); } } // Log downloads on the master server

« previous php.mirrors (#20873) next »