www/includes/db_recipes.php

changeset 228
98536f6539ee
parent 226
40e68b18b50d
child 233
14a84d42031d
equal deleted inserted replaced
227:fd6d87d1c9ed 228:98536f6539ee
225 } 225 }
226 } 226 }
227 $yeasts .= ']'; 227 $yeasts .= ']';
228 $sql .= "', json_yeasts='" . $yeasts; 228 $sql .= "', json_yeasts='" . $yeasts;
229 229
230 $mashs = '[';
231 $comma = FALSE;
230 if (isset($_POST['mashs'])) { 232 if (isset($_POST['mashs'])) {
231 $array = $_POST['mashs']; 233 $array = $_POST['mashs'];
232 foreach($array as $key => $item){ 234 foreach($array as $key => $item) {
233 foreach ($disallowed as $disallowed_key) { 235 if ($comma)
234 unset($array[$key]["$disallowed_key"]); 236 $mashs .= ',';
235 } 237 $comma = TRUE;
236 } 238 $mash = '{"step_name":"' . str_replace($rescapers,$rreplacements,$item['step_name']);
237 syslog(LOG_NOTICE, "json_mashs: ".str_replace($rescapers,$rreplacements,json_encode($array))); 239 $mash .= '","step_type":' . $item['step_type'];
238 $sql .= "', json_mashs='" . str_replace($rescapers,$rreplacements,json_encode($array)); 240 if (isset($item['step_infuse_amount']) && $item['step_infuse_amount'] != "")
239 } 241 $mash .= ',"step_infuse_amount":' . $item['step_infuse_amount'];
242 else
243 $mash .= ',"step_infuse_amount":0';
244 $mash .= ',"step_temp":' . $item['step_temp'];
245 $mash .= ',"step_time":' . $item['step_time'];
246 $mash .= ',"ramp_time":' . $item['ramp_time'];
247 $mash .= ',"end_temp":' . $item['end_temp'] . '}';
248 syslog(LOG_NOTICE, $mash);
249 $mashs .= $mash;
250 }
251 }
252 $mashs .= ']';
253 $sql .= "', json_mashs='" . $mashs;
240 254
241 if (isset($_POST['insert'])) { 255 if (isset($_POST['insert'])) {
242 $sql .= "';"; 256 $sql .= "';";
243 } 257 }
244 if (isset($_POST['update'])) { 258 if (isset($_POST['update'])) {

mercurial