Fri, 25 Jan 2019 22:03:16 +0100
Friendly stock inventory display.
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
3 | require($_SERVER['DOCUMENT_ROOT']."/config.php"); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
4 | require($_SERVER['DOCUMENT_ROOT']."/version.php"); |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | #Connect to the database |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | $connect = mysqli_connect(DBASE_HOST, DBASE_USER, DBASE_PASS, DBASE_NAME); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | if (! $connect) { |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | } |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
72
diff
changeset
|
11 | mysqli_set_charset($connect, "utf8" ); |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
13 | $escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c"); |
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
14 | $replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b"); |
61 | 15 | $rescapers = array("'"); |
16 | $rreplacements = array("\\'"); | |
143
122f64716161
During recipes import of miscs ingredients, convert time in Secondary to days. The hop grid also display the country of origin. Misc ingredients now use a temporary weight table just like the hops.
Michiel Broek <mbroek@mbse.eu>
parents:
142
diff
changeset
|
17 | $disallowed = array('visibleindex','uniqueid','boundindex','uid','h_weight','m_weight'); |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
18 | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
19 | if (isset($_POST['insert']) || isset($_POST['update'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
20 | if (isset($_POST['insert'])) { |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
21 | // INSERT COMMAND |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
22 | $sql = "INSERT INTO `recipes` SET "; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
23 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
24 | if (isset($_POST['update'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
25 | // UPDATE COMMAND |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
26 | $sql = "UPDATE `recipes` SET "; |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
27 | } |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
28 | // Basic settings |
166
635033a29c48
Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents:
156
diff
changeset
|
29 | if (isset($_POST['uuid'])) { |
635033a29c48
Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents:
156
diff
changeset
|
30 | $sql .= "uuid='" . $_POST['uuid']; |
635033a29c48
Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents:
156
diff
changeset
|
31 | } else { |
635033a29c48
Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents:
156
diff
changeset
|
32 | $uuid = str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid')); |
635033a29c48
Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents:
156
diff
changeset
|
33 | $sql .= "uuid='" . $uuid; |
635033a29c48
Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents:
156
diff
changeset
|
34 | } |
168
ce92dc75cb09
Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents:
166
diff
changeset
|
35 | ($_POST['locked'] == 'true') ? $sql .= "', locked='1" : $sql .= "', locked='0"; |
166
635033a29c48
Fixed new recipes uuid generation and saving missing new fields.
Michiel Broek <mbroek@mbse.eu>
parents:
156
diff
changeset
|
36 | $sql .= "', st_name='" . mysqli_real_escape_string($connect, $_POST['st_name']); |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
37 | $sql .= "', st_letter='" . mysqli_real_escape_string($connect, $_POST['st_letter']); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
38 | $sql .= "', st_guide='" . mysqli_real_escape_string($connect, $_POST['st_guide']); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
39 | $sql .= "', st_type='" . mysqli_real_escape_string($connect, $_POST['st_type']); |
80
75b9227fb98c
Added beginning of recipe print.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
40 | $sql .= "', st_category='" . mysqli_real_escape_string($connect, $_POST['st_category']); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
41 | $sql .= "', st_category_number='" . $_POST['st_category_number']; |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
42 | $sql .= "', st_og_min='" . $_POST['st_og_min']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
43 | $sql .= "', st_og_max='" . $_POST['st_og_max']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
44 | $sql .= "', st_fg_min='" . $_POST['st_fg_min']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
45 | $sql .= "', st_fg_max='" . $_POST['st_fg_max']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
46 | $sql .= "', st_ibu_min='" . $_POST['st_ibu_min']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
47 | $sql .= "', st_ibu_max='" . $_POST['st_ibu_max']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
48 | $sql .= "', st_color_min='" . $_POST['st_color_min']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
49 | $sql .= "', st_color_max='" . $_POST['st_color_max']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
50 | $sql .= "', st_carb_min='" . $_POST['st_carb_min']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
51 | $sql .= "', st_carb_max='" . $_POST['st_carb_max']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
52 | $sql .= "', st_abv_min='" . $_POST['st_abv_min']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
53 | $sql .= "', st_abv_max='" . $_POST['st_abv_max']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
54 | $sql .= "', name='" . mysqli_real_escape_string($connect, $_POST['name']); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
55 | $sql .= "', notes='" . mysqli_real_escape_string($connect, $_POST['notes']); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
56 | $sql .= "', type='" . $_POST['type']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
57 | $sql .= "', batch_size='" . $_POST['batch_size']; |
94
295c3af2a421
Include boil_size field in the recipes table. Calculate pre-boil SG. Use that in the IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
80
diff
changeset
|
58 | $sql .= "', boil_size='" . $_POST['boil_size']; |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
59 | $sql .= "', boil_time='" . $_POST['boil_time']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
60 | $sql .= "', efficiency='" . $_POST['efficiency']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
61 | $sql .= "', est_og='" . $_POST['est_og']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
62 | $sql .= "', est_fg='" . $_POST['est_fg']; |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
63 | $sql .= "', est_abv='" . $_POST['est_abv']; |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
64 | $sql .= "', est_carb='" . $_POST['est_carb']; |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
65 | $sql .= "', est_color='" . $_POST['est_color']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
66 | $sql .= "', color_method='" . $_POST['color_method']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
67 | $sql .= "', est_ibu='" . $_POST['est_ibu']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
68 | $sql .= "', ibu_method='" . $_POST['ibu_method']; |
147
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
69 | $sql .= "', sparge_temp='" . $_POST['sparge_temp']; |
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
70 | $sql .= "', sparge_ph='" . $_POST['sparge_ph']; |
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
71 | $sql .= "', sparge_volume='" . $_POST['sparge_volume']; |
156
35860890224c
Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
72 | $sql .= "', sparge_source='" . $_POST['sparge_source']; |
35860890224c
Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
73 | $sql .= "', sparge_acid_type='" . $_POST['sparge_acid_type']; |
35860890224c
Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
74 | $sql .= "', sparge_acid_perc='" . $_POST['sparge_acid_perc']; |
35860890224c
Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
75 | $sql .= "', sparge_acid_amount='" . $_POST['sparge_acid_amount']; |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
76 | $sql .= "', mash_ph='" . $_POST['mash_ph']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
77 | $sql .= "', mash_name='" . $_POST['mash_name']; |
156
35860890224c
Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
78 | ($_POST['calc_acid'] == 'true') ? $sql .= "', calc_acid='1" : $sql .= "', calc_acid='0"; |
148
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
79 | if (isset($_POST['w1_name'])) { |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
80 | $sql .= "', w1_name='" . mysqli_real_escape_string($connect, $_POST['w1_name']); |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
81 | $sql .= "', w1_amount='" . $_POST['w1_amount']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
82 | $sql .= "', w1_calcium='" . $_POST['w1_calcium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
83 | $sql .= "', w1_sulfate='" . $_POST['w1_sulfate']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
84 | $sql .= "', w1_chloride='" . $_POST['w1_chloride']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
85 | $sql .= "', w1_sodium='" . $_POST['w1_sodium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
86 | $sql .= "', w1_magnesium='" . $_POST['w1_magnesium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
87 | $sql .= "', w1_total_alkalinity='" . $_POST['w1_total_alkalinity']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
88 | $sql .= "', w1_ph='" . $_POST['w1_ph']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
89 | $sql .= "', w1_cost='" . $_POST['w1_cost']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
90 | } |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
91 | if (isset($_POST['w2_name'])) { |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
92 | $sql .= "', w2_name='" . mysqli_real_escape_string($connect, $_POST['w2_name']); |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
93 | $sql .= "', w2_amount='" . $_POST['w2_amount']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
94 | $sql .= "', w2_calcium='" . $_POST['w2_calcium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
95 | $sql .= "', w2_sulfate='" . $_POST['w2_sulfate']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
96 | $sql .= "', w2_chloride='" . $_POST['w2_chloride']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
97 | $sql .= "', w2_sodium='" . $_POST['w2_sodium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
98 | $sql .= "', w2_magnesium='" . $_POST['w2_magnesium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
99 | $sql .= "', w2_total_alkalinity='" . $_POST['w2_total_alkalinity']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
100 | $sql .= "', w2_ph='" . $_POST['w2_ph']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
101 | $sql .= "', w2_cost='" . $_POST['w2_cost']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
102 | } |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
103 | syslog(LOG_NOTICE, $sql); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
104 | |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
105 | if (isset($_POST['fermentables'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
106 | $array = $_POST['fermentables']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
107 | foreach($array as $key => $item){ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
108 | foreach ($disallowed as $disallowed_key) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
109 | unset($array[$key]["$disallowed_key"]); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
110 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
111 | } |
61 | 112 | syslog(LOG_NOTICE, "json_fermentables=: ".str_replace($rescapers,$rreplacements,json_encode($array))); |
113 | $sql .= "', json_fermentables='" . str_replace($rescapers,$rreplacements,json_encode($array)); | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
114 | } |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
115 | |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
116 | if (isset($_POST['hops'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
117 | $array = $_POST['hops']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
118 | foreach($array as $key => $item){ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
119 | foreach ($disallowed as $disallowed_key) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
120 | unset($array[$key]["$disallowed_key"]); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
121 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
122 | } |
61 | 123 | syslog(LOG_NOTICE, "json_hops: ".str_replace($rescapers,$rreplacements,json_encode($array))); |
124 | $sql .= "', json_hops='" . str_replace($rescapers,$rreplacements,json_encode($array)); | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
125 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
126 | |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
127 | if (isset($_POST['miscs'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
128 | $array = $_POST['miscs']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
129 | foreach($array as $key => $item){ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
130 | foreach ($disallowed as $disallowed_key) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
131 | unset($array[$key]["$disallowed_key"]); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
132 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
133 | } |
61 | 134 | syslog(LOG_NOTICE, "json_miscs: ".str_replace($rescapers,$rreplacements,json_encode($array))); |
135 | $sql .= "', json_miscs='" . str_replace($rescapers,$rreplacements,json_encode($array)); | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
136 | } |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
137 | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
138 | if (isset($_POST['yeasts'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
139 | $array = $_POST['yeasts']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
140 | foreach($array as $key => $item){ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
141 | foreach ($disallowed as $disallowed_key) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
142 | unset($array[$key]["$disallowed_key"]); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
143 | } |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
144 | } |
61 | 145 | syslog(LOG_NOTICE, "json_yeasts: ". str_replace($rescapers,$rreplacements,json_encode($array))); |
146 | $sql .= "', json_yeasts='" . str_replace($rescapers,$rreplacements,json_encode($array)); | |
57
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
147 | } |
bb9a06aa9acd
Completed framework inline fermentables editor
Michiel Broek <mbroek@mbse.eu>
parents:
52
diff
changeset
|
148 | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
149 | if (isset($_POST['mashs'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
150 | $array = $_POST['mashs']; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
151 | foreach($array as $key => $item){ |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
152 | foreach ($disallowed as $disallowed_key) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
153 | unset($array[$key]["$disallowed_key"]); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
154 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
155 | } |
61 | 156 | syslog(LOG_NOTICE, "json_mashs: ".str_replace($rescapers,$rreplacements,json_encode($array))); |
157 | $sql .= "', json_mashs='" . str_replace($rescapers,$rreplacements,json_encode($array)); | |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
158 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
159 | |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
160 | if (isset($_POST['insert'])) { |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
161 | $sql .= "';"; |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
162 | } |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
163 | if (isset($_POST['update'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
164 | $sql .= "' WHERE record='" . $_POST['record'] . "';"; |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
165 | } |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
167 | $result = mysqli_query($connect, $sql); |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
168 | if (! $result) { |
61 | 169 | syslog(LOG_NOTICE, "db_recipes: result: ".mysqli_error($connect)); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
170 | } else { |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
171 | if (isset($_POST['update'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
172 | syslog(LOG_NOTICE, "db_recipes: updated record ".$_POST['record']); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
173 | } else { |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
174 | $lastid = mysqli_insert_id($connect); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
175 | syslog(LOG_NOTICE, "db_recipes: inserted record ".$lastid); |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
176 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
177 | } |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
178 | echo $result; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
179 | |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
180 | } else if (isset($_POST['delete'])) { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
181 | // DELETE COMMAND |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
182 | $sql = "DELETE FROM `recipes` WHERE record='".$_POST['record']."';"; |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
183 | $result = mysqli_query($connect, $sql); |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
184 | if (! $result) { |
61 | 185 | syslog(LOG_NOTICE, "db_recipes: result: ".mysqli_error($connect)); |
60
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
186 | } else { |
dbbe408108ea
Added miscs inline editor. Switched to http POST because of GET limitations.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
187 | syslog(LOG_NOTICE, "db_recipes: deleted record ".$_POST['record']); |
52
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
188 | } |
b1f2a893572f
More progress on the recipes design
Michiel Broek <mbroek@mbse.eu>
parents:
51
diff
changeset
|
189 | echo $result; |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
190 | |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
191 | } else { |
130
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
192 | /* |
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
193 | * Select all or a given record. |
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
194 | */ |
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
195 | if (isset($_GET['record'])) { |
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
196 | $query = "SELECT * FROM recipes WHERE record='" . $_GET['record'] . "';"; |
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
197 | } else { |
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
198 | $query = "SELECT * FROM recipes ORDER BY st_guide,st_letter,st_name,name"; |
601920b902e5
Load a single recipe from the database instead of client side select.
Michiel Broek <mbroek@mbse.eu>
parents:
94
diff
changeset
|
199 | } |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
200 | $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | $recipes = '['; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
202 | $comma = FALSE; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
203 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
204 | // Manual encode to JSON. |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
205 | if ($comma) { |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
206 | $recipes .= ','; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
207 | } |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | $comma = TRUE; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | $recipes .= '{"record":' . $row['record']; |
168
ce92dc75cb09
Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents:
166
diff
changeset
|
210 | $recipes .= ',"uuid":"' . $row['uuid']; |
ce92dc75cb09
Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents:
166
diff
changeset
|
211 | $recipes .= '","locked":' . $row['locked']; |
51 | 212 | $recipes .= ',"st_guide":"' . str_replace($escapers, $replacements, $row['st_guide']); |
213 | $recipes .= '","st_letter":"' . str_replace($escapers, $replacements, $row['st_letter']); | |
214 | $recipes .= '","st_name":"' . str_replace($escapers, $replacements, $row['st_name']); | |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
215 | $recipes .= '","st_type":"' . str_replace($escapers, $replacements, $row['st_type']); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
216 | $recipes .= '","st_category":"' . str_replace($escapers, $replacements, $row['st_category']); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
217 | $recipes .= '","st_category_number":' . floatval($row['st_category_number']); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
218 | $recipes .= ',"st_og_min":' . floatval($row['st_og_min']); |
51 | 219 | $recipes .= ',"st_og_max":' . floatval($row['st_og_max']); |
220 | $recipes .= ',"st_fg_min":' . floatval($row['st_fg_min']); | |
221 | $recipes .= ',"st_fg_max":' . floatval($row['st_fg_max']); | |
222 | $recipes .= ',"st_ibu_min":' . floatval($row['st_ibu_min']); | |
223 | $recipes .= ',"st_ibu_max":' . floatval($row['st_ibu_max']); | |
224 | $recipes .= ',"st_color_min":' . floatval($row['st_color_min']); | |
225 | $recipes .= ',"st_color_max":' . floatval($row['st_color_max']); | |
226 | $recipes .= ',"st_carb_min":' . floatval($row['st_carb_min']); | |
227 | $recipes .= ',"st_carb_max":' . floatval($row['st_carb_max']); | |
228 | $recipes .= ',"st_abv_min":' . floatval($row['st_abv_min']); | |
229 | $recipes .= ',"st_abv_max":' . floatval($row['st_abv_max']); | |
230 | $recipes .= ',"name":"' . str_replace($escapers, $replacements, $row['name']); | |
50
6d94167c2697
Next steps to implement a recipe editor
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
231 | $recipes .= '","notes":"' . str_replace($escapers, $replacements, $row['notes']); |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
232 | $recipes .= '","type":"' . $row['type']; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
233 | $recipes .= '","batch_size":' . floatval($row['batch_size']); |
94
295c3af2a421
Include boil_size field in the recipes table. Calculate pre-boil SG. Use that in the IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
80
diff
changeset
|
234 | $recipes .= ',"boil_size":' . floatval($row['boil_size']); |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
235 | $recipes .= ',"boil_time":' . floatval($row['boil_time']); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
236 | $recipes .= ',"efficiency":' . floatval($row['efficiency']); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
237 | $recipes .= ',"est_og":' . floatval($row['est_og']); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
238 | $recipes .= ',"est_fg":' . floatval($row['est_fg']); |
72
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
239 | $recipes .= ',"est_abv":' . floatval($row['est_abv']); |
93a0be4f5be3
Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents:
71
diff
changeset
|
240 | $recipes .= ',"est_carb":' . floatval($row['est_carb']); |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
241 | $recipes .= ',"est_color":' . floatval($row['est_color']); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
242 | $recipes .= ',"color_method":"' . $row['color_method']; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
243 | $recipes .= '","est_ibu":' . floatval($row['est_ibu']); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
244 | $recipes .= ',"ibu_method":"' . $row['ibu_method']; |
147
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
245 | $recipes .= '","sparge_temp":' . $row['sparge_temp']; |
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
246 | $recipes .= ',"sparge_ph":' . $row['sparge_ph']; |
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
247 | $recipes .= ',"sparge_volume":' . $row['sparge_volume']; |
156
35860890224c
Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
248 | $recipes .= ',"sparge_source":"' . $row['sparge_source']; |
35860890224c
Added sparge water acid calculation. Added residual alkalinity calculation.
Michiel Broek <mbroek@mbse.eu>
parents:
154
diff
changeset
|
249 | $recipes .= '","sparge_acid_type":"' . $row['sparge_acid_type']; |
147
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
250 | $recipes .= '","sparge_acid_perc":' . $row['sparge_acid_perc']; |
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
251 | $recipes .= ',"sparge_acid_amount":' . $row['sparge_acid_amount']; |
51 | 252 | $recipes .= ',"mash_ph":' . $row['mash_ph']; |
253 | $recipes .= ',"mash_name":"' . $row['mash_name']; | |
147
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
254 | $recipes .= '","calc_acid":' . $row['calc_acid']; |
148
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
255 | $recipes .= ',"w1_name":"' . str_replace($escapers, $replacements, $row['w1_name']); |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
256 | $recipes .= '","w1_amount":' . $row['w1_amount']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
257 | $recipes .= ',"w1_calcium":' . $row['w1_calcium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
258 | $recipes .= ',"w1_sulfate":' . $row['w1_sulfate']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
259 | $recipes .= ',"w1_chloride":' . $row['w1_chloride']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
260 | $recipes .= ',"w1_sodium":' . $row['w1_sodium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
261 | $recipes .= ',"w1_magnesium":' . $row['w1_magnesium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
262 | $recipes .= ',"w1_total_alkalinity":' . $row['w1_total_alkalinity']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
263 | $recipes .= ',"w1_ph":' . $row['w1_ph']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
264 | $recipes .= ',"w1_cost":' . $row['w1_cost']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
265 | $recipes .= ',"w2_name":"' . str_replace($escapers, $replacements, $row['w2_name']); |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
266 | $recipes .= '","w2_amount":' . $row['w2_amount']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
267 | $recipes .= ',"w2_calcium":' . $row['w2_calcium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
268 | $recipes .= ',"w2_sulfate":' . $row['w2_sulfate']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
269 | $recipes .= ',"w2_chloride":' . $row['w2_chloride']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
270 | $recipes .= ',"w2_sodium":' . $row['w2_sodium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
271 | $recipes .= ',"w2_magnesium":' . $row['w2_magnesium']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
272 | $recipes .= ',"w2_total_alkalinity":' . $row['w2_total_alkalinity']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
273 | $recipes .= ',"w2_ph":' . $row['w2_ph']; |
c0f0bbfefd63
Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents:
147
diff
changeset
|
274 | $recipes .= ',"w2_cost":' . $row['w2_cost']; |
147
e6e5d007eb54
Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents:
143
diff
changeset
|
275 | $recipes .= ',"fermentables":' . $row['json_fermentables']; |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
276 | $recipes .= ',"hops":' . $row['json_hops']; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
277 | $recipes .= ',"miscs":' . $row['json_miscs']; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
278 | $recipes .= ',"yeasts":' . $row['json_yeasts']; |
51 | 279 | $recipes .= ',"mashs":' . $row['json_mashs']; |
49
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
280 | $recipes .= '}'; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
281 | } |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
282 | $recipes .= ']'; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
283 | header("Content-type: application/json"); |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
284 | echo $recipes; |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
285 | } |
4d27a7fb1265
Finisched recipe import. Added recipe retrieve script.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
286 | ?> |