Fixes to prevent php warnings about trying to access array offset on null

This commit is contained in:
2026-02-24 09:50:05 -05:00
parent 1480feecf0
commit b201ac6d24

View File

@@ -764,17 +764,25 @@ switch ($table) {
";
// pull current values from database
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from techs where techid=$id"));
$name = $currentvalues["techname"];
$pass = $passconf = "password_is_unchanged";
$shift = $currentvalues["shift"];
if ($currentvalues["admin"] == 1) {
$admintag = "<input type=\"checkbox\" name=\"admin\" checked>";
if (!empty($currentvalues)) {
$name = $currentvalues["techname"];
$pass = $passconf = "password_is_unchanged";
$shift = $currentvalues["shift"];
if ($currentvalues["admin"] == 1) {
$admintag = "<input type=\"checkbox\" name=\"admin\" checked>";
} else {
$admintag = "<input type=\"checkbox\" name=\"admin\">";
}
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
$name = NULL;
$pass = NULL;
$shift = NULL;
$admintag = "<input type=\"checkbox\" name=\"admin\">";
}
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
@@ -878,10 +886,15 @@ switch ($table) {
";
// pull current values from database
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from shifts where shiftid=$id"));
$name = $currentvalues["shiftname"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
if (!empty($currentvalues)) {
$name = $currentvalues["shiftname"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
$name = NULL;
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
@@ -952,10 +965,15 @@ switch ($table) {
";
// pull current values from database
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from subjects where subjectid=$id"));
$name = $currentvalues["subjectname"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
if (!empty($currentvalues)) {
$name = $currentvalues["subjectname"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
$name = "";
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
@@ -1026,12 +1044,19 @@ switch ($table) {
";
// pull current values from database
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from links where linkid=$id"));
$name = $currentvalues["displaytxt"];
$priority = $currentvalues["linkpriority"];
$url = $currentvalues["urltxt"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
if (!empty($currentvalues)) {
$name = $currentvalues["displaytxt"];
$priority = $currentvalues["linkpriority"];
$url = $currentvalues["urltxt"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
$name = NULL;
$priority = NULL;
$url = NULL;
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
// determine where we are in the priority stack
@@ -1145,10 +1170,22 @@ switch ($table) {
";
// pull current values from database
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=$id"));
$name = $currentvalues["flagname"];
$flagsym = $currentvalues["flagsym"];
$flagcolor = $currentvalues["flagcolor"];
$flagcoloropts = "";
if (!empty($currentvalues)) {
$name = $currentvalues["flagname"];
$flagsym = $currentvalues["flagsym"];
$flagcolor = $currentvalues["flagcolor"];
$flagcoloropts = "";
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
$name = NULL;
$flagsym = NULL;
$flagcolor = NULL;
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
foreach ($basic_colors as $cname => $chex) {
if ($chex == $flagcolor) {
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\" selected>$cname</option>";
@@ -1156,11 +1193,6 @@ switch ($table) {
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\">$cname</option>";
}
}
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
// set form options for add
$sectiontitle = "<b>Add New Flag</b><br><br>";
@@ -1246,10 +1278,15 @@ switch ($table) {
";
// pull current values from database
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from logpartactions where lpactionid=$id"));
$name = $currentvalues["lpactionname"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
if (!empty($currentvalues)) {
$name = $currentvalues["lpactionname"];
if ($currentvalues["status"] == 1) {
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
} else {
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
$name = NULL;
$activetag = "<input type=\"checkbox\" name=\"active\">";
}
} else {
@@ -1320,9 +1357,15 @@ switch ($table) {
";
// pull current values from database
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from banners where bannerid=$id"));
$name = $currentvalues["bannername"];
$bnrcolor = $currentvalues["bannercolor"];
$bnrtextcolor = $currentvalues["textcolor"];
if (!empty($currentvalues)) {
$name = $currentvalues["bannername"];
$bnrcolor = $currentvalues["bannercolor"];
$bnrtextcolor = $currentvalues["textcolor"];
} else {
$name = NULL;
$bnrcolor = NULL;
$bnrtextcolor = NULL;
}
$bnrcoloropts = "";
foreach ($basic_colors as $cname => $chex) {
if ($chex == $bnrcolor) {