Incorporated changes for release 1.4.0
This commit is contained in:
@@ -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%\">
|
||||
|
||||
Reference in New Issue
Block a user