Incorporated changes for release 1.4.0

This commit is contained in:
2026-02-24 20:34:15 -05:00
parent eb8829af47
commit 4d95710f43
117 changed files with 594 additions and 12056 deletions

View File

@@ -1,5 +1,5 @@
OpenDRS - Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ Changelog
chromium hotkey combinations and enable ctrl-alt-del reboot.
- Changed systemd ctrl-alt-del.target symlink to point to
reboot.target.
1.1.2 - 2021-04-28
- Added ability to export search results as a CSV file.
- Fixed bug in server-setup.sh that resulted in an incorrect install
@@ -123,7 +123,7 @@ Changelog
- Chromium browser will use the printer designated as the local
default if it is selected as such in the Cups printer
configuration.
1.3.3 - 2023-10-03
- Restricted the ability to change the report date and time when
creating or editing a writeup to only logged in users. This is to
@@ -134,4 +134,27 @@ Changelog
logged into Webmin instead of the user "pi" which may not exist
if rpi-imager options were used to set a different initial user
when the SD card was created.
1.4.0 - 2024-05-09
- Updated the installer script (install.sh) to check for and install the
prerequisites (apache, php, mariadb/mysql) and optional packages
(webmin, phpmyadmin).
- Added an access mode setting. The access mode should be "untrusted" if
OpenDRS is exposed to an untrusted environment such as the internet.
Untrusted mode requires a login to access any part of the application.
The access mode should be "trusted" when the application is used
in a trusted environment where anybody on the network can
create/edit writeups and search the database, with a login required
for everything else.
- On the View All Writeups pages, replaced the "Last 7 days" and
"Last 30 days" buttons with a dropdown with more options, including
future dates so that OpenDRS can be more useful for things like
preventive maintenance.
- Changed the global font to a sans-serif font.
- For Raspberry Pi:
- Removed the Raspberry Pi terminal setup from OpenDRS. Setting up
a Raspberry Pi as a terminal for OpenDRS can now be accomplished
by installing the OpenKiosk application.
- Removed the Raspberry Pi server setup from OpenDRS. Setting up
a Raspberry Pi as an OpenDRS server is easily accomplished by
the OpenDRS installer.

View File

@@ -23,6 +23,6 @@ passwords are unchanged.
The Admin Functions menu will be shown when logged in as an admin user.
Click on Global Settings to set display options, page colors, banners, and
miscellaneous options. Click on Manage Database to set users, devices,
subsystems, action reasons and periods.
subsystems, action reasons and when discovereds.
6. Start making writeups

View File

