From 1aa886e213a44ec3d15fb4f7843f9a25732311c3 Mon Sep 17 00:00:00 2001 From: kanoi Date: Wed, 29 Oct 2014 18:47:35 +1100 Subject: [PATCH] php - api allow empty fields for json conversion --- pool/page_api.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pool/page_api.php b/pool/page_api.php index e5b84906..8b773410 100644 --- a/pool/page_api.php +++ b/pool/page_api.php @@ -61,6 +61,8 @@ function show_api($page, $menu, $name, $user) if ($i == 0) $zeflds .= "$fld,"; } + $rep .= fldEncode($ans, 'arn', false); + $rep .= fldEncode($ans, 'arp', false); $rep .= fldEncode(array(), 'flds', false); $rep .= substr($zeflds, 0, -1); } @@ -68,7 +70,7 @@ function show_api($page, $menu, $name, $user) echo $rep; else { - $j = preg_replace("/([^=]+)=([^$fld_sep]+)$fld_sep/", '"$1":"$2",', $rep.$fld_sep); + $j = preg_replace("/([^=]+)=([^$fld_sep]*)$fld_sep/", '"$1":"$2",', $rep.$fld_sep); echo '{'.substr($j, 0, -1).'}'; } exit(0);