summaryrefslogtreecommitdiff
path: root/npc/functions/util.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r--npc/functions/util.txt16
1 files changed, 8 insertions, 8 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index a46f9b3ba..99dc2045f 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -1019,7 +1019,7 @@ function script json_encode {
if (getargcount() < 2 || getargcount() % 2 != 0)
return Exception("json_encode arguments must be paired");
- .@json="{";
+ .@json$="{";
.@tab=true;
// For arguments
@@ -1028,24 +1028,24 @@ function script json_encode {
if (.@tab)
.@tab=false;
else
- .@json+=",";
+ .@json$+=",";
// Input variable name
- .@json+="\""+getarg(.@i)+"\": ";
+ .@json$+="\""+getarg(.@i)+"\": ";
// Input variable value
if (isstr(getarg(.@i+1)))
- .@json+="\""+getarg(.@i+1)+"\"";
+ .@json$+="\""+getarg(.@i+1)+"\"";
else
- .@json+=getarg(.@i+1);
+ .@json$+=getarg(.@i+1);
// Advance
.@i++;
}
// Close the JSON
- .@json+="}";
- return .@json;
+ .@json$+="}";
+ return .@json$;
}
@@ -1053,7 +1053,7 @@ function script json_encode {
// sends to API
function script api_send {
.@cde=getarg(0);
- .@fm$=getarg(1);
+ .@fm$=escape_sql(getarg(1));
query_sql("INSERT INTO `api_export` (`type`, `data`) VALUES ('"+.@cde+"', \""+.@fm$+"\")");
return;
}