www/includes/db_recipes.php

changeset 225
ad2e1e3ccaca
parent 223
0de4455bd2a1
child 226
40e68b18b50d
--- a/www/includes/db_recipes.php	Thu Jan 31 14:09:54 2019 +0100
+++ b/www/includes/db_recipes.php	Thu Jan 31 17:16:51 2019 +0100
@@ -138,7 +138,7 @@
 			$fermentable .= ',"f_percentage":' . $item['f_percentage'];
 			$fermentable .= ',"f_di_ph":' . $item['f_di_ph'];
 			$fermentable .= ',"f_acid_to_ph_57":' . $item['f_acid_to_ph_57'] . '}';
-			syslog(LOG_NOTICE, $fermentable);
+			//syslog(LOG_NOTICE, $fermentable);
 			$fermentables .= $fermentable;
 		}
 	}
@@ -169,23 +169,34 @@
 			$hop .= ',"h_cohumulone":' . $item['h_cohumulone'];
 			$hop .= ',"h_myrcene":' . $item['h_myrcene'];
 			$hop .= ',"h_total_oil":' . $item['h_total_oil'] . '}';
-			syslog(LOG_NOTICE, $hop);
+			//syslog(LOG_NOTICE, $hop);
 			$hops .= $hop;
 		}
 	}
 	$hops .= ']';
 	$sql .= "', json_hops='" . $hops;
 
+	$miscs = '[';
+	$comma = FALSE;
 	if (isset($_POST['miscs'])) {
 		$array = $_POST['miscs'];
-		foreach($array as $key => $item){ 
-			foreach ($disallowed as $disallowed_key) {
-				unset($array[$key]["$disallowed_key"]);
-			}
+		foreach($array as $key => $item) {
+			if ($comma)
+				$miscs .= ',';
+			$comma = TRUE;
+			$misc  = '{"m_name":"' . str_replace($rescapers,$rreplacements,$item['m_name']);
+			$misc .= '","m_amount":' . $item['m_amount'];
+			$misc .= ',"m_type":' . $item['m_type'];
+			$misc .= ',"m_use_use":' . $item['m_use_use'];
+			$misc .= ',"m_time":' . $item['m_time'];
+			$misc .= ',"m_amount_is_weight":' . $item['m_amount_is_weight'];
+			$misc .= ',"m_cost":' . $item['m_cost'] . '}';
+			syslog(LOG_NOTICE, $misc);
+			$miscs .= $misc;
 		}
-		syslog(LOG_NOTICE, "json_miscs: ".str_replace($rescapers,$rreplacements,json_encode($array)));
-		$sql .= "', json_miscs='" . str_replace($rescapers,$rreplacements,json_encode($array));
 	}
+	$miscs .= ']';
+	$sql .= "', json_miscs='" . $miscs;
 
 	if (isset($_POST['yeasts'])) {
 		$array = $_POST['yeasts'];

mercurial