aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-23 17:27:27 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-23 17:27:27 -0500
commitb46318283ca6016f07e3e419f778dd69081ad660 (patch)
treef2f19b2bf158ca4232a87989fde5d54707866f98
parentebda82d787b3620424c1dcf4336146ea06815a55 (diff)
downloadbayonetcms-b46318283ca6016f07e3e419f778dd69081ad660.tar.gz
More debugging related code has been added.
Modules and block now report when they have loaded. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@396 c5b2fb0a-d05d-0410-98c8-828840a80ff6
-rw-r--r--blocks/rss_agw/index.php12
-rw-r--r--includes/debug.php24
-rw-r--r--includes/functions.php8
-rw-r--r--modules.php6
4 files changed, 27 insertions, 23 deletions
diff --git a/blocks/rss_agw/index.php b/blocks/rss_agw/index.php
index 4438a98..1ecad83 100644
--- a/blocks/rss_agw/index.php
+++ b/blocks/rss_agw/index.php
@@ -9,7 +9,7 @@ function stripBBCode($text_to_search) {
include 'rssreader.php';
$rss = new rss_php;
- $cacheReadLength = 1024;
+ $cacheReadLength = 2048;
$cacheFile = dirname(__FILE__) . "/rss.cache";
$url = 'http://www.armedglobalwarfare.com/index.php?type=rss;action=.xml;limit=150';
@@ -23,29 +23,33 @@ function stripBBCode($text_to_search) {
decho("Reading internal RSS cache state");
$internal = fopen($cacheFile, "r");
$cacheRead = fread($internal, $cacheReadLength);
+ decho(strlen($cacheRead) . " bytes read");
fclose($internal);
decho("Reading inbound RSS cache data");
$inbound = fopen($url, "r");
$cacheTempRead = fread($inbound, $cacheReadLength);
+ decho(strlen($cacheTempRead) . " bytes downloaded");
fclose($inbound);
decho("Comparing RSS caches");
- if((strncmp($cacheTempRead, $cacheRead, $cacheReadLength)) == 0)
+ if((strncmp($cacheTempRead, $cacheRead, $cacheReadLength)) != 0)
{
+ decho("Downloading updated RSS feed");
$cacheTemp = implode('', file($url));
- decho("Length of cached RSS is " . strlen($cacheTemp));
+ decho("Length of updated RSS is " . strlen($cacheTemp));
decho("Writing cached RSS data to file");
$cachefp = fopen($cacheFile, "w+");
$cacheWritten = fwrite($cachefp, $cacheTemp, strlen($cacheTemp));
fclose($cachefp);
- decho("$cacheWritten bytes written to RSS cache.<br/>");
+ decho("$cacheWritten bytes written to RSS cache");
}
else
{
decho("RSS cache matches external source, using internal");
}
+ decho("Loading RSS cache into aggregator");
$rss->load($cacheFile);
$items = $rss->getItems(); #returns all rss items
diff --git a/includes/debug.php b/includes/debug.php
index 872f5db..516573d 100644
--- a/includes/debug.php
+++ b/includes/debug.php
@@ -25,26 +25,17 @@ define('REPEAT',true);
static $last_message = NULL;
static $last_message_count = 0;
-static $debug_ident = NULL;
static $log_message_last = NULL;
static $log_message_queue = array();
static $log_message_pos = 0;
-function debug_set_ident($str)
-{
- global $debug_ident;
- $debug_ident = $str;
-}
-
-function debug_clear_ident()
-{
- global $debug_ident;
- $debug_ident = "";
-}
-
function decho($message, $from = "GENERIC")
{
- global $debug_ident, $log_message_last, $log_message_queue, $log_message_pos, $config;
+ global $log_message_last, $log_message_queue, $log_message_pos, $config;
+
+ if($config['debug']['enabled'] == false ||
+ $config['debug']['show_messages'] == false) return;
+
date_default_timezone_set($config['logs']['timezone']);
$timestamp = date('H:i:s T');
$message = "[$timestamp]: $message";
@@ -55,6 +46,11 @@ function decho($message, $from = "GENERIC")
function queuePrint($obj)
{
+ global $config;
+
+ if($config['debug']['enabled'] == false ||
+ $config['debug']['show_messages'] == false) return;
+
if(is_array($obj))
{
$array_dump = print_r($obj,true);
diff --git a/includes/functions.php b/includes/functions.php
index 73c506c..4518fa8 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -77,9 +77,10 @@ function bbcode_format ($str)
return $str;
}
- //BBcode 2 HTML was written by WAY2WEB.net
-
- function BBCode($Text)
+/**
+ * BBcode 2 HTML was written by WAY2WEB.net
+ */
+function BBCode($Text)
{
// Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
@@ -574,6 +575,7 @@ function GetBlocks($position = BLOCK_LEFT)
OpenBlock($block['title']);
include $load;
CloseBlock();
+ decho("'{$block['dir_name']}' block loaded");
}
else
{
diff --git a/modules.php b/modules.php
index 9cd6350..c35a351 100644
--- a/modules.php
+++ b/modules.php
@@ -70,6 +70,7 @@ if(isset($load) && !empty($load) && !isset($file))
if(file_exists("modules/" . $load))
{
include 'modules/' . $load . '/index.php';
+ decho("'$load' module loaded");
}
else
{
@@ -86,8 +87,9 @@ elseif(isset($load) && isset($file))
$run = "modules/" . $load . "/" . $file;
if(file_exists($run))
- {
- include $run;
+ {
+ include $run;
+ decho("Loaded '$file' file from $load module");
}
else
{