Compare commits
22 Commits
3385954624
...
5.3.0dev
| Author | SHA1 | Date | |
|---|---|---|---|
| b70996b4d9 | |||
| 8647c9b4d8 | |||
| b201ac6d24 | |||
| 1480feecf0 | |||
| f84395f79a | |||
| f3db1c1523 | |||
| 962bd7b504 | |||
| ec8efec61e | |||
| d23a19a3eb | |||
| 152bb30029 | |||
| 11c876886a | |||
| 9cce143cf9 | |||
| eb29a3799c | |||
| ba7db9279d | |||
| ce8e5d9ca7 | |||
| 0600ba18cd | |||
| ef0599342b | |||
| 5129d30992 | |||
| ed7a25cea3 | |||
| 968964e3fe | |||
| d41519ba91 | |||
| 513017d3cb |
@@ -278,3 +278,7 @@
|
|||||||
installation.
|
installation.
|
||||||
- Various code cleanups to prevent php warnings in the logs if logging
|
- Various code cleanups to prevent php warnings in the logs if logging
|
||||||
is enabled.
|
is enabled.
|
||||||
|
- Validate all date and time fields to prevent user entered invalid date
|
||||||
|
formats from crashing php.
|
||||||
|
- Fixed profile page to automatically refresh page to show the results
|
||||||
|
when a user changes their color preferences.
|
||||||
|
|||||||
4
INSTALL
4
INSTALL
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
SPDX-License-Identifier: GPL-2.0
|
SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
|
||||||
Installation of OpenLog is straightforward.
|
Installation of OpenLog is straightforward.
|
||||||
|
|
||||||
1. Gather the required information.
|
1. Gather the required information.
|
||||||
@@ -31,5 +30,4 @@ settings. You will need to log in as OpenLogAdmin. The initial default password
|
|||||||
is "OpenLog-1". From the Administration page, you can click on the links at the
|
is "OpenLog-1". From the Administration page, you can click on the links at the
|
||||||
top to add techs, subjects, shifts, etc.
|
top to add techs, subjects, shifts, etc.
|
||||||
|
|
||||||
7. Start using OpenLog.
|
6. Start using OpenLog.
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ set autocommit = 0;
|
|||||||
|
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`configs`
|
`configs`
|
||||||
VALUES (1, 'ol_version', '5.2.4'),
|
VALUES (1, 'ol_version', '5.3.0'),
|
||||||
(2, 'log_name', 'OpenLog'),
|
(2, 'log_name', 'OpenLog'),
|
||||||
(3, 'banner', '1'),
|
(3, 'banner', '1'),
|
||||||
(
|
(
|
||||||
|
|||||||
13
default-apache.conf
Normal file
13
default-apache.conf
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# _APPNAME_ default Apache configuration
|
||||||
|
|
||||||
|
Alias /_BASEURL_ _DOCROOTIN_/_BASEURL_
|
||||||
|
|
||||||
|
<Directory _DOCROOTIN_/_BASEURL_>
|
||||||
|
AllowOverride Options
|
||||||
|
Options FollowSymLinks
|
||||||
|
DirectoryIndex index.php
|
||||||
|
|
||||||
|
#RewriteEngine On
|
||||||
|
#RewriteBase /_BASEURL_/
|
||||||
|
#RewriteRule . maintenancemode.php [L]
|
||||||
|
</Directory>
|
||||||
@@ -278,3 +278,9 @@
|
|||||||
installation.
|
installation.
|
||||||
- Various code cleanups to prevent php warnings in the logs if logging
|
- Various code cleanups to prevent php warnings in the logs if logging
|
||||||
is enabled.
|
is enabled.
|
||||||
|
- Validate all date and time fields to prevent user entered invalid date
|
||||||
|
formats from crashing php.
|
||||||
|
- Fixed profile page to automatically refresh page to show the results
|
||||||
|
when a user changes their color preferences.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -764,6 +764,7 @@ switch ($table) {
|
|||||||
";
|
";
|
||||||
// pull current values from database
|
// pull current values from database
|
||||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from techs where techid=$id"));
|
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from techs where techid=$id"));
|
||||||
|
if (!empty($currentvalues)) {
|
||||||
$name = $currentvalues["techname"];
|
$name = $currentvalues["techname"];
|
||||||
$pass = $passconf = "password_is_unchanged";
|
$pass = $passconf = "password_is_unchanged";
|
||||||
$shift = $currentvalues["shift"];
|
$shift = $currentvalues["shift"];
|
||||||
@@ -777,6 +778,13 @@ switch ($table) {
|
|||||||
} else {
|
} else {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$name = NULL;
|
||||||
|
$pass = NULL;
|
||||||
|
$shift = NULL;
|
||||||
|
$admintag = "<input type=\"checkbox\" name=\"admin\">";
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// set form options for add
|
// set form options for add
|
||||||
$sectiontitle = "<b>Add New Tech</b><br><br>";
|
$sectiontitle = "<b>Add New Tech</b><br><br>";
|
||||||
@@ -878,12 +886,17 @@ switch ($table) {
|
|||||||
";
|
";
|
||||||
// pull current values from database
|
// pull current values from database
|
||||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from shifts where shiftid=$id"));
|
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from shifts where shiftid=$id"));
|
||||||
|
if (!empty($currentvalues)) {
|
||||||
$name = $currentvalues["shiftname"];
|
$name = $currentvalues["shiftname"];
|
||||||
if ($currentvalues["status"] == 1) {
|
if ($currentvalues["status"] == 1) {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||||
} else {
|
} else {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$name = NULL;
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// set form options for add
|
// set form options for add
|
||||||
$sectiontitle = "<b>Add New Shift</b><br><br>";
|
$sectiontitle = "<b>Add New Shift</b><br><br>";
|
||||||
@@ -952,12 +965,17 @@ switch ($table) {
|
|||||||
";
|
";
|
||||||
// pull current values from database
|
// pull current values from database
|
||||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from subjects where subjectid=$id"));
|
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from subjects where subjectid=$id"));
|
||||||
|
if (!empty($currentvalues)) {
|
||||||
$name = $currentvalues["subjectname"];
|
$name = $currentvalues["subjectname"];
|
||||||
if ($currentvalues["status"] == 1) {
|
if ($currentvalues["status"] == 1) {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||||
} else {
|
} else {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$name = "";
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// set form options for add
|
// set form options for add
|
||||||
$sectiontitle = "<b>Add New Subject</b><br><br>";
|
$sectiontitle = "<b>Add New Subject</b><br><br>";
|
||||||
@@ -1026,6 +1044,7 @@ switch ($table) {
|
|||||||
";
|
";
|
||||||
// pull current values from database
|
// pull current values from database
|
||||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from links where linkid=$id"));
|
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from links where linkid=$id"));
|
||||||
|
if (!empty($currentvalues)) {
|
||||||
$name = $currentvalues["displaytxt"];
|
$name = $currentvalues["displaytxt"];
|
||||||
$priority = $currentvalues["linkpriority"];
|
$priority = $currentvalues["linkpriority"];
|
||||||
$url = $currentvalues["urltxt"];
|
$url = $currentvalues["urltxt"];
|
||||||
@@ -1034,6 +1053,12 @@ switch ($table) {
|
|||||||
} else {
|
} else {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$name = NULL;
|
||||||
|
$priority = NULL;
|
||||||
|
$url = NULL;
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
|
}
|
||||||
// determine where we are in the priority stack
|
// determine where we are in the priority stack
|
||||||
$prow = mysqli_fetch_assoc(mysqli_query($db, "select min(linkpriority) as highest from links"));
|
$prow = mysqli_fetch_assoc(mysqli_query($db, "select min(linkpriority) as highest from links"));
|
||||||
if ($prow["highest"] == $priority) {
|
if ($prow["highest"] == $priority) {
|
||||||
@@ -1145,10 +1170,22 @@ switch ($table) {
|
|||||||
";
|
";
|
||||||
// pull current values from database
|
// pull current values from database
|
||||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=$id"));
|
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=$id"));
|
||||||
|
if (!empty($currentvalues)) {
|
||||||
$name = $currentvalues["flagname"];
|
$name = $currentvalues["flagname"];
|
||||||
$flagsym = $currentvalues["flagsym"];
|
$flagsym = $currentvalues["flagsym"];
|
||||||
$flagcolor = $currentvalues["flagcolor"];
|
$flagcolor = $currentvalues["flagcolor"];
|
||||||
$flagcoloropts = "";
|
$flagcoloropts = "";
|
||||||
|
if ($currentvalues["status"] == 1) {
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||||
|
} else {
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$name = NULL;
|
||||||
|
$flagsym = NULL;
|
||||||
|
$flagcolor = NULL;
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
|
}
|
||||||
foreach ($basic_colors as $cname => $chex) {
|
foreach ($basic_colors as $cname => $chex) {
|
||||||
if ($chex == $flagcolor) {
|
if ($chex == $flagcolor) {
|
||||||
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
||||||
@@ -1156,11 +1193,6 @@ switch ($table) {
|
|||||||
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\">$cname</option>";
|
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\">$cname</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($currentvalues["status"] == 1) {
|
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
|
||||||
} else {
|
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// set form options for add
|
// set form options for add
|
||||||
$sectiontitle = "<b>Add New Flag</b><br><br>";
|
$sectiontitle = "<b>Add New Flag</b><br><br>";
|
||||||
@@ -1246,12 +1278,17 @@ switch ($table) {
|
|||||||
";
|
";
|
||||||
// pull current values from database
|
// pull current values from database
|
||||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from logpartactions where lpactionid=$id"));
|
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from logpartactions where lpactionid=$id"));
|
||||||
|
if (!empty($currentvalues)) {
|
||||||
$name = $currentvalues["lpactionname"];
|
$name = $currentvalues["lpactionname"];
|
||||||
if ($currentvalues["status"] == 1) {
|
if ($currentvalues["status"] == 1) {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||||
} else {
|
} else {
|
||||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$name = NULL;
|
||||||
|
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// set form options for add
|
// set form options for add
|
||||||
$sectiontitle = "<b>Add New Part Action</b><br><br>";
|
$sectiontitle = "<b>Add New Part Action</b><br><br>";
|
||||||
@@ -1320,9 +1357,15 @@ switch ($table) {
|
|||||||
";
|
";
|
||||||
// pull current values from database
|
// pull current values from database
|
||||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from banners where bannerid=$id"));
|
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from banners where bannerid=$id"));
|
||||||
|
if (!empty($currentvalues)) {
|
||||||
$name = $currentvalues["bannername"];
|
$name = $currentvalues["bannername"];
|
||||||
$bnrcolor = $currentvalues["bannercolor"];
|
$bnrcolor = $currentvalues["bannercolor"];
|
||||||
$bnrtextcolor = $currentvalues["textcolor"];
|
$bnrtextcolor = $currentvalues["textcolor"];
|
||||||
|
} else {
|
||||||
|
$name = NULL;
|
||||||
|
$bnrcolor = NULL;
|
||||||
|
$bnrtextcolor = NULL;
|
||||||
|
}
|
||||||
$bnrcoloropts = "";
|
$bnrcoloropts = "";
|
||||||
foreach ($basic_colors as $cname => $chex) {
|
foreach ($basic_colors as $cname => $chex) {
|
||||||
if ($chex == $bnrcolor) {
|
if ($chex == $bnrcolor) {
|
||||||
|
|||||||
@@ -953,8 +953,9 @@ function templateselect($techid, $operation)
|
|||||||
{
|
{
|
||||||
// Displays a line enabling selection of a user or global template
|
// Displays a line enabling selection of a user or global template
|
||||||
// $techid is the id number of the current tech
|
// $techid is the id number of the current tech
|
||||||
// $operation is one of "add" "edit" "delete"
|
// $operation is one of "add" "edit" "delete" or NULL
|
||||||
global $db;
|
global $db;
|
||||||
|
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||||
echo "
|
echo "
|
||||||
<form method=\"post\">
|
<form method=\"post\">
|
||||||
";
|
";
|
||||||
@@ -967,11 +968,20 @@ function templateselect($techid, $operation)
|
|||||||
<td>
|
<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.\">
|
<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) {
|
||||||
|
$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");
|
$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");
|
printf("<option value=\"%s\" selected>%s</option>", "0", "Select user template");
|
||||||
while ($templateitem = mysqli_fetch_assoc($templaterow)) {
|
while ($templateitem = mysqli_fetch_assoc($templaterow)) {
|
||||||
|
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"]);
|
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo "
|
echo "
|
||||||
</select> or
|
</select> or
|
||||||
";
|
";
|
||||||
@@ -1000,3 +1010,31 @@ function templateselect($techid, $operation)
|
|||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fix_date($datestring)
|
||||||
|
{
|
||||||
|
// accepts a string as an argument
|
||||||
|
// returns a valid date string in the format YYYY-MM-DD
|
||||||
|
// if input string is not a valid date, return the current date
|
||||||
|
global $db, $today;
|
||||||
|
|
||||||
|
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;
|
||||||
|
$datestring = mysqli_real_escape_string($db, $datestring);
|
||||||
|
return $datestring;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fix_time($timestring)
|
||||||
|
{
|
||||||
|
// accepts a string as an argument
|
||||||
|
// returns a valid time string in the format HH:MM:SS
|
||||||
|
// if input string is not a valid time, return the current time
|
||||||
|
global $db, $now;
|
||||||
|
|
||||||
|
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;
|
||||||
|
$timestring = mysqli_real_escape_string($db, $timestring);
|
||||||
|
return $timestring;
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
if (!$_SESSION['login'] && !$_REQUEST['partview']) {
|
if (!array_key_exists("login", $_SESSION) && !array_key_exists("partview", $_REQUEST)) {
|
||||||
header("Location: login.php");
|
header("Location: login.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,10 +96,9 @@ if ($add) {
|
|||||||
// add the entry if submit is pressed
|
// add the entry if submit is pressed
|
||||||
if ($note) {
|
if ($note) {
|
||||||
// sanitize and fix blank date and time
|
// sanitize and fix blank date and time
|
||||||
$date = mysqli_real_escape_string($db, $date);
|
$date = fix_date($date);
|
||||||
$time = mysqli_real_escape_string($db, $time);
|
$time = fix_time($time);
|
||||||
if (!$date) $date = $today;
|
|
||||||
if (!$time) $time = $now;
|
|
||||||
// determine whether supplied date is future or past
|
// determine whether supplied date is future or past
|
||||||
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$date\",CURRENT_DATE)"));
|
$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
|
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||||
@@ -263,6 +262,10 @@ if ($edit) {
|
|||||||
if ($removepart && $authorized) mysqli_query($db, "delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\"");
|
if ($removepart && $authorized) mysqli_query($db, "delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\"");
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
if ($note) {
|
if ($note) {
|
||||||
|
// sanitize and fix blank date and time
|
||||||
|
$date = fix_date($date);
|
||||||
|
$time = fix_time($time);
|
||||||
|
|
||||||
// remove cruft from note text
|
// remove cruft from note text
|
||||||
$note = strip_tags($note, "<a>");
|
$note = strip_tags($note, "<a>");
|
||||||
$note = mysqli_real_escape_string($db, $note);
|
$note = mysqli_real_escape_string($db, $note);
|
||||||
@@ -497,7 +500,7 @@ if ($delete) {
|
|||||||
format_message(0, "<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
|
format_message(0, "<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_SESSION['login']) {
|
if (array_key_exists('login', $_SESSION)) {
|
||||||
// show the template selection line
|
// show the template selection line
|
||||||
templateselect($techid, NULL);
|
templateselect($techid, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
include("functions.php");
|
include("functions.php");
|
||||||
|
|
||||||
$print = $_REQUEST['print'];
|
$print = $_REQUEST['print'] ?? NULL;
|
||||||
$tech = $_REQUEST['tech'];
|
$tech = $_REQUEST['tech'] ?? NULL;
|
||||||
$pass = $_REQUEST['pass'];
|
$pass = $_REQUEST['pass'] ?? NULL;
|
||||||
$login = $_REQUEST['login'];
|
$login = $_REQUEST['login'] ?? NULL;
|
||||||
$cancel = $_REQUEST['cancel'];
|
$cancel = $_REQUEST['cancel'] ?? NULL;
|
||||||
|
|
||||||
if ($cancel) {
|
if ($cancel) {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|||||||
@@ -135,6 +135,9 @@ if ($mfadd) {
|
|||||||
if ($mfsubmit) {
|
if ($mfsubmit) {
|
||||||
// add the entry if submit is pressed
|
// add the entry if submit is pressed
|
||||||
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
||||||
|
// sanitize and fix blank date and time
|
||||||
|
$mfdate = fix_date($mfdate);
|
||||||
|
$mftime = fix_time($mftime);
|
||||||
// determine whether supplied date is future or past
|
// determine whether supplied date is future or past
|
||||||
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$mfdate\",CURRENT_DATE)"));
|
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$mfdate\",CURRENT_DATE)"));
|
||||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||||
@@ -175,6 +178,7 @@ if ($mfadd) {
|
|||||||
|
|
||||||
// add the record to maintforms
|
// add the record to maintforms
|
||||||
if (! $pdatamismatch) {
|
if (! $pdatamismatch) {
|
||||||
|
$lognoteid = ($lognoteid == NULL) ? 0 : $lognoteid;
|
||||||
mysqli_query($db, "insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending)
|
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\")");
|
values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")");
|
||||||
$newmaintformid = mysqli_insert_id($db);
|
$newmaintformid = mysqli_insert_id($db);
|
||||||
@@ -183,7 +187,7 @@ if ($mfadd) {
|
|||||||
// update the flagmap table
|
// update the flagmap table
|
||||||
foreach ($flags as $thisflag) {
|
foreach ($flags as $thisflag) {
|
||||||
// set flag for this maintenance form
|
// set flag for this maintenance form
|
||||||
mysqli_query($db, "insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$$newmaintformid\")");
|
mysqli_query($db, "insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$newmaintformid\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,6 +240,9 @@ if ($mfdelete && $mfauthorized) {
|
|||||||
if ($actionadd) {
|
if ($actionadd) {
|
||||||
if ($actionaddsubmit) {
|
if ($actionaddsubmit) {
|
||||||
if ($action) {
|
if ($action) {
|
||||||
|
// sanitize and fix blank date and time
|
||||||
|
$actiondate = fix_date($actiondate);
|
||||||
|
$actiontime = fix_time($actiontime);
|
||||||
// determine whether supplied date is future or past
|
// determine whether supplied date is future or past
|
||||||
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$actiondate\",CURRENT_DATE)"));
|
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$actiondate\",CURRENT_DATE)"));
|
||||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||||
@@ -260,6 +267,9 @@ if ($actionadd) {
|
|||||||
if ($actionedit) {
|
if ($actionedit) {
|
||||||
if ($actioneditsubmit && $actionauthorized) {
|
if ($actioneditsubmit && $actionauthorized) {
|
||||||
// update the action
|
// update the action
|
||||||
|
// sanitize and fix blank date and time
|
||||||
|
$actiondate = fix_date($actiondate);
|
||||||
|
$actiontime = fix_time($actiontime);
|
||||||
// remove cruft from action text
|
// remove cruft from action text
|
||||||
$action = htmlentities($action);
|
$action = htmlentities($action);
|
||||||
$action = addslashes($action);
|
$action = addslashes($action);
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ if (!$print) {
|
|||||||
// color settings
|
// color settings
|
||||||
$hexcolor = "#" . ltrim($hexcolor);
|
$hexcolor = "#" . ltrim($hexcolor);
|
||||||
putsetting($modcolor, $hexcolor, $techid);
|
putsetting($modcolor, $hexcolor, $techid);
|
||||||
|
$currentpage = $_SERVER['PHP_SELF'];
|
||||||
|
header("Refresh: .1; url=$currentpage");
|
||||||
}
|
}
|
||||||
if ($resetcustom) mysqli_query($db, "delete from customs where customtech=\"$techid\"");
|
if ($resetcustom) mysqli_query($db, "delete from customs where customtech=\"$techid\"");
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
blankpage.php
|
schedmaint.php
|
||||||
OpenLog Online Logbook
|
OpenLog Online Logbook
|
||||||
Copyright (C) 2026 Rod Wright
|
Copyright (C) 2026 Rod Wright
|
||||||
|
|
||||||
@@ -73,9 +73,9 @@ $errorstack = array();
|
|||||||
if ($action) {
|
if ($action) {
|
||||||
if ($complete) {
|
if ($complete) {
|
||||||
// sanitize user input
|
// sanitize user input
|
||||||
$completedate = mysqli_real_escape_string($db, $completedate);
|
$completedate = fix_date($completedate);
|
||||||
// update events
|
// update events
|
||||||
mysqli_query($db, "update events set last_date=\"$completedate\", deferred_flag=0, deferred_date=\"0000-00-00\" where eventid=\"$id\"");
|
mysqli_query($db, "update events set last_date=\"$completedate\", deferred_flag=0, deferred_date=\"0001-01-01\" where eventid=\"$id\"");
|
||||||
if ($addlognote) {
|
if ($addlognote) {
|
||||||
$compltaskname = mysqli_fetch_row(mysqli_query($db, "select tasks.taskname from tasks,events where events.eventid=\"$id\" and tasks.taskid=events.task"))[0];
|
$compltaskname = mysqli_fetch_row(mysqli_query($db, "select tasks.taskname from tasks,events where events.eventid=\"$id\" and tasks.taskid=events.task"))[0];
|
||||||
$compldevicename = mysqli_fetch_row(mysqli_query($db, "select devices.devicename from devices,events where events.eventid=\"$id\" and devices.deviceid=events.device"))[0];
|
$compldevicename = mysqli_fetch_row(mysqli_query($db, "select devices.devicename from devices,events where events.eventid=\"$id\" and devices.deviceid=events.device"))[0];
|
||||||
@@ -88,6 +88,7 @@ if ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($defer) {
|
if ($defer) {
|
||||||
|
$deferuntil = fix_date($deferuntil);
|
||||||
// update events
|
// update events
|
||||||
mysqli_query($db, "update events set deferred_flag=1, deferred_date=\"$deferuntil\" where eventid=\"$id\"");
|
mysqli_query($db, "update events set deferred_flag=1, deferred_date=\"$deferuntil\" where eventid=\"$id\"");
|
||||||
}
|
}
|
||||||
@@ -110,9 +111,12 @@ if ($add) {
|
|||||||
$errorstack[] = "<img src=\"icons/exclamation-red.png\" border=\"0\"> You didn't select a device.<br>";
|
$errorstack[] = "<img src=\"icons/exclamation-red.png\" border=\"0\"> You didn't select a device.<br>";
|
||||||
}
|
}
|
||||||
// sanitize text data
|
// sanitize text data
|
||||||
$start_date = mysqli_real_escape_string($db, $start_date);
|
if ($start_date == NULL) $start_date = $today;
|
||||||
$last_date = mysqli_real_escape_string($db, $last_date);
|
if ($last_date == NULL) $last_date = "0001-01-01";
|
||||||
$deferred_date = mysqli_real_escape_string($db, $deferred_date);
|
if ($deferred_date == NULL) $deferred_date = "0001-01-01";
|
||||||
|
$start_date = fix_date($start_date);
|
||||||
|
$last_date = fix_date($last_date);
|
||||||
|
$deferred_date = fix_date($deferred_date);
|
||||||
if ($taskselected && $deviceselected) {
|
if ($taskselected && $deviceselected) {
|
||||||
// determine if device represents a group and break out individual devices
|
// determine if device represents a group and break out individual devices
|
||||||
if (dblookup($db, "devices", "deviceid", "group_flag", $device)) {
|
if (dblookup($db, "devices", "deviceid", "group_flag", $device)) {
|
||||||
@@ -126,9 +130,6 @@ if ($add) {
|
|||||||
}
|
}
|
||||||
// run through the memberlist and modify the table
|
// run through the memberlist and modify the table
|
||||||
foreach ($memberlist as $memberdev) {
|
foreach ($memberlist as $memberdev) {
|
||||||
if ($start_date == NULL) $start_date = $today;
|
|
||||||
if ($last_date == NULL) $last_date = "0000-00-00";
|
|
||||||
if ($deferred_date == NULL) $deferred_date = "0000-00-00";
|
|
||||||
$addqry = ("insert into events(task,device,start_date,last_date,deferred_flag,deferred_date,active_flag)
|
$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\")");
|
values(\"$task\",\"$memberdev\",\"$start_date\",\"$last_date\",\"$deferred_flag\",\"$deferred_date\",\"$active_flag\")");
|
||||||
mysqli_query($db, $addqry);
|
mysqli_query($db, $addqry);
|
||||||
@@ -199,13 +200,13 @@ if ($edit) {
|
|||||||
if ($update) {
|
if ($update) {
|
||||||
// do error checking
|
// do error checking
|
||||||
// sanitize text data
|
// sanitize text data
|
||||||
$start_date = mysqli_real_escape_string($db, $start_date);
|
|
||||||
$last_date = mysqli_real_escape_string($db, $last_date);
|
|
||||||
$deferred_date = mysqli_real_escape_string($db, $deferred_date);
|
|
||||||
// update the tasks table
|
|
||||||
if ($start_date == NULL) $start_date = $today;
|
if ($start_date == NULL) $start_date = $today;
|
||||||
if ($last_date == NULL) $last_date = "0000-00-00";
|
if ($last_date == NULL) $last_date = "0001-01-01";
|
||||||
if ($deferred_date == NULL) $deferred_date = "0000-00-00";
|
if ($deferred_date == NULL) $deferred_date = "0001-01-01";
|
||||||
|
$start_date = fix_date($start_date);
|
||||||
|
$last_date = fix_date($last_date);
|
||||||
|
$deferred_date = fix_date($deferred_date);
|
||||||
|
// update the tasks table
|
||||||
mysqli_query($db, "update events
|
mysqli_query($db, "update events
|
||||||
set task=\"$task\",device=\"$device\",start_date=\"$start_date\",last_date=\"$last_date\",deferred_flag=\"$deferred_flag\",
|
set task=\"$task\",device=\"$device\",start_date=\"$start_date\",last_date=\"$last_date\",deferred_flag=\"$deferred_flag\",
|
||||||
deferred_date=\"$deferred_date\",active_flag=\"$active_flag\"
|
deferred_date=\"$deferred_date\",active_flag=\"$active_flag\"
|
||||||
@@ -404,9 +405,9 @@ if ($action) {
|
|||||||
} else {
|
} else {
|
||||||
$deferredtag = "<input type=\"checkbox\" name=\"deferred_flag\" value=\"1\">";
|
$deferredtag = "<input type=\"checkbox\" name=\"deferred_flag\" value=\"1\">";
|
||||||
}
|
}
|
||||||
if ($start_date == "0000-00-00") $start_date = $today;
|
if ($start_date == "0001-01-01") $start_date = $today;
|
||||||
if ($last_date == "0000-00-00") $last_date = "";
|
//if ($last_date == "0001-01-01") $last_date = "";
|
||||||
if ($deferred_date == "0000-00-00") $deferred_date = $tomorrow;
|
if ($deferred_date == "0001-01-01") $deferred_date = $tomorrow;
|
||||||
$deferuntiltag = "<input type=\"text\" name=\"deferred_date\" id=\"deferdatepicker\" size=\"10\" maxlength=\"10\" value=\"$deferred_date\" title=\"Format: YYYY-MM-DD\">";
|
$deferuntiltag = "<input type=\"text\" name=\"deferred_date\" id=\"deferdatepicker\" size=\"10\" maxlength=\"10\" value=\"$deferred_date\" title=\"Format: YYYY-MM-DD\">";
|
||||||
$startdatetag = "<input type=\"text\" name=\"start_date\" id=\"startdatepicker\" size=\"10\" maxlength=\"10\" value=\"$start_date\" title=\"Format: YYYY-MM-DD\">";
|
$startdatetag = "<input type=\"text\" name=\"start_date\" id=\"startdatepicker\" size=\"10\" maxlength=\"10\" value=\"$start_date\" title=\"Format: YYYY-MM-DD\">";
|
||||||
$lastdatetag = "<input type=\"text\" name=\"last_date\" id=\"completedatepicker\" size=\"10\" maxlength=\"10\" value=\"$last_date\" title=\"Format: YYYY-MM-DD\">";
|
$lastdatetag = "<input type=\"text\" name=\"last_date\" id=\"completedatepicker\" size=\"10\" maxlength=\"10\" value=\"$last_date\" title=\"Format: YYYY-MM-DD\">";
|
||||||
@@ -487,9 +488,9 @@ if ($action) {
|
|||||||
";
|
";
|
||||||
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
|
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
|
||||||
extract($tablerow);
|
extract($tablerow);
|
||||||
if ($start_date == "0000-00-00") $start_date = $today;
|
if ($start_date == "0001-01-01") $start_date = $today;
|
||||||
if ($last_date == "0000-00-00") $last_date = "";
|
if ($last_date == "0001-01-01") $last_date = "";
|
||||||
if ($deferred_date == "0000-00-00") $deferred_date = "";
|
if ($deferred_date == "0001-01-01") $deferred_date = "";
|
||||||
if ($active_flag) {
|
if ($active_flag) {
|
||||||
$statdef = "<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
$statdef = "<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
||||||
} else {
|
} else {
|
||||||
@@ -855,7 +856,7 @@ if ($action) {
|
|||||||
$taskdata = mysqli_fetch_assoc(mysqli_query($db, "select * from tasks where taskid=\"$def_task\""));
|
$taskdata = mysqli_fetch_assoc(mysqli_query($db, "select * from tasks where taskid=\"$def_task\""));
|
||||||
extract($taskdata, EXTR_PREFIX_ALL, "taskdata");
|
extract($taskdata, EXTR_PREFIX_ALL, "taskdata");
|
||||||
if (! ($taskdata_period == "once" && $def_last_date > $def_start_date)) {
|
if (! ($taskdata_period == "once" && $def_last_date > $def_start_date)) {
|
||||||
if ($def_last_date == "0000-00-00") {
|
if ($def_last_date == "0001-01-01") {
|
||||||
$lastdatestrg = "never";
|
$lastdatestrg = "never";
|
||||||
} else {
|
} else {
|
||||||
$lastdatestrg = "$def_last_date";
|
$lastdatestrg = "$def_last_date";
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ $srchploc = $_REQUEST['srchploc'] ?? NULL;
|
|||||||
$srchnha = $_REQUEST['srchnha'] ?? NULL;
|
$srchnha = $_REQUEST['srchnha'] ?? NULL;
|
||||||
$srchrepord = $_REQUEST['srchrepord'] ?? NULL;
|
$srchrepord = $_REQUEST['srchrepord'] ?? NULL;
|
||||||
$srchflags = $_POST['srchflags'] ?? [];
|
$srchflags = $_POST['srchflags'] ?? [];
|
||||||
$target = $_REQUEST['target'] ?? NULL;
|
$target = $_REQUEST['target'] ?? ["log", "maintform", "part"];
|
||||||
|
|
||||||
$doparts = PARTS_FUNCTIONS;
|
$doparts = PARTS_FUNCTIONS;
|
||||||
$logname = LOG_NAME;
|
$logname = LOG_NAME;
|
||||||
@@ -56,7 +56,7 @@ framework("begin", "$logname Search", "Search", $print);
|
|||||||
|
|
||||||
// echo "REQUEST variables: <br>";
|
// echo "REQUEST variables: <br>";
|
||||||
// var_dump($_REQUEST);
|
// var_dump($_REQUEST);
|
||||||
|
// echo "<br>";
|
||||||
|
|
||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
|
|
||||||
@@ -92,7 +92,6 @@ if ($search) {
|
|||||||
$srchpname = trim($srchpname);
|
$srchpname = trim($srchpname);
|
||||||
$srchploc = trim($srchploc);
|
$srchploc = trim($srchploc);
|
||||||
$srchnha = trim($srchnha);
|
$srchnha = trim($srchnha);
|
||||||
if ($target[0] == "") $target = [];
|
|
||||||
if (in_array("log", $target)) {
|
if (in_array("log", $target)) {
|
||||||
// define the query constraints
|
// define the query constraints
|
||||||
// log note id
|
// log note id
|
||||||
@@ -131,23 +130,6 @@ if ($search) {
|
|||||||
$logfromtables[] = "lognotes";
|
$logfromtables[] = "lognotes";
|
||||||
$logconstraints[] = "lognotes.lognote like \"%$srchtext%\"";
|
$logconstraints[] = "lognotes.lognote like \"%$srchtext%\"";
|
||||||
}
|
}
|
||||||
// flags
|
|
||||||
if (!empty($srchflags)) {
|
|
||||||
unset($flagconstraints);
|
|
||||||
$flagcount = count($srchflags);
|
|
||||||
$logfromtables[] = "lognotes";
|
|
||||||
$logfromtables[] = "flagmap";
|
|
||||||
$flagconstraints[] = "flagmap.lognoteid=lognotes.lognoteid and flagmap.flagid in (";
|
|
||||||
foreach ($srchflags as $flagid) {
|
|
||||||
$flagconstraints[] = "\"$flagid\"";
|
|
||||||
$flagconstraints[] = ",";
|
|
||||||
}
|
|
||||||
// remove final comma
|
|
||||||
array_splice($flagconstraints, -1, 1);
|
|
||||||
$flagconstraints[] = ") group by flagmap.lognoteid having count(distinct flagmap.flagid)=$flagcount";
|
|
||||||
// make flagconstraints a single string so that the final implode doesn't split it
|
|
||||||
$logconstraints[] = join('', $flagconstraints);
|
|
||||||
}
|
|
||||||
// uid
|
// uid
|
||||||
if ($srchuid != "any" && $srchuid != "") {
|
if ($srchuid != "any" && $srchuid != "") {
|
||||||
$logfromtables[] = "lognotes";
|
$logfromtables[] = "lognotes";
|
||||||
@@ -200,12 +182,28 @@ if ($search) {
|
|||||||
$logfromtables[] = "maintforms";
|
$logfromtables[] = "maintforms";
|
||||||
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
||||||
}
|
}
|
||||||
|
// flags
|
||||||
|
if (!empty($srchflags)) {
|
||||||
|
unset($flagconstraints);
|
||||||
|
$flagcount = count($srchflags);
|
||||||
|
$logfromtables[] = "lognotes";
|
||||||
|
$logfromtables[] = "flagmap";
|
||||||
|
$flagconstraints[] = "flagmap.lognoteid=lognotes.lognoteid and flagmap.flagid in (";
|
||||||
|
foreach ($srchflags as $flagid) {
|
||||||
|
$flagconstraints[] = "\"$flagid\"";
|
||||||
|
$flagconstraints[] = ",";
|
||||||
|
}
|
||||||
|
// remove final comma
|
||||||
|
array_splice($flagconstraints, -1, 1);
|
||||||
|
$flagconstraints[] = ") group by flagmap.lognoteid having count(distinct flagmap.flagid)=$flagcount";
|
||||||
|
// make flagconstraints a single string so that the final implode doesn't split it
|
||||||
|
$logconstraints[] = join('', $flagconstraints);
|
||||||
|
}
|
||||||
// build the clauses and run the query
|
// build the clauses and run the query
|
||||||
$logfromclause = implode(",", array_unique($logfromtables));
|
$logfromclause = implode(",", array_unique($logfromtables));
|
||||||
$logwhereclause = implode(" and ", $logconstraints);
|
$logwhereclause = implode(" and ", $logconstraints);
|
||||||
$logrowqry = mysqli_query($db, "select lognotes.* from $logfromclause where $logwhereclause order by lognotes.date asc, lognotes.time asc");
|
$logrowqry = mysqli_query($db, "select lognotes.* from $logfromclause where $logwhereclause order by lognotes.date asc, lognotes.time asc");
|
||||||
}
|
}
|
||||||
if ($target[0] == "") $target = [];
|
|
||||||
if (in_array("maintform", $target)) {
|
if (in_array("maintform", $target)) {
|
||||||
// maintforms search
|
// maintforms search
|
||||||
// define the query constraints
|
// define the query constraints
|
||||||
@@ -248,23 +246,6 @@ if ($search) {
|
|||||||
$mffromtables[] = "maintactions";
|
$mffromtables[] = "maintactions";
|
||||||
$mfconstraints[] = "maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
|
$mfconstraints[] = "maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
|
||||||
}
|
}
|
||||||
// flags
|
|
||||||
if (!empty($srchflags)) {
|
|
||||||
unset($flagconstraints);
|
|
||||||
$flagcount = count($srchflags);
|
|
||||||
$mffromtables[] = "maintforms";
|
|
||||||
$mffromtables[] = "flagmap";
|
|
||||||
$flagconstraints[] = "flagmap.maintformid=maintforms.maintformid and flagmap.flagid in (";
|
|
||||||
foreach ($srchflags as $thisflagid) {
|
|
||||||
$flagconstraints[] = "\"$thisflagid\"";
|
|
||||||
$flagconstraints[] = ",";
|
|
||||||
}
|
|
||||||
// remove final comma
|
|
||||||
array_splice($flagconstraints, -1, 1);
|
|
||||||
$flagconstraints[] = ") group by flagmap.maintformid having count(distinct flagmap.flagid)=$flagcount";
|
|
||||||
// make flagconstraints a single string so that the final implode doesn't split it
|
|
||||||
$mfconstraints[] = join('', $flagconstraints);
|
|
||||||
}
|
|
||||||
// uid
|
// uid
|
||||||
if ($srchuid != "any" && $srchuid != "") {
|
if ($srchuid != "any" && $srchuid != "") {
|
||||||
$mffromtables[] = "maintforms";
|
$mffromtables[] = "maintforms";
|
||||||
@@ -307,12 +288,28 @@ if ($search) {
|
|||||||
$mffromtables[] = "maintforms";
|
$mffromtables[] = "maintforms";
|
||||||
$mfconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
$mfconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
||||||
}
|
}
|
||||||
|
// flags
|
||||||
|
if (!empty($srchflags)) {
|
||||||
|
unset($flagconstraints);
|
||||||
|
$flagcount = count($srchflags);
|
||||||
|
$mffromtables[] = "maintforms";
|
||||||
|
$mffromtables[] = "flagmap";
|
||||||
|
$flagconstraints[] = "flagmap.maintformid=maintforms.maintformid and flagmap.flagid in (";
|
||||||
|
foreach ($srchflags as $thisflagid) {
|
||||||
|
$flagconstraints[] = "\"$thisflagid\"";
|
||||||
|
$flagconstraints[] = ",";
|
||||||
|
}
|
||||||
|
// remove final comma
|
||||||
|
array_splice($flagconstraints, -1, 1);
|
||||||
|
$flagconstraints[] = ") group by flagmap.maintformid having count(distinct flagmap.flagid)=$flagcount";
|
||||||
|
// make flagconstraints a single string so that the final implode doesn't split it
|
||||||
|
$mfconstraints[] = join('', $flagconstraints);
|
||||||
|
}
|
||||||
// build the clauses and run the query
|
// build the clauses and run the query
|
||||||
$mffromclause = implode(",", array_unique($mffromtables));
|
$mffromclause = implode(",", array_unique($mffromtables));
|
||||||
$mfwhereclause = implode(" and ", $mfconstraints);
|
$mfwhereclause = implode(" and ", $mfconstraints);
|
||||||
$mfrowqry = mysqli_query($db, "select maintforms.* from $mffromclause where $mfwhereclause order by maintforms.mfdate asc, maintforms.mftime asc");
|
$mfrowqry = mysqli_query($db, "select maintforms.* from $mffromclause where $mfwhereclause order by maintforms.mfdate asc, maintforms.mftime asc");
|
||||||
}
|
}
|
||||||
if ($target[0] == "") $target = [];
|
|
||||||
if (in_array("part", $target)) {
|
if (in_array("part", $target)) {
|
||||||
// parts search
|
// parts search
|
||||||
// define the query constraints
|
// define the query constraints
|
||||||
@@ -334,7 +331,6 @@ if ($search) {
|
|||||||
// tech doesn't apply to parts
|
// tech doesn't apply to parts
|
||||||
// subject doesn't apply to parts
|
// subject doesn't apply to parts
|
||||||
// search text doesn't apply to parts
|
// search text doesn't apply to parts
|
||||||
// flags doesn't apply to parts
|
|
||||||
// uid
|
// uid
|
||||||
if ($srchuid != "any" && $srchuid != "") {
|
if ($srchuid != "any" && $srchuid != "") {
|
||||||
$pfromtables[] = "parts";
|
$pfromtables[] = "parts";
|
||||||
@@ -373,6 +369,7 @@ if ($search) {
|
|||||||
$pfromtables[] = "maintforms";
|
$pfromtables[] = "maintforms";
|
||||||
$pconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
$pconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
||||||
}
|
}
|
||||||
|
// flags doesn't apply to parts
|
||||||
// build the clauses and run the query
|
// build the clauses and run the query
|
||||||
$pfromclause = implode(",", array_unique($pfromtables));
|
$pfromclause = implode(",", array_unique($pfromtables));
|
||||||
$pwhereclause = implode(" and ", $pconstraints);
|
$pwhereclause = implode(" and ", $pconstraints);
|
||||||
|
|||||||
@@ -162,6 +162,12 @@ if ($usertemplateid) {
|
|||||||
$loadtemplate = NULL;
|
$loadtemplate = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// determine original owner of template
|
||||||
|
$orig_owner = dblookup($db, "notetemplates", "templateid", "tech", $templateid);
|
||||||
|
if ($efftechid != NULL && $efftechid != $orig_owner) {
|
||||||
|
$operation = "add";
|
||||||
|
}
|
||||||
|
|
||||||
if ($operation == "add") {
|
if ($operation == "add") {
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
if ($note) {
|
if ($note) {
|
||||||
|
|||||||
80
install.sh
80
install.sh
@@ -201,9 +201,36 @@ then
|
|||||||
abort_exit
|
abort_exit
|
||||||
else
|
else
|
||||||
# proceed with upgrade
|
# proceed with upgrade
|
||||||
|
# put app in maintenance mode
|
||||||
# take app offline during upgrade
|
echo "Putting the application in maintenance mode..."
|
||||||
a2disconf $install_loc_in
|
# make sure mod_rewrite is enabled
|
||||||
|
if [[ ! -e "$APACHE_CONF_DIR/../mods-enabled/rewrite.load" ]]
|
||||||
|
then
|
||||||
|
a2enmod -q rewrite
|
||||||
|
systemctl restart apache2
|
||||||
|
fi
|
||||||
|
# disable the app
|
||||||
|
a2disconf -q $install_loc_in
|
||||||
|
systemctl reload apache2
|
||||||
|
# modify the apache conf file
|
||||||
|
if ! grep -q "RewriteEngine" "$APACHE_CONF_DIR/$install_loc_in.conf"
|
||||||
|
then
|
||||||
|
# this is an old version of the conf file. Replace with new version
|
||||||
|
cp -f default-apache.conf $APACHE_CONF_DIR/$install_loc_in.conf
|
||||||
|
sed -i "s|_APPNAME_|$APP_NAME|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||||
|
sed -i "s|_BASEURL_|$install_loc_in|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||||
|
sed -i "s|_DOCROOTIN_|$doc_root_in|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||||
|
fi
|
||||||
|
sed -i "s|#Rewrite|Rewrite|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||||
|
# copy in the default maintenancemode.php if it's not already there
|
||||||
|
if [[ ! -e "$install_path/maintenancemode.php" ]]
|
||||||
|
then
|
||||||
|
cp maintenancemode.php $install_path/
|
||||||
|
# modify the maintenancemode.php file
|
||||||
|
sed -i "s|_APPNAME_|$APP_NAME|g" $install_path/maintenancemode.php
|
||||||
|
fi
|
||||||
|
# re-enable the app in maintenance mode
|
||||||
|
a2enconf -q $install_loc_in
|
||||||
systemctl reload apache2
|
systemctl reload apache2
|
||||||
|
|
||||||
datestamp=$(date +%Y-%m-%d_%H:%M:%S)
|
datestamp=$(date +%Y-%m-%d_%H:%M:%S)
|
||||||
@@ -231,8 +258,8 @@ then
|
|||||||
echo "Backing up current installation to the package directory."
|
echo "Backing up current installation to the package directory."
|
||||||
cp -R $install_path $backupdir/$install_loc_in-$datestamp-backup
|
cp -R $install_path $backupdir/$install_loc_in-$datestamp-backup
|
||||||
|
|
||||||
# delete all existing installation files except db.php
|
# delete all existing installation files except db.php and maintenancemode.php
|
||||||
find $install_path/ -mindepth 1 -not -name 'db.php' -delete
|
find $install_path/ -mindepth 1 ! \( -name 'db.php' -o -name 'maintenancemode.php' \) -delete
|
||||||
|
|
||||||
echo "Performing database updates..."
|
echo "Performing database updates..."
|
||||||
# apply database updates from sql file
|
# apply database updates from sql file
|
||||||
@@ -271,6 +298,17 @@ then
|
|||||||
chown -R $httpd_user_group $install_path
|
chown -R $httpd_user_group $install_path
|
||||||
echo "Backups of the previous openlog files and the previous database were made"
|
echo "Backups of the previous openlog files and the previous database were made"
|
||||||
echo "and are located in the $backupdir directory."
|
echo "and are located in the $backupdir directory."
|
||||||
|
|
||||||
|
# take app out of maintenance mode
|
||||||
|
echo "Taking the app out of maintenance mode..."
|
||||||
|
# disable the app
|
||||||
|
a2disconf -q $install_loc_in
|
||||||
|
systemctl reload apache2
|
||||||
|
# modify the apache conf file
|
||||||
|
sed -i "s|Rewrite|#Rewrite|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||||
|
# re-enable the app in production mode
|
||||||
|
a2enconf -q $install_loc_in
|
||||||
|
systemctl reload apache2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# This was a mistake. Exit now to avoid clobbering another app.
|
# This was a mistake. Exit now to avoid clobbering another app.
|
||||||
@@ -369,10 +407,16 @@ else
|
|||||||
if [[ ! -f "$install_path/db.php" ]]
|
if [[ ! -f "$install_path/db.php" ]]
|
||||||
then
|
then
|
||||||
cp db.php.template $install_path/db.php
|
cp db.php.template $install_path/db.php
|
||||||
sed -i "s/DBNAME/$new_db_name/g" $install_path/db.php
|
sed -i "s|DBNAME|$new_db_name|g" $install_path/db.php
|
||||||
sed -i "s/DBUSER/$db_user/g" $install_path/db.php
|
sed -i "s|DBUSER|$db_user|g" $install_path/db.php
|
||||||
sed -i "s/DBPASS/$db_pass/g" $install_path/db.php
|
sed -i "s|DBPASS|$db_pass|g" $install_path/db.php
|
||||||
sed -i "s/APPNAME/$APP_NAME/g" $install_path/db.php
|
sed -i "s|APPNAME|$APP_NAME|g" $install_path/db.php
|
||||||
|
fi
|
||||||
|
# Create maintenancemode.php if it doesn't exist
|
||||||
|
if [[ ! -f "$install_path/maintenancemode.php" ]]
|
||||||
|
then
|
||||||
|
cp maintenancemode.php $install_path/maintenancemode.php
|
||||||
|
sed -i "s|_APPNAME_|$APP_NAME|g" $install_path/maintenancemode.php
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# copy distribution to install location
|
# copy distribution to install location
|
||||||
@@ -407,25 +451,21 @@ echo "$APP_NAME has been $operation."
|
|||||||
base_url=$install_loc_in
|
base_url=$install_loc_in
|
||||||
if [[ "$operation" == "upgraded" ]]
|
if [[ "$operation" == "upgraded" ]]
|
||||||
then
|
then
|
||||||
a2enconf $base_url
|
a2enconf -q $base_url
|
||||||
systemctl reload apache2
|
systemctl reload apache2
|
||||||
fi
|
fi
|
||||||
if [[ "$operation" == "installed" ]]
|
if [[ "$operation" == "installed" ]]
|
||||||
then
|
then
|
||||||
echo "# $APP_NAME default Apache configuration" > $APACHE_CONF_DIR/$base_url.conf
|
cp -f default-apache.conf $APACHE_CONF_DIR/$base_url.conf
|
||||||
echo "" >> $APACHE_CONF_DIR/$base_url.conf
|
sed -i "s|_APPNAME_|$APP_NAME|g" $APACHE_CONF_DIR/$base_url.conf
|
||||||
echo "Alias /$base_url $doc_root_in/$base_url" >> $APACHE_CONF_DIR/$base_url.conf
|
sed -i "s|_BASEURL_|$base_url|g" $APACHE_CONF_DIR/$base_url.conf
|
||||||
echo "" >> $APACHE_CONF_DIR/$base_url.conf
|
sed -i "s|_DOCROOTIN_|$doc_root_in|g" $APACHE_CONF_DIR/$base_url.conf
|
||||||
echo "<Directory $doc_root_in/$base_url>" >> $APACHE_CONF_DIR/$base_url.conf
|
|
||||||
echo " AllowOverride Options" >> $APACHE_CONF_DIR/$base_url.conf
|
|
||||||
echo " Options FollowSymLinks" >> $APACHE_CONF_DIR/$base_url.conf
|
|
||||||
echo " DirectoryIndex index.php" >> $APACHE_CONF_DIR/$base_url.conf
|
|
||||||
echo "</Directory>" >> $APACHE_CONF_DIR/$base_url.conf
|
|
||||||
echo -n "The apache2 $base_url configuration must be enabled. Would you like to do that now? [Y/n] :"
|
echo -n "The apache2 $base_url configuration must be enabled. Would you like to do that now? [Y/n] :"
|
||||||
read enconf
|
read enconf
|
||||||
if [[ "$enconf" == "" || "$enconf" == "Y" || "$enconf" == "y" ]]
|
if [[ "$enconf" == "" || "$enconf" == "Y" || "$enconf" == "y" ]]
|
||||||
then
|
then
|
||||||
a2enconf $base_url.conf >/dev/null
|
a2enconf -q $base_url.conf >/dev/null
|
||||||
systemctl reload apache2
|
systemctl reload apache2
|
||||||
echo "You can now point a web browser to $base_url on your web server "
|
echo "You can now point a web browser to $base_url on your web server "
|
||||||
echo "to set up and configure $APP_NAME."
|
echo "to set up and configure $APP_NAME."
|
||||||
|
|||||||
26
maintenancemode.php
Normal file
26
maintenancemode.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
maintenancemode.php
|
||||||
|
OpenLog Online Logbook
|
||||||
|
Copyright (C) 2026 Rod Wright
|
||||||
|
|
||||||
|
SPDX-License-Identifier: GPL-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo "
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>_APPNAME_</title>
|
||||||
|
<style type=\"text/css\">
|
||||||
|
* {font-family: Arial, Helvetica, sans-serif;}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<br><br><br><br>
|
||||||
|
_APPNAME_ is currently down for maintenance. Please try again later.
|
||||||
|
<br><br>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
";
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user