summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-09-15 14:03:27 +1000
committerMichael Foster <savetheinternet@tinyboard.org>2013-09-15 14:03:27 +1000
commit00833eeafd6e0f71390504ac10ddf86bbaceb39f (patch)
tree2ca84516f2b7d44efe88b9aa2e609bef0dd32fd7 /inc
parentfd5300a49e67f9401b821404a146b338bc21dd8a (diff)
js/ajax.js: post with ajax
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php1
-rw-r--r--inc/display.php8
2 files changed, 9 insertions, 0 deletions
diff --git a/inc/config.php b/inc/config.php
index e1929766..e6856341 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -272,6 +272,7 @@
'quick-reply',
'page',
'file_url',
+ 'json_response',
);
// Enable reCaptcha to make spam even harder. Rarely necessary.
diff --git a/inc/display.php b/inc/display.php
index e2646c60..7cd69134 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -74,6 +74,14 @@ function error($message, $priority = true, $debug_stuff = false) {
$debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error);
}
+ // Is there a reason to disable this?
+ if (isset($_POST['json_response'])) {
+ header('Content-Type: text/json; charset=utf-8');
+ die(json_encode(array(
+ 'error' => $message
+ )));
+ }
+
die(Element('page.html', array(
'config' => $config,
'title' => _('Error'),