diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-05-21 15:22:10 +1000 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-05-21 15:22:10 +1000 |
| commit | 5c4ead4f6656ae3f62550557f98bd51208b7ece1 (patch) | |
| tree | e08183f06f6be0e85a47b4c1497b8b6605ebd5e2 /inc | |
| parent | bdb05b16d84115067acfce2e9e53c699521bc69c (diff) | |
"debug" thing
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/database.php | 10 | ||||
| -rw-r--r-- | inc/template.php | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/inc/database.php b/inc/database.php index 3dea39cb..792eae58 100644 --- a/inc/database.php +++ b/inc/database.php @@ -36,14 +36,20 @@ } function prepare($query) { - global $pdo; + global $pdo, $debug, $config; + if($config['debug']) { + $debug['sql'][] = $query; + } sql_open(); return $pdo->prepare($query); } function query($query) { - global $pdo; + global $pdo, $debug, $config; + if($config['debug']) { + $debug['sql'][] = $query; + } sql_open(); return $pdo->query($query); diff --git a/inc/template.php b/inc/template.php index e966a057..f9d59c2a 100644 --- a/inc/template.php +++ b/inc/template.php @@ -168,13 +168,17 @@ }
function Element($templateFile, array $options) {
- global $config;
+ global $config, $debug;
// Small little hack to add the PM system
- if(function_exists('create_pm_header') && (@$options['mod'] || @$options['__mod'])) {
+ if(function_exists('create_pm_header') && (isset($options['mod']) || isset($options['__mod']))) {
$options['pm'] = create_pm_header();
}
+ if(isset($options['body']) && $config['debug']) {
+ $options['body'] .= '<h3>Debug</h3><pre style="white-space: pre-wrap;font-size: 10px;">' . print_r($debug, true) . '</pre><hr/>';
+ }
+
// Read the template file
if($template = @file_get_contents("{$config['dir']['template']}/${templateFile}")) {
return templateParse($template, $options, null, $templateFile);
|
