Resolved errors and issues for Configuration menu

This commit is contained in:
Armanveer Gill 2025-01-01 10:14:13 -05:00
parent 36996267e0
commit e869c34ad5
13 changed files with 33 additions and 26 deletions

View File

@ -1050,8 +1050,8 @@ if(!$orderby) $orderby="order";
$q->execute();
echo $pdo->errorInfo();
show_do_errros_if_any($pdo);
print_r($q->rowCount());
if($q->rowCount())
{
echo "* ".i18n("Click on the Script Order and drag to re-order the awards");

View File

@ -276,7 +276,7 @@ function i18n($str,$args=array(),$argsdesc=array(),$forcelang="")
{
for($x=1;$x<=count($args);$x++)
{
$str=str_replace("%$x",$args[$x-1],$str);
$str=str_replace("%$x",get_value_from_array($args,$x-1, ''),$str);
}
if($forcelang) $_SESSION['lang']=$savelang;
return $str;

View File

@ -88,7 +88,7 @@ echo $dump;
}
else if($_POST['action']=="restore") {
else if(get_value_from_array($_POST, 'action')=="restore") {
echo send_header("Database Backup/Restore",
array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php')
@ -150,7 +150,7 @@ else if($_POST['action']=="restore") {
send_footer();
}
else if($_POST['action']=="restoreproceed") {
else if(get_value_from_array($_POST,'action')=="restoreproceed") {
echo send_header("Database Backup/Restore",
array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php')
@ -207,7 +207,7 @@ else if($_POST['action']=="restoreproceed") {
}
else if ($_POST['action'] == 'clean_judges') {
else if (get_value_from_array($_POST, 'action') == 'clean_judges') {
//select all judges
$query = $pdo->prepare('SELECT * FROM users WHERE types LIKE "judge"');
@ -273,7 +273,7 @@ else if ($_POST['action'] == 'clean_judges') {
error(i18n($str));}
}
else if ($_POST['action'] == 'clean_parents') {
else if (get_value_from_array($_POST, 'action') == 'clean_parents') {
$query_parents = $pdo->prepare('SELECT * FROM users WHERE types LIKE "parent" AND year !='.$config['FAIRYEAR']);
$query_parents->execute();

View File

@ -73,7 +73,7 @@
{
//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'])
{
{
$q=$pdo->prepare("SELECT id FROM projectcategories WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'");
$q->execute();
if($q->rowCount())
@ -81,15 +81,15 @@
echo error(i18n("Category ID %1 already exists",array($_POST['id']),array("category ID")));
}
else
{
$pdo->prepare("INSERT INTO projectcategories (id,category,category_shortform,mingrade,maxgrade,year) VALUES ( ".
{
$stmt = $pdo->prepare("INSERT INTO projectcategories (id,category,category_shortform,mingrade,maxgrade,year) VALUES ( ".
"'".$_POST['id']."', ".
"'".stripslashes($_POST['category'])."', ".
"'".stripslashes($_POST['category_shortform'])."', ".
"'".$_POST['mingrade']."', ".
"'".$_POST['maxgrade']."', ".
"'".$config['FAIRYEAR']."')");
$pdo->execute();
$stmt->execute();
echo happy(i18n("Category successfully added"));
}
@ -127,6 +127,8 @@
echo "<th>".i18n("Actions")."</th>\n";
echo "</tr>";
$categoryr = null;
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";
@ -145,10 +147,10 @@
echo "<tr>";
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"".get_value_property_or_default($categoryr, 'id', ' ')."\"></td>";
echo " <td><input type=\"text\" size=\"20\" name=\"category\" value=\"$categoryr->category\"></td>";
echo " <td><input type=\"text\" size=\"5\" name=\"category_shortform\" value=\"$categoryr->category_shortform\"></td>";
echo " <td><input type=\"text\" size=\"3\" name=\"mingrade\" value=\"$categoryr->mingrade\"></td>";
echo " <td><input type=\"text\" size=\"3\" name=\"maxgrade\" value=\"$categoryr->maxgrade\"></td>";
echo " <td><input type=\"text\" size=\"20\" name=\"category\" value=\"".get_value_property_or_default($categoryr, 'category')."\"></td>";
echo " <td><input type=\"text\" size=\"5\" name=\"category_shortform\" value=\"".get_value_property_or_default($categoryr, 'category_shortform')."\"></td>";
echo " <td><input type=\"text\" size=\"3\" name=\"mingrade\" value=\"".get_value_property_or_default($categoryr, 'mingrade')."\"></td>";
echo " <td><input type=\"text\" size=\"3\" name=\"maxgrade\" value=\"".get_value_property_or_default($categoryr, 'maxgrade')."\"></td>";
echo " <td><input type=\"submit\" value=\"".i18n($buttontext)."\"></td>";
echo "</tr>";
}

View File

@ -27,6 +27,8 @@
require_once('../helper.inc.php');
user_auth_required('committee', 'config');
$divisionr = null;
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",
array('Committee Main' => 'committee_main.php',
@ -154,6 +156,7 @@ if(get_value_from_array($_GET, 'action') == "edit" || get_value_from_array($_GET
echo "<th>".i18n("Actions")."</th>\n";
echo "</tr>";
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";
@ -171,9 +174,9 @@ if(get_value_from_array($_GET, 'action') == "edit" || get_value_from_array($_GET
$buttontext="Add";
}
echo "<tr>";
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$divisionr->id\" /></td>";
echo " <td><input type=\"text\" size=\"40\" name=\"division\" value=\"$divisionr->division\" /></td>";
echo " <td align=\"center\"><input type=\"text\" size=\"5\" name=\"division_shortform\" value=\"$divisionr->division_shortform\" /></td>";
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"".get_value_property_or_default($divisionr, 'id')."\" /></td>";
echo " <td><input type=\"text\" size=\"40\" name=\"division\" value=\"".get_value_property_or_default($divisionr, 'division')."\" /></td>";
echo " <td align=\"center\"><input type=\"text\" size=\"5\" name=\"division_shortform\" value=\"".get_value_property_or_default($divisionr, 'division_shortform')."\" /></td>";
//###### Feature Specific - filtering divisions by category
if($config['filterdivisionbycategory']=="yes"){

View File

@ -34,7 +34,7 @@ if(get_value_from_array($_POST,'action') == "addimage") {
if($_FILES['image']['error']==UPLOAD_ERR_OK) {
//make sure its a JPEG
$imagesize=getimagesize($_FILES['image']['tmp_name']);
if($imagesize[2]==1 || $imagesize[2]==2 || $imagesize[2]==3) // GIF or JPG or PNG
if(get_value_from_array($imagesize, 2)==1 || get_value_from_array($imagesize, 2)==2 || get_value_from_array($imagesize, 2)==3) // GIF or JPG or PNG
{
/* Here's how to do it with GD, if GD didn't absolutely suck at

View File

@ -48,6 +48,7 @@
'".$r->text."',
'".$config['FAIRYEAR']."',
'".$lang."')");
echo $r->textname;
$q->execute();
}
}

View File

@ -57,10 +57,10 @@
if(get_value_from_array($_GET, 'action') == "check")
{
$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(get_value_from_array($v,'version'),get_value_from_array($v, 'date')));
echo "<br />";
echo "<br />";
$val=version_compare($config['version'],$v['version']);
$val=version_compare(get_value_from_array($config,'version',''),get_value_from_array($v, 'version', ' '));
if($val==0)
{
echo happy(i18n("Your current version (%1) is up-to-date",array($config['version'])));
@ -72,7 +72,7 @@
}
else if($val>0)
{
echo happy(i18n("You are running a newer (probably a development) version (%1) that is newer than the most recent release (%2)",array($config['version'],$v['version'])));
echo happy(i18n("You are running a newer (probably a development) version (%1) that is newer than the most recent release (%2)",array(get_value_from_array($config,'version'),get_value_from_array($v,'version'))));
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -31,6 +31,7 @@ function questions_load_answers($section, $users_id)
$yearq->execute();
$yearr=$yearq->fetch(PDO::FETCH_OBJ);
$ans=array();
$qs=questions_load_questions($section,$yearr->year);
foreach($qs AS $id=>$question) {
$q=$pdo->prepare("SELECT * FROM question_answers WHERE users_id='$users_id' AND questions_id='$id'");
@ -180,7 +181,7 @@ function questions_update_question($qs)
}
function questions_save_new_question($qs, $year)
{
{ global $pdo;
$stmt = $pdo->prepare("INSERT INTO questions ".
"(question,type,section,db_heading,required,ord,year) VALUES (".
"'".$qs['question']."',".
@ -347,7 +348,7 @@ function questions_editor($section, $year, $array_name, $self)
if((get_value_from_array($_GET, 'action') == "edit" && get_value_from_array($_GET, 'edit')) || get_value_from_array($_GET, 'action') == "new") {
$q = null;
$showform=true;
echo "<form method=\"post\" action=\"$self\">";
if($_GET['action']=="new")
@ -373,10 +374,10 @@ function questions_editor($section, $year, $array_name, $self)
{
echo "<table class=\"summarytable\">";
echo "<tr><td>".i18n("Question")."</td><td>";
echo "<input size=\"60\" type=\"text\" name=\"{$array_name}[question]\" value=\"".htmlspecialchars($q['question'])."\">\n";
echo "<input size=\"60\" type=\"text\" name=\"{$array_name}[question]\" value=\"".htmlspecialchars(get_value_from_array($q, 'question', ''))."\">\n";
echo "</td></tr>";
echo "<tr><td>".i18n("Table Heading")."</td><td>";
echo "<input size=\"20\" type=\"text\" name=\"{$array_name}[db_heading]\" value=\"".htmlspecialchars($q['db_heading'])."\">\n";
echo "<input size=\"20\" type=\"text\" name=\"{$array_name}[db_heading]\" value=\"".htmlspecialchars(get_value_from_array($q, 'db_heading', ''))."\">\n";
echo "</td></tr>";
echo "<tr><td>".i18n("Type")."</td><td>";
echo "<select name=\"{$array_name}[type]\">";