aboutsummaryrefslogtreecommitdiffstats
path: root/inc/messages.inc
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-05-07 13:40:16 +0200
committerpiernov <piernov@piernov.org>2016-05-07 13:40:16 +0200
commit80f5826d1ac8f6d42866d5133c6f463943b96bab (patch)
tree1bfccff31d9be66bb9b791ed6dd942f638c32df9 /inc/messages.inc
parent79cfbb29042fd60dfbc76a6810f75cce21d3ffe0 (diff)
parentec7771705d62d09fcd142c87f4941604f31c1d76 (diff)
downloadcandybox-80f5826d1ac8f6d42866d5133c6f463943b96bab.tar.gz
candybox-80f5826d1ac8f6d42866d5133c6f463943b96bab.tar.bz2
candybox-80f5826d1ac8f6d42866d5133c6f463943b96bab.tar.xz
candybox-80f5826d1ac8f6d42866d5133c6f463943b96bab.zip
Merge branch 'feat/savegame' into alexichi
Diffstat (limited to 'inc/messages.inc')
-rw-r--r--inc/messages.inc14
1 files changed, 9 insertions, 5 deletions
diff --git a/inc/messages.inc b/inc/messages.inc
index 1f25ed3..da36c4e 100644
--- a/inc/messages.inc
+++ b/inc/messages.inc
@@ -12,20 +12,24 @@ $messages = array(
"gamesave_not_found" => "Couldn't find the specified save file.",
"gamesave_delete_fail" => "Couldn't delete the specified save file.",
"gamesave_delete_success" => "Game save successfully removed from server",
+
+ "upload_fail" => "Could not upload save file.",
+ "upload_success" => "Save file uploaded successfully: %s",
);
-function sendMessage($type, $msg) {
+function sendMessage($type, $msg, $fmt = null) {
global $messages;
$text = $messages[$msg];
+ if($fmt) $text = vsprintf($text, $fmt);
echo json_encode(array($type => $text));
}
-function sendError($msg) {
- sendMessage("error", $msg);
+function sendError($msg, $fmt = null) {
+ sendMessage("error", $msg, $fmt);
}
-function sendInfo($msg) {
- sendMessage("info", $msg);
+function sendInfo($msg, $fmt = null) {
+ sendMessage("info", $msg, $fmt);
}
?>