@@ -2,7 +2,7 @@
/*
about.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -51,7 +51,6 @@ if ($print=="Printer Friendly") {
$mbgcolor=MENUBG_COLOR;
}
$role=dblookup($drs_db,"users","id","role",$userid);
framework("begin","$appname","About OpenDRS",$print);
@@ -80,7 +79,7 @@ echo "
OpenDRS $drs_version Discrepancy Reporting System
</h3><br>
<p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link
or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2023 by Rod Wright.
or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2024 by Rod Wright.
</p>
<p>
OpenDRS is a simple online maintenance tracking/discrepancy reporting application. It allows anyone with a web browser to create,

View File

@@ -1,8 +1,8 @@
<?php
/*
changelog.php
OpenMTS Online Maintenance Tracking System
Copyright (C) 2023 Rod Wright
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,11 +14,11 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to search.php on cancel button press
// redirect to index.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:search.php");
header("Location:index.php");
exit();
}

View File

@@ -2,7 +2,7 @@
/*
common.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -37,6 +37,7 @@ $functional_yes=FUNCTIONAL_YES;
$functional_no=FUNCTIONAL_NO;
$functional_yes_short=FUNCTIONAL_YES_SHORT;
$functional_no_short=FUNCTIONAL_NO_SHORT;
$access_mode=ACCESS_MODE;
// define some other constants
define("STAT_OPEN",1);
@@ -65,6 +66,17 @@ $basic_colors=array(
"Fuchsia" => "#FF00FF",
"Purple" => "#800080");
// Determine access mode, login status, and admin status
if ($access_mode == "trusted") $trusted=true; else $trusted=false;
$loggedin=$isadmin=false;
if (isset($_SESSION['userid'])) {
$uid=$_SESSION['userid'];
$loggedin=true;
if (mysqli_fetch_row(mysqli_query($drs_db,"select role from users where id=\"$uid\""))[0] == ADMIN) {
$isadmin=true;
}
}
// Generic functions
function framework($option,$htmltitle,$pagetitle,$print) {
@@ -94,6 +106,7 @@ function framework($option,$htmltitle,$pagetitle,$print) {
<meta http-equiv=\"x-ua-compatible\" content=\"IE=edge\">
<title>$htmltitle</title>
<style type=\"text/css\">
* {font-family: Arial, Helvetica, sans-serif;}
table.writeup {table-layout:fixed;}
td.forcewrap {word-wrap: break-word;}
</style>
@@ -274,6 +287,7 @@ function framework($option,$htmltitle,$pagetitle,$print) {
});
$( \"#device, #subsystem, #discoveredselect, #functional, [id|='sel']\" ).selectmenu();
$( \"#status, #user, #reason\" ).selectmenu();
$( \"#showdays\" ).selectmenu( { width : 130 } );
$( \"#subsystem, #discovered, #searchstatus, #pass, #passconf\").tooltip();
$( \"[id|='ms']\").multiselect();
$( \"#configtabs, #dbadmintabs, #profiletabs\" ).tabs();
@@ -355,30 +369,31 @@ function pageblock($block,$option) {
function sidemenu($printable=true) {
// Displays sidebar menu
global $drs_db,$mbgcolor;
echo "
<div class=\"sidemenu\">
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"create.php\" title=\"Create new writeup\"><font size=\"+1\"><b>Create New Writeup</b></font></a></td></tr>
</table>
<br>";
global $drs_db,$mbgcolor,$trusted,$loggedin,$isadmin;
if ($trusted || $loggedin) {
echo "
<div class=\"sidemenu\">
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"create.php\" title=\"Create new writeup\"><font size=\"+1\"><b>Create New Writeup</b></font></a></td></tr>
</table>
<br>";
}
echo "
<center><button onclick=\"goBack()\">Go Back</button></center>
";
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View open writeups\">View Open Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"writeups.php?view=1\" title=\"View all writeups for a date range\">View All Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
</table>
<br>
";
if (isset($_SESSION['userid'])) {
$menuuser=$_SESSION['userid'];
if (mysqli_fetch_row(mysqli_query($drs_db,"select role from users where id=\"$menuuser\""))[0] == ADMIN) {
if ($trusted || $loggedin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View open writeups\">View Open Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"writeups.php?view=1\" title=\"View all writeups for a date range\">View All Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
</table>
<br>
";
if ($isadmin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
@@ -392,7 +407,7 @@ function sidemenu($printable=true) {
}
}
if (!isset($_SESSION['userid'])) {
if (! $loggedin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
@@ -401,8 +416,8 @@ function sidemenu($printable=true) {
</table>
<br>";
} else {
$loginid=$_SESSION['userid'];
$loggedinas=mysqli_fetch_row(mysqli_query($drs_db,"select firstname,lastname from users where id=\"$loginid\""));
$menuuser=$_SESSION['userid'];
$loggedinas=mysqli_fetch_row(mysqli_query($drs_db,"select firstname,lastname from users where id=\"$menuuser\""));
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">

View File

@@ -2,7 +2,7 @@
/*
config.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to index.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
@@ -23,11 +32,9 @@ if (array_key_exists('cancel',$_REQUEST)) {
}
// import session variables
if (isset($_SESSION['userid'])) $userid=$_SESSION['userid'];
$role=dblookup($drs_db,"users","id","role",$userid);
// redirect to index.php if not an admin
if ($role != ADMIN) {
// redirect to index.php if not an admin
if (! $isadmin) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:index.php");
@@ -82,6 +89,7 @@ extract($incoming, EXTR_SKIP);
* update_misc
* sessttl
* logoutall
* accessmode
*/
if (!isset($update_display)) $update_display=false;
@@ -249,6 +257,9 @@ if ($edit_banner) {
}
if ($update_misc) {
if ($accessmode) {
mysqli_query($drs_db,"update config set value=\"$accessmode\" where name=\"access_mode\"");
}
if ($logoutall) {
if ($ostype == 'WIN') {
$sessfileloc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"win_server_session_dir\""))[0];
@@ -544,9 +555,17 @@ echo "
<form method=\"post\" action=\"config.php#miscellaneous\">
";
if ($ttlsuppld_err) format_message(1,"Session expiration time cannot be blank.");
$curaccessmode=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"access_mode\""))[0];
$trustedstate=$untrustedstate="";
if($curaccessmode=="trusted") $trustedstate="checked";
if($curaccessmode=="untrusted") $untrustedstate="checked";
$curttl=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"session_ttl_days\""))[0];
echo "
<font size=\"+1\"><b>Miscellaneous Configuration Parameters</b></font><br><br><br><br>
Access mode:&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"accessmode\" value=\"trusted\" $trustedstate> Trusted &nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"accessmode\" value=\"untrusted\" $untrustedstate> Untrusted<br><br><br>
Session expiration time (users will have to log in again after this long) : &nbsp;<input type=\"text\" name=\"sessttl\" size=\"3\" value=\"$curttl\"> days<br><br>
Force logout of all users &nbsp;<input type=\"checkbox\" name=\"logoutall\"><br><br><br><br>
<input type=\"submit\" name=\"update_misc\" value=\"Update Options\">&nbsp;&nbsp;&nbsp;&nbsp;

