1<?php 2// Try to make this page non-cached 3header_nocache(); 4 5// No file to download 6if (!isset($df)) { 7 exit("No file requested for download"); 8} 9 10// Could be a normal download or a manual download file 11$possible_files = [$df, "manual/$df"]; 12 13$site_config = [ 14 'current' => 'downloads', 15 'css' => ['mirror.css'], 16]; 17 18// Find out what is the exact file requested 19$file = false; 20foreach ($possible_files as $name) { 21 if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $name)) { 22 $file = $name; 23 break; 24 } 25} 26 27// Print out common header 28site_header('Get Download', $site_config); 29 30echo '<div id="mirrors-container">'; 31$size = 0; 32// No downloadable file found 33if ($file === false) { 34 $info = "<p> 35 The file you requested (<strong>" . htmlspecialchars($df, ENT_QUOTES, "UTF-8") . "</strong>) is not found on 36 this server (<strong>{$MYSITE}</strong>).</p>"; 37 38 echo <<<EOT 39<h1>Download not found</h1> 40{$info} 41EOT; 42} else { 43 // Set local file name 44 $local_file = $_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $file; 45 // Try to get filesize to display 46 $size = @filesize($local_file); 47} 48?> 49</div> 50 51 52<?php site_footer(); 53