'!Y!S!N!', 'BOTTLE' => '!1!2!3!', 'BUNDLE' => '!Y!A!N!', 'CARBONATION' => '!S!R!', 'CIDERS' => '!Y!S!N!', 'GENBE' => '!N!C!U!A!', 'GENSJ' => '!N!O!C!A!', 'HC-ASK' => '!Y!N!', 'JS-LD' => '!Y!N!', 'LIMITB' => '!Y!N!', 'LIMITBN' => '!C!L!N!', 'LIMITE' => '!Y!N!', 'LIMITEB' => '!Y!N!', 'LIMITEC' => '!Y!N!', 'LIMITEN' => '!C!L!N!', 'LIMITEP' => '!Y!N!', 'LIMITES' => '!Y!N!', 'MEADS' => '!Y!S!N!', 'MFORMAT' => '!P!H!', 'NB-ASK' => '!Y!N!', 'NB-FREE' => '!Y!N!', 'PLACES' => '!Y!A!N!', 'PP-ACCEPT' => '!N!L!S!', 'RENUM' => '!Y!N!', 'REQGRP' => '!N!Y!', 'RESTRICT' => '!N!C!S!', 'SCORES' => '!Y!A!N!', 'SESS-ASK' => '!Y!N!', 'SHEETS' => '!Y!A!N!', 'SS-E-PERIOD' => '!H!D!W!', 'SS-M-PERIOD' => '!H!D!W!', 'SS-W-PERIOD' => '!H!D!W!', 'STAGE' => '!PRE!OPEN!CLOSED!POST!MAINT!'); $SelFields['SWEETNESS']=($Comp_SG == '2015' ? '!S!R!' : '!S!R!ES!ER!'); if (array_key_exists('DATE', $Len)) { list($dt['DATE'],$dt_res['DATE'])=chk_date($ctrls['DATE']); } if (array_key_exists('START', $Len)) { list($dt['START'],$dt_res['START'])=chk_date($ctrls['START']); } if (array_key_exists('END', $Len)) { list($dt['END'],$dt_res['END'])=chk_date($ctrls['END']); } if ($Return == 'G') { if (!empty($ctrls['SHORT'])) { $ctrls['SHORT']=strtoupper($ctrls['SHORT']); } if (!empty($ctrls['NEXTB'])) { $ctrls['NEXTB']=strip_zeros($ctrls['NEXTB']); } $query='select count(*) from style_type where sg="'.$ctrls['GUIDE'].'"'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] < 1) { $e_ctrls['GUIDE_1']=TRUE; $upd_ctrls['GUIDE']=FALSE; } if (!empty($ctrls['NEXTE'])) { $ctrls['NEXTE']=strip_zeros($ctrls['NEXTE']); } } elseif ($Return == 'I') { if (empty($ctrls['AHAIMG'])) { $ctrls['AHAX']=$ctrls['AHAY']=$ctrls['AHAURL']=''; } if (empty($ctrls['BJCPIMG'])) { $ctrls['BJCPX']=$ctrls['BJCPY']=$ctrls['BJCPURL']=''; } if (empty($ctrls['CLUBIMG'])) { $ctrls['CLUBX']=$ctrls['CLUBY']=$ctrls['CLUBALT']=$ctrls['CLUBURL']=''; } if (empty($ctrls['COMPIMG'])) { $ctrls['COMPX']=$ctrls['COMPY']=$ctrls['COMPALT']=$ctrls['COMPURL']=''; } } elseif ($Return == 'L') { if ($ctrls['LIMITE'] != 'Y') { $ctrls['LIMITEV']=$ctrls['LIMITEN']=$ctrls['LIMITEP']=''; } else { if (empty($ctrls['LIMITEV'])) { $e_ctrls['LIMITEV_R']=TRUE; $upd_ctrls['LIMITEV']=FALSE; } } if ($ctrls['LIMITB'] != 'Y') { $ctrls['LIMITBV']=$ctrls['LIMITBN']=''; } else { if (empty($ctrls['LIMITBV'])) { $e_ctrls['LIMITBV_R']=TRUE; $upd_ctrls['LIMITBV']=FALSE; } } if ($ctrls['LIMITEB'] != 'Y') { $ctrls['LIMITEBV']=''; } else { if (empty($ctrls['LIMITEBV'])) { $e_ctrls['LIMITEBV_R']=TRUE; $upd_ctrls['LIMITEBV']=FALSE; } } if ($ctrls['LIMITEC'] != 'Y') { $ctrls['LIMITECV']=''; } else { if (empty($ctrls['LIMITECV'])) { $e_ctrls['LIMITECV_R']=TRUE; $upd_ctrls['LIMITECV']=FALSE; } else { if ($ctrls['LIMITES'] == 'Y' && $ctrls['LIMITECV'] != $o_ctrls['LIMITECV'] && !empty($ctrls['LIMITESV']) && $ctrls['LIMITESV'] > $ctrls['LIMITECV']) { $e_ctrls['LIMITECV_4']=TRUE; $upd_ctrls['LIMITECV']=FALSE; } } } if ($ctrls['LIMITES'] != 'Y') { $ctrls['LIMITESV']=''; } else { if (empty($ctrls['LIMITESV'])) { $e_ctrls['LIMITESV_R']=TRUE; $upd_ctrls['LIMITESV']=FALSE; } else { if ($ctrls['LIMITEC'] == 'Y' && $ctrls['LIMITESV'] != $o_ctrls['LIMITESV'] && !empty($ctrls['LIMITECV']) && $ctrls['LIMITECV'] < $ctrls['LIMITESV']) { $e_ctrls['LIMITESV_4']=TRUE; $upd_ctrls['LIMITESV']=FALSE; } } } } elseif ($Return == 'M') { if (!empty($ctrls['GENBE']) && (strpos('CUA', $ctrls['GENBE']) === FALSE) && !empty($ctrls['GENSJ']) && (strpos('OCA', $ctrls['GENSJ']) === FALSE)) { $ctrls['MFORMAT']=''; } elseif (empty($ctrls['MFORMAT'])) { $e_ctrls['MFORMAT_R']=TRUE; $upd_ctrls['MFORMAT']=FALSE; } } elseif ($Return == 'S') { if (empty($ctrls['RES-INTERVAL']) && !empty($ctrls['RES-PERIOD'])) { $e_ctrls['RES-INTERVAL_2']=TRUE; $upd_ctrls['RES-INTERVAL']=FALSE; } if (empty($ctrls['RES-PERIOD']) && !empty($ctrls['RES-INTERVAL'])) { $e_ctrls['RES-PERIOD_2']=TRUE; $upd_ctrls['RES-PERIOD']=FALSE; } foreach (array(0 => 'W', 1 => 'E', 2 => 'M') as $tag => $value) { if ($HANDLE_split[$tag] == 'N') { $ctrls['SS-'.$value.'-INTERVAL']=$ctrls['SS-'.$value.'-PERIOD']=''; } else { if (empty($ctrls['SS-'.$value.'-INTERVAL']) && !empty($ctrls['SS-'.$value.'-PERIOD'])) { $e_ctrls['SS-'.$value.'-INTERVAL_2']=TRUE; $upd_ctrls['SS-'.$value.'-INTERVAL']=FALSE; } if (empty($ctrls['SS-'.$value.'-PERIOD']) && !empty($ctrls['SS-'.$value.'-INTERVAL'])) { $e_ctrls['SS-'.$value.'-PERIOD_2']=TRUE; $upd_ctrls['SS-'.$value.'-PERIOD']=FALSE; } } } } elseif ($Return == 'T') { if (empty($ctrls['SITE-ADDR2']) && !empty($ctrls['SITE-ADDR3'])) { $ctrls['SITE-ADDR2']=$ctrls['SITE-ADDR3']; $ctrls['SITE-ADDR3']=''; } if (empty($ctrls['SITE-ADDR1']) && !empty($ctrls['SITE-ADDR2'])) { $ctrls['SITE-ADDR1']=$ctrls['SITE-ADDR2']; $ctrls['SITE-ADDR2']=''; } if (!empty($ctrls['SITE-STATE']) && !chk_state($ctrls['SITE-STATE'])) { $e_ctrls['SITE-STATE_1']=TRUE; $upd_ctrls['SITE-STATE']=FALSE; } if (!empty($ctrls['SITE-ZIP'])) { if (empty($ctrls['SITE-STATE']) || (!array_key_exists('SITE-STATE', $upd_ctrls) && empty($o_ctrls['SITE-STATE']))) { $e_ctrls['SITE-ZIP_3']=TRUE; $upd_ctrls['SITE-ZIP']=FALSE; } if (!array_key_exists('SITE-ZIP', $upd_ctrls) && !empty($ctrls['SITE-STATE'])) { list($Res, $Val)=test_zip($ctrls['SITE-ZIP'], $ctrls['SITE-STATE']); if ($Res == 0) { $ctrls['SITE-ZIP']=$Val; } else { $e_ctrls['SITE-ZIP_'.$Res]=TRUE; $upd_ctrls['SITE-ZIP']=FALSE; } } } } foreach ($ctrls as $tag => $tag_val) { if (empty($tag_val)) { $upd_ctrls[$tag]=!empty($o_ctrls[$tag]); continue; } if (array_key_exists($tag, $upd_ctrls) && !$upd_ctrls[$tag]) { continue; } if ($tag_val == $o_ctrls[$tag] || in_array($tag, $Skip)) { $upd_ctrls[$tag]=FALSE; continue; } $Res=0; if (in_array($tag, $NumberFields)) { $Res=test_int($tag_val); } elseif (in_array($tag, $MoneyFields)) { $Res=test_money($tag_val); } elseif (in_array($tag, $DateFields)) { if ($dt_res[$tag] != 0) { $Res=$dt_res[$tag]; } else { $Res=test_date($tag, $dt); } } elseif (in_array($tag, $ImgFields)) { $Res=test_url($tag_val, TRUE); } elseif (in_array($tag, $UrlFields)) { $Res=test_url($tag_val); } elseif (!empty($tag_val) && array_key_exists($tag, $SelFields)) { $Res=(strpos($SelFields[$tag], '!'.$tag_val.'!') === FALSE ? 1 : 0); } if ($Res != 0) { $e_ctrls[$tag.'_'.$Res]=TRUE; $upd_ctrls[$tag]=FALSE; } else { $upd_ctrls[$tag]=($ctrls[$tag] != $o_ctrls[$tag]); } } if ($Return == 'G') { if ($upd_ctrls['SHORT']) { if (!empty($ctrls['SHORT']) && !ctype_alnum($ctrls['SHORT'])) { $e_ctrls['SHORT_1']=TRUE; $upd_ctrls['SHORT']=FALSE; } } } elseif ($Return == 'I') { foreach (array('AHA', 'BJCP', 'CLUB', 'COMP') as $img_tag) { if (array_key_exists($img_tag.'IMG_1', $e_ctrls) && empty($o_ctrls[$img_tag.'IMG'])) { $upd_ctrls[$img_tag.'Y']=FALSE; $upd_ctrls[$img_tag.'X']=FALSE; $upd_ctrls[$img_tag.'URL']=FALSE; if (in_array($img_tag, array('CLUB', 'COMP'))) { $upd_ctrls[$img_tag.'ALT']=FALSE; } } } } elseif ($Return == 'L') { if ((!empty($ctrls['LIMITBV']) && !$upd_ctrls['LIMITBV']) || (array_key_exists('LIMITBV_R', $e_ctrls) && $e_ctrls['LIMITBV_R'])) { $upd_ctrls['LIMITB']=FALSE; } if ((!empty($ctrls['LIMITEV']) && !$upd_ctrls['LIMITEV']) || (array_key_exists('LIMITEV_R', $e_ctrls) && $e_ctrls['LIMITEV_R'])) { $upd_ctrls['LIMITE']=FALSE; } if ((!empty($ctrls['LIMITEBV']) && !$upd_ctrls['LIMITEBV']) || (array_key_exists('LIMITEBV_R', $e_ctrls) && $e_ctrls['LIMITEBV_R'])) { $upd_ctrls['LIMITEB']=FALSE; } if ((!empty($ctrls['LIMITECV']) && !$upd_ctrls['LIMITECV']) || (array_key_exists('LIMITECV_R', $e_ctrls) && $e_ctrls['LIMITECV_R']) || (array_key_exists('LIMITECV_4', $e_ctrls) && $e_ctrls['LIMITECV_4'])) { $upd_ctrls['LIMITEC']=FALSE; } if ((!empty($ctrls['LIMITESV']) && !$upd_ctrls['LIMITESV']) || (array_key_exists('LIMITESV_R', $e_ctrls) && $e_ctrls['LIMITESV_R']) || (array_key_exists('LIMITESV_4', $e_ctrls) && $e_ctrls['LIMITESV_4'])) { $upd_ctrls['LIMITES']=FALSE; } if ((empty($o_ctrls['LIMITEC']) || $o_ctrls['LIMITEC'] == 'N') && $ctrls['LIMITEC'] == 'Y') { $w_ctrls['LIMITEC_W']=TRUE; if (count($e_ctrls) != 0) { $upd_ctrls['LIMITEC']=FALSE; $upd_ctrls['LIMITECV']=FALSE; } } if ((empty($o_ctrls['LIMITES']) || $o_ctrls['LIMITES'] == 'N') && $ctrls['LIMITES'] == 'Y') { $w_ctrls['LIMITES_W']=TRUE; if (count($e_ctrls) != 0) { $upd_ctrls['LIMITES']=FALSE; $upd_ctrls['LIMITESV']=FALSE; } } } elseif ($Return == 'P') { if (empty($ctrls['PRICEA']) && !empty($ctrls['QTYA'])) { $e_ctrls['PRICEA_3']=TRUE; $upd_ctrls['PRICEA']=FALSE; } if (!empty($ctrls['PRICEA']) && empty($ctrls['PRICE'])) { $e_ctrls['PRICEA_4']=TRUE; $upd_ctrls['PRICEA']=FALSE; } if (empty($ctrls['PRICEA']) && !empty($ctrls['PRICEB'])) { $e_ctrls['PRICEA_5']=TRUE; $upd_ctrls['PRICEA']=FALSE; } if (empty($ctrls['QTYA']) && !empty($ctrls['PRICEA'])) { $e_ctrls['QTYA_3']=TRUE; $upd_ctrls['QTYA']=FALSE; } if (!empty($ctrls['QTYA']) && empty($ctrls['PRICE'])) { $e_ctrls['QTYA_4']=TRUE; $upd_ctrls['QTYA']=FALSE; } if (!empty($ctrls['QTYA']) && $ctrls['QTYA'] < 2) { $e_ctrls['QTYA_5']=TRUE; $upd_ctrls['QTYA']=FALSE; } if (!empty($ctrls['QTYA']) && !empty($ctrls['QTYB']) && ($ctrls['QTYB'] <= $ctrls['QTYA'])) { $e_ctrls['QTYA_6']=TRUE; $upd_ctrls['QTYA']=FALSE; } if (empty($ctrls['QTYA']) && !empty($ctrls['QTYB'])) { $e_ctrls['QTYA_7']=TRUE; $upd_ctrls['QTYA']=FALSE; } if (empty($ctrls['PRICEB']) && !empty($ctrls['QTYB'])) { $e_ctrls['PRICEB_3']=TRUE; $upd_ctrls['PRICEB']=FALSE; } if (!empty($ctrls['PRICEB']) && empty($ctrls['PRICEA'])) { $e_ctrls['PRICEB_4']=TRUE; $upd_ctrls['PRICEB']=FALSE; } if (empty($ctrls['QTYB']) && !empty($ctrls['PRICEB'])) { $e_ctrls['QTYB_3']=TRUE; $upd_ctrls['QTYB']=FALSE; } if (!empty($ctrls['QTYB']) && empty($ctrls['PRICEA'])) { $e_ctrls['QTYB_4']=TRUE; $upd_ctrls['QTYB']=FALSE; } if (!empty($ctrls['QTYA']) && !empty($ctrls['QTYB']) && ($ctrls['QTYB'] <= $ctrls['QTYA'])) { $e_ctrls['QTYB_5']=TRUE; $upd_ctrls['QTYB']=FALSE; } if (array_key_exists('QTYA', $upd_ctrls) && !$upd_ctrls['QTYA'] && empty($o_ctrls['QTYA']) && array_key_exists('PRICEA', $upd_ctrls) && $upd_ctrls['PRICEA']) { $upd_ctrls['PRICEA']=FALSE; } if (array_key_exists('PRICEA', $upd_ctrls) && !$upd_ctrls['PRICEA'] && empty($o_ctrls['PRICEA']) && array_key_exists('QTYA', $upd_ctrls) && $upd_ctrls['QTYA']) { $upd_ctrls['QTYA']=FALSE; } if (array_key_exists('QTYB', $upd_ctrls) && !$upd_ctrls['QTYB'] && empty($o_ctrls['QTYB']) && array_key_exists('PRICEB', $upd_ctrls) && $upd_ctrls['PRICEB']) { $upd_ctrls['PRICEB']=FALSE; } if (array_key_exists('PRICEB', $upd_ctrls) && !$upd_ctrls['PRICEB'] && empty($o_ctrls['PRICEB']) && array_key_exists('QTYB', $upd_ctrls) && $upd_ctrls['QTYB']) { $upd_ctrls['QTYB']=FALSE; } if (in_array($ctrls['PP-ACCEPT'], array('L', 'S'))) { if (empty($ctrls['PP-USER'])) { $e_ctrls['PP-USER_1']=TRUE; $upd_ctrls['PP-ACCEPT']=FALSE; } } else { if ($ctrls['PP-USER'] != '') { $upd_ctrls['PP-USER']=TRUE; } $ctrls['PP-USER']=''; } } elseif ($Return == 'S') { if (array_key_exists('RES-INTERVAL_2', $e_ctrls)) { $upd_ctrls['RES-PERIOD']=FALSE; } if (array_key_exists('RES-PERIOD_2', $e_ctrls)) { $upd_ctrls['RES-INTERVAL']=FALSE; } foreach (array('W', 'E', 'M') as $tag) { if (array_key_exists('SS-'.$tag.'-INTERVAL_2', $e_ctrls)) { $upd_ctrls['SS-'.$tag.'-PERIOD']=FALSE; } if (array_key_exists('SS-'.$tag.'-PERIOD_2', $e_ctrls)) { $upd_ctrls['SS-'.$tag.'-INTERVAL']=FALSE; } } } foreach ($upd_ctrls as $tag => $tag_val) { if ($tag_val) { $Result=upd_ctrl($Key, $tag, Format($tag, $ctrls[$tag]), $o_ctrls[$tag]); if ($Result == 'C') { $e_ctrls[$tag.'_C']=TRUE; $upd_ctrls[$tag]=FALSE; } else { $o_ctrls[$tag]=$ctrls[$tag]; } } } if ($Return == 'G') { if ($upd_ctrls['NB-ASK'] && $ctrls['NB-ASK'] == 'N') { $brewer=array(); $query='select brewer from brewer where new_brewer="Y" order by brewer'; $chg_res=mysqli_query($db, $query); while ($chg_row=mysqli_fetch_assoc($chg_res)) { $brewer[]=$chg_row['brewer']; } foreach ($brewer as $chg_brewer) { $query='update brewer set new_brewer="N" where brewer="'.$chg_brewer.'"'; if (mysqli_query($db, $query)) { $query='insert into changelog values(null, null, "'.$Key.'", "brewer", "C", "new_brewer", "'.$chg_brewer.'", "Y", "N")'; mysqli_query($db, $query); } } if (get_ctrl('NB-FREE') == 'Y') { upd_ctrl($Key, 'NB-FREE', 'N', 'Y'); } } if ($upd_ctrls['JS-LD'] && $ctrls['JS-LD'] == 'N') { $brewer=array(); $query='select brewer, rank, type_seq, cat, sub_cat from style_prefs where brewer>0 order by brewer, rank'; $chg_res=mysqli_query($db, $query); while ($chg_row=mysqli_fetch_assoc($chg_res)) { $brewer[]=$chg_row; } foreach ($brewer as $prefs) { $query='delete from style_prefs where brewer="'.$prefs['brewer'].'" and rank="'.$prefs['rank'].'"'; if (mysqli_query($db, $query)) { $query='insert into changelog values(null, null, "'.$Key.'", "style_prefs", "C", "", "'.$prefs['brewer'].':'.$prefs['rank'].'", "'.$prefs['type_seq'].':'.$prefs['cat'].':'.$prefs['sub_cat'].'", "")'; mysqli_query($db, $query); $query='insert into changelog values(null, null, "'.$Key.'", "style_prefs", "D", "", "'.$prefs['brewer'].':'.$prefs['rank'].'", "", "")'; mysqli_query($db, $query); } } } } } ?> '."\n"; } else { if (count($e_ctrls) == 0 && count($w_ctrls) == 0) { echo ''."\n"; $UseForm=FALSE; } else { $UseForm=TRUE; } } ?>

Updating Control values

'."\n"; if (!array_key_exists('BADPAGE', $e_ctrls)) { if (array_key_exists('RELOAD', $e_ctrls)) { echo ''."\n"; } else { echo ''."\n"; BuildHidden($ctrls, TRUE); BuildHidden($o_ctrls, TRUE, '_ORIG'); BuildHidden($e_ctrls); BuildHidden($w_ctrls); } } echo ''."\n"; echo ''."\n"; } ?>