Fix usage of get_value_from_array

This commit is contained in:
Armanveer Gill 2024-12-18 14:27:47 -05:00
parent ea287cd7af
commit cce7d93023
20 changed files with 63 additions and 61 deletions

View File

@ -36,7 +36,7 @@
"website_content_management" "website_content_management"
); );
if(get_value_from_array($_POST, 'action',"save")) if(get_value_from_array($_POST, 'action')=="save")
{ {
$err=false; $err=false;
foreach($config['languages'] AS $lang=>$langname) { foreach($config['languages'] AS $lang=>$langname) {

View File

@ -172,7 +172,7 @@ if(get_value_from_array($_POST,'committees_id') && get_value_from_array($_POST,'
} }
if(get_value_from_array($_POST, 'action', "assign")) if(get_value_from_array($_POST, 'action')=="assign")
{ {
if(get_value_from_array($_POST, 'committees_id') && get_vaue_from_array($_POST,'users_uid')) { if(get_value_from_array($_POST, 'committees_id') && get_vaue_from_array($_POST,'users_uid')) {
$cid = intval($_POST['committees_id']); $cid = intval($_POST['committees_id']);
@ -199,7 +199,7 @@ if(get_value_from_array($_GET, 'deletecommittee')) {
echo happy(i18n("Committee removed")); echo happy(i18n("Committee removed"));
} }
if(get_value_from_array($_POST, 'action',"remove")) { if(get_value_from_array($_POST, 'action')=="remove") {
/* user_delete takes care of unlinking the user in other tables */ /* user_delete takes care of unlinking the user in other tables */
user_delete($uid, 'committee'); user_delete($uid, 'committee');
echo happy(i18n("Committee member deleted")); echo happy(i18n("Committee member deleted"));

View File

@ -1293,7 +1293,7 @@ echo "<hr />";
</div> </div>
<? <?
if(get_value_from_array($_GET,'action',"add")) { if(get_value_from_array($_GET,'action')=="add") {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {

View File

@ -30,7 +30,7 @@
require_once('curl.inc.php'); require_once('curl.inc.php');
/* Hack so we can jump right to YSC stats */ /* Hack so we can jump right to YSC stats */
if(get_value_from_array($_GET,'abbrv','YSC')) { if(get_value_from_array($_GET,'abbrv')=='YSC') {
$q = $pdo->prepare("SELECT id FROM fairs WHERE abbrv='YSC'"); $q = $pdo->prepare("SELECT id FROM fairs WHERE abbrv='YSC'");
$q->execute(); $q->execute();
$r = $q->fetch(PDO::FETCH_ASSOC); $r = $q->fetch(PDO::FETCH_ASSOC);

View File

@ -26,7 +26,7 @@
user_auth_required('committee', 'admin'); user_auth_required('committee', 'admin');
if(get_value_from_array($_GET,'action',"refresh")) { if(get_value_from_array($_GET,'action') == "refresh") {
?> ?>
<h3><?=i18n("Fundraising Purposes and Progress Year to Date")?></h3> <h3><?=i18n("Fundraising Purposes and Progress Year to Date")?></h3>

View File

@ -209,7 +209,7 @@ echo $pdo->errorInfo();
} }
else if((get_value_from_array($_POST,'action',"receivedyes") || get_value_from_array($_POST,'action',"receivedyesnocash")) && get_value_from_array($_POST, 'registration_number')) { else if((get_value_from_array($_POST,'action') =="receivedyes" || get_value_from_array($_POST,'action') == "receivedyesnocash") && get_value_from_array($_POST, 'registration_number')) {
$regnum = intval($_POST['registration_number']); $regnum = intval($_POST['registration_number']);
$checkNumQuery=$pdo->prepare("SELECT projectnumber $checkNumQuery=$pdo->prepare("SELECT projectnumber
@ -285,12 +285,12 @@ echo $pdo->errorInfo();
echo happy(i18n("Registration of form %1 marked as payment pending",array($regnum))); echo happy(i18n("Registration of form %1 marked as payment pending",array($regnum)));
} }
} }
else if(get_value_from_array($_POST, 'action',"receivedno") && get_value_from_array($_POST, 'registration_number')) else if(get_value_from_array($_POST, 'action') == "receivedno" && get_value_from_array($_POST, 'registration_number'))
{ {
echo notice(i18n("Registration of form %1 cancelled",array($_POST['registration_number']))); echo notice(i18n("Registration of form %1 cancelled",array($_POST['registration_number'])));
} }
else if(get_value_from_array($_GET,'action',"unregister") && get_value_from_array($_GET, 'registration_number')) { else if(get_value_from_array($_GET,'action') == "unregister" && get_value_from_array($_GET, 'registration_number')) {
$reg_num=intval(trim($_GET['registration_number'])); $reg_num=intval(trim($_GET['registration_number']));
$q=$pdo-prepare("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.year='{$config['FAIRYEAR']}' AND registrations.num='$reg_num'"); $q=$pdo-prepare("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.year='{$config['FAIRYEAR']}' AND registrations.num='$reg_num'");
$q->execute(); $q->execute();

View File

@ -27,9 +27,9 @@
user_auth_required('committee', 'admin'); user_auth_required('committee', 'admin');
if(get_value_from_array($_POST,'save',"edit") || get_value_from_array($_POST,'save',"add")) if(get_value_from_array($_POST,'save') == "edit" || get_value_from_array($_POST,'save') == "add")
{ {
if(get_value_from_array($_POST,'save',"add")) if(get_value_from_array($_POST,'save') == "add")
{ {
$q=$pdo->prepare("INSERT INTO schools (year) VALUES ('".$config['FAIRYEAR']."')"); $q=$pdo->prepare("INSERT INTO schools (year) VALUES ('".$config['FAIRYEAR']."')");
$q->execute(); $q->execute();
@ -148,27 +148,27 @@
$stmt->execute(); $stmt->execute();
show_pdo_errors_if_any($pdo); show_pdo_errors_if_any($pdo);
if(get_value_from_array($_POST,'save',"add")) if(get_value_from_array($_POST,'save') == "add")
$notice = 'added'; $notice = 'added';
else else
$notice = 'saved'; $notice = 'saved';
} }
if(get_value_from_array($_GET,'action',"delete") && get_value_from_array($_GET, 'delete', '')) if(get_value_from_array($_GET,'action') == "delete" && get_value_from_array($_GET, 'delete', ''))
{ {
$stmt = $pdo->prepare("DELETE FROM schools WHERE id='".$_GET['delete']."'"); $stmt = $pdo->prepare("DELETE FROM schools WHERE id='".$_GET['delete']."'");
$stmt->execute(); $stmt->execute();
$notice = 'deleted'; $notice = 'deleted';
} }
if(get_value_from_array($_GET,'action',"clearaccesscodes")) if(get_value_from_array($_GET,'action') == "clearaccesscodes")
{ {
$stmt = $pdo->prepare("UPDATE schools SET accesscode=NULL WHERE year='{$config['FAIRYEAR']}'"); $stmt = $pdo->prepare("UPDATE schools SET accesscode=NULL WHERE year='{$config['FAIRYEAR']}'");
$stmt->execute(); $stmt->execute();
$notice = 'clearaccess'; $notice = 'clearaccess';
} }
if(get_value_from_array($_GET,'action',"makeaccesscodes")) if(get_value_from_array($_GET,'action') == "makeaccesscodes")
{ {
$q=$pdo->prepare("SELECT id FROM schools WHERE year='{$config['FAIRYEAR']}' AND (accesscode IS NULL OR accesscode='')"); $q=$pdo->prepare("SELECT id FROM schools WHERE year='{$config['FAIRYEAR']}' AND (accesscode IS NULL OR accesscode='')");
$q->execute(); $q->execute();
@ -182,23 +182,23 @@
$notice = 'makeaccess'; $notice = 'makeaccess';
} }
if(get_value_from_array($_GET,'action',"edit") || get_value_from_array($_GET,'action',"add")) if(get_value_from_array($_GET,'action') == "edit" || get_value_from_array($_GET,'action') == "add")
{ {
send_header(get_value_from_array($_GET, 'action', 'edit') ? "Edit School" : "Add New School", send_header(get_value_from_array($_GET, 'action') == 'edit' ? "Edit School" : "Add New School",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php', 'Administration' => 'admin/index.php',
'School Management' => 'admin/schools.php'), 'School Management' => 'admin/schools.php'),
"schools_management" "schools_management"
); );
if(get_value_from_array($_GET,'action',"edit")) if(get_value_from_array($_GET,'action') == "edit")
{ {
$buttontext="Save School"; $buttontext="Save School";
$q=$pdo->prepare("SELECT * FROM schools WHERE id='".get_value_from_array($_GET, 'edit', '')."'"); $q=$pdo->prepare("SELECT * FROM schools WHERE id='".get_value_from_array($_GET, 'edit', '')."'");
$q->execute(); $q->execute();
$r=$q->fetch(PDO::FETCH_OBJ); $r=$q->fetch(PDO::FETCH_OBJ);
} }
else if(get_value_from_array($_GET, 'action',"add")) else if(get_value_from_array($_GET, 'action') == "add")
{ {
$buttontext="Add School"; $buttontext="Add School";
} }
@ -207,7 +207,7 @@
echo "<form method=\"post\" action=\"schools.php\">\n"; echo "<form method=\"post\" action=\"schools.php\">\n";
echo "<input type=\"hidden\" name=\"save\" value=\"".get_value_from_array($_GET, 'action')."\">\n"; echo "<input type=\"hidden\" name=\"save\" value=\"".get_value_from_array($_GET, 'action')."\">\n";
if(get_value_from_array($_GET,'action',"edit")) if(get_value_from_array($_GET,'action') == "edit")
echo "<input type=\"hidden\" name=\"id\" value=\"".get_value_from_array($_GET,'edit', '')."\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"".get_value_from_array($_GET,'edit', '')."\">\n";
echo "<table>\n"; echo "<table>\n";

View File

@ -37,12 +37,12 @@
$show_types = $_GET['show_types']; $show_types = $_GET['show_types'];
if(user_valid_type($show_types) == false) $show_types = array('judge'); if(user_valid_type($show_types) == false) $show_types = array('judge');
$show_complete = (get_value_from_array($_GET,'show_complete','yes')) ? 'yes' : 'no'; $show_complete = (get_value_from_array($_GET,'show_complete') == 'yes') ? 'yes' : 'no';
$show_year = get_value_from_array($_GET,'show_year','current') ? 'current' : 'all'; $show_year = get_value_from_array($_GET,'show_year') == 'current' ? 'current' : 'all';
$uid = intval(get_value_from_array($_GET,'uid')); $uid = intval(get_value_from_array($_GET,'uid'));
if(get_value_from_array($_GET,'action','remove')) { if(get_value_from_array($_GET,'action') == 'remove') {
if(!$uid) { if(!$uid) {
echo "Invalid uid for delete"; echo "Invalid uid for delete";
exit; exit;

View File

@ -32,7 +32,7 @@ if(!file_exists("../data/backuprestore"))
file_put_contents("../data/backuprestore/.htaccess","Order Deny,Allow\r\nDeny From All\r\n"); file_put_contents("../data/backuprestore/.htaccess","Order Deny,Allow\r\nDeny From All\r\n");
if(get_value_from_array($_GET,'action',"backup")) { if(get_value_from_array($_GET,'action') == "backup") {
$ts=time(); $ts=time();
$dump="#SFIAB SQL BACKUP: ".date("r",$ts)."\n"; $dump="#SFIAB SQL BACKUP: ".date("r",$ts)."\n";
$dump.="#SFIAB VERSION: ".$config['version']."\n"; $dump.="#SFIAB VERSION: ".$config['version']."\n";

View File

@ -27,8 +27,8 @@
require_once('../helper.inc.php'); require_once('../helper.inc.php');
user_auth_required('committee', 'config'); user_auth_required('committee', 'config');
if(get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'action',"new")) { if(get_value_from_array($_GET, 'action') == "edit" || get_value_from_array($_GET,'action') == "new") {
send_header((get_value_from_array($_GET, 'action',"edit")) ? 'Edit Category' : 'New Category', send_header((get_value_from_array($_GET, 'action') == "edit") ? 'Edit Category' : 'New Category',
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php', 'SFIAB Configuration' => 'config/index.php',
'Age Categories' => 'config/categories.php'),"project_age_categories"); 'Age Categories' => 'config/categories.php'),"project_age_categories");
@ -38,7 +38,7 @@
'SFIAB Configuration' => 'config/index.php'),"project_age_categories"); 'SFIAB Configuration' => 'config/index.php'),"project_age_categories");
} }
if(get_value_from_array($_POST, 'action', "edit")) if(get_value_from_array($_POST, 'action') == "edit")
{ {
//ues isset($_POST['mingrade']) instead of just $_POST['mingrade'] to allow entering 0 for kindergarden //ues isset($_POST['mingrade']) instead of just $_POST['mingrade'] to allow entering 0 for kindergarden
if(get_value_from_array($_POST, 'id') && get_value_from_array($_POST, 'category') && isset($_POST['mingrade']) && $_POST['maxgrade']) if(get_value_from_array($_POST, 'id') && get_value_from_array($_POST, 'category') && isset($_POST['mingrade']) && $_POST['maxgrade'])
@ -69,7 +69,7 @@
} }
} }
if(get_value_from_array($_POST, 'action', "new")) if(get_value_from_array($_POST, 'action') == "new")
{ {
//ues isset($_POST['mingrade']) instead of just $_POST['mingrade'] to allow entering 0 for kindergarden //ues isset($_POST['mingrade']) instead of just $_POST['mingrade'] to allow entering 0 for kindergarden
if(get_value_from_array($_POST, 'id') && $_POST['category'] && isset($_POST['mingrade']) && $_POST['maxgrade']) if(get_value_from_array($_POST, 'id') && $_POST['category'] && isset($_POST['mingrade']) && $_POST['maxgrade'])
@ -100,7 +100,7 @@
} }
} }
if(get_value_from_array($_GET, 'action',"remove") && get_value_from_array($_GET, 'remove')) if(get_value_from_array($_GET, 'action') == "remove" && get_value_from_array($_GET, 'remove'))
{ {
//###### Feature Specific - filtering divisions by category - not conditional, cause even if they have the filtering turned off..if any links //###### Feature Specific - filtering divisions by category - not conditional, cause even if they have the filtering turned off..if any links
//for this division exist they should be deleted //for this division exist they should be deleted
@ -114,7 +114,7 @@
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">"; echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
if(! get_value_from_array($_GET, 'action', "edit" ) || get_value_from_array($_GET, 'action',"new") ) if(! get_value_from_array($_GET, 'action') == "edit" || get_value_from_array($_GET, 'action') == "new")
echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\">".i18n("Add new age category")."</a>\n"; echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\">".i18n("Add new age category")."</a>\n";
echo "<table class=\"summarytable\">"; echo "<table class=\"summarytable\">";
@ -127,10 +127,10 @@
echo "<th>".i18n("Actions")."</th>\n"; echo "<th>".i18n("Actions")."</th>\n";
echo "</tr>"; echo "</tr>";
if(get_value_from_array($_GET, 'action', "edit") || get_value_from_array($_GET, 'action', "new")) if(get_value_from_array($_GET, 'action') == "edit") || get_value_from_array($_GET, 'action') == "new")
{ {
echo "<input type=\"hidden\" name=\"action\" value=\"".get_value_from_array($_GET,'action')."\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"".get_value_from_array($_GET,'action')."\">\n";
if(get_value_from_array($_GET,'action',"edit")) if(get_value_from_array($_GET,'action') == "edit")
{ {
echo "<input type=\"hidden\" name=\"saveid\" value=\"".get_value_from_array($_GET, 'edit')."\">\n"; echo "<input type=\"hidden\" name=\"saveid\" value=\"".get_value_from_array($_GET, 'edit')."\">\n";
$q=$pdo->prepare("SELECT * FROM projectcategories WHERE id='".get_value_from_array($_GET, 'edit')."' AND year='".$config['FAIRYEAR']."'"); $q=$pdo->prepare("SELECT * FROM projectcategories WHERE id='".get_value_from_array($_GET, 'edit')."' AND year='".$config['FAIRYEAR']."'");
@ -138,7 +138,7 @@
$categoryr=$q->fetch(PDO::FETCH_OBJ); $categoryr=$q->fetch(PDO::FETCH_OBJ);
$buttontext="Save"; $buttontext="Save";
} }
else if(get_value_from_array($_GET,'action',"new")) else if(get_value_from_array($_GET,'action') == "new")
{ {
$buttontext="Add"; $buttontext="Add";
} }

View File

@ -50,7 +50,7 @@ $(document).ready(function() {
$error_ids = array(); $error_ids = array();
if(get_value_from_array($_POST, 'action', "save")) { if(get_value_from_array($_POST, 'action') == "save") {
if($_POST['savedates']) { if($_POST['savedates']) {
foreach($_POST['savedates'] as $key=>$val) { foreach($_POST['savedates'] as $key=>$val) {
//put the date and time back together //put the date and time back together

View File

@ -27,8 +27,8 @@
require_once('../helper.inc.php'); require_once('../helper.inc.php');
user_auth_required('committee', 'config'); user_auth_required('committee', 'config');
if(get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'action',"new")) { if(get_value_from_array($_GET, 'action') == "edit" || get_value_from_array($_GET,'action') == "new") {
send_header(get_value_from_array($_GET,'action',"edit") ? "Edit Division" : "New Division", send_header(get_value_from_array($_GET,'action') == "edit" ? "Edit Division" : "New Division",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php', 'SFIAB Configuration' => 'config/index.php',
'Project Divisions' => 'config/divisions.php'), 'Project Divisions' => 'config/divisions.php'),
@ -41,7 +41,7 @@ if(get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'a
} }
if(get_value_from_array($_POST,'action',"edit")) if(get_value_from_array($_POST,'action') == "edit")
{ {
if(get_value_from_array($_POST, 'id') && get_value_from_array($_POST, 'division' )) if(get_value_from_array($_POST, 'id') && get_value_from_array($_POST, 'division' ))
{ {
@ -87,7 +87,7 @@ if(get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'a
} }
} }
if(get_value_from_array($_POST, 'action',"new")) if(get_value_from_array($_POST, 'action') == "new")
{ {
if(get_value_from_array($_POST, 'id') && get_value_from_array($_POST, 'division')) if(get_value_from_array($_POST, 'id') && get_value_from_array($_POST, 'division'))
{ {
@ -126,7 +126,7 @@ if(get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'a
} }
} }
if(get_value_from_array($_GET,'action',"remove") && get_value_from_array($_GET, 'remove')) if(get_value_from_array($_GET,'action') == "remove") && get_value_from_array($_GET, 'remove'))
{ {
//###### Feature Specific - filtering divisions by category - not conditional, cause even if they have the filtering turned off..if any links //###### Feature Specific - filtering divisions by category - not conditional, cause even if they have the filtering turned off..if any links
//for this division exist they should be deleted //for this division exist they should be deleted
@ -139,7 +139,7 @@ if(get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'a
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">"; echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
if(! get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'action',"new") ) if(! get_value_from_array($_GET, 'action') == "edit"|| get_value_from_array($_GET,'action') == "new")
echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\">".i18n("Add new division")."</a>\n"; echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\">".i18n("Add new division")."</a>\n";
echo "<table class=\"summarytable\">"; echo "<table class=\"summarytable\">";
@ -154,10 +154,10 @@ if(get_value_from_array($_GET, 'action',"edit") || get_value_from_array($_GET,'a
echo "<th>".i18n("Actions")."</th>\n"; echo "<th>".i18n("Actions")."</th>\n";
echo "</tr>"; echo "</tr>";
if(get_value_from_array($_GET, 'action', "edit") ||get_value_from_array( $_GET,'action',"new")) if(get_value_from_array($_GET, 'action') == "edit" ||get_value_from_array( $_GET,'action') == "new")
{ {
echo "<input type=\"hidden\" name=\"action\" value=\"".get_value_from_array($_GET, 'action')."\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"".get_value_from_array($_GET, 'action')."\">\n";
if(get_value_from_array($_GET,'action',"edit")) if(get_value_from_array($_GET,'action') == "edit")
{ {
echo "<input type=\"hidden\" name=\"saveid\" value=\"".get_value_from_array($_GET,'edit')."\">\n"; echo "<input type=\"hidden\" name=\"saveid\" value=\"".get_value_from_array($_GET,'edit')."\">\n";
$q=$pdo->prepare("SELECT * FROM projectdivisions WHERE id='".get_value_from_array($_GET,'edit')."' AND year='".$config['FAIRYEAR']."'"); $q=$pdo->prepare("SELECT * FROM projectdivisions WHERE id='".get_value_from_array($_GET,'edit')."' AND year='".$config['FAIRYEAR']."'");

View File

@ -30,7 +30,7 @@ send_header("Fair Logo Image",
'SFIAB Configuration' => 'config/index.php'), 'SFIAB Configuration' => 'config/index.php'),
"images"); "images");
if(get_value_from_array($_POST,'action',"addimage")) { if(get_value_from_array($_POST,'action') == "addimage") {
if($_FILES['image']['error']==UPLOAD_ERR_OK) { if($_FILES['image']['error']==UPLOAD_ERR_OK) {
//make sure its a JPEG //make sure its a JPEG
$imagesize=getimagesize($_FILES['image']['tmp_name']); $imagesize=getimagesize($_FILES['image']['tmp_name']);
@ -96,7 +96,7 @@ if(get_value_from_array($_POST,'action',"addimage")) {
echo error(i18n("Error uploading Logo Image").": ".$_FILES['image']['error']); echo error(i18n("Error uploading Logo Image").": ".$_FILES['image']['error']);
} }
if(get_value_from_array($_POST,'action',"delimage")) { if(get_value_from_array($_POST,'action') == "delimage") {
@unlink("../data/logo.gif"); @unlink("../data/logo.gif");
@unlink("../data/logo-100.gif"); @unlink("../data/logo-100.gif");
@unlink("../data/logo-200.gif"); @unlink("../data/logo-200.gif");

View File

@ -62,7 +62,7 @@
} }
if(get_value_from_array($_GET,'action',"check")) if(get_value_from_array($_GET,'action') == "check"))
{ {
$packs=loadLanguagePacks(); $packs=loadLanguagePacks();
@ -92,7 +92,7 @@
} }
} }
if(get_value_from_array($_GET,'action',"install") && get_value_from_array($_GET,'install')) if(get_value_from_array($_GET,'action') == "install" && get_value_from_array($_GET,'install'))
{ {
$packs=loadLanguagePacks(); $packs=loadLanguagePacks();
$loaded=0; $loaded=0;

View File

@ -75,7 +75,7 @@ function draw_body(){
} }
function rolloverfiscalyear($newYear){ function rolloverfiscalyear($newYear){
global $config; global $config, $pdo;
$oldYear = $config['FISCALYEAR']; $oldYear = $config['FISCALYEAR'];
$yearDiff = $newYear - $oldYear; $yearDiff = $newYear - $oldYear;

View File

@ -32,7 +32,7 @@
,"exhibitor_signature_page" ,"exhibitor_signature_page"
); );
if(get_value_from_array($_POST,'action',"save")) if(get_value_from_array($_POST,'action') == "save")
{ {
if(get_value_from_array($_POST, 'useexhibitordeclaration')) $useex="1"; else $useex="0"; if(get_value_from_array($_POST, 'useexhibitordeclaration')) $useex="1"; else $useex="0";
if(get_value_from_array($_POST, 'useparentdeclaration')) $usepg="1"; else $usepg="0"; if(get_value_from_array($_POST, 'useparentdeclaration')) $usepg="1"; else $usepg="0";

View File

@ -25,8 +25,8 @@
require("../common.inc.php"); require("../common.inc.php");
require_once("../user.inc.php"); require_once("../user.inc.php");
user_auth_required('committee', 'config'); user_auth_required('committee', 'config');
if(get_value_from_array($_GET,'action',"edit") || get_value_from_array($_GET,'action',"new")) { if(get_value_from_array($_GET,'action') == "edit" || get_value_from_array($_GET,'action') == "new") {
send_header(get_value_from_array($_GET,'action',"edit") ? "Edit Sub-Division" : "New Sub-Division", send_header(get_value_from_array($_GET,'action') == "edit" ? "Edit Sub-Division" : "New Sub-Division",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php', 'SFIAB Configuration' => 'config/index.php',
'Project Sub-Divisions' => 'config/subdivisions.php'), 'Project Sub-Divisions' => 'config/subdivisions.php'),
@ -38,7 +38,7 @@
"project_sub_divisions"); "project_sub_divisions");
} }
if(get_value_from_array($_POST,'action',"edit")) if(get_value_from_array($_POST,'action') == "edit")
{ {
if(get_value_from_array($_POST,'id' )&& get_value_from_array($_POST,'projectdivisions_id') && get_value_from_array($_POST,'subdivision') ) if(get_value_from_array($_POST,'id' )&& get_value_from_array($_POST,'projectdivisions_id') && get_value_from_array($_POST,'subdivision') )
{ {
@ -65,7 +65,7 @@
} }
} }
if(get_value_from_array($_POST,'action',"new")) if(get_value_from_array($_POST,'action') == "new")
{ {
if(get_value_from_array($_POST, 'projectdivisions_id') && get_value_from_array($_POST,'subdivision')) if(get_value_from_array($_POST, 'projectdivisions_id') && get_value_from_array($_POST,'subdivision'))
{ {
@ -103,7 +103,7 @@
} }
} }
if(get_value_from_array($_GET,'action',"remove") && get_value_from_array($_GET,'remove')) if(get_value_from_array($_GET,'action') == "remove") && get_value_from_array($_GET,'remove'))
{ {
$stmt = $pdo->prepare("DELETE FROM projectsubdivisions WHERE id='".$_GET['remove']."'"); $stmt = $pdo->prepare("DELETE FROM projectsubdivisions WHERE id='".$_GET['remove']."'");
$stmt->execute(); $stmt->execute();
@ -112,7 +112,7 @@
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">"; echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
if(! (get_value_from_array($_GET,'action',"edit") || get_value_from_array($_GET,'action',"new")) ) if(! (get_value_from_array($_GET,'action') == "edit" || get_value_from_array($_GET,'action') == "new"))
echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\">".i18n("Add new sub-division")."</a>\n"; echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\">".i18n("Add new sub-division")."</a>\n";
echo "<table class=\"summarytable\">"; echo "<table class=\"summarytable\">";
@ -123,10 +123,10 @@
echo "<th>".i18n("Actions")."</th>\n"; echo "<th>".i18n("Actions")."</th>\n";
echo "</tr>"; echo "</tr>";
if(get_value_from_array($_GET,'action',"edit") || get_value_from_array($_GET, 'action',"new")) if(get_value_from_array($_GET,'action') == "edit" || get_value_from_array($_GET, 'action') == "new")
{ {
echo "<input type=\"hidden\" name=\"action\" value=\"".get_value_from_array($_GET,'action')."\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"".get_value_from_array($_GET,'action')."\">\n";
if(get_value_from_array($_GET,'action',"edit")) if(get_value_from_array($_GET,'action') == "edit")
{ {
echo "<input type=\"hidden\" name=\"saveid\" value=\"".get_value_from_array($_GET, 'edit')."\">\n"; echo "<input type=\"hidden\" name=\"saveid\" value=\"".get_value_from_array($_GET, 'edit')."\">\n";
$q=$pdo->prepare("SELECT * FROM projectsubdivisions WHERE id='".get_value_from_array($_GET,'edit')."' AND year='".$config['FAIRYEAR']."'"); $q=$pdo->prepare("SELECT * FROM projectsubdivisions WHERE id='".get_value_from_array($_GET,'edit')."' AND year='".$config['FAIRYEAR']."'");
@ -187,7 +187,7 @@ echo $pdo->errorInfo();
} }
} }
echo "</table>"; echo "</table>";
if(get_value_from_array($_GET,'action',"new")) if(get_value_from_array($_GET,'action') == "new")
echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;".i18n("Leave ID field blank to auto-assign next available ID"); echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;".i18n("Leave ID field blank to auto-assign next available ID");
echo "</form>"; echo "</form>";

View File

@ -53,7 +53,7 @@
return $ret; return $ret;
} }
if(get_value_from_array($_GET, 'action',"check")) if(get_value_from_array($_GET, 'action') == "check")
{ {
$v=loadVersions(); $v=loadVersions();
echo i18n("Newest version available: <b>%1</b> (%2)",array($v['version'],$v['date'])); echo i18n("Newest version available: <b>%1</b> (%2)",array($v['version'],$v['date']));

View File

@ -141,7 +141,7 @@ function config_editor_handle_actions($category, $year, $array_name)
$config_editor_actions_done = true; $config_editor_actions_done = true;
$updated = false; $updated = false;
if(get_value_from_array($_POST, 'action', "update")) { if(get_value_from_array($_POST, 'action') == "update") {
$var = config_editor_parse_from_http_headers($array_name); $var = config_editor_parse_from_http_headers($array_name);
$varkeys = array_keys($var); $varkeys = array_keys($var);
foreach($varkeys as $k) { foreach($varkeys as $k) {

View File

@ -381,7 +381,8 @@ function user_save_type_list($u, $db, $fields)
$stmt->execute(); $stmt->execute();
if($pdo->errorInfo()) { if($pdo->errorInfo()) {
show_pdo_errors_if_any($pdo); show_pdo_errors_if_any($pdo);
echo error("Full query: $query"); //FIXME Take advantage of this function
//echo error("Full query: $query");
} }
} }
} }
@ -584,7 +585,8 @@ function user_delete($u, $type=false)
if(!is_array($u)) { if(!is_array($u)) {
$u = user_load($u); $u = user_load($u);
} }
if($type != false) { if($type != false) {
if(!in_array($type, $u['types'])) { if(!in_array($type, $u['types'])) {
/* Hum, type specified, but the user is not this type, /* Hum, type specified, but the user is not this type,