Reformats

This commit is contained in:
2026-02-24 09:47:38 -05:00
parent f3db1c1523
commit f84395f79a
7 changed files with 18 additions and 19 deletions

View File

@@ -14,10 +14,10 @@
** DO NOT EDIT ** ** DO NOT EDIT **
************************************************************************ ************************************************************************
*/ */
$appname="APPNAME"; $appname = "APPNAME";
$dbname="DBNAME"; $dbname = "DBNAME";
$username="DBUSER"; $username = "DBUSER";
$dbpass="DBPASS"; $dbpass = "DBPASS";
function dberrmsg($dbname) { function dberrmsg($dbname) {
echo " echo "
@@ -34,7 +34,7 @@ function dberrmsg($dbname) {
exit(); exit();
} }
$db=@mysqli_connect("localhost",$username,$dbpass,$dbname); $db = @mysqli_connect("localhost",$username,$dbpass,$dbname);
if (mysqli_errno($db)) { if (mysqli_errno($db)) {
dberrmsg($dbname); dberrmsg($dbname);
} }

View File

@@ -968,15 +968,15 @@ function templateselect($techid, $operation)
<td> <td>
<select name=\"usertemplateid\" title=\"Select the user template you'd like to load and click the Load Template button. User template selection takes precedence.\"> <select name=\"usertemplateid\" title=\"Select the user template you'd like to load and click the Load Template button. User template selection takes precedence.\">
"; ";
if ($isadmin && $operation!=NULL) { if ($isadmin && $operation != NULL) {
$templaterow = mysqli_query($db, "select * from notetemplates where tech!=\"0\" order by tech asc, templatename asc"); $templaterow = mysqli_query($db, "select * from notetemplates where tech!=\"0\" order by tech asc, templatename asc");
} else { } else {
$templaterow = mysqli_query($db, "select * from notetemplates where tech=\"$techid\" order by templatename asc"); $templaterow = mysqli_query($db, "select * from notetemplates where tech=\"$techid\" order by templatename asc");
} }
printf("<option value=\"%s\" selected>%s</option>", "0", "Select user template"); printf("<option value=\"%s\" selected>%s</option>", "0", "Select user template");
while ($templateitem = mysqli_fetch_assoc($templaterow)) { while ($templateitem = mysqli_fetch_assoc($templaterow)) {
if ($isadmin && $operation!=NULL) { if ($isadmin && $operation != NULL) {
$techname=dblookup($db, "techs", "techid", "techname", $templateitem["tech"]); $techname = dblookup($db, "techs", "techid", "techname", $templateitem["tech"]);
printf("<option value=\"%s\">%s(%s)</option>", $templateitem["templateid"], $templateitem["templatename"], $techname); printf("<option value=\"%s\">%s(%s)</option>", $templateitem["templateid"], $templateitem["templatename"], $techname);
} else { } else {
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]); printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
@@ -1020,7 +1020,7 @@ function fix_date($datestring)
if (!$datestring) $datestring = $today; if (!$datestring) $datestring = $today;
$datepatt = '/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/'; $datepatt = '/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/';
if (!preg_match($datepatt,$datestring)) $datestring = $today; if (!preg_match($datepatt, $datestring)) $datestring = $today;
$datestring = mysqli_real_escape_string($db, $datestring); $datestring = mysqli_real_escape_string($db, $datestring);
return $datestring; return $datestring;
} }
@@ -1034,7 +1034,7 @@ function fix_time($timestring)
if (!$timestring) $timestring = $now; if (!$timestring) $timestring = $now;
$timepatt = '/^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/'; $timepatt = '/^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/';
if (!preg_match($timepatt,$timestring)) $timestring = $now; if (!preg_match($timepatt, $timestring)) $timestring = $now;
$timestring = mysqli_real_escape_string($db, $timestring); $timestring = mysqli_real_escape_string($db, $timestring);
return $timestring; return $timestring;
} }

View File

