diff options
author | jhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6> | 2009-12-25 00:38:03 -0500 |
---|---|---|
committer | jhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6> | 2009-12-25 00:38:03 -0500 |
commit | 752d40ac119723885e7923fc37f2e6f0db086f21 (patch) | |
tree | 3b96530f6ae9b0222bccfe4127b8b6b043358168 /modules | |
parent | 44a18f3e13077138af782f96cffb39294bca6283 (diff) | |
download | bayonetcms-752d40ac119723885e7923fc37f2e6f0db086f21.tar.gz |
Debugging was incomplete. Apparently I forgot to double-check to make
certain that arrays and objects were being parsed out in the correct
fashion. That has been fixed, so decho will properly insert both types
into the message stack.
logQueueFlush can now be forced to operate if debugging is disabled globally
Example: logQueueFlush(FORCE);
The inital commit of the download module has been added. It works, but
the MySQL back-end needs to be beefed up with more file information.
git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@399 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'modules')
-rw-r--r-- | modules/download/index.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/modules/download/index.php b/modules/download/index.php new file mode 100644 index 0000000..1fa99e5 --- /dev/null +++ b/modules/download/index.php @@ -0,0 +1,65 @@ +<?php
+/**
+ * Bayonet Content Management System
+ * Copyright (C) 2008 Joseph Hunkeler & Evan O'Connell
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+if(!defined("MODULE_FILE"))
+{
+ die("Access denied...");
+}
+global $db;
+$download = NULL;
+$download_relative_path = "modules/" . basename(dirname(__FILE__)) . "/files/";
+$download_absolute_path = dirname(__FILE__) . "/files/";
+
+$result = $db->Query("SELECT uid, name, description, filename FROM bayonet_downloads");
+while(($row = $db->Fetch($result)) !== false)
+{
+ $download[] = $row;
+}
+
+OpenTable();
+echo "<div class=\"contentHeading\">Downloads</div>";
+echo "<div class=\"content\">";
+foreach($download as $file)
+{
+ $download_full_path = $download_absolute_path . $file['filename'];
+
+ if(file_exists($download_full_path))
+ {
+ echo "<p>";
+ echo LinkInternal($file['name'], $file['filename'], $download_relative_path) . "<br/>\n";
+ echo "<b>Filename:</b> {$file['filename']}<br/>\n";
+ printf("<b>Size:</b> %.2fKB<br/>\n", filesize($download_full_path) / 1024);
+ echo "<b>MD5 Hash:</b> " . md5_file($download_full_path) . "<br/>\n";
+ echo "<b>Description:</b> {$file['description']}<br/>\n";
+ echo "</p>";
+ }
+ else
+ {
+ decho("File $download_absolute_path{$file['filename']} does not exist! Not listing for download.");
+ }
+}
+decho($download);
+//logQueueFlush(FORCE);
+
+echo "</div>";
+
+CloseTable();
+
+
+?>
\ No newline at end of file |