Incorporated changes for release 1.4.0
This commit is contained in:
@@ -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: <input type=\"radio\" name=\"accessmode\" value=\"trusted\" $trustedstate> Trusted
|
||||
<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) : <input type=\"text\" name=\"sessttl\" size=\"3\" value=\"$curttl\"> days<br><br>
|
||||
Force logout of all users <input type=\"checkbox\" name=\"logoutall\"><br><br><br><br>
|
||||
<input type=\"submit\" name=\"update_misc\" value=\"Update Options\">
|
||||
|
||||
Reference in New Issue
Block a user