# HG changeset patch # User Dan # Date 1204854346 18000 # Node ID 51386f1852b87b8eab06924d4e3e04db547415b9 # Parent 3d751a6f2b05c2aeb7ec4e696c52e223ffad364e Fixed $db->die_json(), should now produce standards-compliant output. diff -r 3d751a6f2b05 -r 51386f1852b8 includes/dbal.php --- a/includes/dbal.php Wed Mar 05 23:10:26 2008 -0500 +++ b/includes/dbal.php Thu Mar 06 20:45:46 2008 -0500 @@ -100,11 +100,14 @@ exit; } - function die_json() + function die_json($loc = false) { $e = addslashes(htmlspecialchars(mysql_error())); $q = str_replace("\n", "\\n", addslashes($this->latest_query)); - $t = "{'mode':'error','error':'An error occurred during database query.\\nQuery was:\\n $q\\n\\nError returned by MySQL: $e'}"; + $loc = ( $loc ) ? addslashes("\n\nDescription or location of error: $loc") : ""; + $loc .= "\n\nPlease report the full text of this error to the administrator of the site. If you believe that this is a bug with the software, please contact support@enanocms.org."; + $loc = str_replace("\n", "\\n", $loc); + $t = "{\"mode\":\"error\",\"error\":\"An error occurred during database query.\\nQuery was:\\n $q\\n\\nError returned by MySQL: $e$loc\"}"; die($t); }