Incorporated changes for release 1.3.2

This commit is contained in:
2026-02-24 20:13:13 -05:00
parent f7b91f4ef0
commit 2bddfba99a
23 changed files with 929 additions and 463 deletions

View File

@@ -8,9 +8,14 @@
*/
include("common.php");
if (array_key_exists('print',$_REQUEST)) {
$print=true;
} else {
$print=false;
}
// redirect to writeups.php on change cancel
if ($_REQUEST['cancel']) {
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:writeups.php");
@@ -18,10 +23,14 @@ if ($_REQUEST['cancel']) {
}
// import session variables
if (isset($_SESSION['personid'])) $personid=$_SESSION['personid'];
if (isset($_SESSION['userid'])) {
$userid=$_SESSION['userid'];
} else {
$userid=NULL;
}
// import incoming arrays
$print=$_REQUEST['print'];
if ($print) {
// if printer friendly was clicked, values will be passed in serialized
// form as "all_parameters" so we need to load those into $incoming[]
@@ -31,28 +40,40 @@ if ($print) {
$incoming=arrayCopy($_REQUEST);
}
// load variables from incoming array
$create=$incoming['create'];
$device=$incoming['device'];
$discovered=$incoming['discovered'];
$functional=$incoming['functional'];
$reported_by=$incoming['reported_by'];
$report_date=$incoming['report_date'];
$report_time=$incoming['report_time'];
$subsystem=$incoming['subsystem'];
$discrepancy_text=$incoming['discrepancy_text'];
$status=$incoming['status'];
// extract incoming array keys into variables
extract($incoming, EXTR_SKIP);
/*
* possible keys are:
* create
* device
* discovered
* functional
* reported_by
* report_date
* report_time
* subsystem
* discrepancy_text
* status
*/
if (!isset($device)) $device=NULL;
if (!isset($discovered)) $discovered=NULL;
if (!isset($reported_by)) $reported_by=NULL;
if (!isset($discrepancy_text)) $discrepancy_text=NULL;
if (!isset($functional)) $functional=NULL;
if (!isset($subsystem)) $subsystem=NULL;
// assign variables from constants
$appname=APP_NAME;
if ($print=="Printer Friendly") {
if ($print) {
$mbgcolor=P_MENUBG_COLOR;
} else {
$mbgcolor=MENUBG_COLOR;
}
$role=dblookup($drs_db,"persons","id","role",$personid);
$role=dblookup($drs_db,"users","id","role",$userid);
framework("begin","$appname","New Writeup",$print);
@@ -66,17 +87,17 @@ framework("begin","$appname","New Writeup",$print);
// determine today's date and make it the default
$today=date("Y-m-d");
$now=date("H:i:s");
if (!$report_date || $report_date=="automatic") $report_date=$today;
if (!$report_time || $report_time=="automatic") $report_time=$now;
if (!isset($report_date) || $report_date=="automatic") $report_date=$today;
if (!isset($report_time) || $report_time=="automatic") $report_time=$now;
if ($create) {
if (isset($create)) {
// add the entry if create is pressed
if ($discrepancy_text && $reported_by && $device && $subsystem && $discovered) {
if ($discrepancy_text!=NULL && $reported_by!=NULL && $device!=NULL && $subsystem!=NULL && $discovered!=NULL) {
// sanitize and fix blank date and time
$report_date=mysqli_real_escape_string($drs_db,$report_date);
$report_time=mysqli_real_escape_string($drs_db,$report_time);
if (!$report_date) $report_date=$today;
if (!$report_time) $report_time=$now;
if (!isset($report_date)) $report_date=$today;
if (!isset($report_time)) $report_time=$now;
// remove html tags from discrepancy text and sanitize
$discrepancy_text=strip_tags($discrepancy_text);
@@ -101,33 +122,33 @@ pageblock("right","begin");
banner($print);
echo "<br>";
// display the form
if ($create) {
if ($discrepancy_text && $reported_by) {
if (isset($create)) {
if ($discrepancy_text!=NULL && $reported_by!=NULL) {
format_message(0,"<strong>Writeup created.</strong> You may create another writeup or <a href=\"writeups.php\">return to Open Writeups page.</a>");
$preserve=FALSE;
$preserve=false;
}
if (!$device) {
if ($device==NULL) {
format_message(1,"You didn't select a $device_term. Please try again.");
$preserve=TRUE;
$preserve=true;
}
if (!$subsystem) {
if ($subsystem==NULL) {
format_message(1,"You didn't select a subsystem. Please try again.");
$preserve=TRUE;
$preserve=true;
}
if (!$discovered) {
if ($discovered==NULL) {
format_message(1,"You didn't select a $discovered_term. Please try again.");
$preserve=TRUE;
$preserve=true;
}
if (!$discrepancy_text) {
if ($discrepancy_text==NULL) {
format_message(1,"You didn't enter any discrepancy text. Please try again.");
$preserve=TRUE;
$preserve=true;
}
if (!$reported_by) {
if ($reported_by==NULL) {
format_message(1,"You didn't enter your name in the Reported by: block. Please try again.");
$preserve=TRUE;
$preserve=true;
}
} else {
$preserve=FALSE;
$preserve=false;
}
echo "
@@ -135,9 +156,6 @@ echo "
";
// start writeup entry section
if ($status==1) $statusind="<b><font color=\"#FF0000\">OPEN</font></b>";
if ($status==2) $statusind="<b><font color=\"#008000\">CLSD</font></b>";
if ($status==3) $statusind="<b><font color=\"#FFFF00\">DFRD</font></b>";
echo "
<table border=\"0\" cellpadding=\"5\">
@@ -185,7 +203,7 @@ if ($disc_drop_data=="Name") {
}
$drow=mysqli_query($drs_db,"select * from discovered where active is true order by whendiscoveredname asc");
while ($ditem=mysqli_fetch_assoc($drow)) {
if ($discoverd==$ditem["id"] && $preserve) {
if ($discovered==$ditem["id"] && $preserve) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);
} else {
printf("<option value=\"%s\" title=\"%s\">%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);