Remove unneeded scripts

Thu, 04 Aug 2022 20:32:25 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 04 Aug 2022 20:32:25 +0200
changeset 812
d286bf289d45
parent 811
4e3409cfd2b1
child 813
752bb80362fb

Remove unneeded scripts

www/Makefile file | annotate | diff | comparison | revisions
www/includes/global.inc.php file | annotate | diff | comparison | revisions
www/js/rec_import.js file | annotate | diff | comparison | revisions
www/js/rec_new.js file | annotate | diff | comparison | revisions
www/rec_import.php file | annotate | diff | comparison | revisions
www/rec_new.php file | annotate | diff | comparison | revisions
www/upl_recipe.php file | annotate | diff | comparison | revisions
--- a/www/Makefile	Thu Aug 04 20:13:41 2022 +0200
+++ b/www/Makefile	Thu Aug 04 20:32:25 2022 +0200
@@ -13,9 +13,8 @@
 		  prod_beerxml.php prod_checklist.php prod_divide.php prod_duplicate.php \
 		  prod_edit.php prod_export.php prod_forum.php \
 		  prod_impbrew.php prod_inprod.php prod_new.php prod_print.php prod_torecipe.php \
-		  rec_edit.php rec_import.php rec_main.php rec_new.php \
-		  upl_fermentables.php upl_hops.php upl_miscs.php upl_recipe.php \
-		  upl_styles.php upl_yeasts.php version.php
+		  rec_edit.php rec_main.php \
+		  upl_fermentables.php upl_hops.php upl_miscs.php upl_styles.php upl_yeasts.php version.php
 SUB		= version.php.in images/* css/* jqwidgets/* jqwidgets/styles/* \
 		  jqwidgets/styles/images/* jqwidgets/globalization/* js/* \
 		  includes/* fpdf/* import/*
--- a/www/includes/global.inc.php	Thu Aug 04 20:13:41 2022 +0200
+++ b/www/includes/global.inc.php	Thu Aug 04 20:32:25 2022 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014-2021
+ * Copyright (C) 2014-2022
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -228,17 +228,8 @@
        <li><img style='float: left; margin-right: 5px;' src='images/list-add.png' /><a href="prod_new.php?return=index.php">Start nieuw</a></li>
       </ul>
      </li>
-     <li style='width: 80px;'>Recepten
-      <ul style='width: 200px;'>
-       <li><img style='float: left; margin-right: 5px;' src='images/beerstyles.png' /><a href="rec_main.php">Recepten</a></li>
-       <li><img style='float: left; margin-right: 5px;' src='images/insert-object.png' /><a href="rec_import.php">Import beerxml</a></li>
-      </ul>
-     </li>
-     <li style='width: 80px;'>Over
-      <ul style='width: 150px;'>
-       <li><img style='float: left; margin-right: 5px;' src='images/help-about.png' /><a href="gen_about.php">Informatie</a></li>
-      </ul>
-     </li>
+     <li style='width: 80px;'><a href="rec_main.php">Recepten</a></li>
+     <li style='width: 80px;'><a href="gen_about.php">Over</a></li>
     </ul>
    </div> <!-- End menu -->
 
--- a/www/js/rec_import.js	Thu Aug 04 20:13:41 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019
- *
- * Michiel Broek <mbroek at mbse dot eu>
- *
- * This file is part of BMS
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * BrewCloud is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with ThermFerm; see the file COPYING.  If not, write to the Free
- * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *****************************************************************************/
-
-
-$(document).ready(function() {
-
- $('#jqxFileUpload').jqxFileUpload({
-  width: 300,
-  browseTemplate: 'success',
-  cancelTemplate: 'inverse',
-  uploadTemplate: 'primary',
-  theme: theme,
-  multipleFilesUpload: false,
-  accept: 'application/xml',
-  uploadUrl: 'upl_recipe.php',
-  fileInputName: 'fileToUpload'
- });
- $('#eventsPanel').jqxPanel({
-  width: 800,
-  height: 200,
-  theme: theme
- });
- $('#jqxFileUpload').on('select', function(event) {
-  var args = event.args,
-  fileName = args.file,
-  fileSize = args.size;
-  $('#eventsPanel').jqxPanel('clearcontent');
-  $('#eventsPanel').jqxPanel('append', '<strong>' + event.type + ':</strong> ' + fileName + '  size: ' + fileSize + '<br />');
- });
- $('#jqxFileUpload').on('uploadEnd', function(event) {
-  var args = event.args,
-  fileName = args.file,
-  serverResponce = args.response;
-  $('#eventsPanel').jqxPanel('append', '<strong>' + event.type + ':</strong> ontvangen ' + fileName + '<br />' + serverResponce + '<br />');
- });
-
-});
--- a/www/js/rec_new.js	Thu Aug 04 20:13:41 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,345 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2018-2020
- *
- * Michiel Broek <mbroek at mbse dot eu>
- *
- * This file is part of BMS
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * BrewCloud is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with ThermFerm; see the file COPYING.  If not, write to the Free
- * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *****************************************************************************/
-
-
-$(document).ready(function() {
-
- var recipe_type = 2,
- style_type = 0,
-
- //Creating wizard module
- wizard = (function() {
-
-  //Adding event listeners
-  var _addHandlers = function() {
-   $('#name').on('change', function(event) { wizard.validate(true); });
-   $('#type').on('change', function(event) { wizard.validate(true); });
-   $('#boil_time').on('change', function(event) { wizard.validate(true); });
-   $('#est_og').on('change', function(event) { wizard.validate(true); });
-   $('#efficiency').on('change', function(event) { wizard.validate(true); });
-   $('#styleSelect').on('change', function(event) { wizard.validate(true); });
-   $('#nextButtonCompleted').click(function() {
-    console.log('insert start');
-    var newrow = {
-     record: -1,
-     locked: 0,
-     name: $('#name').val(),
-     notes: $('#notes').val(),
-     st_name: $('#st_name').val(),
-     st_letter: $('#st_style_letter').val(),
-     st_guide: $('#st_style_guide').val(),
-     st_category: $('#st_category').val(),
-     st_category_number: $('#st_category_number').val(),
-     st_type: style_type,
-     st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')),
-     st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')),
-     st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')),
-     st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')),
-     st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')),
-     st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')),
-     st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')),
-     st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')),
-     st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')),
-     st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')),
-     st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')),
-     st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')),
-     type: recipe_type,
-     batch_size: 20.0,
-     boil_size: 22.0,
-     boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
-     efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
-     est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
-     est_fg: 1.000,
-     est_color: 0,
-     est_abv: 0.0,
-     est_carb: 0.0,
-     color_method: 0, // Morey
-     est_ibu: 0,
-     ibu_method: 0,  // Tinseth
-     mash_name: '',
-     mash_ph: 5.4,
-     sparge_temp: 85.0,
-     sparge_volume: 12.0,
-     sparge_ph: 5.8,
-     sparge_source: 0, // Source 1
-     sparge_acid_type: 0, // Lactic acid
-     sparge_acid_perc: 80,
-     sparge_acid_amount: 0,
-     calc_acid: 1,
-     w1_name: 'Tap water',
-     w1_amount: 15,
-     w1_calcium: 0,
-     w1_sulfate: 0,
-     w1_chloride: 0,
-     w1_sodium: 0,
-     w1_magnesium: 0,
-     w1_total_alkalinity: 0,
-     w1_ph: 7.0,
-     w1_cost: 0.0,
-     wg_amount: 15,
-     wg_calcium: 0,
-     wg_sulfate: 0,
-     wg_chloride: 0,
-     wg_sodium: 0,
-     wg_magnesium: 0,
-     wg_total_alkalinity: 0,
-     wg_ph: 7.0,
-     wb_calcium: 0,
-     wb_sulfate: 0,
-     wb_sodium: 0,
-     wb_chloride: 0,
-     wb_magnesium: 0,
-     wb_total_alkalinity: 0,
-     wb_ph: 0,
-     wa_acid_name: 0, // Lactic acid
-     wa_acid_perc: 80,
-     wa_base_name: 0
-    },
-    data = 'insert=true&return=' + my_return + '&' + $.param(newrow);
-    $.ajax({
-     dataType: 'json',
-     url: 'includes/db_recipes.php',
-     cache: false,
-     data: data,
-     type: 'POST',
-     success: function(data, status, xhr) {
-      // update command is executed.
-      window.location.href = my_return;
-     },
-     error: function(jqXHR, textStatus, errorThrown) {
-     }
-    });
-   });
-   $('.nextButton').click(function() {
-    wizard.validate(true);
-    $('#jqxTabs').jqxTabs('next');
-   });
-   $('.backButton').click(function() {
-    wizard.validate(true);
-    $('#jqxTabs').jqxTabs('previous');
-   });
-  };
-
-  return {
-   //Initializing the wizzard - creating all elements, adding event handlers and starting the validation
-   init: function() {
-    $('#jqxTabs').jqxTabs({
-     theme: theme,
-     height: 630,
-     width: 1280,
-     autoHeight: false,
-     position: 'top',
-     keyboardNavigation: false
-    });
-    $('#nextButtonBase').jqxButton({ theme: theme, width: 150 });
-    $('#nextButtonStyle').jqxButton({ theme: theme, width: 150});
-    $('#backButtonStyle').jqxButton({ theme: theme, template: 'success', width: 150});
-    $('#nextButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150});
-    $('#backButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150});
-    _addHandlers();
-    this.validate();
-    this.showHint('Vul de nodige gegevens in.');
-   },
-
-   //Validating all wizard tabs
-   validate: function(notify) {
-    if (!this.firstTab(notify)) {
-     $('#jqxTabs').jqxTabs('disableAt', 1);
-     $('#jqxTabs').jqxTabs('disableAt', 2);
-     return;
-    } else {
-     $('#jqxTabs').jqxTabs('enableAt', 1);
-    }
-    if (!this.secondTab(notify)) {
-     $('#jqxTabs').jqxTabs('disableAt', 2);
-     return;
-    } else {
-     $('#jqxTabs').jqxTabs('enableAt', 2);
-    }
-   },
-
-   //Displaying message to the user
-   showHint: function(message, selector) {
-    if (typeof selector === 'undefined') {
-     selector = '.hint';
-    }
-    if (message === '') {
-     message = 'Ok, je mag doorgaan.';
-    }
-    $(selector).html('<strong>' + message + '</strong>');
-   },
-
-   //Validating the first tab
-   firstTab: function(notify) {
-    var name = $('#name').val(),
-        type = $('#type').val(),
-        boil_time = parseFloat($('#boil_time').jqxNumberInput('decimal')),
-        est_og = parseFloat($('#est_og').jqxNumberInput('decimal')),
-        efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal')),
-        message = '';
-    if (name.length < 3) {
-     message += 'Je moet een recept naam invullen. <br />';
-    }
-    // Check if name already exists.
-    if (type.length < 1) {
-     message += 'Je moet een brouw type kiezen. <br />';
-    }
-    if ((boil_time < 4) || (boil_time > 360)) {
-     message += 'De kooktijd moet tussen 4 en 360 minuten zijn. <br />';
-    }
-    if ((est_og < 1.010) || (est_og > 1.200)) {
-     message += 'Het OG moet tussen 1.010 en 1.200 zijn. <br />';
-    }
-    if ((efficiency < 35) || (efficiency > 95)) {
-     message += 'Het brouwzaal rendement moet tussen 35 en 95 zijn. <br />';
-    }
-    if (message !== '') {
-     if (notify) {
-      this.showHint(message, '#hintBase');
-     }
-     return false;
-    }
-    this.showHint('Ok, je mag doorgaan.', '#hintBase');
-    $('#nextButtonBase').jqxButton({ template: 'success' });
-    return true;
-   },
-
-   //Validating the second tab
-   secondTab: function(notify) {
-    var stylesel = $('#styleSelect').val(),
-        message = '';
-    if (stylesel.length < 3) {
-     message += 'Je moet een bierstijl kiezen. <br />';
-    }
-    if (message !== '') {
-     if (notify) {
-      this.showHint(message, '#hintStyle');
-     }
-     return false;
-    }
-    this.showHint('Ok, je mag doorgaan.', '#hintStyle');
-    $('#nextButtonStyle').jqxButton({ template: 'success' });
-    return true;
-   }
-  };
- } ());
-
- // Tab 1, Base
- $('#name').jqxTooltip({ content: 'De naam voor dit recept.' });
- $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
- $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
- $('#notes').jqxInput({ theme: theme, width: 960, height: 200 });
- $('#type').jqxDropDownList({
-  theme: theme,
-  source: RecipeTypeAdapter,
-  valueMember: 'id',
-  displayMember: 'nl',
-  width: 180,
-  height: 23,
-  autoDropDownHeight: true
- });
- $('#type').jqxDropDownList('selectItem', 2);
- $('#type').on('select', function(event) {
-  if (event.args) {
-   recipe_type = event.args.index;
-  }
- });
- $('#boil_time').jqxNumberInput(PosInt);
- $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
- $('#efficiency').jqxNumberInput(Perc0);
- $('#est_og').jqxNumberInput(SGopts);
- // Default values.
- $('#boil_time').val(90);
- $('#efficiency').val(75);
- $('#est_og').val(1.052);
-
- // Tab 2, Style
- $('#st_name').jqxInput({ theme: theme, width: 250, height: 23 });
- $('#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
- $('#st_category_number').jqxInput({ theme: theme, width: 70, height: 23 });
- $('#st_style_letter').jqxInput({ theme: theme, width: 250, height: 23 });
- $('#st_style_guide').jqxInput({ theme: theme, width: 250, height: 23 });
- $('#st_notes').jqxInput({ theme: theme, width: 800, height: 100 });
- $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 });
- $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
- $('#st_og_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
- $('#st_fg_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
- $('#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
- $('#st_ibu_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
- $('#st_ibu_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
- $('#st_color_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
- $('#st_color_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
- $('#st_carb_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
- $('#st_carb_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
- $('#st_abv_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
- $('#st_abv_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
- $('#st_profile').jqxInput({ theme: theme, width: 800, height: 48 });
- $('#st_ingredients').jqxInput({ theme: theme, width: 800, height: 23 });
- $('#st_examples').jqxInput({ theme: theme, width: 800, height: 48 });
- $('#styleSelect').jqxDropDownList({
-  placeHolder: 'Kies bierstijl:',
-  theme: theme,
-  source: styleslist,
-  displayMember: 'name',
-  width: 250,
-  height: 27,
-  dropDownWidth: 500,
-  dropDownHeight: 500,
-  renderer: function(index, label, value) {
-   var datarecord = styleslist.records[index];
-   return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name;
-  }
- });
- $('#styleSelect').on('select', function(event) {
-  if (event.args) {
-   var datarecord, index = event.args.index;
-   datarecord = styleslist.records[index];
-   $('#st_name').val(datarecord.name);
-   $('#st_category').val(datarecord.category);
-   $('#st_category_number').val(datarecord.category_number);
-   $('#st_style_letter').val(datarecord.style_letter);
-   $('#st_style_guide').val(datarecord.style_guide);
-   style_type = datarecord.type;
-   $('#st_type').val(StyleTypeData[datarecord.type].nl);
-   $('#st_og_min').val(datarecord.og_min);
-   $('#st_og_max').val(datarecord.og_max);
-   $('#st_fg_min').val(datarecord.fg_min);
-   $('#st_fg_max').val(datarecord.fg_max);
-   $('#st_ibu_min').val(datarecord.ibu_min);
-   $('#st_ibu_max').val(datarecord.ibu_max);
-   $('#st_color_min').val(datarecord.color_min);
-   $('#st_color_max').val(datarecord.color_max);
-   $('#st_carb_min').val(datarecord.carb_min);
-   $('#st_carb_max').val(datarecord.carb_max);
-   $('#st_abv_min').val(datarecord.abv_min);
-   $('#st_abv_max').val(datarecord.abv_max);
-   $('#st_notes').val(datarecord.notes);
-   $('#st_profile').val(datarecord.profile);
-   $('#st_ingredients').val(datarecord.ingredients);
-   $('#st_examples').val(datarecord.examples);
-  }
- });
-
- //Initializing the wizard
- wizard.init();
-});
-
--- a/www/rec_import.php	Thu Aug 04 20:13:41 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-page_header('Recept import', 'rec_import');
-?>
-
-   <div id="MainPanel">
-    <div style="float: left; margin-left: 240px; margin-top: 50px;">
-     <div align="center">Recept beerxml bestand upload.</div><br>
-     <div id="eventsPanel"> </div>
-     <div style="float: left; margin-top: 10px;" id="jqxFileUpload"> </div>
-    </div>
-   </div>
-
-<?php
-page_footer();
-?>
--- a/www/rec_new.php	Thu Aug 04 20:13:41 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-<?php
-require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
-page_header('Nieuw recept', 'rec_new');
-?>
-
-   <div id='jqxTabs'>
-    <ul>
-     <li style="margin-left: 30px;">Recept basis</li>
-     <li>Bierstijl</li>
-     <li>Overzicht</li>
-    </ul>
-
-    <div class="section">
-     <div style="overflow: hidden;">
-      <table>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Recept naam:</td>
-        <td align="left" colspan="3" style="vertical-align: top; padding: 3px;"><input id="name" /></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Opmerkingen:</td>
-        <td colspan="3" style="padding: 3px;"><textarea id="notes"></textarea></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Brouw type:</td>
-	<td align="left" style="padding: 3px;"><div id="type"></div></td>
-        <td style="vertical-align: top; float: right; padding: 3px;">Start SG:</td>
-        <td style="padding: 3px;"><div style="float: left;" id="est_og"></div></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Kooktijd minuten:</td>
-        <td style="padding: 3px;"><div id="boil_time"></div></td>
-        <td style="vertical-align: top; float: right; padding: 3px;">Brouwzaal rendement %:</td>
-        <td style="padding: 3px;"><div id="efficiency"></div></td>
-       </tr>
-      </table>
-     </div>
-     <div id="hintBase" class="hint">
-     </div>
-     <div id="baseButtonsWrapper">
-      <input type="button" value="Volgende" class="nextButton" id="nextButtonBase" />
-     </div>
-    </div>
-
-    <div class="section">
-     <div style="overflow: hidden;">
-      <table>
-       <tr>
-	<td align="right" style="vertical-align: top;">Kies stijl:</td>
-        <td align="left" colspan="3"><div id="styleSelect">Stylenlijst</div></td>
-       </tr>
-       <tr>
-        <td align="right" style="vertical-align: top;">Bier stijl:</td>
-        <td align="left" style="vertical-align: top;"><input readonly="1" id="st_name" /></td>
-        <td align="right" style="vertical-align: top;">Bier groep:</td>
-        <td align="left" style="vertical-align: top;"><input readonly="1" id="st_style_letter" /></td>
-       </tr>
-       <tr>
-        <td align="right" style="vertical-align: top;">Type:</td>
-        <td align="left" style="vertical-align: top;"><input readonly="1" id="st_type" /></td>
-        <td align="right" style="vertical-align: top;">Stijl gids:</td>
-	<td align="left" style="vertical-align: top;"><input readonly="1" id="st_style_guide" /></td>
-       </tr>
-       <tr>
-        <td align="right" style="vertical-align: top;">Categorie:</td>
-        <td align="left" style="vertical-align: top;"><input readonly="1" id="st_category" /></td>
-        <td align="right" style="vertical-align: top;">Categorie nummer:</td>
-        <td align="left" style="vertical-align: top;"><input readonly="1" id="st_category_number" /></td>
-       </tr>
-       <tr>
-        <td align="right" style="vertical-align: top;">Opmerkingen:</td>
-        <td align="left" colspan="3"><textarea readonly="1" id="st_notes"></textarea></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Begin SG:</td>
-	<td style="padding: 3px;"><div style="float: left;" id="st_og_min"></div><div style="float: left; margin-left: 5px;" id="st_og_max"></div></td>
-        <td style="vertical-align: top; float: right; padding: 3px;">Kleur EBC:</td>
-	<td style="padding: 3px;"><div style="float: left;" id="st_color_min"></div><div style="float: left; margin-left: 5px;" id="st_color_max"></div></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Eind SG:</td>
-        <td style="padding: 3px;"><div style="float: left;" id="st_fg_min"></div><div style="float: left; margin-left: 5px;" id="st_fg_max"></div></td>
-        <td style="vertical-align: top; float: right; padding: 3px;">Koolzuur vol:</td>
-        <td style="padding: 3px;"><div style="float: left;" id="st_carb_min"></div><div style="float: left; margin-left: 5px;" id="st_carb_max"></div></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Bitterheid IBU:</td>
-        <td style="padding: 3px;"><div style="float: left;" id="st_ibu_min"></div><div style="float: left; margin-left: 5px;" id="st_ibu_max"></div></td>
-        <td style="vertical-align: top; float: right; padding: 3px;">Alcohol vol%:</td>
-        <td style="padding: 3px;"><div style="float: left;" id="st_abv_min"></div><div style="float: left; margin-left: 5px;" id="st_abv_max"></div></td>
-       </tr>
-       <tr>
-        <td align="right" style="vertical-align: top;">Profiel:</td>
-        <td align="left" colspan="3"><textarea readonly="1" id="st_profile"></textarea></td>
-       </tr>
-       <tr>
-        <td align="right" style="vertical-align: top;">Ingredienten:</td>
-        <td align="left" colspan="3"><textarea readonly="1" id="st_ingredients"></textarea></td>
-       </tr>
-       <tr>
-        <td align="right" style="vertical-align: top;">Voorbeelden:</td>
-        <td align="left" colspan="3"><textarea readonly="1" id="st_examples"></textarea></td>
-       </tr>
-      </table>
-     </div>
-     <div class="hint" id="hintStyle">
-     </div>
-     <div id="styleButtonsWrapper">
-      <input type="button" value="Terug" class="backButton" id="backButtonStyle" />
-      <input type="button" value="Volgende" class="nextButton" id="nextButtonStyle" />
-     </div>
-    </div>
-
-    <div class="section">
-     <div style="overflow: hidden; margin: 25px;"><br>
-      <p>Alle nodige gegevens zijn compleet.</p>
-      <p> Zodra je de "Volgende" toets gebruikt zal een nieuw recept aangemaakt worden en<br>
-      wordt het recept in de database gezet. Hierna kun je dat recept bewerken.</p>
-     </div>
-     <div id="completedButtonsWrapper">
-      <input type="button" value="Terug" id="backButtonCompleted" class="backButton" />
-      <input type="button" value="Volgende" class="nextButton" id="nextButtonCompleted" />
-     </div>
-    </div>
-   </div>
-
-<?php
-page_footer();
-?>
--- a/www/upl_recipe.php	Thu Aug 04 20:13:41 2022 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,714 +0,0 @@
-<?php
-require_once('config.php');
-require("version.php");
-require("includes/formulas.php");
-
-
-$target_dir = "tmp/";
-$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
-$uploadOk = 1;
-$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
-
-// Check if file already exists
-if (file_exists($target_file)) {
-	echo "Fout 1: bestand bestaat al. ";
-	$uploadOk = 0;
-}
-// Check file size
-if ($_FILES["fileToUpload"]["size"] > 500000 && $uploadOk) {
-	echo "Fout 2: het bestand is te groot. ";
-	$uploadOk = 0;
-}
-// Allow certain file formats
-if ($imageFileType != "xml" && $uploadOk) {
-	echo "Fout 3: alleen XML bestanden toegestaan. ";
-	$uploadOk = 0;
-}
-// Check if $uploadOk is set to 0 by an error
-if ($uploadOk == 0) {
-	exit;
-}
-
-if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
-	echo "Verwerken bestand ". basename( $_FILES["fileToUpload"]["name"]). "<br />";
-} else {
-	echo "Fout 4: er ging iets fout met de upload.";
-	exit;
-}
-
-
-$db = mysqli_connect(DBASE_HOST, DBASE_USER, DBASE_PASS, DBASE_NAME);
-if (! $db) {
-	echo "Fout 5: ".mysqli_connect_errno()." ".mysqli_connect_error();
-	exit;
-}
-mysqli_set_charset($db, "utf8" );
-date_default_timezone_set('Europe/Amsterdam');
-
-
-$pCara = 0;
-$pSugar = 0;
-$svg = 77;
-$efficiency = 75;
-$batch_size = 20;
-$colorw = 0;
-$f_sugars = 0;
-
-
-
-function get_miscs_cost($miscname) {
-	global $db;
-
-	if ($result = mysqli_query($db, "SELECT cost FROM inventory_miscs WHERE name='$miscname'")) {
-		if ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
-			return floatval($row['cost']);
-		}
-	}
-	return 0.0;
-}
-
-
-
-function recipe_style($recipe)
-{
-	global  $db;
-
-	if ($recipe->STYLE->NAME)
-		$sql  = "', st_name='" . mysqli_real_escape_string($db, $recipe->STYLE->NAME);
-	if ($recipe->STYLE->STYLE_LETTER)
-		$sql .= "', st_letter='" . mysqli_real_escape_string($db, $recipe->STYLE->STYLE_LETTER);
-	if ($recipe->STYLE->STYLE_GUIDE) {
-		if ($recipe->STYLE->STYLE_GUIDE == "Biertypengids Derek Walsh") {
-			$sql .= "', st_guide='BKG 2019";
-		} else if ($recipe->STYLE->STYLE_GUIDE == "BKG Biertypen") {
-			$sql .= "', st_guide='BKG 2019";
-		} else if ($recipe->STYLE->STYLE_GUIDE == "BKG 2015") {
-			$sql .= "', st_guide='BKG 2019";
-		} else {
-			$sql .= "', st_guide='" . mysqli_real_escape_string($db, $recipe->STYLE->STYLE_GUIDE);
-		}
-	} else {
-		$sql .= "', st_guide='BKG 2019";
-	}
-	if ($recipe->STYLE->CATEGORY)
-		$sql .= "', st_category='" . mysqli_real_escape_string($db, $recipe->STYLE->CATEGORY);
-	if ($recipe->STYLE->CATEGORY_NUMBER)
-		$sql .= "', st_category_number='" . floatval($recipe->STYLE->CATEGORY_NUMBER);
-	else
-		$sql .= "', st_category_number='0";
-	if ($recipe->STYLE->TYPE == 'Lager')
-		$sql .= "', st_type='0";
-	else if (($recipe->STYLE->TYPE == 'Ale') || ($recipe->STYLE->TYPE == 'Strong Ale'))
-		$sql .= "', st_type='1";
-	else if ($recipe->STYLE->TYPE == 'Mead')
-		$sql .= "', st_type='2";
-	else if ($recipe->STYLE->TYPE == 'Wheat')
-		$sql .= "', st_type='3";
-	else if ($recipe->STYLE->TYPE == 'Mixed')
-		$sql .= "', st_type='4";
-	else if ($recipe->STYLE->TYPE == 'Cider')
-		$sql .= "', st_type='5";
-	else
-		echo "Unknown TYPE " . $recipe->STYLE->TYPE . "<br />";
-
-	if ($recipe->STYLE->OG_MIN)
-		$sql .= "', st_og_min='" . floatval($recipe->STYLE->OG_MIN);
-	if ($recipe->STYLE->OG_MAX)
-		$sql .= "', st_og_max='" . floatval($recipe->STYLE->OG_MAX);
-	if ($recipe->STYLE->FG_MIN)
-		$sql .= "', st_fg_min='" . floatval($recipe->STYLE->FG_MIN);
-	if ($recipe->STYLE->FG_MAX)
-		$sql .= "', st_fg_max='" . floatval($recipe->STYLE->FG_MAX);
-	if ($recipe->STYLE->IBU_MIN)
-		$sql .= "', st_ibu_min='" . floatval($recipe->STYLE->IBU_MIN);
-	if ($recipe->STYLE->IBU_MAX)
-		$sql .= "', st_ibu_max='" . floatval($recipe->STYLE->IBU_MAX);
-	if ($recipe->STYLE->COLOR_MIN) {
-		$srm = floatval($recipe->STYLE->COLOR_MIN);
-		$sql .= "', st_color_min='" . srm_to_ebc($srm);
-	}
-	if ($recipe->STYLE->COLOR_MAX) {
-		$srm = floatval($recipe->STYLE->COLOR_MAX);
-		$sql .= "', st_color_max='" . srm_to_ebc($srm);
-	}
-	if ($recipe->STYLE->CARB_MIN)
-		$sql .= "', st_carb_min='" . floatval($recipe->STYLE->CARB_MIN);
-	if ($recipe->STYLE->CARB_MAX)
-		$sql .= "', st_carb_max='" . floatval($recipe->STYLE->CARB_MAX);
-	if ($recipe->STYLE->ABV_MIN)
-		$sql .= "', st_abv_min='" . floatval($recipe->STYLE->ABV_MIN);
-	if ($recipe->STYLE->ABV_MAX)
-		$sql .= "', st_abv_max='" . floatval($recipe->STYLE->ABV_MAX);
-	return $sql;
-}
-
-
-
-function recipe_fermentables($recipe)
-{
-	global  $db;
-	global  $pCara;
-	global  $pSugar;
-	global  $batch_size;
-	global  $efficiency;
-	global  $colorw;
-	global  $f_sugars;
-
-	$fermentables = "[";
-	$comma = FALSE;
-	foreach ($recipe->FERMENTABLES->FERMENTABLE as $fermentable) {
-		if ($comma)
-			$fermentables .= ',';
-		$comma = TRUE;
-		$fermentables .= '{"f_name":"' . mysqli_real_escape_string($db, $fermentable->NAME) . '"';
-		$fermentables .= ',"f_origin":"' . mysqli_real_escape_string($db, $fermentable->ORIGIN) . '"';
-		$fermentables .= ',"f_supplier":"' . mysqli_real_escape_string($db, $fermentable->SUPPLIER) . '"';
-		$famount = floatval($fermentable->AMOUNT);
-		$fermentables .= ',"f_amount":' . $famount;
-		$fermentables .= ',"f_cost":' . floatval($fermentable->COST);
-
-		if ($fermentable->TYPE == 'Grain')
-			$fermentables .= ',"f_type":0';
-		else if ($fermentable->TYPE == 'Sugar')
-			$fermentables .= ',"f_type":1';
-		else if ($fermentable->TYPE == 'Extract')
-			$fermentables .= ',"f_type":2';
-		else if (($fermentable->TYPE == 'Dry extract') || ($fermentable->TYPE == 'Dry Extract'))
-			$fermentables .= ',"f_type":3';
-		else if ($fermentable->TYPE == 'Adjunct')
-			$fermentables .= ',"f_type":4';
-		else
-			echo "Unknown TYPE " . $fermentable->TYPE . "<br / >";
-
-		$fyield = floatval($fermentable->YIELD);
-		$fermentables .= ',"f_yield":' . $fyield;
-		if ($fermentable->COLOR) {
-			$srm = floatval($fermentable->COLOR);
-			$ebc = srm_to_ebc($srm);
-		} else {
-			$srm = 0;
-			$ebc = 0;
-		}
-		$colorw += ($famount * $srm / $batch_size) * 8.34436;   /* Kleurwerking */
-		$fermentables .= ',"f_color":' . $ebc;
-		if ($fermentable->COARSE_FINE_DIFF)
-			$fermentables .= ',"f_coarse_fine_diff":' . floatval($fermentable->COARSE_FINE_DIFF);
-		else
-			$fermentables .= ',"f_coarse_fine_diff":0';
-		if ($fermentable->MOISTURE)
-			$fmoisture = floatval($fermentable->MOISTURE);
-		else
-			$fmoisture = 0;
-		$fermentables .= ',"f_moisture":' . $fmoisture;
-		if ($fermentable->DIASTATIC_POWER)
-			$fermentables .= ',"f_diastatic_power":' . floatval($fermentable->DIASTATIC_POWER);
-		else
-			$fermentables .= ',"f_diastatic_power":0';
-		if ($fermentable->PROTEIN)
-			$fermentables .= ',"f_protein":' . floatval($fermentable->PROTEIN);
-		else
-			$fermentables .= ',"f_protein":0';
-		if ($fermentable->MAX_IN_BATCH)
-			$fermentables .= ',"f_max_in_batch":' . floatval($fermentable->MAX_IN_BATCH);
-		else
-			$fermentables .= ',"f_max_in_batch":100.0';
-
-		if ($fermentable->GRAINTYPE == 'Roast')
-			$fermentables .= ',"f_graintype":1';
-		else if ($fermentable->GRAINTYPE == 'Crystal')
-			$fermentables .= ',"f_graintype":2';
-		else if ($fermentable->GRAINTYPE == 'Kilned')
-			$fermentables .= ',"f_graintype":3';
-		else if (($fermentable->GRAINTYPE == 'Sour malt') || ($fermentable->GRAINTYPE == 'Sour Malt'))
-			$fermentables .= ',"f_graintype":4';
-		else if ($fermentable->GRAINTYPE == 'Special')
-			$fermentables .= ',"f_graintype":5';
-		else if (($fermentable->GRAINTYPE == 'No malt') || ($fermentable->GRAINTYPE == 'No Malt'))
-			$fermentables .= ',"f_graintype":6';
-		else
-			$fermentables .= ',"f_graintype":0'; // Base, default
-
-		if ($fermentable->ADDED == 'Boil')
-			$fermentables .= ',"f_added":1';
-		else if ($fermentable->ADDED == 'Fermentation')
-			$fermentables .= ',"f_added":2';
-		else if ($fermentable->ADDED == 'Lagering')
-			$fermentables .= ',"f_added":3';
-		else if ($fermentable->ADDED == 'Bottle')
-			$fermentables .= ',"f_added":4';
-		else
-			$fermentables .= ',"f_added":0'; // Mash, default.
-
-		($fermentable->ADD_AFTER_BOIL== "TRUE") ? $fermentables .= ',"f_add_after_boil":1' : $fermentables .= ',"f_add_after_boil":0';
-		($fermentable->RECOMMEND_MASH== "TRUE") ? $fermentables .= ',"f_recommend_mash":1' : $fermentables .= ',"f_recommend_mash":0';
-		if ($fermentable->DISSOLVED_PROTEIN)
-			$fermentables .= ',"f_dissolved_protein":' . floatval($fermentable->DISSOLVED_PROTEIN);
-		else
-			$fermentables .= ',"f_dissolved_protein":0';
-		($fermentable->ADJUST_TO_TOTAL_100 == "TRUE") ? $fermentables .= ',"f_adjust_to_total_100":1' : $fermentables .= ',"f_adjust_to_total_100":0';
-		$percent = floatval($fermentable->PERCENTAGE);
-		$fermentables .= ',"f_percentage":' . round($percent * 10) / 10.0;
-		if ($fermentable->DI_pH)
-			$fermentables .= ',"f_di_ph":' . floatval($fermentable->DI_pH);
-		else
-			$fermentables .= ',"f_di_ph":0.0';
-		if ($fermentable->{'ACID_TO_pH_5.7'})
-			$fermentables .= ',"f_acid_to_ph_57":' . floatval($fermentable->{'ACID_TO_pH_5.7'});
-		else
-			$fermentables .= ',"f_acid_to_ph_57":0.0';
-		$fermentables .= "}";
-
-		/* Sugars */
-		$d = $famount * ($fyield / 100) * (1 - $fmoisture / 100);
-		if ($fermentable->ADDED == 'Mash')
-			$d = floatval($efficiency) / 100 * $d;
-		$f_sugars += $d;
-		if ($fermentable->GRAINTYPE == 'Crystal')
-			$pCara += $percent;
-		if ($fermentable->TYPE == 'Sugar')
-			$pSugar += $percent;
-	}
-	$fermentables .= ']';
-	return $fermentables;
-}
-
-
-
-function recipe_hops($recipe)
-{
-	global  $db;
-
-	$hops = "[";
-	$comma = FALSE;
-	foreach ($recipe->HOPS->HOP as $hop) {
-		if ($comma)
-			$hops .= ',';
-		$comma = TRUE;
-		$hops .= '{"h_name":"' . mysqli_real_escape_string($db, $hop->NAME) . '"';
-		$hops .= ',"h_amount":' . floatval($hop->AMOUNT);
-		$hops .= ',"h_cost":' . floatval($hop->COST);
-
-		if ($hop->TYPE == 'Aroma')
-			$hops .= ',"h_type":1';
-		else if ($hop->TYPE == 'Both')
-			$hops .= ',"h_type":2';
-		else
-			$hops .= ',"h_type":0'; // Default bittering
-
-		if ($hop->FORM == 'Pellet')
-			$hops .= ',"h_form":0';
-		else if ($hop->FORM == 'Plug')
-			$hops .= ',"h_form":1';
-		else
-			$hops .= ',"h_form":2'; // Default.
-
-		if ($hop->USE == 'Mash')
-			$hops .= ',"h_useat":0';
-		else if (($hop->USE == 'First wort') || ($hop->USE == 'First Wort'))
-			$hops .= ',"h_useat":1';
-		else if ($hop->USE == 'Aroma')
-			$hops .= ',"h_useat":3';
-		else if ($hop->USE == 'Whirlpool')
-			$hops .= ',"h_useat":4';
-		else if (($hop->USE == 'Dry hop') || ($hop->USE == 'Dry Hop'))
-			$hops .= ',"h_useat":5';
-		else
-			$hops .= ',"h_useat":2'; // Default boil.
-
-		if ($hop->TIME)
-			$hops .= ',"h_time":' . floatval($hop->TIME);
-		else
-			$hops .= ',"h_time":0';
-		$hops .= ',"h_alpha":' . floatval($hop->ALPHA);
-		$hops .= ',"h_beta":' . floatval($hop->BETA);
-		$hops .= ',"h_hsi":' . floatval($hop->HSI);
-		$hops .= ',"h_humulene":' . floatval($hop->HUMULENE);
-		$hops .= ',"h_caryophyllene":' . floatval($hop->CAROPHYLLENE);
-		$hops .= ',"h_cohumulone":' . floatval($hop->COHUMULONE);
-		$hops .= ',"h_myrcene":' . floatval($hop->MYRCENE);
-		if ($hop->TOTAL_OIL)
-			$hops .= ',"h_total_oil":' . floatval($hop->TOTAL_OIL);
-		else
-			$hops .= ',"h_total_oil":0';
-		if ($hop->ORIGIN)
-			$hops .= ',"h_origin":"' . mysqli_real_escape_string($db, $hop->ORIGIN) . '"';
-		else
-			$hops .= ',"h_origin":""';
-		$hops .= "}";
-	}
-	$hops .= ']';
-	return $hops;
-}
-
-
-
-function recipe_miscs($recipe)
-{
-	global  $db;
-
-	$miscs = "[";
-	$comma = FALSE;
-	foreach ($recipe->MISCS->MISC as $misc) {
-		if ($comma)
-			$miscs .= ',';
-		$comma = TRUE;
-		$mname = mysqli_real_escape_string($db, $misc->NAME);
-		$miscs .= '{"m_name":"' . $mname . '"';
-		$miscs .= ',"m_amount":' . floatval($misc->AMOUNT);
-		if ($misc->COST) {
-			$miscs .= ',"m_cost":' . floatval($misc->COST);
-		} else {
-			/* Brouwhulp bug, added water agents have no cost field. */
-			if (($misc->TYPE == "Water agent") || ($misc->TYPE == "Water Agent")) {
-				$miscs .= ',"m_cost":'. get_miscs_cost($mname);
-			} else {
-				$miscs .= ',"m_cost":0';
-			}
-		}
-
-		if ($misc->TYPE == 'Spice')
-			$miscs .= ',"m_type":0';
-		else if ($misc->TYPE == 'Herb')
-			$miscs .= ',"m_type":1';
-		else if ($misc->TYPE == 'Flavor')
-			$miscs .= ',"m_type":2';
-		else if ($misc->TYPE == 'Fining')
-			$miscs .= ',"m_type":3';
-		else if (($misc->TYPE == 'Water agent') || ($misc->TYPE == 'Water Agent'))
-			$miscs .= ',"m_type":4';
-		else if (($misc->TYPE == 'Yeast nutrient') || ($misc->TYPE == 'Yeast Nutrient'))
-			$miscs .= ',"m_type":5';
-		else if ($misc->TYPE == 'Other')
-			$miscs .= ',"m_type":6';
-		else
-			echo "Unknown TYPE " . $misc->TYPE . "<br />";
-
-		if ($misc->USE == 'Starter')
-			$miscs .= ',"m_use_use":0';
-		else if ($misc->USE == 'Mash')
-			$miscs .= ',"m_use_use":1';
-		else if ($misc->USE == 'Primary')
-			$miscs .= ',"m_use_use":3';
-		else if ($misc->USE == 'Secondary')
-			$miscs .= ',"m_use_use":4';
-		else if ($misc->USE == 'Bottling')
-			$miscs .= ',"m_use_use":5';
-		else
-			$miscs .= ',"m_use_use":2'; // Default boil. BrewFather defines 'Sparge', we don't support this even if it's a nice idea.
-
-		($misc->AMOUNT_IS_WEIGHT== "TRUE") ? $miscs .= ',"m_amount_is_weight":1' : $miscs.= ',"m_amount_is_weight":0';
-		if ($misc->TIME) {
-			$miscs .= ',"m_time":' . floatval($misc->TIME);
-		} else
-			$miscs .= ',"m_time":0';
-		$miscs .= "}";
-	}
-	$miscs .= ']';
-	return $miscs;
-}
-
-
-
-function recipe_yeasts($recipe)
-{
-	global  $db;
-	global  $svg;
-
-	$yeasts = "[";
-	$comma = FALSE;
-	foreach ($recipe->YEASTS->YEAST as $yeast) {
-		if ($comma)
-			$yeasts .= ',';
-		$comma = TRUE;
-		$yeasts .= '{"y_name":"' . mysqli_real_escape_string($db, $yeast->NAME) . '"';
-		if ($yeast->FORM == "Liquid") {
-			$paks = floatval($yeast->AMOUNT) / 0.0588;
-		$yeasts .= ',"y_amount":' . $paks;
-			$yeasts .= ',"y_cost":' . floatval($yeast->COST);
-		} else {
-			$yeasts .= ',"y_amount":' . floatval($yeast->AMOUNT);
-			$yeasts .= ',"y_cost":' . floatval($yeast->COST) * 1000;
-		}
-
-		$yeasts .= ',"y_laboratory":"' . mysqli_real_escape_string($db, $yeast->LABORATORY) . '"';
-		$yeasts .= ',"y_product_id":"' . mysqli_real_escape_string($db, $yeast->PRODUCT_ID) . '"';
-
-		if ($yeast->TYPE == 'Lager')
-			$yeasts .= ',"y_type":0';
-		else if ($yeast->TYPE == 'Ale')
-			$yeasts .= ',"y_type":1';
-		else if ($yeast->TYPE == 'Wheat')
-			$yeasts .= ',"y_type":2';
-		else if ($yeast->TYPE == 'Wine')
-			$yeasts .= ',"y_type":3';
-		else if ($yeast->TYPE == 'Champagne')
-			$yeasts .= ',"y_type":4';
-		else
-			echo "Unknown TYPE " . $yeast->TYPE . "<br />";
-
-		if ($yeast->FORM == 'Liquid') {
-			if ($yeast->LABORATORY == 'Imperial Yeast')
-				$yeasts .= ',"y_form":0,"y_cells":200000000000';
-			else
-				$yeasts .= ',"y_form":0,"y_cells":100000000000';
-		} else if ($yeast->FORM == 'Dry')
-			$yeasts .= ',"y_form":1,"y_cells":15000000000';
-		else if ($yeast->FORM == 'Slant')
-			$yeasts .= ',"y_form":2,"y_cells":1700000000';
-		else if ($yeast->FORM == 'Culture')
-			$yeasts .= ',"y_form":3,"y_cells":1700000000';
-		else if ($yeast->FORM == 'Frozen')
-			$yeasts .= ',"y_form":4,"y_cells":1700000000';
-		else if ($yeast->FORM == 'Bottle')
-			$yeasts .= ',"y_form":5,"y_cells":1700000000';
-		else
-			echo "Unknown FORM " . $yeast->FORM . "<br />";
-
-		if ($yeast->FLOCCULATION == 'Medium')
-			$yeasts .= ',"y_flocculation":1';
-		else if ($yeast->FLOCCULATION == 'High')
-			$yeasts .= ',"y_flocculation":2';
-		else if ($yeast->FLOCCULATION == 'Very high')
-			$yeasts .= ',"y_flocculation":3';
-		else
-			$yeasts .= ',"y_flocculation":0'; // Low, default.
-
-		if ($yeast->PRODUCT_ID=="F2" || $yeast->PRODUCT_ID=="CBC-1") {
-			$yeasts .= ',"y_use":3';        // Bottle
-		} else if ($yeast->ADD_TO_SECONDARY=="TRUE") {
-			$yeasts .= ',"y_use":1';        // Secondary
-		} else {
-			$yeasts .= ',"y_use":0';        // Primary
-			$svg = floatval($yeast->ATTENUATION);
-		}
-		$yeasts .= ',"y_min_temperature":' . floatval($yeast->MIN_TEMPERATURE);
-		$yeasts .= ',"y_max_temperature":' . floatval($yeast->MAX_TEMPERATURE);
-		$yeasts .= ',"y_attenuation":' . floatval($yeast->ATTENUATION);
-		$yeasts .= "}";
-	}
-	$yeasts .= ']';
-	return $yeasts;
-}
-
-
-
-function recipe_waters($recipe, $db)
-{
-	$waters = "";
-	$index = 0;
-	foreach ($recipe->WATERS->WATER as $water) {
-		$index++;
-		$waters .= "', w" . $index . "_name='" . mysqli_real_escape_string($db, $water->NAME);
-		$waters .= "', w" . $index . "_amount='" . floatval($water->AMOUNT);
-		if ($water->CALCIUM)
-			$waters .= "', w" . $index . "_calcium='" . floatval($water->CALCIUM);
-		if ($water->SULFATE)
-			$waters .= "', w" . $index . "_sulfate='" . floatval($water->SULFATE);
-		if ($water->CHLORIDE)
-			$waters .= "', w" . $index . "_chloride='" . floatval($water->CHLORIDE);
-		if ($water->SODIUM)
-			$waters .= "', w" . $index . "_sodium='" . floatval($water->SODIUM);
-		if ($water->MAGNESIUM)
-			$waters .= "', w" . $index . "_magnesium='" . floatval($water->MAGNESIUM);
-		if ($water->PH)
-			$waters .= "', w" . $index . "_ph='" . floatval($water->PH);
-		if ($water->TOTAL_ALKALINITY)
-			$waters .= "', w" . $index . "_total_alkalinity='" . floatval($water->TOTAL_ALKALINITY);
-		if ($water->COST)
-			$waters .= "', w" . $index . "_cost='" . floatval($water->COST);
-		else
-			$waters .= "', w" . $index . "_cost='0";
-	}
-	return $waters;
-}
-
-
-
-function recipe_mash_steps($recipe)
-{
-	global  $db;
-
-	$steps = '[';
-	$comma = FALSE;
-	foreach ($recipe->MASH->MASH_STEPS->MASH_STEP as $step) {
-		if ($comma)
-			$steps .= ',';
-		$comma = TRUE;
-		$steps .= '{"step_name":"' . mysqli_real_escape_string($db, $step->NAME) . '"';
-
-		if ($step->TYPE == 'Infusion')
-			$steps .= ',"step_type":0';
-		else if ($step->TYPE == 'Temperature')
-			$steps .= ',"step_type":1';
-		else if ($step->TYPE == 'Decoction')
-			$steps .= ',"step_type":2';
-		else
-			echo "Unknown step TYPE " . $step->TYPE . "<br />";
-
-		if ($step->INFUSE_AMOUNT)
-			$steps .= ',"step_infuse_amount":' . floatval($step->INFUSE_AMOUNT);
-		else
-			$steps .= ',"step_infuse_amount":0';
-		if ($step->STEP_TEMP)
-			$steps .= ',"step_temp":' . floatval($step->STEP_TEMP);
-		if ($step->STEP_TIME)
-			$steps .= ',"step_time":' . floatval($step->STEP_TIME);
-		if ($step->RAMP_TIME)
-			$steps .= ',"ramp_time":' . floatval($step->RAMP_TIME);
-		if ($step->END_TEMP)
-			$steps .= ',"end_temp":' . floatval($step->END_TEMP);
-		$steps .= "}";
-	}
-	$steps .= ']';
-	return $steps;
-}
-
-
-$imported = 0;
-$recipes = simplexml_load_file($target_file);
-foreach ($recipes->RECIPE as $recipe) {
-	$f_sugars = 0;
-	$efficiency = 75;
-	$batch_size = 20;
-	$boil_size = 22;
-	$pCara = 0;
-	$pSugar = 0;
-	$svg = 77;
-	$colorw = 0;
-	$uuid = str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid'));
-
-	$sql  = "INSERT INTO recipes SET uuid='" . $uuid;
-	$sql .= "', name='" . mysqli_real_escape_string($db, $recipe->NAME);
-	$sql .= "', locked='0";
-	if ($recipe->NOTES)
-		$sql .= "', notes='" . mysqli_real_escape_string($db, $recipe->NOTES);
-	else
-		$sql .= "', notes='";
-
-	if ($recipe->TYPE == 'Extract')
-		$sql .= "', type='0";
-	else if ($recipe->TYPE == 'Partial Mash')
-		$sql .= "', type='1";
-	else if ($recipe->TYPE == 'All Grain')
-		$sql .= "', type='2";
-	else
-		echo "Unknown TYPE " . $recipe->TYPE . "<br />";
-
-	if ($recipe->BATCH_SIZE)
-		$batch_size = floatval($recipe->BATCH_SIZE);
-	$sql .= "', batch_size='" . $batch_size;
-	if ($recipe->BOIL_SIZE)
-		$boil_size = floatval($recipe->BOIL_SIZE);
-	$sql .= "', boil_size='" . $boil_size;
-	if ($recipe->BOIL_TIME)
-		$sql .= "', boil_time='" . floatval($recipe->BOIL_TIME);
-	else
-		$sql .= "', boil_time='90";
-	if ($recipe->EFFICIENCY)
-		$efficiency = floatval($recipe->EFFICIENCY);
-	$sql .= "', efficiency='" . $efficiency;
-
-	$color_method = 0; // Morey
-	if ($recipe->COLOR_METHOD == 'Mosher') {
-		$color_method = 1;
-	} else if ($recipe->COLOR_METHOD == 'Daniels') {
-		$color_method = 2;
-	}
-	$sql .= "', color_method='" . $color_method;;
-
-
-	if ($recipe->IBU)
-		$sql .= "', est_ibu='" . floatval($recipe->IBU);
-	if ($recipe->IBU_METHOD == 'Rager')
-		$sql .= "', ibu_method='1";
-	else if ($recipe->IBU_METHOD == 'Daniels')
-		$sql .= "', ibu_method='2";
-	else
-		$sql .= "', ibu_method='0";  // Tinseth, default
-
-	if ($recipe->CARBONATION)
-		$sql .= "', est_carb='" . floatval($recipe->CARBONATION);
-
-	if ($recipe->STYLE) {
-		$sql .= recipe_style($recipe);
-	}
-	if ($recipe->CALC_ACID) {
-		($recipe->CALC_ACID == "TRUE") ? $sql .= "', calc_acid='1" : $sql .= "', calc_acid='0";
-	}
-	if ($recipe->TARGET_PH) {
-		$sql .= "', mash_ph='" . floatval($recipe->TARGET_PH);
-	}
-	if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Lactic")) {
-		$sql .= "', sparge_acid_type='0";
-	} else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Hydrochloric")) {
-		$sql .= "', sparge_acid_type='1";
-	} else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Phosphoric")) {
-		$sql .= "', sparge_acid_type='2";
-	} else if ($recipe->SPARGE_ACID_TYPE && ($recipe->SPARGE_ACID_TYPE == "Sulfuric")) {
-		$sql .= "', sparge_acid_type='3";
-	}
-	if ($recipe->ACID_SPARGE_PERC) {
-		$sql .= "', sparge_acid_perc='" . floatval($recipe->ACID_SPARGE_PERC);
-	}
-	if ($recipe->LACTIC_SPARGE) {
-		$sql .= "', sparge_acid_amount='" . floatval($recipe->LACTIC_SPARGE);
-	}
-	if ($recipe->VOLUME_HLT) {
-		$sql .= "', sparge_volume='" . floatval($recipe->VOLUME_HLT);
-	}
-	$sql .= "', sparge_source='0";
-
-	/*
-	 * Put all ingredients in json arrays
-	 */
-	if ($recipe->FERMENTABLES)
-		$sql .= "', json_fermentables='" . recipe_fermentables($recipe);
-	if ($recipe->HOPS)
-		$sql .= "', json_hops='" . recipe_hops($recipe);
-	if ($recipe->MISCS)
-		$sql .= "', json_miscs='" . recipe_miscs($recipe);
-	if ($recipe->YEASTS)
-		$sql .= "', json_yeasts='" . recipe_yeasts($recipe);
-	if ($recipe->WATERS)
-		$sql .= recipe_waters($recipe, $db);
-	if ($recipe->MASH) {
-		$sql .= "',sparge_temp='" . floatval($recipe->MASH->SPARGE_TEMP);
-		$sql .= "',sparge_ph='" . floatval($recipe->MASH->PH);
-		if ($recipe->MASH->NAME)
-			$sql .= "',mash_name='" . mysqli_real_escape_string($db, $recipe->MASH->NAME);
-		if ($recipe->MASH->MASH_STEPS)
-			$sql .= "', json_mashs='" . recipe_mash_steps($recipe);
-	}
-
-	/*
-	 * Added the calculated values
-	 *  OG, FG, color, IBU
-	 */
-	$og = estimate_sg($f_sugars, $batch_size);
-	$sql .= "', est_og='" . floatval($og);
-	$fg = estimate_fg($pSugar, $pCara, 0, 0, 0, $svg, $og);
-	$sql .= "', est_fg='" . floatval($fg);
-	$abv = abvol($og, $fg);
-	$sql .= "', est_abv='" . floatval($abv);
-	$color = kw_to_ebc($color_method, $colorw);
-	$sql .= "', est_color='" . floatval($color);
-	$sql .= "';";
-	if (! $result = mysqli_query($db, $sql)) {
-		echo "Fout 6: " . mysqli_error($db) . "<br />";
-		syslog(LOG_NOTICE, "upl_recipe: result: ".mysqli_error($db));
-	} else {
-		echo "Recept `" . $recipe->NAME . "' toegevoegd<br />";
-		$lastid = mysqli_insert_id($db);
-		syslog(LOG_NOTICE, "upl_recipe: inserted record ".$lastid);
-	}
-	$imported++;
-}
-if ($imported == 0) {
-	echo "Fout 7: geen recepten in dit bestand.<br />";
-}
-
-
-// Don't clutter the upload directory.
-unlink($target_file);
-
-?>

mercurial