From a2a40fa657d4263d62c2c04e6a26d002675af635 Mon Sep 17 00:00:00 2001
From: garvinhicking <garvinhicking>
Date: Wed, 14 Dec 2005 18:51:00 +0000
Subject: [PATCH] debugging helper

---
 include/functions_entries.inc.php | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php
index 06acfa6..d64fd89 100644
--- a/include/functions_entries.inc.php
+++ b/include/functions_entries.inc.php
@@ -162,15 +162,15 @@ function serendipity_fetchEntryCategories($entryid) {
  *
  * @access  public
  * @param   mixed       Restricts fetching entries to a specific timespan. Behaves differently depending on the type:
- *                      Numeric: 
- *                        YYYYMMDD - Shows all entries from YYYY-MM-DD. 
- *                                   If DD is "00", it will show all entries from that month. 
+ *                      Numeric:
+ *                        YYYYMMDD - Shows all entries from YYYY-MM-DD.
+ *                                   If DD is "00", it will show all entries from that month.
  *                                   If DD is any other number, it will show entries of that specific day.
  *                      2-Dimensional Array:
  *                        Key #0   - Specifies the start timestamp (unix seconds)
  *                        Key #1   - Specifies the end timestamp (unix seconds)
  *                      Other (null, 3-dimensional Array, ...):
- *                        Entries newer than $modified_since will be fetched 
+ *                        Entries newer than $modified_since will be fetched
  * @param   boolean     Indicates if the full entry will be fetched (body+extended: TRUE), or only the body (FALSE).
  * @param   string      Holds a "Y" or "X, Y" string that tells which entries to fetch. X is the first entry offset, Y is number of entries. If not set, the global fetchLimit will be applied (15 entries by default)
  * @param   boolean     Indicates whether drafts should be fetched (TRUE) or not
@@ -265,7 +265,7 @@ function serendipity_fetchEntries($range = null, $full = true, $limit = '', $fet
     } elseif (isset($serendipity['GET']['hide_category'])) {
         $cat_sql = serendipity_getMultiCategoriesSQL($serendipity['GET']['hide_category'], true);
     }
-    
+
     if (!empty($cat_sql)) {
         if (!empty($cond['and'])) {
             $cond['and'] .= " AND ($cat_sql)";
@@ -598,7 +598,11 @@ function serendipity_fetchCategories($authorid = null, $name = null, $order = nu
         $querystring .= "\n ORDER BY $order";
     }
 
-    return serendipity_db_query($querystring);
+    $ret = serendipity_db_query($querystring);
+    if (!is_array($ret)) {
+        echo "Query failed: $ret";
+    }
+    return $ret;
 }
 
 /**
@@ -851,7 +855,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
             } else {
                 $key = date('Ymd', serendipity_serverOffsetHour($entries[$x]['timestamp']));
             }
-    
+
             $dategroup[$key]['date']        = $entries[$x]['timestamp'];
             $dategroup[$key]['is_sticky']   = (isset($entries[$x]['is_sticky']) && serendipity_db_bool($entries[$x]['is_sticky']) ? true : false);
             $dategroup[$key]['entries'][]   = &$entries[$x];
@@ -867,17 +871,17 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
     foreach($dategroup as $properties) {
         foreach($properties['entries'] as $x => $_entry) {
             $entry = &$properties['entries'][$x]; // PHP4 Compat
-            
+
             if (!empty($entry['properties']['ep_cache_body'])) {
                 $entry['body']      = &$entry['properties']['ep_cache_body'];
                 $entry['is_cached'] = true;
             }
-    
+
             if (!empty($entry['properties']['ep_cache_extended'])) {
                 $entry['extended']  = &$entry['properties']['ep_cache_extended'];
                 $entry['is_cached'] = true;
             }
-            
+
             if ($preview) {
                 $entry['author']   = $entry['realname'];
                 $entry['authorid'] = $serendipity['authorid'];
-- 
2.39.5