aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/functions.php4
-rw-r--r--includes/sql.class.php26
-rw-r--r--modules/download/index.php61
3 files changed, 59 insertions, 32 deletions
diff --git a/includes/functions.php b/includes/functions.php
index 5d3dc7d..09fc456 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -621,9 +621,7 @@ function GetBlocks($position = BLOCK_LEFT)
$query = sprintf("SELECT block_id, active, weight, position, dir_name, title FROM bayonet_blocks WHERE active = 1 AND position = %d ORDER BY weight", (int)$position);
$result = $db->Query($query);
- /* Is the result valid? */
- if($db->Rows($result) < 1)
- return false;
+
$blocks = $db->Fetch($result);
if(empty($blocks)) return;
diff --git a/includes/sql.class.php b/includes/sql.class.php
index 6bda00f..c32de63 100644
--- a/includes/sql.class.php
+++ b/includes/sql.class.php
@@ -53,6 +53,14 @@ class Bayonet_SQL
return mysqli_select_db($GLOBALS['___mysqli_ston'], $db);
}
+ private function validResult($p_result)
+ {
+ if($this->Rows($p_result) > 0)
+ return true;
+ else
+ return false;
+ }
+
public function Query($str)
{
global $db_queries;
@@ -78,6 +86,12 @@ class Bayonet_SQL
$db_fetches++;
decho('Fetching result');
+ if(!$this->validResult($p_result))
+ {
+ decho('Result was not valid.');
+ return array();
+ }
+
while ($row = mysqli_fetch_array($p_result, MYSQLI_ASSOC))
{
$result[] = $row;
@@ -94,6 +108,12 @@ class Bayonet_SQL
decho("Fetching object result");
+ if(!$this->validResult($p_result))
+ {
+ decho('Result was not valid.');
+ return (object)array();
+ }
+
while ($row = mysqli_fetch_object($p_result, $class))
{
if($no_array == true)
@@ -121,6 +141,12 @@ class Bayonet_SQL
decho("Fetching single row");
+ if(!$this->validResult($p_result))
+ {
+ decho('Result was not valid.');
+ return array();
+ }
+
while ($row = mysqli_fetch_assoc($p_result)) {
$result = $row;
}
diff --git a/modules/download/index.php b/modules/download/index.php
index 0c0ed2e..b819e8d 100644
--- a/modules/download/index.php
+++ b/modules/download/index.php
@@ -92,40 +92,43 @@ $categoryList = getCategoryList();
echo "</div>\n</div>\n";
CloseContent();
+echo "<br/>"; //spacer between div tags
-OpenContent();
-echo "<div class=\"contentHeading\">" . getCategoryName($category) . "</div>\n";
-echo "<div class=\"content\">\n";
-
+if(isset($category))
+{
OpenContent();
- echo "<div class=\"contentHeading\">Files</div>\n";
- echo "<div class=\"content\">\n";
-
- if(empty($downloads))
- {
- echo "No downloads available.\n";
- return;
- }
-
- foreach($downloads as $file)
- {
- $download_full_path = $download_absolute_path . $file['filename'];
+ echo "<div class=\"contentHeading\">" . getCategoryName($category) . "</div>\n";
+ echo "<div class=\"content\">\n";
+
+ OpenContent();
+ echo "<div class=\"contentHeading\">Files</div>\n";
+ echo "<div class=\"content\">\n";
+
+ if(empty($downloads))
+ {
+ echo "No downloads available.\n";
+ return;
+ }
- if(!file_exists($download_full_path)) $broken = "(Broken link detected)";
- echo "<p>";
- echo LinkInternal($file['name'], $file['filename'], $download_relative_path) . " $broken<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>";
+ foreach($downloads as $file)
+ {
+ $download_full_path = $download_absolute_path . $file['filename'];
+
+ if(!file_exists($download_full_path)) $broken = "(Broken link detected)";
+ echo "<p>";
+ echo LinkInternal($file['name'], $file['filename'], $download_relative_path) . " $broken<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>";
+
+ }
+ //logQueueFlush(FORCE);
- }
- //logQueueFlush(FORCE);
-
+ echo "</div>\n</div>";
echo "</div>\n</div>";
- echo "</div>\n</div>";
-
+}
CloseContent();
CloseContent();
?>