Fixed depreacated issues and warnings

This commit is contained in:
Armanveer Gill 2024-12-13 01:49:54 -05:00
parent 9892d738d4
commit 8630024655
9 changed files with 35 additions and 26 deletions

View File

@ -27,8 +27,8 @@ header("Content-Type: text/html; charset=utf8");
//set error reporting to not show notices, for some reason some people's installation dont set this by default //set error reporting to not show notices, for some reason some people's installation dont set this by default
//so we will set it in the code instead just to make sure //so we will set it in the code instead just to make sure
#error_reporting(E_ALL); error_reporting(E_ALL);
error_reporting( E_ALL ^ E_WARNING ); #error_reporting( E_ALL ^ E_WARNING );
#error_reporting( E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED ); #error_reporting( E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED );
define('REQUIREDFIELD','<span class="requiredfield">*</span>'); define('REQUIREDFIELD','<span class="requiredfield">*</span>');
@ -86,7 +86,7 @@ else
$dsn = "mysql:host=db;dbname=sfiab;charset=utf8mb4"; $dsn = "mysql:host=db;dbname=sfiab;charset=utf8mb4";
$pdo = new PDO($dsn,$DBUSER,$DBPASS,$dsn_options); $pdo = new PDO($dsn,$DBUSER,$DBPASS);
if(!$pdo) if(!$pdo)
{ {
@ -195,7 +195,7 @@ require_once("theme/{$config['theme_icons']}/icons.php");
require_once("committee.inc.php"); require_once("committee.inc.php");
session_start();
if($config['SFIABDIRECTORY'] == '') { if($config['SFIABDIRECTORY'] == '') {
session_name("SFIABSESSID"); session_name("SFIABSESSID");
@ -205,6 +205,8 @@ if($config['SFIABDIRECTORY'] == '') {
session_set_cookie_params(0,$config['SFIABDIRECTORY']); session_set_cookie_params(0,$config['SFIABDIRECTORY']);
} }
session_start();
//detect the browser first, so we know what icons to use - we store this in the config array as well //detect the browser first, so we know what icons to use - we store this in the config array as well
//even though its not configurable by the fair //even though its not configurable by the fair
if(stristr($_SERVER['HTTP_USER_AGENT'],"MSIE")) if(stristr($_SERVER['HTTP_USER_AGENT'],"MSIE"))
@ -230,6 +232,7 @@ else
} }
} }
//now if no language has been set yet, lets set it to the default language //now if no language has been set yet, lets set it to the default language
if(!$_SESSION['lang']) if(!$_SESSION['lang'])
{ {
//first try the default language, if that doesnt work, use "en" //first try the default language, if that doesnt work, use "en"
@ -1086,7 +1089,7 @@ function output_page_text($textname)
} }
//if it looks like we have HTML content, dont do a nl2br, if there's no html, then do the nl2br //if it looks like we have HTML content, dont do a nl2br, if there's no html, then do the nl2br
if(strlen($r->text)==strlen(strip_tags($r->text))) if($r->text !== null and strlen($r->text)==strlen(strip_tags($r->text)))
echo nl2br($r->text); echo nl2br($r->text);
else else
echo $r->text; echo $r->text;
@ -1108,7 +1111,7 @@ function output_page_cms($filename)
echo "<img align=\"right\" src=\"".$config['SFIABDIRECTORY']."/data/logo-200.gif\" border=\"0\">"; echo "<img align=\"right\" src=\"".$config['SFIABDIRECTORY']."/data/logo-200.gif\" border=\"0\">";
//if it looks like we have HTML content, dont do a nl2br, if there's no html, then do the nl2br //if it looks like we have HTML content, dont do a nl2br, if there's no html, then do the nl2br
if(strlen($r->text)==strlen(strip_tags($r->text))) if($r->text !== null and strlen($r->text)==strlen(strip_tags($r->text)))
echo nl2br($r->text); echo nl2br($r->text);
else else
echo $r->text; echo $r->text;

View File

