From 62e97732e8a060a7e1a0e6eb8b35a05c73ee92b3 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Fri, 17 Dec 2010 04:41:11 +1100 Subject: [PATCH] Fixed config page --- mod.php | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/mod.php b/mod.php index 7b52735f..87514aec 100644 --- a/mod.php +++ b/mod.php @@ -88,13 +88,42 @@ // Show instance-config.php - $data = highlight_file('inc/instance-config.php', true); - if(MOD_NEVER_REAL_PASSWORD) { - // Rough and dirty removal of password - $data = str_replace(MY_PASSWORD, '*******', $data); + //$data = highlight_file('inc/instance-config.php', true); + //if(MOD_NEVER_REAL_PASSWORD) { + // // Rough and dirty removal of password + // $data = str_replace(MY_PASSWORD, '*******', $data); + //} + + $constants = get_defined_constants(true); + $constants = $constants['user']; + + $data = ''; + foreach($constants as $name => $value) { + if(MOD_NEVER_REAL_PASSWORD && $name == 'MY_PASSWORD') + $value = '********'; + else { + // For some reason PHP is only giving me the first defined value (the default), so use constant() + $value = constant($name); + if(gettype($value) == 'boolean') { + $value = $value ? 'On' : 'Off'; + } elseif(gettype($value) == 'string') { + $value = '' . utf8tohtml($value) . ''; + } elseif(gettype($value) == 'integer') { + $value = '' . $value . ''; + } + } + + $data .= + '' . + $name . + '' . + substr($value, 0, 120) . + '' . + (strlen($value) > 120 ? '…' : '') . + ''; } - $body = '
Configuration' . $data . '
'; + $body = '
Configuration' . $data . '
'; echo Element('page.html', Array( 'index'=>ROOT,