Stabilizing trunk so that development can continue.

* Removed check_mobile include which was crashing pages like the admin section (it was previously added to functions.inc.php)
* Fixed ABV display in lists
* Fixed bitterness calculations.
* Removed call-time pass-by-reference in BeerXML parser, since it is no longer supported by PHP
This commit is contained in:
George Hotelling
2012-08-11 15:08:49 +00:00
parent 0ebad02de1
commit 5d6bdd07aa
35 changed files with 189 additions and 184 deletions

View File

@@ -1,12 +1,11 @@
<?php
require ('../../paths.php');
require_once (CONFIG.'config.php');
include ('../../includes/check_mobile.inc.php');
include ('../../includes/functions.inc.php');
include ('../../includes/url_variables.inc.php');
include ('../../includes/db_connect_log.inc.php');
include ('../../includes/url_variables.inc.php');
include ('../../includes/db_connect_universal.inc.php');
include ('../../includes/plug-ins.inc.php');
$page = "icons";
$imageSrc = "../../images/";

View File

@@ -5,12 +5,15 @@ $imageSrc = "../images/";
require ('../paths.php');
require_once (CONFIG.'config.php');
require (INCLUDES.'authentication.inc.php'); session_start(); sessionAuthenticate();
include (INCLUDES.'check_mobile.inc.php');
//override various default settings with GET parameters, if they exist
include (INCLUDES.'url_variables.inc.php');
include (INCLUDES.'db_connect_universal.inc.php');
include (INCLUDES.'db_connect_admin.inc.php');
include (INCLUDES.'plug-ins.inc.php');
include (INCLUDES.'version.inc.php');
include_once (ADMIN_INCLUDES.'constants.inc.php');
include (INCLUDES.'functions.inc.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

View File

@@ -1,57 +1,57 @@
<?php
/**
* Module: bitterness.lib.php
* Description: This library includes functions necessary for performing IBU
* calculations. Included formulas are: Tinseth, Garetz, Rager
* and Daniels.
*/
/**
* Module: bitterness.lib.php
* Description: This library includes functions necessary for performing IBU
* calculations. Included formulas are: Tinseth, Garetz, Rager
* and Daniels.
*/
/*
$pelletFactor represents the utilization difference between
pellets and whole/plug hops. Depending on the
utilization formula used, this value is either
multiplied or divided with the result. For example,
the Tinseth formula is based on whole hops so we need
to multiply the result of the formula with this factor
to produce a result for pellet hops.
/*
$pelletFactor represents the utilization difference between
pellets and whole/plug hops. Depending on the
utilization formula used, this value is either
multiplied or divided with the result. For example,
the Tinseth formula is based on whole hops so we need
to multiply the result of the formula with this factor
to produce a result for pellet hops.
Hop Union has published data suggesting a 5% - 7% difference
in utilization between whole and pellet (Type 90) hops.
Most modern data I've seen supports this range. The 15%
delta value is a left-over from the old days and appears to
have been based on speculation at that time.
Leaf, whole and plug can all be considered the same thing as
there's little difference between whole/leaf and plug, if
any.
- Kevin
*/
Hop Union has published data suggesting a 5% - 7% difference
in utilization between whole and pellet (Type 90) hops.
Most modern data I've seen supports this range. The 15%
delta value is a left-over from the old days and appears to
have been based on speculation at that time.
Leaf, whole and plug can all be considered the same thing as
there's little difference between whole/leaf and plug, if
any.
- Kevin
*/
$pelletFactor = $row_pref['hopPelletFactor'];
/* --------------------------- Tinseth Method ---------------------------
Reference: Tinseth, Glenn. www.realbeer.com/hops, 1995-1999.
Default form: whole
Tinseth based all of his data to produce this formula on whole
hops; Therefore, we produce the IBU result for whole hops first
and then apply the pelletFactor if needed for pellets.
IBUs = decimal alpha acid utilization * mg/l of added alpha acids
metric
mg/l of added alpha acids = decimal AA rating * grams hops * 1000
-------------------------------------
liters of wort
non-metric
mg/l of added alpha acids = decimal AA rating * ozs hops * 7490
-------------------------------------
gallons of wort
Decimal Alpha Acid Utilization = Bigness Factor * Boil Time Factor
$form = ('pellet' || any other value is treated as whole/leaf/plug)
$units = ('metric' || 'us')
*/
/* --------------------------- Tinseth Method ---------------------------
Reference: Tinseth, Glenn. www.realbeer.com/hops, 1995-1999.
Default form: whole
Tinseth based all of his data to produce this formula on whole
hops; Therefore, we produce the IBU result for whole hops first
and then apply the pelletFactor if needed for pellets.
IBUs = decimal alpha acid utilization * mg/l of added alpha acids
metric
mg/l of added alpha acids = decimal AA rating * grams hops * 1000
-------------------------------------
liters of wort
non-metric
mg/l of added alpha acids = decimal AA rating * ozs hops * 7490
-------------------------------------
gallons of wort
Decimal Alpha Acid Utilization = Bigness Factor * Boil Time Factor
$form = ('pellet' || any other value is treated as whole/leaf/plug)
$units = ('metric' || 'us')
*/
function calc_bitter_tinseth($boilTime, $sg, $aa, $weight, $vol, $form, $units) {
global $pelletFactor;
@@ -120,8 +120,8 @@ function calc_bitter_rager($boilTime, $sg, $aa, $weight, $vol, $form, $units) {
else
$u = "0";
if ($gravity > 1.050)
$ga = (($gravity - 1.050) / .2);
if ($sg > 1.050)
$ga = (($sg - 1.050) / .2);
else
$ga = 0;
@@ -205,23 +205,23 @@ function calc_bitter_garetz($boilTime, $sg, $aa, $weight, $postBoilVol, $form, $
return $ibu;
}
/* ----------------------------- Daniels Method -----------------------------
Reference: Daniels, Ray. Designing Great Beers, Brewers
Publications, 2000.
Equation - U.S.:
IBU = Weight * Utilization % * Alpha % * 7,489
-------------------------------------------------
(Final Volume * (1 +[(Boil Time - 1.050) / 0.2)])
Equation - Metric:
IBU = Weight * Utilization % * Alpha % * 1,000
-------------------------------------------------
(Final Volume * (1 +[(Boil Time - 1.050) / 0.2)])
$form = ('pellet' || any other value is treated as whole/leaf/plug)
$units = ('metric' || 'us')
*/
/* ----------------------------- Daniels Method -----------------------------
Reference: Daniels, Ray. Designing Great Beers, Brewers
Publications, 2000.
Equation - U.S.:
IBU = Weight * Utilization % * Alpha % * 7,489
-------------------------------------------------
(Final Volume * (1 +[(Boil Time - 1.050) / 0.2)])
Equation - Metric:
IBU = Weight * Utilization % * Alpha % * 1,000
-------------------------------------------------
(Final Volume * (1 +[(Boil Time - 1.050) / 0.2)])
$form = ('pellet' || any other value is treated as whole/leaf/plug)
$units = ('metric' || 'us')
*/
function calc_bitter_daniels($boilTime, $sg, $aa, $weight, $vol, $form, $units) {
$f = ($units == "us") ? 7489 : 1000;
@@ -263,10 +263,10 @@ function calc_bitter_daniels($boilTime, $sg, $aa, $weight, $vol, $form, $units)
}
// Correct gravity
if ($gravity < 1.050)
if ($sg < 1.050)
$cGravity = 1;
else
$cGravity = 1 + (($gravity - 1.050) / 0.2);
$cGravity = 1 + (($sg - 1.050) / 0.2);
// Calculate
$ibu = ($weight * $u * ($aa * .01) * $f) / ($vol * $cGravity);

View File

@@ -3,16 +3,8 @@
// Bitterness Calculator //
//-----------------------//
// Load the library of bitterness formula functions
// The file_exists.. statement helps determine what our CWD is since the getcwd()
// function isn't entirely portable or may be disabled.
if (file_exists("bitterness.php")) {
require_once (ADMIN_LIBRARY.'bitterness.lib.php');
require_once (ADMIN_INCLUDES.'constants.inc.php');
} else {
require_once (ADMIN_LIBRARY.'bitterness.lib.php');
require_once (ADMIN_INCLUDES.'includes/constants.inc.php');
}
require_once (ADMIN_LIBRARY.'bitterness.lib.php');
require_once (ADMIN_INCLUDES.'constants.inc.php');
// This is the maximum number of hop entries we can
// process in this calculator.
@@ -34,53 +26,75 @@ if ($row_user['defaultBatchSize'] > 0) {
$DEFAULT_BATCH_SZ = 19;
}
$gravity = (isset($_POST['gravity']))?$_POST['gravity']:'';
if (($action == "calculate") || ($action == "entry")) {
// The $form variable and 'form' $_POST key are in reference to
// the format of the hops, i.e. whole/plug or pellet.
// It's easy to confuse this with fact that it's being
// submitted via an HTML form.
// @TODO: Format this form as $_POST['hops'][$i]['weight|aa|utilization|form'] so we can foreach over it
$submittedHops = 0;
for ($i = 0; $i < MAX_HOPS; $i++) {
$hopWeight[$i] = $_POST['hopWeight'][$i];
$hopAA[$i] = $_POST['hopAA'][$i];
$utilization[$i] = $_POST['utilization'][$i];
$form[$i] = $_POST['form'][$i];
if (isset($_POST['hopWeight'][$i])) {
$submittedHops = $i + 1;
}
$hopWeight[$i] = isset($_POST['hopWeight'][$i])?$_POST['hopWeight'][$i]:NULL;
$hopAA[$i] = isset($_POST['hopAA'][$i])?$_POST['hopAA'][$i]:NULL;
$utilization[$i] = isset($_POST['utilization'][$i])?$_POST['utilization'][$i]:NULL;
$form[$i] = isset($_POST['form'][$i])?$_POST['form'][$i]:NULL;
}
$preBoilVol = $_POST['preBoilVol'];
$finalVol = $_POST['finalVol'];
$gravity = $_POST['gravity'];
$desiredIBUs = $_POST['desiredIBUs'];
$elevation = $_POST['elevation'];
$units = $_POST['units'];
// Tinseth method
$ibuT = 0;
$ibu_T = array_fill(0, MAX_HOPS, NULL);
for ($i = 0; $i < MAX_HOPS; $i++) {
if (!isset($hopWeight[$i])) {
continue;
}
$ibu_T[$i] = calc_bitter_tinseth($utilization[$i], $gravity, $hopAA[$i], $hopWeight[$i], $finalVol, $form[$i], $units);
$ibuT += $ibu_T[$i];
}
// Rager Method
$ibuR = 0;
$ibu_R = array_fill(0, MAX_HOPS, NULL);
for ($i = 0; $i < MAX_HOPS; $i++) {
if (!isset($hopWeight[$i])) {
continue;
}
$ibu_R[$i] = calc_bitter_rager($utilization[$i], $gravity, $hopAA[$i], $hopWeight[$i], $finalVol, $form[$i], $units);
$ibuR += $ibu_R[$i];
}
// Daniels Method
$ibuD = 0;
$ibu_D = array_fill(0, MAX_HOPS, NULL);
for ($i = 0; $i < MAX_HOPS; $i++) {
if (!isset($hopWeight[$i])) {
continue;
}
$ibu_D[$i] = calc_bitter_daniels($utilization[$i], $gravity, $hopAA[$i], $hopWeight[$i], $finalVol, $form[$i], $units);
$ibuD += $ibu_D[$i];
}
// Garetz Method
$ibuG = 0;
$ibu_G = array_fill(0, MAX_HOPS, NULL);
if (($preBoilVol > 0) && ($desiredIBUs > 0) && ($elevation >= 0)) {
for ($i = 0; $i < MAX_HOPS; $i++) {
if (!isset($hopWeight[$i])) {
continue;
}
$ibu_G[$i] = calc_bitter_garetz($utilization[$i], $gravity, $hopAA[$i], $hopWeight[$i], $finalVol, $form[$i], $units,
$preBoilVol, $desiredIBUs, $elevation);
$preBoilVol, $desiredIBUs, $elevation);
$ibuG += $ibu_G[$i];
}
}
@@ -94,7 +108,7 @@ if (($action == "default") || ($action == "entry")) {
<div id="wideWrapper<?php if ($page == "tools") echo "Reference"; ?>">
<div id="referenceHeader">International Bitterness Unit (IBU) Calculator</div>
<table id="hop_entries">
<?php
function create_hop_entries($start, $end) {
global $action, $hopWeight, $hopAA, $utilization, $form, $DEFAULT_FORM;
@@ -225,7 +239,7 @@ for ($i = 0; $i < MAX_HOPS; $i++) {
<?php
$endHopEntries = 0;
for ($i = 0; $i < MAX_HOPS; $i++) {
if ($ibu_T[$i] > 0) $endHopEntries = $i;
if (isset($ibu_T[$i]) && $ibu_T[$i] > 0) $endHopEntries = $i;
}
for ($i = 0; $i <= $endHopEntries; $i++) {
@@ -250,27 +264,27 @@ for ($i = 0; $i < MAX_HOPS; $i++) {
<td class="dataLabelLeft">Average IBUs:</td>
<?php
if ($ibuG > 0) {
echo '<td class="data" colspan="4">';
$ibuAverage = ($ibuG + $ibuR + $ibuT + $ibuD) / 4;
echo round ($ibuAverage, 1) . '</td>';
echo '<td class="data" colspan="4">';
$ibuAverage = ($ibuG + $ibuR + $ibuT + $ibuD) / 4;
echo round ($ibuAverage, 1) . '</td>';
} else {
echo '<td class="data">';
$ibuAverage = ($ibuR + $ibuT + $ibuD) / 3;
echo round ($ibuAverage, 1);
echo '<td class="data" colspan="3">(Garetz formula excluded from avg.)</td>';
echo '<td class="data">';
$ibuAverage = ($ibuR + $ibuT + $ibuD) / 3;
echo round ($ibuAverage, 1);
echo '<td class="data" colspan="3">(Garetz formula excluded from avg.)</td>';
}
?>
</tr>
<?php
if ($desiredIBUs > 0) {
echo '<tr>';
echo '<td class="dataLabelLeft">Target IBUs:</td>';
echo '<td class="data" colspan="4">' . $desiredIBUs . '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="dataLabelLeft">Target IBUs:</td>';
echo '<td class="data" colspan="4">' . $desiredIBUs . '</td>';
echo '</tr>';
}
?>
</table>
</div>
<?php if (!checkmobile()) { ?><input type="image" src="<?php echo $imageSrc."Brilliant"; ?>/button_back_Brilliant.png" alt="Re-Enter Values" class="calcButton" value="Re-Enter Values" /><? } else { ?><input type="submit" class="calcButton" value="Go Back" /><?php } ?></div>
<?php } ?>

View File

@@ -1,13 +1,12 @@
<?php
require ('../../paths.php');
require_once (CONFIG.'config.php');
include ('../../includes/check_mobile.inc.php');
include ('../../includes/functions.inc.php');
include ('../../includes/url_variables.inc.php');
include ('../../includes/db_connect_universal.inc.php');
if ($action != "default") include ('../../includes/db_connect_log.inc.php');
include ('../../includes/abv.inc.php');
include ('../../includes/color.inc.php');
include ('../../includes/plug-ins.inc.php');
$page = "calculate";
$imageSrc = "../../images/";
?>

View File

@@ -15,10 +15,10 @@
// This needs to be a user profile variable.
$CAL_TEMP_DEFAULT = 60;
$calTemp = $_POST["calTemp"];
$temp = $_POST["temp"];
$sg = $_POST["sg"];
$units = $_POST["units"];
$calTemp = isset($_POST["calTemp"])?$_POST["calTemp"]:$CAL_TEMP_DEFAULT;
$temp = isset($_POST["temp"])?$_POST["temp"]:NULL;
$sg = isset($_POST["sg"])?$_POST["sg"]:NULL;
$units = isset($_POST["units"])?$_POST["units"]:NULL;
if (($action == "default") || ($action == "entry")) { ?>
<script type="text/javascript" language="JavaScript">

View File

@@ -7,14 +7,14 @@ evaporation rate to be in volume
instead of a percentage.
**********************************
*/
$units = $_POST["units"];
$grainWeight = $_POST["grainWeight"];
$grainRetainCoeff = $_POST["grainRetainCoeff"];
$finalBoilVol = $_POST["finalBoilVol"];
$equipLoss = $_POST["equipLoss"];
$evapRate = $_POST["evapRate"];
$boilTime = $_POST["boilTime"];
$thickness = $_POST["thickness"];
$units = isset($_POST["units"])?$_POST["units"]:NULL;
$grainWeight = isset($_POST["grainWeight"])?$_POST["grainWeight"]:NULL;
$grainRetainCoeff = isset($_POST["grainRetainCoeff"])?$_POST["grainRetainCoeff"]:NULL;
$finalBoilVol = isset($_POST["finalBoilVol"])?$_POST["finalBoilVol"]:NULL;
$equipLoss = isset($_POST["equipLoss"])?$_POST["equipLoss"]:NULL;
$evapRate = isset($_POST["evapRate"])?$_POST["evapRate"]:NULL;
$boilTime = isset($_POST["boilTime"])?$_POST["boilTime"]:NULL;
$thickness = isset($_POST["thickness"])?$_POST["thickness"]:NULL;
?>
<script type="text/javascript" language="JavaScript">
<!-- Copyright 2003 Bontrager Connection, LLC

View File

@@ -2,12 +2,11 @@
require ('paths.php');
require_once (CONFIG.'config.php');
require (INCLUDES.'authentication.inc.php'); session_start(); sessionAuthenticate();
include (INCLUDES.'check_mobile.inc.php');
include (INCLUDES.'functions.inc.php');
include (INCLUDES.'url_variables.inc.php');
$page = "contestPrint";
include (INCLUDES.'db_connect_universal.inc.php');
include (INCLUDES.'db_connect_log.inc.php');
include (INCLUDES.'plug-ins.inc.php');
$dbTable = "brewing";
if (isset($_GET['dbTable'])) {

View File

@@ -1,10 +1,4 @@
<?php
mysql_select_db($database_brewing, $brewing);
$query_user = sprintf("SELECT * FROM users WHERE user_name = '%s'", $loginUsername);
$user = mysql_query($query_user, $brewing) or die(mysql_error());
$row_user = mysql_fetch_assoc($user);
$totalRows_user = mysql_num_rows($user);
function authenticateUserNav($connection, $username, $password)
{
// Test the username and password parameters

View File

@@ -69,7 +69,7 @@ class BeerXMLParser {
function BeerXMLParser($filename)
{
$xml_parser = xml_parser_create();
xml_set_object($xml_parser,&$this);
xml_set_object($xml_parser, $this);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "nodeData");
xml_parser_set_option($xml_parser,XML_OPTION_TARGET_ENCODING,"UTF-8");

View File

@@ -35,7 +35,7 @@ abstract class Parser {
public $inNode;
function parse($parser,$beerXMLParser){
xml_set_object($parser,&$this);
xml_set_object($parser, $this);
$this->parser = $beerXMLParser;
}
}

View File

@@ -1,10 +1,6 @@
<?php
//if ($row_pref['mode'] == "1") $page = "brewBlogCurrent";
//elseif ($row_pref['mode'] == "2") $page = "about";
$page = $row_pref['home'];
if (isset($_GET['page'])) {
$page = (get_magic_quotes_gpc()) ? $_GET['page'] : addslashes($_GET['page']);
}
if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail") || ($page == "recipeDetail") || ($page == "recipeList")) $sort = "brewName";
elseif ($page == "awardsList") $sort = "awardBrewName";
@@ -592,11 +588,13 @@ $totalRows_awards = mysql_num_rows($awards);
// -----------------------------------------------------------------------------------------------
// User Breadcrumb
if (($page == "recipeDetail") && ($row_log['brewBrewerID'] != "")) {
mysql_select_db($database_brewing, $brewing);
$query_user3 = sprintf("SELECT * FROM users WHERE user_name = '%s'", $row_log['brewBrewerID']);
$user3 = mysql_query($query_user3, $brewing) or die(mysql_error());
$row_user3 = mysql_fetch_assoc($user3);
$totalRows_user3 = mysql_num_rows($user3);
}
// Members
if (($page == "members") || ($page == "calendar") || ($page == "profile")) {

View File

@@ -2,11 +2,14 @@
// Get server's PHP version
$phpVersion = phpversion();
//echo $phpVersion;
if (!isset($_SESSION)) {
session_start();
}
$currentPage = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
if (!empty($_SERVER["QUERY_STRING"])) $currentPage .= "?".$_SERVER['QUERY_STRING'];
if (!empty($_SESSION["loginUsername"])) $loginUsername = $_SESSION["loginUsername"];
$loginUsername = $_SESSION["loginUsername"];
$loginUsername = NULL;
if (isset($_SESSION['loginUsername']) && !empty($_SESSION["loginUsername"])) $loginUsername = $_SESSION["loginUsername"];
// Universal DB Connections
mysql_select_db($database_brewing, $brewing);
@@ -28,6 +31,12 @@ $pref = mysql_query($query_pref, $brewing) or die(mysql_error());
$row_pref = mysql_fetch_assoc($pref);
$totalRows_pref = mysql_num_rows($pref);
if (!isset($page)) {
$page = $row_pref['home'];
}
if (isset($_GET['page'])) {
$page = (get_magic_quotes_gpc()) ? $_GET['page'] : addslashes($_GET['page']);
}
// -----------------------------------------------------------------------------------------------
// Theme

View File

@@ -165,6 +165,9 @@ function calc_efficiency($gravity,$wort,$grain,$units,$log_id) {
// ---------------------------- Date Conversion -----------------------------------------
// http://www.phpbuilder.com/annotate/message.php3?id=1031006
function dateconvert($date,$func) {
if (empty($date)) {
return '';
}
if ($func == 1){ //insert conversion
list($day, $month, $year) = explode("/", $date);
@@ -364,6 +367,4 @@ function output_print_log($id, $source, $dbTable, $page, $style, $scale, $amt, $
$output .= '<img src="'.$imageSrc.$theme.'/button_print_log_'.$theme.'.png" border="0" alt="print '.$source.'"></a>';
return $output;
}
?>
}

View File

@@ -11,9 +11,11 @@ $toolTip_name = "DO NOT use an apostrophe (') as it will cause functionality to
$toolTip_filename = "Names entered here must be exactly the same as the actual file name.";
// ---------------------------- Messages ------------------------------------------------
$msg1 = "The ".$msgName." has been added!";
$msg2 = "The ".$msgName." has been updated!";
$msg3 = "The ".$msgName." has been deleted!";
$msg9 = "The ".$msgName."s have been updated!";
if (isset($msgName)) {
$msg1 = "The ".$msgName." has been added!";
$msg2 = "The ".$msgName." has been updated!";
$msg3 = "The ".$msgName." has been deleted!";
$msg9 = "The ".$msgName."s have been updated!";
}
?>

View File

@@ -1,7 +1,6 @@
<?php require_once(CONFIG.'config.php');
include('../includes/db_connect_universal.inc.php');
include('../includes/check_mobile.inc.php');
include('../includes/plug-ins.inc.php');
include('../includes/functions.inc.php');
$colname_log = "-1";
if (isset($_GET['id'])) {

View File

@@ -1,4 +1,5 @@
<?php
$dbName = '';
// ---------------------------- Friendly Names------------------------------------------
if (($dbTable == "recipes") || ($source == "recipes") || ($page == "recipeList") || ($page == "recipeDetail")) {
$dbName = $row_pref['menuRecipes'];
@@ -169,6 +170,7 @@ if ($dbTable == "preferences") { $dbName = "Preferences"; $icon = "cog"; }
// ---------------------------- Titles --------------------------------------------------
if ($page == "brewBlogCurrent") { if ($row_pref['mode'] == "1") $page_title = "Current "; if ($row_pref['mode'] == "2") $page_title = $row_pref['menuBrewBlogs']; $page_title_extension = " &gt; ".$row_log['brewName']; $icon = "book"; }
if ($page == "members") { $page_title = $row_pref['menuMembers']; $icon = "group"; }
if ($page == "news") { $page_title = "News/Announcements"; $icon = "newspaper";}

View File

@@ -75,7 +75,7 @@ if (isset($_GET['amt'])) {
}
$colname_log = "-1";
if (is_numeric($_GET['id'])) {
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$colname_log = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}

View File

@@ -15,19 +15,11 @@ include (INCLUDES.'db_connect_universal.inc.php');
//set up recipes, brewlogs, etc.
include (INCLUDES.'db_connect_log.inc.php');
//include function to check for mobile browsers
//include (INCLUDES.'check_mobile.inc.php');
//do various abv calculations related to the currently viewed recipe (if any)
//include (INCLUDES.'abv.inc.php');
//include various conversions functions, date functions and truncate functions
//plus additional libs for
// titles.inc.php - set up the navigation?
// messages.inc.php - tooltips and a few messages
// scrubber.inc.php - a few arrays for character replacement
include (INCLUDES.'plug-ins.inc.php'); // Deprecated --> Transition functions to 'functions.inc.php' file keep here for now
include (INCLUDES.'functions.inc.php');
//figure out SRM and a hex value for displaying beer color

View File

@@ -21,6 +21,7 @@ define('REFERENCE',ROOT.'reference'.DIRECTORY_SEPARATOR);
define('RECIPE',ROOT.'sections'.DIRECTORY_SEPARATOR.'recipe'.DIRECTORY_SEPARATOR);
define('TEMPLATES',ROOT.'templates'.DIRECTORY_SEPARATOR);
define('CLASSES',ROOT.'classes'.DIRECTORY_SEPARATOR);
define('IMAGES_DIR',ROOT.'images'.DIRECTORY_SEPARATOR);
require(CONFIG.'config.php');
?>

View File

@@ -12,10 +12,7 @@ include (INCLUDES.'db_connect_universal.inc.php');
include (INCLUDES.'db_connect_log.inc.php');
//include function to check for mobile browsers
include (INCLUDES.'check_mobile.inc.php');
//do various abv calculations related to the currently viewed recipe (if any)
include (INCLUDES.'abv.inc.php');
include (INCLUDES.'functions.inc.php');
//include various conversions functions, date functions and truncate functions
@@ -23,7 +20,6 @@ include (INCLUDES.'functions.inc.php');
// titles.inc.php - set up the navigation?
// messages.inc.php - tooltips and a few messages
// scrubber.inc.php - a few arrays for character replacement
include (INCLUDES.'plug-ins.inc.php');
//figure out SRM and a hex value for displaying beer color
//include (INCLUDES.'color.inc.php');

View File

@@ -1,7 +1,7 @@
<?php
include ('../includes/check_mobile.inc.php');
include ('../includes/plug-ins.inc.php');
$imageSrc = "../images/";
$agent = $_SERVER['HTTP_USER_AGENT'];
if (strstr($agent, "MSIE")) $printBrowser = "IE"; else $printBrowser = "notIE";
?>
<html>
<head>

View File

@@ -87,8 +87,7 @@ $totalRows_review = mysql_num_rows($review);
}
include ('../includes/db_connect_universal.inc.php');
include ('../includes/check_mobile.inc.php');
include ('../includes/plug-ins.inc.php');
include ('../includes/functions.inc.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

View File

@@ -98,7 +98,7 @@
</td>
<?php } ?>
<td class="dataList"><?php if ($row_log['brewBitterness'] != "") { echo round ($row_log['brewBitterness'], 1); } else echo "&nbsp;" ?></td>
<td class="dataList"><?php if (($row_log['brewOG'] != "") && ($row_log['brewFG'] != "")) { include (INCLUDES.'abv.inc.php'); echo round ($abv, 1)."%"; } else echo "&nbsp;"; ?></td>
<td class="dataList"><?php if (($row_log['brewOG'] != "") && ($row_log['brewFG'] != "")) { echo round (calc_abv($row_log['brewOG'], $row_log['brewFG']), 1)."%"; } else echo "&nbsp;"; ?></td>
<?php if (($row_pref['mode'] == "2") && ($filter == "all")) { ?><td class="dataList"><a href="?page=<?php echo $page; ?>&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&filter=<?php echo $row_user2['user_name']; ?>&view=limited"><?php echo $row_user2['realFirstName']."&nbsp;".$row_user2['realLastName']; ?></a></td><?php } ?>
<td class="dataList center"><?php if ($totalRows_awards2 > 0) echo $totalRows_awards2; else echo "&nbsp;"; ?></td>
</tr>

View File

@@ -66,7 +66,7 @@
</td>
<?php } ?>
<td class="dataList"><?php if ($row_featured['brewBitterness'] != "") { echo round ($row_featured['brewBitterness'], 1); } else echo "&nbsp;" ?></td>
<td class="dataList"><?php if (($row_featured['brewOG'] != "") && ($row_featured['brewFG'] != "")) { include (INCLUDES.'abv.inc.php'); echo round ($abv_featured, 1)."%"; } else echo "&nbsp;"; ?></td>
<td class="dataList"><?php if (($row_featured['brewOG'] != "") && ($row_featured['brewFG'] != "")) { echo round (calc_abv($row_featured['brewOG'], $row_featured['brewFG']), 1)."%"; } else echo "&nbsp;"; ?></td>
<?php if (($row_pref['mode'] == "2") && ($filter == "all")) { ?><td class="dataList"><a href="?page=brewBlogList&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&filter=<?php echo $row_user2['user_name']; ?>&view=limited"><?php echo $row_user2['realFirstName']."&nbsp;".$row_user2['realLastName']; ?></a></td><?php } ?>
<td class="dataList center"><?php if ($totalRows_awards2 > 0) echo $totalRows_awards2; else echo "&nbsp;"; ?></td>
</tr>

View File

@@ -1,5 +1,5 @@
<?php
$filename = $images_dir."/label_images/".$row_log['brewLabelImage'];
$filename = IMAGES_DIR."/label_images/".$row_log['brewLabelImage'];
if (($row_log['brewLabelImage'] != "") && (file_exists($filename))) {
function getFileSizeW($file)
{

View File

@@ -7,7 +7,7 @@ if ($row_pref['mode'] == "1")
<div id="sidebarHeader"><span class="data-icon"><img src="<?php echo $imageSrc; ?>book.png" align="absmiddle"></span><span class="data"><?php echo "More"; if ($page != "recipeDetail") echo " ".$row_pref['menuBrewBlogs']; else echo " ".$row_pref['menuRecipes']; ?></span></div>
<div id="sidebarInnerWrapper" >
<table width="100%">
<?php do {
<?php while ($row_list = mysql_fetch_assoc($list)) {
if ($row_list['brewArchive'] != "Y") {
?>
<tr>
@@ -16,7 +16,7 @@ if ($row_pref['mode'] == "1")
</tr>
<?php
}
} while ($row_list = mysql_fetch_assoc($list)); ?>
} ?>
<tr>
<td colspan="2"><div align="center"><?php if (($page == "recipeDetail") && ($total > $display)) { paginate($display, $pg, $total); } elseif ((($page == "brewBlogDetail") || ($page == "brewBlogCurrent")) && ($total > $display)) { paginate($display, $pg, $total); } ?></div></td>
</tr>

View File

@@ -21,12 +21,11 @@ $style = mysql_query($query_style, $brewing) or die(mysql_error());
$row_style = mysql_fetch_assoc($style);
$totalRows_style = mysql_num_rows($style);
include (INCLUDES.INCLUDES.'db_connect_universal.inc.php');
include (INCLUDES.INCLUDES.'abv.inc.php');
include (INCLUDES.INCLUDES.'color.inc.php');
include (INCLUDES.INCLUDES.'check_mobile.inc.php');
include (INCLUDES.INCLUDES.'plug-ins.inc.php');
include (INCLUDES.INCLUDES.'version.inc.php');
include (INCLUDES.'db_connect_universal.inc.php');
include (INCLUDES.'abv.inc.php');
include (INCLUDES.'color.inc.php');
include (INCLUDES.'functions.inc.php');
include (INCLUDES.'version.inc.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

View File

@@ -12,7 +12,7 @@
<tr>
<td class="data-icon_list"><a href="admin/index.php?action=edit&dbTable=<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "brewing"; if ($page == "recipeDetail") echo "recipes"; ?>&id=<?php echo $row_log['id']; ?>"><img src="<?php echo $imageSrc; ?>pencil.png" alt="Edit <?php echo $row_log['brewName']; ?>" title="Edit <?php echo $row_log['brewName']; ?>" border="0" align="absmiddle"></a></td>
<td class="data-icon_list"><a href="admin/index.php?action=reuse&dbTable=<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "brewing"; if ($page == "recipeDetail") echo "recipes"; ?>&filter=<?php echo $filter; ?>&id=<?php echo $row_log['id']; ?>"><img src="<?php echo $imageSrc; ?>page_refresh.png" alt="Reuse/Copy <?php echo $row_log['brewName']; ?>" title="Reuse/Copy <?php echo $row_log['brewName']; ?>" border="0" align="absmiddle"></a></td>
<td class="data-icon_list"><a href="admin/index.php?action=import<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "Recipe"; ?>&dbTable=<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "recipes"; if ($page == "recipeDetail") echo "brewing"; ?>&id=<?php echo $row_log['id']; ?>"><img src="<?php echo $imageSrc; ?>page_lightning.png" alt="Import <?php echo $row_log['brewName']; ?> to <?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo $row_pref['menuRecipes']; else echo $row_pref['menuBrewBlogss']; ?>" title="Import <?php echo $row_log['brewName']; ?> to <?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo $row_pref['menuRecipes']; else echo $row_pref['menuBrewBlogss']; ?>" border="0" align="absmiddle"></a></td>
<td class="data-icon_list"><a href="admin/index.php?action=import<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "Recipe"; ?>&dbTable=<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "recipes"; if ($page == "recipeDetail") echo "brewing"; ?>&id=<?php echo $row_log['id']; ?>"><img src="<?php echo $imageSrc; ?>page_lightning.png" alt="Import <?php echo $row_log['brewName']; ?> to <?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo $row_pref['menuRecipes']; else echo $row_pref['menuBrewBlogs']; ?>" title="Import <?php echo $row_log['brewName']; ?> to <?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo $row_pref['menuRecipes']; else echo $row_pref['menuBrewBlogs']; ?>" border="0" align="absmiddle"></a></td>
<td class="data-icon_list"><a href="admin/index.php?action=calculate&source=<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "brewing"; if ($page == "recipeDetail") echo "recipes"; ?>&filter=<?php echo $filter; ?>&results=false&id=<?php echo $row_log['id']; ?>"><img src="<?php echo $imageSrc; ?>calculator.png" alt="Recalculate <?php echo $row_log['brewName']; ?>" title="Recalculate <?php echo $row_log['brewName']; ?>" border="0" align="absmiddle"></a></td>
<td class="data-icon_list"><a href="admin/index.php?action=add&dbTable=awards&assoc=<?php if (($page == "brewBlogCurrent") || ($page == "brewBlogDetail")) echo "brewing"; if ($page == "recipeDetail") echo "recipes"; ?>&filter=<?php echo $filter; ?>&id=<?php echo $row_log['id']; ?>"><img src="<?php echo $imageSrc; ?>medal_gold_3.png" alt="Add Awards for <?php echo $row_log['brewName']; ?>" title="Add Awards for <?php echo $row_log['brewName']; ?>" border="0" align="absmiddle"></a></td>
<?php if (($page == "brewBlogDetail") || ($page == "brewBlogCurrent")) { ?>

View File

@@ -31,14 +31,14 @@ $totalGrist = ($totalExtract + $totalGrain);
for ($i = 0; $i <= MAX_EXT; $i++) {
$key = 'brewExtract' . ($i + 1) . 'Weight';
if ($row_log[$key] != "" && $row_log[$key] > 0) {
if (isset($row_log[$key]) && $row_log[$key] != "" && $row_log[$key] > 0) {
$extractPer[$i] = (($row_log[$key] / $totalGrist) * 100);
}
}
for ($i = 0; $i <= MAX_GRAINS; $i++) {
$key = 'brewGrain' . ($i + 1) . 'Weight';
if ($row_log[$key] != "" && $row_log[$key] > 0) {
if (isset($row_log[$key]) && $row_log[$key] != "" && $row_log[$key] > 0) {
$grainPer[$i] = (($row_log[$key] / $totalGrist) * 100);
}
}

View File

@@ -90,7 +90,7 @@
</td>
<?php } ?>
<td class="dataList"><?php if ($row_recipeList['brewBitterness'] != "") { echo round ($row_recipeList['brewBitterness'], 1); } else echo "&nbsp;" ?></td>
<td class="dataList"><?php if (($row_recipeList['brewOG'] != "") && ($row_recipeList['brewFG'] != "")) { include (INCLUDES.'abv.inc.php'); echo round ($abv, 1)."%"; } else echo "&nbsp;"; ?></td>
<td class="dataList"><?php if (($row_recipeList['brewOG'] != "") && ($row_recipeList['brewFG'] != "")) { echo round (calc_abv($row_recipeList['brewOG'], $row_recipeList['brewFG']), 1)."%"; } else echo "&nbsp;"; ?></td>
<?php if (($row_pref['mode'] == "2") && ($filter == "all")) { ?><td class="dataList"><a href="?page=<?php echo $page; ?>&sort=<?php echo $sort; ?>&dir=<?php echo $dir; ?>&filter=<?php echo $row_user2['user_name']; ?>&view=limited"><?php echo $row_user2['realFirstName']."&nbsp;".$row_user2['realLastName']; ?></a></td><?php } ?>
<td class="dataList center"><?php if ($totalRows_awards2 > 0) echo $totalRows_awards2; else echo "&nbsp;"; ?></td>
</tr>

View File

@@ -39,7 +39,7 @@ $totalRows_styles = mysql_num_rows($styles);
<div class="data-regular"><?php echo dateconvert($row_log['brewDate'],2);?></div>
</div>
<?php } ?>
<?php if ($row_log['brewTapDate'] != "") { ?>
<?php if (isset($row_log['brewTapDate']) && $row_log['brewTapDate'] != "") { ?>
<div class="data-item-container">
<div class="data-label">Tap Date:</div>
<div class="data-regular"><?php echo dateconvert($row_log['brewTapDate'],2); ?></div>

View File

@@ -10,8 +10,7 @@ require_once (CONFIG.'config.php');
require_once (ADMIN_LIBRARY.'color.lib.php');
include (INCLUDES.'url_variables.inc.php');
include (INCLUDES.'db_connect_universal.inc.php');
include (INCLUDES.'check_mobile.inc.php');
include (INCLUDES.'plug-ins.inc.php');
include (INCLUDES.'functions.inc.php');
$imageSrc = "../images/";
//echo (REFERENCE.'color.inc.php');
}

View File

@@ -1,6 +1,6 @@
<?php if ($row_members['userPicURL'] != "") {
$img = $row_members['userPicURL'];
$file = rtrim($images_dir."/label_images/".$img, " ");
$file = rtrim(IMAGES_DIR."/label_images/".$img, " ");
$max_width = 225;
$max_height = 450;

View File

@@ -2,15 +2,15 @@
$grainWeight = $totalGrain;
if (isset($_SESSION["loginUsername"])) {
if (($row_user['defaultWaterRatio'] != "") && ($row_log['brewWaterRatio'] == "")) $thickness = $row_user['defaultWaterRatio'];
elseif ($row_log['brewWaterRatio'] != "") $thickness = $row_log['brewWaterRatio'];
elseif (isset($row_log['brewWaterRatio']) && $row_log['brewWaterRatio'] != "") $thickness = $row_log['brewWaterRatio'];
else $thickness = "1.33";
}
else $thickness = "1.33";
if (($row_log['brewEquipProfile'] != "") && ($row_pref['measFluid2'] == "gallons")) { $evapRate = round(($row_equip_profiles['equipBoilVolume'] / $row_equip_profiles['equipEvapRate']), 2) ; $equipLoss = $row_equip_profiles['equipLoss']; }
elseif (($row_log['brewEquipProfile'] != "") && ($row_pref['measFluid2'] == "liters")) { $evapRate = round((($row_equip_profiles['equipBoilVolume'] / $row_equip_profiles['equipEvapRate']) * 3.78), 2); $equipLoss = round($row_equip_profiles['equipLoss'] * 3.78, 2); }
elseif (($row_pref['measFluid2'] == "gallons") && ($row_log['brewEquipProfile'] == "")) { $evapRate = 1.5; $equipLoss = 1; }
elseif (($row_pref['measFluid2'] == "liters") && ($row_log['brewEquipProfile'] == "")) { $evapRate = 5.6; $equipLoss = 3.8; }
if ((isset($row_log['brewEquipProfile']) && $row_log['brewEquipProfile'] != "") && ($row_pref['measFluid2'] == "gallons")) { $evapRate = round(($row_equip_profiles['equipBoilVolume'] / $row_equip_profiles['equipEvapRate']), 2) ; $equipLoss = $row_equip_profiles['equipLoss']; }
elseif ((isset($row_log['brewEquipProfile']) && $row_log['brewEquipProfile'] != "") && ($row_pref['measFluid2'] == "liters")) { $evapRate = round((($row_equip_profiles['equipBoilVolume'] / $row_equip_profiles['equipEvapRate']) * 3.78), 2); $equipLoss = round($row_equip_profiles['equipLoss'] * 3.78, 2); }
elseif (($row_pref['measFluid2'] == "gallons") && (!isset($row_log['brewEquipProfile']) || $row_log['brewEquipProfile'] == "")) { $evapRate = 1.5; $equipLoss = 1; }
elseif (($row_pref['measFluid2'] == "liters") && (!isset($row_log['brewEquipProfile']) || $row_log['brewEquipProfile'] == "")) { $evapRate = 5.6; $equipLoss = 3.8; }
else $evapRate = 1.5;
if ($row_log['brewBoilTime'] != "") $boilTime = $row_log['brewBoilTime'];