Reformats
This commit is contained in:
@@ -14,10 +14,10 @@
|
||||
** DO NOT EDIT **
|
||||
************************************************************************
|
||||
*/
|
||||
$appname="APPNAME";
|
||||
$dbname="DBNAME";
|
||||
$username="DBUSER";
|
||||
$dbpass="DBPASS";
|
||||
$appname = "APPNAME";
|
||||
$dbname = "DBNAME";
|
||||
$username = "DBUSER";
|
||||
$dbpass = "DBPASS";
|
||||
|
||||
function dberrmsg($dbname) {
|
||||
echo "
|
||||
@@ -34,7 +34,7 @@ function dberrmsg($dbname) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$db=@mysqli_connect("localhost",$username,$dbpass,$dbname);
|
||||
$db = @mysqli_connect("localhost",$username,$dbpass,$dbname);
|
||||
if (mysqli_errno($db)) {
|
||||
dberrmsg($dbname);
|
||||
}
|
||||
|
||||
@@ -968,15 +968,15 @@ function templateselect($techid, $operation)
|
||||
<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.\">
|
||||
";
|
||||
if ($isadmin && $operation!=NULL) {
|
||||
if ($isadmin && $operation != NULL) {
|
||||
$templaterow = mysqli_query($db, "select * from notetemplates where tech!=\"0\" order by tech asc, templatename asc");
|
||||
} else {
|
||||
$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");
|
||||
while ($templateitem = mysqli_fetch_assoc($templaterow)) {
|
||||
if ($isadmin && $operation!=NULL) {
|
||||
$techname=dblookup($db, "techs", "techid", "techname", $templateitem["tech"]);
|
||||
if ($isadmin && $operation != NULL) {
|
||||
$techname = dblookup($db, "techs", "techid", "techname", $templateitem["tech"]);
|
||||
printf("<option value=\"%s\">%s(%s)</option>", $templateitem["templateid"], $templateitem["templatename"], $techname);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
|
||||
@@ -1020,7 +1020,7 @@ function fix_date($datestring)
|
||||
|
||||
if (!$datestring) $datestring = $today;
|
||||
$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);
|
||||
return $datestring;
|
||||
}
|
||||
@@ -1034,7 +1034,7 @@ function fix_time($timestring)
|
||||
|
||||
if (!$timestring) $timestring = $now;
|
||||
$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);
|
||||
return $timestring;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ if ($add) {
|
||||
// sanitize and fix blank date and time
|
||||
$date = fix_date($date);
|
||||
$time = fix_time($time);
|
||||
|
||||
|
||||
// determine whether supplied date is future or past
|
||||
$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
|
||||
@@ -265,7 +265,7 @@ if ($edit) {
|
||||
// sanitize and fix blank date and time
|
||||
$date = fix_date($date);
|
||||
$time = fix_time($time);
|
||||
|
||||
|
||||
// remove cruft from note text
|
||||
$note = strip_tags($note, "<a>");
|
||||
$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>");
|
||||
}
|
||||
|
||||
if (array_key_exists('login',$_SESSION)) {
|
||||
if (array_key_exists('login', $_SESSION)) {
|
||||
// show the template selection line
|
||||
templateselect($techid, NULL);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ if ($mfadd) {
|
||||
|
||||
// add the record to maintforms
|
||||
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)
|
||||
values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")");
|
||||
$newmaintformid = mysqli_insert_id($db);
|
||||
|
||||
@@ -130,7 +130,6 @@ if ($add) {
|
||||
}
|
||||
// run through the memberlist and modify the table
|
||||
foreach ($memberlist as $memberdev) {
|
||||
|
||||
$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\")");
|
||||
mysqli_query($db, $addqry);
|
||||
|
||||
@@ -35,7 +35,7 @@ $srchploc = $_REQUEST['srchploc'] ?? NULL;
|
||||
$srchnha = $_REQUEST['srchnha'] ?? NULL;
|
||||
$srchrepord = $_REQUEST['srchrepord'] ?? NULL;
|
||||
$srchflags = $_POST['srchflags'] ?? [];
|
||||
$target = $_REQUEST['target'] ?? ["log","maintform","part"];
|
||||
$target = $_REQUEST['target'] ?? ["log", "maintform", "part"];
|
||||
|
||||
$doparts = PARTS_FUNCTIONS;
|
||||
$logname = LOG_NAME;
|
||||
|
||||
@@ -163,9 +163,9 @@ if ($usertemplateid) {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$operation="add";
|
||||
$operation = "add";
|
||||
}
|
||||
|
||||
if ($operation == "add") {
|
||||
|
||||
Reference in New Issue
Block a user