@ -50,7 +50,7 @@ while($tr=$tableq->fetch(PDO::FETCH_NUM)) {
$str="INSERT INTO `$table` ("; $str="INSERT INTO `$table` (";
unset($fields); unset($fields);
$fields=array(); $fields=array();
while($cr=$columnq->fetch(PDO:;FETCH_OBJ)) { while($cr=$columnq->fetch(PDO:FETCH_OBJ)) {
$str.="`".$cr->Field."`,"; $str.="`".$cr->Field."`,";
$fields[]=$cr->Field; $fields[]=$cr->Field;
} }

View File

@ -31,7 +31,7 @@
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");
} else } else {
send_header("Age Categories", send_header("Age Categories",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php'),"project_age_categories"); 'SFIAB Configuration' => 'config/index.php'),"project_age_categories");

View File

@ -218,7 +218,7 @@ if($_GET['action']=="edit" || $_GET['action']=="new") {
$tempcat="&nbsp;"; $tempcat="&nbsp;";
}else{ }else{
$tempcat=""; $tempcat="";
while($categoryr=$c->fetch(PDO::FETCH_OBJ){ while($categoryr=$c->fetch(PDO::FETCH_OBJ)){
$tempcat.=",".$categoryr->category; $tempcat.=",".$categoryr->category;
} }
$tempcat=substr($tempcat,1); $tempcat=substr($tempcat,1);

View File

@ -39,6 +39,7 @@
function loadLanguagePacks() function loadLanguagePacks()
{ {
$ret=array(); $ret=array();
//// FIXME Replace!
if($packs=file("http://www.sfiab.ca/languages/langpacklist.txt")) if($packs=file("http://www.sfiab.ca/languages/langpacklist.txt"))
{ {
$num=count($packs); $num=count($packs);

View File

@ -81,10 +81,10 @@ $q->execute();
$trclass = ($trclass == 'odd') ? 'even' : 'odd'; $trclass = ($trclass == 'odd') ? 'even' : 'odd';
echo "<tr class=\"$trclass\">"; echo "<tr class=\"$trclass\">";
echo "<td align=\"right\">"; echo "<td align=\"right\">";
if($r->cat==$category) if($r['cat']==$category)
echo "<b>".i18n($r->cat)."</b>"; echo "<b>".i18n($r['cat'])."</b>";
else else
echo "<a href=\"".$_SERVER['PHP_SELF']."?category=".urlencode($r->cat)."\">".i18n($r->cat)."</a>"; echo "<a href=\"".$_SERVER['PHP_SELF']."?category=".urlencode($r['cat'])."\">".i18n($r['cat'])."</a>";
echo "</td>"; echo "</td>";
echo "</tr>\n"; echo "</tr>\n";
} }

View File

@ -41,6 +41,7 @@
function loadVersions() function loadVersions()
{ {
$ret=array(); $ret=array();
// FIXME Replace
if($v=file("http://www.sfiab.ca/version.txt")) if($v=file("http://www.sfiab.ca/version.txt"))
{ {
list($version,$date)=split("\t",trim($v[0])); list($version,$date)=split("\t",trim($v[0]));

View File

@ -24,19 +24,22 @@
<? <?
function config_editor_load($category, $year) function config_editor_load($category, $year)
{ global $pdo; {
global $pdo;
$query = "SELECT * FROM config WHERE year='$year' AND category='$category' ORDER BY ord"; $query = "SELECT * FROM config WHERE year='$year' AND category='$category' ORDER BY ord";
$q = $pdo->prepare($query); $q = $pdo->prepare($query);
print($pdo->errorInfo()); $q->execute();
//print_r($pdo->errorInfo());
$var = array(); $var = array();
while($r=$q->fetch()) { while($r=$q->fetch()) {
$var[$r->var]['val'] = $r->val; $var[$r['var']]['val'] = $r['val'];
$var[$r->var]['desc'] = $r->description; $var[$r['var']]['desc'] = $r['description'];
$var[$r->var]['category'] = $r->category; $var[$r['var']]['category'] = $r['category'];
$var[$r->var]['ord'] = $r->ord; $var[$r['var']]['ord'] = $r['ord'];
$var[$r->var]['type'] = $r->type; $var[$r['var']]['type'] = $r['type'];
$var[$r->var]['type_values'] = $r->type_values; $var[$r['var']]['type_values'] = $r['type_values'];
} }
return $var; return $var;
} }
@ -200,6 +203,7 @@ function config_editor($category, $year, $array_name, $self)
if($biggest>30) $size=30; if($biggest>30) $size=30;
else $size=$biggest+1; else $size=$biggest+1;
//make sure size is at minimum 8, this way if all fields are empty you dont end up with 1 character long text boxes //make sure size is at minimum 8, this way if all fields are empty you dont end up with 1 character long text boxes
if($size<8) $size=8; if($size<8) $size=8;

View File

@ -174,7 +174,7 @@ function questions_update_question($qs)
`db_heading`='".$qs['db_heading']."', `db_heading`='".$qs['db_heading']."',
`required`='".$qs['required']."', `required`='".$qs['required']."',
`ord`=".intval($qs['ord']." `ord`=".intval($qs['ord']."
WHERE id='{$qs['id']}' "); WHERE id='{$qs['id']}' "));
$stmt->execute(); $stmt->execute();
echo $pdo->errorInfo(); echo $pdo->errorInfo();
} }
@ -369,17 +369,17 @@ function questions_editor($section, $year, $array_name, $self)
echo error(i18n("Invalid question")); echo error(i18n("Invalid question"));
} }
} }
if($showform) if($showform and headers_sent())
{ {
echo "<table class=\"summarytable\">"; echo "<table class=\"summarytable\">";
echo "<tr><td>".i18n("Question")."</td><td>"; 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($q['question'])."\">\n";
echo "</td></tr>"; echo "</td></tr>";
echo "<tr><td>".i18n("Table Heading")."</td><td>"; 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($q['db_heading'])."\">\n";
echo "</td></tr>"; echo "</td></tr>";
echo "<tr><td>".i18n("Type")."</td><td>"; echo "<tr><td>".i18n("Type")."</td><td>";
echo "<select name=\"${array_name}[type]\">"; echo "<select name=\"{$array_name}[type]\">";
if($q['type']=="check") $sel="selected=\"selected\""; else $sel=""; if($q['type']=="check") $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"check\">".i18n("Check box")."</option>\n"; echo "<option $sel value=\"check\">".i18n("Check box")."</option>\n";
if($q['type']=="yesno") $sel="selected=\"selected\""; else $sel=""; if($q['type']=="yesno") $sel="selected=\"selected\""; else $sel="";
@ -392,7 +392,7 @@ function questions_editor($section, $year, $array_name, $self)
echo "</select>"; echo "</select>";
echo "</td>"; echo "</td>";
echo "<tr><td>".i18n("Required?")."</td><td>"; echo "<tr><td>".i18n("Required?")."</td><td>";
echo "<select name=\"${array_name}[required]\">"; echo "<select name=\"{$array_name}[required]\">";
if($q['required']=="yes") $sel="selected=\"selected\""; else $sel=""; if($q['required']=="yes") $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"yes\">".i18n("Yes")."</option>\n"; echo "<option $sel value=\"yes\">".i18n("Yes")."</option>\n";
if($q['required']=="no") $sel="selected=\"selected\""; else $sel=""; if($q['required']=="no") $sel="selected=\"selected\""; else $sel="";