@@ -9,7 +9,7 @@
include("functions.php"); include("functions.php");
if (!array_key_exists("login",$_SESSION) && !array_key_exists("partview",$_REQUEST)) { if (!array_key_exists("login", $_SESSION) && !array_key_exists("partview", $_REQUEST)) {
header("Location: login.php"); header("Location: login.php");
} }
@@ -98,7 +98,7 @@ if ($add) {
// sanitize and fix blank date and time // sanitize and fix blank date and time
$date = fix_date($date); $date = fix_date($date);
$time = fix_time($time); $time = fix_time($time);
// determine whether supplied date is future or past // determine whether supplied date is future or past
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$date\",CURRENT_DATE)")); $datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$date\",CURRENT_DATE)"));
// if future, set time to 00:00:01, if past, set to 23:59:59 // if future, set time to 00:00:01, if past, set to 23:59:59
@@ -265,7 +265,7 @@ if ($edit) {
// sanitize and fix blank date and time // sanitize and fix blank date and time
$date = fix_date($date); $date = fix_date($date);
$time = fix_time($time); $time = fix_time($time);
// remove cruft from note text // remove cruft from note text
$note = strip_tags($note, "<a>"); $note = strip_tags($note, "<a>");
$note = mysqli_real_escape_string($db, $note); $note = mysqli_real_escape_string($db, $note);
@@ -500,7 +500,7 @@ if ($delete) {
format_message(0, "<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>"); format_message(0, "<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
} }
if (array_key_exists('login',$_SESSION)) { if (array_key_exists('login', $_SESSION)) {
// show the template selection line // show the template selection line
templateselect($techid, NULL); templateselect($techid, NULL);
} }

View File

@@ -178,7 +178,7 @@ if ($mfadd) {
// add the record to maintforms // add the record to maintforms
if (! $pdatamismatch) { if (! $pdatamismatch) {
$lognoteid = ($lognoteid==NULL) ? 0 : $lognoteid; $lognoteid = ($lognoteid == NULL) ? 0 : $lognoteid;
mysqli_query($db, "insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending) mysqli_query($db, "insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending)
values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")"); values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")");
$newmaintformid = mysqli_insert_id($db); $newmaintformid = mysqli_insert_id($db);

View File

@@ -130,7 +130,6 @@ if ($add) {
} }
// run through the memberlist and modify the table // run through the memberlist and modify the table
foreach ($memberlist as $memberdev) { foreach ($memberlist as $memberdev) {
$addqry = ("insert into events(task,device,start_date,last_date,deferred_flag,deferred_date,active_flag) $addqry = ("insert into events(task,device,start_date,last_date,deferred_flag,deferred_date,active_flag)
values(\"$task\",\"$memberdev\",\"$start_date\",\"$last_date\",\"$deferred_flag\",\"$deferred_date\",\"$active_flag\")"); values(\"$task\",\"$memberdev\",\"$start_date\",\"$last_date\",\"$deferred_flag\",\"$deferred_date\",\"$active_flag\")");
mysqli_query($db, $addqry); mysqli_query($db, $addqry);

View File

@@ -35,7 +35,7 @@ $srchploc = $_REQUEST['srchploc'] ?? NULL;
$srchnha = $_REQUEST['srchnha'] ?? NULL; $srchnha = $_REQUEST['srchnha'] ?? NULL;
$srchrepord = $_REQUEST['srchrepord'] ?? NULL; $srchrepord = $_REQUEST['srchrepord'] ?? NULL;
$srchflags = $_POST['srchflags'] ?? []; $srchflags = $_POST['srchflags'] ?? [];
$target = $_REQUEST['target'] ?? ["log","maintform","part"]; $target = $_REQUEST['target'] ?? ["log", "maintform", "part"];
$doparts = PARTS_FUNCTIONS; $doparts = PARTS_FUNCTIONS;
$logname = LOG_NAME; $logname = LOG_NAME;

View File

@@ -163,9 +163,9 @@ if ($usertemplateid) {
} }
// determine original owner of template // determine original owner of template
$orig_owner=dblookup($db, "notetemplates","templateid","tech",$templateid); $orig_owner = dblookup($db, "notetemplates", "templateid", "tech", $templateid);
if ($efftechid != NULL && $efftechid != $orig_owner) { if ($efftechid != NULL && $efftechid != $orig_owner) {
$operation="add"; $operation = "add";
} }
if ($operation == "add") { if ($operation == "add") {