www/includes/db_recipes.php

changeset 57
bb9a06aa9acd
parent 52
b1f2a893572f
child 60
dbbe408108ea
--- a/www/includes/db_recipes.php	Tue Sep 18 23:16:14 2018 +0200
+++ b/www/includes/db_recipes.php	Thu Sep 20 16:19:09 2018 +0200
@@ -14,6 +14,7 @@
 
 $escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
 $replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
+$disallowed = array('visibleindex','uniqueid','boundindex','uid');
 
 // get data and store in a json array
 $query = "SELECT * FROM recipes ORDER BY st_guide,st_letter,st_name,name";
@@ -58,8 +59,23 @@
 
 	syslog(LOG_NOTICE, $sql);	// Log upto this part.
 
-	 syslog(LOG_NOTICE, "json_waters: " . json_encode($_GET['waters']));
-	$sql .= "', json_waters='" . json_encode($_GET['waters']);
+	$array = $_GET['fermentables'];
+	foreach($array as $key => $item){
+		foreach ($disallowed as $disallowed_key) {
+			unset($array[$key]["$disallowed_key"]);
+		}
+	}
+	syslog(LOG_NOTICE, "json_fermentables: " . json_encode($array));
+	$sql .= "', json_fermentables='" . json_encode($array);
+
+	$array = $_GET['waters'];
+	foreach($array as $key => $item){
+		foreach ($disallowed as $disallowed_key) {
+			unset($array[$key]["$disallowed_key"]);
+		}
+	}
+	syslog(LOG_NOTICE, "json_waters: " . json_encode($array));
+	$sql .= "', json_waters='" . json_encode($array);
 
 	if (isset($_GET['insert'])) {
 		$sql .= "';";

mercurial