# HG changeset patch # User Michiel Broek # Date 1659637945 -7200 # Node ID d286bf289d45c854f2ea99c0720cdac09ab5679d # Parent 4e3409cfd2b14e3d96b5705464d5f7eee0a6b2ba Remove unneeded scripts diff -r 4e3409cfd2b1 -r d286bf289d45 www/Makefile --- 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/* diff -r 4e3409cfd2b1 -r d286bf289d45 www/includes/global.inc.php --- 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 @@ * @@ -228,17 +228,8 @@
  • Start nieuw
  • -
  • Recepten - -
  • -
  • Over - -
  • +
  • Recepten
  • +
  • Over
  • diff -r 4e3409cfd2b1 -r d286bf289d45 www/js/rec_import.js --- 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 - * - * 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', '' + event.type + ': ' + fileName + ' size: ' + fileSize + '
    '); - }); - $('#jqxFileUpload').on('uploadEnd', function(event) { - var args = event.args, - fileName = args.file, - serverResponce = args.response; - $('#eventsPanel').jqxPanel('append', '' + event.type + ': ontvangen ' + fileName + '
    ' + serverResponce + '
    '); - }); - -}); diff -r 4e3409cfd2b1 -r d286bf289d45 www/js/rec_new.js --- 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 - * - * 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('' + message + ''); - }, - - //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.
    '; - } - // Check if name already exists. - if (type.length < 1) { - message += 'Je moet een brouw type kiezen.
    '; - } - if ((boil_time < 4) || (boil_time > 360)) { - message += 'De kooktijd moet tussen 4 en 360 minuten zijn.
    '; - } - if ((est_og < 1.010) || (est_og > 1.200)) { - message += 'Het OG moet tussen 1.010 en 1.200 zijn.
    '; - } - if ((efficiency < 35) || (efficiency > 95)) { - message += 'Het brouwzaal rendement moet tussen 35 en 95 zijn.
    '; - } - 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.
    '; - } - 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(); -}); - diff -r 4e3409cfd2b1 -r d286bf289d45 www/rec_import.php --- 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 @@ - - -
    -
    -
    Recept beerxml bestand upload.

    -
    -
    -
    -
    - - diff -r 4e3409cfd2b1 -r d286bf289d45 www/rec_new.php --- 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 @@ - - -
    -
      -
    • Recept basis
    • -
    • Bierstijl
    • -
    • Overzicht
    • -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    Recept naam:
    Opmerkingen:
    Brouw type:
    Start SG:
    Kooktijd minuten:
    Brouwzaal rendement %:
    -
    -
    -
    -
    - -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Kies stijl:
    Stylenlijst
    Bier stijl:Bier groep:
    Type:Stijl gids:
    Categorie:Categorie nummer:
    Opmerkingen:
    Begin SG:
    Kleur EBC:
    Eind SG:
    Koolzuur vol:
    Bitterheid IBU:
    Alcohol vol%:
    Profiel:
    Ingredienten:
    Voorbeelden:
    -
    -
    -
    -
    - - -
    -
    - -
    -

    -

    Alle nodige gegevens zijn compleet.

    -

    Zodra je de "Volgende" toets gebruikt zal een nieuw recept aangemaakt worden en
    - wordt het recept in de database gezet. Hierna kun je dat recept bewerken.

    -
    -
    - - -
    -
    -
    - - diff -r 4e3409cfd2b1 -r d286bf289d45 www/upl_recipe.php --- 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 @@ - 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"]). "
    "; -} 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 . "
    "; - - 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 . "
    "; - - $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 . "
    "; - - 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 . "
    "; - - 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 . "
    "; - - 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 . "
    "; - - 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 . "
    "; - - 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) . "
    "; - syslog(LOG_NOTICE, "upl_recipe: result: ".mysqli_error($db)); - } else { - echo "Recept `" . $recipe->NAME . "' toegevoegd
    "; - $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.
    "; -} - - -// Don't clutter the upload directory. -unlink($target_file); - -?>