Fixed $db->die_json(), should now produce standards-compliant output.
authorDan
Thu, 06 Mar 2008 20:45:46 -0500
changeset 475 51386f1852b8
parent 474 3d751a6f2b05
child 476 f26a69c40431
Fixed $db->die_json(), should now produce standards-compliant output.
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);
   }