aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-04-24 22:05:25 +0200
committerpiernov <piernov@piernov.org>2016-04-24 22:05:25 +0200
commit8a3610d9ac8349877b7a023a417288c2daee14ba (patch)
tree18c984dc08f4fce7753e7a33abe0de90147c5832 /inc
parent198eaff1fb3469e27318592c4b592e2f099f41a1 (diff)
downloadcandybox-8a3610d9ac8349877b7a023a417288c2daee14ba.tar.gz
candybox-8a3610d9ac8349877b7a023a417288c2daee14ba.tar.bz2
candybox-8a3610d9ac8349877b7a023a417288c2daee14ba.tar.xz
candybox-8a3610d9ac8349877b7a023a417288c2daee14ba.zip
Add sendError() PHP error message helper
Diffstat (limited to 'inc')
-rw-r--r--inc/messages.inc15
1 files changed, 15 insertions, 0 deletions
diff --git a/inc/messages.inc b/inc/messages.inc
new file mode 100644
index 0000000..f1ca8b3
--- /dev/null
+++ b/inc/messages.inc
@@ -0,0 +1,15 @@
+<?php
+
+$messages = array(
+ "shop_already_built" => "You have already built a shop.",
+ "gold_insufficient" => "You don't have enough gold.",
+ "shop_missing_item" => "This item does not exist.",
+);
+
+function sendError($msg) {
+ global $messages;
+ $text = $messages[$msg];
+ echo json_encode(array("error" => $text));
+}
+
+?>