Source for file download.php
Documentation is available at download.php
* UARS Day file download interface.
* This file displays a list of links to download a series of archive files
* for a set of search results..
* This file is part of HRDIODB.
* HRDIODB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* HRDIODB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with HRDIODB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** Configuration file */
require_once("conf.php");
/** Debugging functions */
require_once("debugging.php");
/** HRDI database class */
require_once("hrdi_db_class.php");
require_once("session_class.php");
require_once("user_class.php");
require_once("common_class.php");
// Create class instances
$user = new user($hdb, $session);
// Check to make sure we're authenticated
if (!$user->authenticated()) {
$session->set_var("page", $_SERVER['REQUEST_URI']);
// Redirect to login page
require_once("header.php");
// These session variables are set in {@link search.php}
$days = $session->get_var("days");
$types = $session->get_var("types");
// Initialize size variable
/* Figure out the size of the archive for one day by summing up the average
sizes of all the file types that were requested. */
foreach ($types as $type) {
$s = $hdb->get_one("SELECT AverageSize
error("Average file size for file type id $type is 0");
require_once("footer.php");
// Make sure we're within allowed maximum archive size
if ($size > $max_archive_size) {
error("An archive of files for a sigle day is larger than the maximum allowed archive size");
require_once("footer.php");
// Number of days per archive file
$days_per_file = floor($max_archive_size / $size);
print "<center><br/><br/><table class=\"hrdi\"><tr><td class=\"c_label\" colspan=\"2\">File Download</td></tr>";
// Display the download links
for ($i = 0; $i < count($days); $i++ ) {
$days_in_file[] = $days[$i];
if (($current == $days_per_file) ||
($i == count($days) - 1)) {
print "<tr><td class=\"data\">";
if (count($days_in_file) > 1) {
print implode(', ', $days_in_file);
print "</td><td class=\"data\" nowrap>
<a href=\"file.php?dpf=$days_per_file&n=$number\">→ Download Set "
print "</table></center>";
require_once("footer.php");
|