www/includes/db_recipes.php

changeset 225
ad2e1e3ccaca
parent 223
0de4455bd2a1
child 226
40e68b18b50d
equal deleted inserted replaced
224:d3cdcfac81cb 225:ad2e1e3ccaca
136 $fermentable .= ',"f_add_after_boil":' . $item['f_add_after_boil']; 136 $fermentable .= ',"f_add_after_boil":' . $item['f_add_after_boil'];
137 $fermentable .= ',"f_adjust_to_total_100":' . $item['f_adjust_to_total_100']; 137 $fermentable .= ',"f_adjust_to_total_100":' . $item['f_adjust_to_total_100'];
138 $fermentable .= ',"f_percentage":' . $item['f_percentage']; 138 $fermentable .= ',"f_percentage":' . $item['f_percentage'];
139 $fermentable .= ',"f_di_ph":' . $item['f_di_ph']; 139 $fermentable .= ',"f_di_ph":' . $item['f_di_ph'];
140 $fermentable .= ',"f_acid_to_ph_57":' . $item['f_acid_to_ph_57'] . '}'; 140 $fermentable .= ',"f_acid_to_ph_57":' . $item['f_acid_to_ph_57'] . '}';
141 syslog(LOG_NOTICE, $fermentable); 141 //syslog(LOG_NOTICE, $fermentable);
142 $fermentables .= $fermentable; 142 $fermentables .= $fermentable;
143 } 143 }
144 } 144 }
145 $fermentables .= ']'; 145 $fermentables .= ']';
146 $sql .= "', json_fermentables='" . $fermentables; 146 $sql .= "', json_fermentables='" . $fermentables;
167 $hop .= ',"h_humulene":' . $item['h_humulene']; 167 $hop .= ',"h_humulene":' . $item['h_humulene'];
168 $hop .= ',"h_caryophyllene":' . $item['h_caryophyllene']; 168 $hop .= ',"h_caryophyllene":' . $item['h_caryophyllene'];
169 $hop .= ',"h_cohumulone":' . $item['h_cohumulone']; 169 $hop .= ',"h_cohumulone":' . $item['h_cohumulone'];
170 $hop .= ',"h_myrcene":' . $item['h_myrcene']; 170 $hop .= ',"h_myrcene":' . $item['h_myrcene'];
171 $hop .= ',"h_total_oil":' . $item['h_total_oil'] . '}'; 171 $hop .= ',"h_total_oil":' . $item['h_total_oil'] . '}';
172 syslog(LOG_NOTICE, $hop); 172 //syslog(LOG_NOTICE, $hop);
173 $hops .= $hop; 173 $hops .= $hop;
174 } 174 }
175 } 175 }
176 $hops .= ']'; 176 $hops .= ']';
177 $sql .= "', json_hops='" . $hops; 177 $sql .= "', json_hops='" . $hops;
178 178
179 $miscs = '[';
180 $comma = FALSE;
179 if (isset($_POST['miscs'])) { 181 if (isset($_POST['miscs'])) {
180 $array = $_POST['miscs']; 182 $array = $_POST['miscs'];
181 foreach($array as $key => $item){ 183 foreach($array as $key => $item) {
182 foreach ($disallowed as $disallowed_key) { 184 if ($comma)
183 unset($array[$key]["$disallowed_key"]); 185 $miscs .= ',';
184 } 186 $comma = TRUE;
185 } 187 $misc = '{"m_name":"' . str_replace($rescapers,$rreplacements,$item['m_name']);
186 syslog(LOG_NOTICE, "json_miscs: ".str_replace($rescapers,$rreplacements,json_encode($array))); 188 $misc .= '","m_amount":' . $item['m_amount'];
187 $sql .= "', json_miscs='" . str_replace($rescapers,$rreplacements,json_encode($array)); 189 $misc .= ',"m_type":' . $item['m_type'];
188 } 190 $misc .= ',"m_use_use":' . $item['m_use_use'];
191 $misc .= ',"m_time":' . $item['m_time'];
192 $misc .= ',"m_amount_is_weight":' . $item['m_amount_is_weight'];
193 $misc .= ',"m_cost":' . $item['m_cost'] . '}';
194 syslog(LOG_NOTICE, $misc);
195 $miscs .= $misc;
196 }
197 }
198 $miscs .= ']';
199 $sql .= "', json_miscs='" . $miscs;
189 200
190 if (isset($_POST['yeasts'])) { 201 if (isset($_POST['yeasts'])) {
191 $array = $_POST['yeasts']; 202 $array = $_POST['yeasts'];
192 foreach($array as $key => $item){ 203 foreach($array as $key => $item){
193 foreach ($disallowed as $disallowed_key) { 204 foreach ($disallowed as $disallowed_key) {

mercurial