includes/dbal.php
changeset 475 51386f1852b8
parent 468 194a19711346
child 483 2cb1c8a6d3db
equal deleted inserted replaced
474:3d751a6f2b05 475:51386f1852b8
    98     if(defined('ENANO_CONFIG_FETCHED')) die_semicritical('Database error', $internal_text);
    98     if(defined('ENANO_CONFIG_FETCHED')) die_semicritical('Database error', $internal_text);
    99     else                                   grinding_halt('Database error', $internal_text);
    99     else                                   grinding_halt('Database error', $internal_text);
   100     exit;
   100     exit;
   101   }
   101   }
   102   
   102   
   103   function die_json()
   103   function die_json($loc = false)
   104   {
   104   {
   105     $e = addslashes(htmlspecialchars(mysql_error()));
   105     $e = addslashes(htmlspecialchars(mysql_error()));
   106     $q = str_replace("\n", "\\n", addslashes($this->latest_query));
   106     $q = str_replace("\n", "\\n", addslashes($this->latest_query));
   107     $t = "{'mode':'error','error':'An error occurred during database query.\\nQuery was:\\n  $q\\n\\nError returned by MySQL: $e'}";
   107     $loc = ( $loc ) ? addslashes("\n\nDescription or location of error: $loc") : "";
       
   108     $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.";
       
   109     $loc = str_replace("\n", "\\n", $loc);
       
   110     $t = "{\"mode\":\"error\",\"error\":\"An error occurred during database query.\\nQuery was:\\n  $q\\n\\nError returned by MySQL: $e$loc\"}";
   108     die($t);
   111     die($t);
   109   }
   112   }
   110   
   113   
   111   function get_error($t = '') {
   114   function get_error($t = '') {
   112     header('HTTP/1.1 500 Internal Server Error');
   115     header('HTTP/1.1 500 Internal Server Error');