View File

@@ -2,7 +2,7 @@
/*
create.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to writeups.php on change cancel
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");

View File

@@ -2,7 +2,7 @@
/*
dbadmin.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -13,6 +13,16 @@ if (array_key_exists('print',$_REQUEST)) {
} else {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to index.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");

View File

@@ -2,7 +2,7 @@
/*
gpl.php
OpenMTS Online Maintenance Tracking System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/

View File

@@ -2,7 +2,7 @@
/*
groups.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to groups.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");

View File

@@ -2,7 +2,7 @@
/*
login.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/

View File

@@ -2,7 +2,7 @@
/*
profile.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to index.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");

View File

@@ -2,7 +2,7 @@
/*
search.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to search.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");

View File

@@ -2,7 +2,7 @@
/*
settings.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -51,7 +51,7 @@ while ($configrow = mysqli_fetch_assoc($configqry)) {
}
// level of error reporting. Set to 0 for production or E_ALL for development/troubleshooting
error_reporting(0);
//error_reporting(E_ALL);
//error_reporting(0);
error_reporting(E_ALL);
?>

View File

@@ -2,7 +2,7 @@
/*
writeupdetail.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to writeups.php on change cancel
if (array_key_exists('cancel',$_REQUEST)) {
$id=$_REQUEST['id'];

View File

@@ -2,7 +2,7 @@
/*
writeups.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2023 Rod Wright
Copyright (C) 2024 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
@@ -14,6 +14,15 @@ if (array_key_exists('print',$_REQUEST)) {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// import session variables
if (isset($_SESSION['userid'])) {
$userid=$_SESSION['userid'];
@@ -44,6 +53,7 @@ extract($incoming, EXTR_SKIP);
* showyesterday
* show7day
* show30day
* showdays
* viewtype
* togroup
* addtogroup
@@ -209,8 +219,24 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
echo "
<input type=\"submit\" name=\"showtoday\" value=\"Today\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"showyesterday\" value=\"Yesterday\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"show7day\" value=\"Last 7 Days\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select name=\"showdays\" id=\"showdays\">
<option value=\"\">Date range...</option>
<option value=\"-3\">Last 3 days</option>
<option value=\"-7\">Last 7 days</option>
<option value=\"-30\">Last 30 days</option>
<option value=\"-90\">Last 90 days</option>
<option value=\"-180\">Last 180 days</option></option>
<option value=\"-365\">Last 365 days</option>
<option value=\"-\">All past</option>
<option value=\"+3\">Next 3 days</option>
<option value=\"+7\">Next 7 days</option>
<option value=\"+30\">Next 30 days</option>
<option value=\"+90\">Next 90 days</option>
<option value=\"+180\">Next 180 days</option></option>
<option value=\"+365\">Next 365 days</option>
<option value=\"+\">All future</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
";
}
echo "
@@ -381,13 +407,28 @@ if (isset($showyesterday)) {
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval 1 day)"))[0];
$end_date=$start_date;
}
if (isset($show7day)) {
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval 7 day)"))[0];
$end_date=$today;
}
if (isset($show30day)) {
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval 30 day)"))[0];
$end_date=$today;
if (isset($showdays) && $showdays != "") {
$minmaxqry=mysqli_query($drs_db,"select min(report_date),max(report_date) from writeups");
$minmaxdates=mysqli_fetch_row($minmaxqry);
$direction=$showdays[0];
$numdays=substr($showdays,1);
if ($direction=="-") {
if ($numdays=="") {
$start_date=$minmaxdates[0];
} else {
$start_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval $numdays day)"))[0];
}
$end_date=$today;
}
if ($direction=="+") {
$start_date=$today;
if ($numdays=="") {
$end_date=$minmaxdates[1];
} else {
$end_date=mysqli_fetch_row(mysqli_query($drs_db,"select date_add(curdate(),interval $numdays day)"))[0];
}
}
}
if (isset($view)) {