foreach ($tmp as $Name => $Parameter) { $Pattern = '/(.+)(' . $Name . ')([\\W\\s]*)(.*)/'; $Replacement = "\$1'" . htmlentities($Parameter, ENT_COMPAT, 'UTF-8') . "'\$3\$4"; $Query = preg_replace($Pattern, $Replacement, $Query); } echo '<pre' . ($Odd === FALSE ? '' : ' class="Odd"') . '>', $Query, '; <small>', @number_format($QueryTimes[$Key], 6), 's</small></pre>'; $Odd = $Odd == TRUE ? FALSE : TRUE; } echo "</div>\n"; } } if (function_exists('CleanErrorArguments') && is_array($Arguments) && count($Arguments) > 0) { echo '<h3><strong>Variables in local scope:</strong></h3> <div class="PreContainer">'; $Odd = FALSE; CleanErrorArguments($Arguments); foreach ($Arguments as $Key => $Value) { // Don't echo the configuration array as it contains sensitive information if (!in_array($Key, array('Config', 'Configuration'))) { echo '<pre' . ($Odd === FALSE ? '' : ' class="Odd"') . '><strong>[' . $Key . ']</strong> '; echo htmlentities(var_export($Value, true), ENT_COMPAT, 'UTF-8'); echo "</pre>\r\n"; $Odd = $Odd == TRUE ? FALSE : TRUE; } } echo "</div>\n"; } ?> <h2>Need Help?</h2> <p>If you are a user of this website, you can report this message to a website administrator.</p>
function CleanErrorArguments(&$Var, $BlackList = array('configuration', 'config', 'database', 'password')) { if (is_array($Var)) { foreach ($Var as $Key => $Value) { if (in_array(strtolower($Key), $BlackList)) { $Var[$Key] = 'SECURITY'; } else { if (is_object($Value)) { $Value = Gdn_Format::ObjectAsArray($Value); $Var[$Key] = $Value; } if (is_array($Value)) { CleanErrorArguments($Var[$Key], $BlackList); } } } } }