Various reformats. Changed boolean variables from 1/0 to TRUE/FALSE in multiple files.

This commit is contained in:
2026-02-19 14:08:40 -05:00
parent 9122040863
commit 01fd47814b
22 changed files with 3502 additions and 3150 deletions

View File

@@ -10,133 +10,136 @@
include("functions.php");
if (!isset($_SESSION['login'])) {
header ("Location: login.php");
header("Location: login.php");
}
$techid=$_SESSION['login'] ?? NULL;
$print=$_REQUEST['print'] ?? NULL;
$table=$_REQUEST['table'] ?? NULL;
$updateinfo=$_REQUEST['updateinfo'] ?? NULL;
$updatedisplay=$_REQUEST['updatedisplay'] ?? NULL;
$setcolor=$_REQUEST['setcolor'] ?? NULL;
$name=$_REQUEST['name'] ?? NULL;
$pass=$_REQUEST['pass'] ?? NULL;
$passconf=$_REQUEST['passconf'] ?? NULL;
$shift=$_REQUEST['shift'] ?? NULL;
$display_urlchunk=$_REQUEST['display_urlchunk'] ?? NULL;
$display_showts=$_REQUEST['display_showts'] ?? NULL;
$display_techalpha=$_REQUEST['display_techalpha'] ?? NULL;
$display_subjalpha=$_REQUEST['display_subjalpha'] ?? NULL;
$display_logstyle=$_REQUEST['display_logstyle'] ?? NULL;
$modcolor=$_REQUEST['modcolor'] ?? NULL;
$hexcolor=$_REQUEST['hexcolor'] ?? NULL;
$resetcustom=$_REQUEST["resetcustom"] ?? NULL;
$techid = $_SESSION['login'] ?? NULL;
$print = $_REQUEST['print'] ?? NULL;
$table = $_REQUEST['table'] ?? NULL;
$updateinfo = $_REQUEST['updateinfo'] ?? NULL;
$updatedisplay = $_REQUEST['updatedisplay'] ?? NULL;
$setcolor = $_REQUEST['setcolor'] ?? NULL;
$name = $_REQUEST['name'] ?? NULL;
$pass = $_REQUEST['pass'] ?? NULL;
$passconf = $_REQUEST['passconf'] ?? NULL;
$shift = $_REQUEST['shift'] ?? NULL;
$display_urlchunk = $_REQUEST['display_urlchunk'] ?? NULL;
$display_showts = $_REQUEST['display_showts'] ?? NULL;
$display_techalpha = $_REQUEST['display_techalpha'] ?? NULL;
$display_subjalpha = $_REQUEST['display_subjalpha'] ?? NULL;
$display_logstyle = $_REQUEST['display_logstyle'] ?? NULL;
$modcolor = $_REQUEST['modcolor'] ?? NULL;
$hexcolor = $_REQUEST['hexcolor'] ?? NULL;
$resetcustom = $_REQUEST["resetcustom"] ?? NULL;
$logname=LOG_NAME;
$logname = LOG_NAME;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
framework("begin","$logname","My Profile",$print);
framework("begin", "$logname", "My Profile", $print);
pagetable("begin");
if(!$print){
pageblock("left","begin");
if (!$print) {
pageblock("left", "begin");
// ******** begin database manipulation ********
if ($updateinfo) {
// name shift password settings
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name cannot be blank.<br>";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db,"select techid from techs where techname=\"$name\" and techid!=\"$techid\""))) {
if (mysqli_num_rows(mysqli_query($db,"select techid from techs where techname=\"$name\""))) {
$nameunique=0;
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\" and techid!=\"$techid\""))) {
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for matching passwords
if ($pass!="password_is_unchanged") {
if ($pass==$passconf) {
$passmatch=1;
$passhash=password_hash($pass,PASSWORD_DEFAULT);
$namepassupdqry=("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
if ($pass != "password_is_unchanged") {
if ($pass == $passconf) {
$passmatch = TRUE;
$passhash = password_hash($pass, PASSWORD_DEFAULT);
$namepassupdqry = ("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
} else {
$passmatch=0;
$passmatch = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;The passwords you supplied don't match.<br>";
}
} else {
$passmatch=1;
$namepassupdqry="update techs set techname=\"$name\" where techid=\"$techid\"";
$passmatch = TRUE;
$namepassupdqry = "update techs set techname=\"$name\" where techid=\"$techid\"";
}
if ($namesuppld && $nameunique && $passmatch) {
mysqli_query($db,$namepassupdqry);
mysqli_query($db,"update techs set shift=\"$shift\" where techid=\"$techid\"");
mysqli_query($db, $namepassupdqry);
mysqli_query($db, "update techs set shift=\"$shift\" where techid=\"$techid\"");
}
}
if ($updatedisplay) {
// display settings
if ($display_showts) $display_showts=1; else $display_showts=0;
if ($display_techalpha=="a") $display_techalpha=1; else $display_techalpha=0;
if ($display_subjalpha=="a") $display_subjalpha=1; else $display_subjalpha=0;
if ($display_showts) $display_showts = 1;
else $display_showts = 0;
if ($display_techalpha == "a") $display_techalpha = 1;
else $display_techalpha = 0;
if ($display_subjalpha == "a") $display_subjalpha = 1;
else $display_subjalpha = 0;
// test for urlchunk supplied
if (strlen(trim($display_urlchunk))) {
$chunksuppld=1;
$chunksuppld = TRUE;
} else {
$chunksuppld=0;
$chunksuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;URL chunk size cannot be blank.<br>";
}
if ($chunksuppld) {
putsetting('url_chunk_size',$display_urlchunk,$techid);
putsetting('show_ts',$display_showts,$techid);
putsetting('tech_alpha',$display_techalpha,$techid);
putsetting('subj_alpha',$display_subjalpha,$techid);
putsetting('log_style',$display_logstyle,$techid);
putsetting('url_chunk_size', $display_urlchunk, $techid);
putsetting('show_ts', $display_showts, $techid);
putsetting('tech_alpha', $display_techalpha, $techid);
putsetting('subj_alpha', $display_subjalpha, $techid);
putsetting('log_style', $display_logstyle, $techid);
}
}
if ($setcolor) {
// color settings
$hexcolor="#".ltrim($hexcolor);
putsetting($modcolor,$hexcolor,$techid);
$hexcolor = "#" . ltrim($hexcolor);
putsetting($modcolor, $hexcolor, $techid);
}
if ($resetcustom) mysqli_query($db,"delete from customs where customtech=\"$techid\"");
if ($resetcustom) mysqli_query($db, "delete from customs where customtech=\"$techid\"");
sidemenu();
pageblock("left","end");
pageblock("left", "end");
}
pageblock("right","begin");
pageblock("right", "begin");
// pull my current data from tables
$curname=dblookup($db,"techs","techid","techname",$techid);
$curshift=dblookup($db,"techs","techid","shift",$techid);
$pass=$passconf="password_is_unchanged";
$curname = dblookup($db, "techs", "techid", "techname", $techid);
$curshift = dblookup($db, "techs", "techid", "shift", $techid);
$pass = $passconf = "password_is_unchanged";
// other values from customs
$curlchunk=getsetting('url_chunk_size',$techid)["value"];
$curts=getsetting('show_ts',$techid)["value"];
$curtdo=getsetting('tech_alpha',$techid)["value"];
$cursdo=getsetting('subj_alpha',$techid)["value"];
$curbgc=getsetting('background_color',$techid)["value"];
$cursbc=getsetting('sidebar_color',$techid)["value"];
$curmbgc=getsetting('menubg_color',$techid)["value"];
$curtc=getsetting('text_color',$techid)["value"];
$curlc=getsetting('link_color',$techid)["value"];
$curvlc=getsetting('vlink_color',$techid)["value"];
$curhc=getsetting('heading_color',$techid)["value"];
$curlogstyle=getsetting('log_style',$techid)["value"];
$curlchunk = getsetting('url_chunk_size', $techid)["value"];
$curts = getsetting('show_ts', $techid)["value"];
$curtdo = getsetting('tech_alpha', $techid)["value"];
$cursdo = getsetting('subj_alpha', $techid)["value"];
$curbgc = getsetting('background_color', $techid)["value"];
$cursbc = getsetting('sidebar_color', $techid)["value"];
$curmbgc = getsetting('menubg_color', $techid)["value"];
$curtc = getsetting('text_color', $techid)["value"];
$curlc = getsetting('link_color', $techid)["value"];
$curvlc = getsetting('vlink_color', $techid)["value"];
$curhc = getsetting('heading_color', $techid)["value"];
$curlogstyle = getsetting('log_style', $techid)["value"];
// show the form
echo "
@@ -149,19 +152,19 @@ Password: &nbsp;<input type=\"password\" name=\"pass\" size=\"40\" value=\"$pass
Repeat Password: &nbsp;<input type=\"password\" name=\"passconf\" size=\"40\" value=\"$passconf\"><br><br>
<font size=\"-1\">Need a random password? &nbsp;</font>
";
$rpw=substr(str_shuffle(password_hash(microtime(),PASSWORD_DEFAULT)), 10, 12);
$rpw = substr(str_shuffle(password_hash(microtime(), PASSWORD_DEFAULT)), 10, 12);
echo "
&nbsp; $rpw<br><br>
<b>Shift: </b>&nbsp;
<select name=\"shift\">
";
$shiftrow=mysqli_query($db,"select * from shifts");
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
$shiftrow = mysqli_query($db, "select * from shifts");
while ($shiftitem = mysqli_fetch_assoc($shiftrow)) {
if ($shiftitem["status"] == 1) {
if ($shiftitem["shiftid"]==$curshift) {
printf("<option value=\"%s\" selected>%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
if ($shiftitem["shiftid"] == $curshift) {
printf("<option value=\"%s\" selected>%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
} else {
printf("<option value=\"%s\">%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
printf("<option value=\"%s\">%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
}
}
}
@@ -176,12 +179,12 @@ echo "
<b>My Display Preferences</b><br><br>
Log style (the look of the log notes display): &nbsp;&nbsp;<select name=\"display_logstyle\">
";
$logstyleqry=mysqli_query($db,"select styleid,stylename from styles where styletype=\"logdisplay\"");
while ($logstylerow=mysqli_fetch_assoc($logstyleqry)) {
if ($logstylerow["styleid"]==$curlogstyle) {
printf("<option value=\"%s\" selected>%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
$logstyleqry = mysqli_query($db, "select styleid,stylename from styles where styletype=\"logdisplay\"");
while ($logstylerow = mysqli_fetch_assoc($logstyleqry)) {
if ($logstylerow["styleid"] == $curlogstyle) {
printf("<option value=\"%s\" selected>%s</option>", $logstylerow["styleid"], $logstylerow["stylename"]);
} else {
printf("<option value=\"%s\">%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
printf("<option value=\"%s\">%s</option>", $logstylerow["styleid"], $logstylerow["stylename"]);
}
}
echo "
@@ -236,7 +239,7 @@ echo "
<hr>
<b>My Color Preferences</b><br><br>
";
switch($modcolor) {
switch ($modcolor) {
case "background_color":
echo "<table border=\"0\"><tr><td>Page background color</td><td>";
colorpicker("profile.php?setcolor=1&modcolor=background_color&hexcolor=");
@@ -290,9 +293,7 @@ echo "
</form>
";
pageblock("right","end");
pageblock("right", "end");
pagetable("end");
framework("end","","",$print);
?>
framework("end", "", "", $print);