6 Commits
5.2.4 ... 5.2.5

17 changed files with 390 additions and 307 deletions

View File

@@ -193,10 +193,54 @@
fixed. Made the corrections to the edit code as well as the fixed. Made the corrections to the edit code as well as the
new entry. new entry.
- In logentry.php, the default times for notes entered using dates - In logentry.php, the default times for notes entered using dates
other than today's date contained a trailing coln that mysql other than today's date contained a trailing colon that mysql
didn't like. Removed trailing colons. didn't like. Removed trailing colons.
- Cleaned up the REQUEST importation in multiple files to default to - Cleaned up the REQUEST importation in multiple files to default to
NULL values for parameters not supplied to prevent warning NULL values for parameters not supplied to prevent warning
messages in the logs. messages in the logs.
- In the install.sh script, removed the prompts for optional package - In the install.sh script, removed the prompts for optional package
installation. Code is still there, just turned off by default. installation. Code is still there, just turned off by default.
5.2.4.1 - 2025-12-10
- Fixed bug in search.php where "Print search results" link on the
search results page resulted in the printable page not showing
any results. This was due to a php fatal error caused by passing
a non-array as the second argument of the php in_array()
function.
5.2.4.2 - 2025-12-11
- Fixed other bugs caused by passing a non-array as the second
argument of the php in_array() function in various files.
5.2.4.3 - 2025-12-16
- Various problems were noted resulting from php's use of UTC as the
default timezone. Now, on installation or upgrade, the installer
gets the correct timezone from the system and sets it as a php
option in a .htaccess file in the install location. This solves
multiple problems and allows today's date and the current time
to be determined from the php date() function as part of the
settings.php once per page load instead of having to query the
database multiple times per page load. Also added the option to
allow apache to read the .htaccess file to the <Directory>
section of the application's conf file in
/etc/apache2/conf-available
- Renamed the installer's db.php_update.sh script to files-update.sh
to reflect that it now can do more than just modify the db.php
file. For this version, it's used to modify the apache conf file
mentioned earlier.
- Completely removed the optional package prompting/installation
code from install.sh. This is best done using separate
installers.
5.2.4.4 - 2025-12-19
-Fixed bugs that caused crashes on the Scheduled Maintenance page
that were caused by more strict behavior of php regarding mysql
queries.
- Fixed bug where some functions defined in functions.php were not
treating the $today variable as global.
- In install.php, if a previous installation was found, make upgrade
the default choice.
5.2.5 - 2026-02-10
This is just a version number bump to get on a major-minor-patch
scheme. There are no code changes for this release.

0
README.md Normal file
View File

1
VERSION.txt Normal file
View File

@@ -0,0 +1 @@
5.2.5

View File

@@ -69,7 +69,7 @@ CREATE TABLE `configs` (
LOCK TABLES `configs` WRITE; LOCK TABLES `configs` WRITE;
/*!40000 ALTER TABLE `configs` DISABLE KEYS */; /*!40000 ALTER TABLE `configs` DISABLE KEYS */;
INSERT INTO `configs` VALUES INSERT INTO `configs` VALUES
(1,'ol_version','5.2.4'), (1,'ol_version','5.2.5'),
(2,'log_name','OpenLog'), (2,'log_name','OpenLog'),
(3,'banner','1'), (3,'banner','1'),
(4,'background_color','#003333'), (4,'background_color','#003333'),

39
database-update.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
# database-update.sh
# OpenLog Online Logbook
# Copyright (C) 2025 Rod Wright
# SPDX-License-Identifier: GPL-2.0
if [[ $1 == "" ]]
then
echo "This script requires a mysql options file, but none was specified. Aborting."
exit 1
fi
mysql_opt_file=$1
if [[ ! -f $mysql_opt_file ]]
then
echo "The mysql options file specified does not exist. Aborting."
exit 1
fi
margs="--defaults-extra-file=$mysql_opt_file"
# ---------- version x.x.x ----------
# Nothing to be done for versions prior to 5.2.4.3
# -----------------------------------
# ---------- version 5.2.4.3 ----------
# Nothing to do
# -------------------------------------
# ---------- version 5.2.4.4 ----------
# Nothing to do
# -------------------------------------
# ---------- version 5.2.5 ------------
# Nothing to do
# -------------------------------------

View File

@@ -30,3 +30,28 @@ UPDATE configs SET confvalue="5.2.3" WHERE confname="ol_version";
-- Update version number -- Update version number
UPDATE configs SET confvalue="5.2.4" WHERE confname="ol_version"; UPDATE configs SET confvalue="5.2.4" WHERE confname="ol_version";
-- -------------------------------------- -- --------------------------------------
-- ---------- version 5.2.4.1 -----------
-- Update version number
UPDATE configs SET confvalue="5.2.4.1" WHERE confname="ol_version";
-- --------------------------------------
-- ---------- version 5.2.4.2 -----------
-- Update version number
UPDATE configs SET confvalue="5.2.4.2" WHERE confname="ol_version";
-- --------------------------------------
-- ---------- version 5.2.4.3 -----------
-- Update version number
UPDATE configs SET confvalue="5.2.4.3" WHERE confname="ol_version";
-- --------------------------------------
-- ---------- version 5.2.4.4 -----------
-- Update version number
UPDATE configs SET confvalue="5.2.4.4" WHERE confname="ol_version";
-- --------------------------------------
-- ---------- version 5.2.5 -------------
-- Update version number
UPDATE configs SET confvalue="5.2.5" WHERE confname="ol_version";
-- --------------------------------------

View File

@@ -1,19 +0,0 @@
# opendrs-update.sh
install_path=$1
# ---------- version 5.2.1 -------------
# No changes to the db.php file
# ---------------------------------------
# ---------- version 5.2.2 -------------
# No changes to the db.php file
# ---------------------------------------
# ---------- version 5.2.3 -------------
# No changes to the db.php file
# ---------------------------------------
# ---------- version 5.2.4 -------------
# No changes to the db.php file
# ---------------------------------------

View File

@@ -201,3 +201,47 @@
- In the install.sh script, removed the prompts for optional package - In the install.sh script, removed the prompts for optional package
installation. Code is still there, just turned off by default. installation. Code is still there, just turned off by default.
5.2.4.1 - 2025-12-10
- Fixed bug in search.php where "Print search results" link on the
search results page resulted in the printable page not showing
any results. This was due to a php fatal error caused by passing
a non-array as the second argument of the php in_array()
function.
5.2.4.2 - 2025-12-11
- Fixed other bugs caused by passing a non-array as the second
argument of the php in_array() function in various files.
5.2.4.3 - 2025-12-16
- Various problems were noted resulting from php's use of UTC as the
default timezone. Now, on installation or upgrade, the installer
gets the correct timezone from the system and sets it as a php
option in a .htaccess file in the install location. This solves
multiple problems and allows today's date and the current time
to be determined from the php date() function as part of the
settings.php once per page load instead of having to query the
database multiple times per page load. Also added the option to
allow apache to read the .htaccess file to the <Directory>
section of the application's conf file in
/etc/apache2/conf-available
- Renamed the installer's db.php_update.sh script to files-update.sh
to reflect that it now can do more than just modify the db.php
file. For this version, it's used to modify the apache conf file
mentioned earlier.
- Completely removed the optional package prompting/installation
code from install.sh. This is best done using separate
installers.
5.2.4.4 - 2025-12-19
-Fixed bugs that caused crashes on the Scheduled Maintenance page
that were caused by more strict behavior of php regarding mysql
queries.
- Fixed bug where some functions defined in functions.php were not
treating the $today variable as global.
- In install.php, if a previous installation was found, make upgrade
the default choice.
5.2.5 - 2026-02-10
This is just a version number bump to get on a major-minor-patch
scheme. There are no code changes for this release.

View File

@@ -721,8 +721,7 @@ function showlinklist($print) {
function nag($tech_id) { function nag($tech_id) {
// nags the user if something is pending // nags the user if something is pending
global $db; global $db, $today;
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
// maintenance forms // maintenance forms
$mfpending=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$tech_id\" and pending=1")); $mfpending=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$tech_id\" and pending=1"));
if ($mfpending) { if ($mfpending) {
@@ -820,8 +819,7 @@ function get_upcoming_events() {
// build array of upcoming events // build array of upcoming events
// takes no arguments // takes no arguments
// returns an array containing arrays of upcoming event data // returns an array containing arrays of upcoming event data
global $db; global $db, $today;
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$uceventsqry=mysqli_query($db,"select * from events where active_flag=\"1\" and (deferred_flag=\"0\" or (deferred_flag=\"1\" and deferred_date <= \"$today\"))"); $uceventsqry=mysqli_query($db,"select * from events where active_flag=\"1\" and (deferred_flag=\"0\" or (deferred_flag=\"1\" and deferred_date <= \"$today\"))");
$ucevents=array(); $ucevents=array();
while ($uceventrow=mysqli_fetch_assoc($uceventsqry)) { while ($uceventrow=mysqli_fetch_assoc($uceventsqry)) {

View File

@@ -77,9 +77,6 @@ if ($edit || $delete) {
// ******** begin database manipulation ******** // ******** begin database manipulation ********
// determine today's date and make it the default
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$now=mysqli_fetch_row(mysqli_query($db,"select current_time"))[0];
if ($add) { if ($add) {
if ($submit) { if ($submit) {
// add the entry if submit is pressed // add the entry if submit is pressed
@@ -249,6 +246,7 @@ if ($add) {
$flagids=mysqli_query($db,"select flagid from flags"); $flagids=mysqli_query($db,"select flagid from flags");
while ($thisflagid=mysqli_fetch_row($flagids)) { while ($thisflagid=mysqli_fetch_row($flagids)) {
$thisflag_tbl="flag_".$thisflagid[0]; $thisflag_tbl="flag_".$thisflagid[0];
if ($flags[0]=="") $flags=[];
if (in_array($thisflagid[0],$flags)) { if (in_array($thisflagid[0],$flags)) {
if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"notetemplates\" and id=\"$templateid\""))) { if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"notetemplates\" and id=\"$templateid\""))) {
mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"notetemplates\",\"$templateid\")"); mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"notetemplates\",\"$templateid\")");
@@ -368,6 +366,7 @@ if ($edit) {
$chainmembers=generate_chain($noteid); $chainmembers=generate_chain($noteid);
while ($thisflagid=mysqli_fetch_row($flagids)) { while ($thisflagid=mysqli_fetch_row($flagids)) {
$thisflag_tbl="flag_".$thisflagid[0]; $thisflag_tbl="flag_".$thisflagid[0];
if ($flags[0]=="") $flags=[];
if (in_array($thisflagid[0],$flags)) { if (in_array($thisflagid[0],$flags)) {
if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"lognotes\" and id=\"$noteid\""))) { if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"lognotes\" and id=\"$noteid\""))) {
// set flag for this noteid // set flag for this noteid

View File

@@ -29,7 +29,6 @@ if ($print) {
} }
// use default date values if not supplied // use default date values if not supplied
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
if ($tgt_date=="") $tgt_date=$today; if ($tgt_date=="") $tgt_date=$today;
// define shifttable_classic function // define shifttable_classic function

View File

@@ -104,9 +104,6 @@ if ($printfmt) {
} }
// ******** begin database manipulation ******** // ******** begin database manipulation ********
// determine today's date and make it the default
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$now=mysqli_fetch_row(mysqli_query($db,"select current_time"))[0];
//var_dump($_REQUEST); //var_dump($_REQUEST);
@@ -146,9 +143,7 @@ if ($mfadd) {
} }
// remove cruft from malfunction text // remove cruft from malfunction text
$mfmalfunction=htmlentities($mfmalfunction); $mfmalfunction=htmlentities($mfmalfunction);
if (!get_magic_quotes_gpc()) {
$mfmalfunction=addslashes($mfmalfunction); $mfmalfunction=addslashes($mfmalfunction);
}
if ($mfauthorized) { if ($mfauthorized) {
$partdatainput=array(); $partdatainput=array();
@@ -170,6 +165,8 @@ if ($mfadd) {
if ($uid =="" || $partnum == "" || $sernum == "") { if ($uid =="" || $partnum == "" || $sernum == "") {
// have the maintenance form stay pending due to incomplete part data // have the maintenance form stay pending due to incomplete part data
$pending=1; $pending=1;
} else {
$pending=0;
} }
// add the record to maintforms // add the record to maintforms
@@ -195,13 +192,14 @@ if ($mfedit) {
if ($mfmalfunction && ($uid || ($partnum && $sernum))) { if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
// remove cruft from malfunction text // remove cruft from malfunction text
$mfmalfunction=htmlentities($mfmalfunction); $mfmalfunction=htmlentities($mfmalfunction);
if (!get_magic_quotes_gpc()) {
$mfmalfunction=addslashes($mfmalfunction); $mfmalfunction=addslashes($mfmalfunction);
}
// update parts table // update parts table
if ($uid =="" || $partnum == "" || $sernum == "") { if ($uid =="" || $partnum == "" || $sernum == "") {
// have the maintenance form stay pending due to incomplete part data // have the maintenance form stay pending due to incomplete part data
$pending=1; $pending=1;
} else {
$pending=0;
} }
if (! $pdatamismatch) { if (! $pdatamismatch) {
mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$mfpart\""); mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$mfpart\"");
@@ -215,6 +213,7 @@ if ($mfedit) {
$flagids=mysqli_query($db,"select flagid from flags"); $flagids=mysqli_query($db,"select flagid from flags");
while ($thisflagid=mysqli_fetch_row($flagids)) { while ($thisflagid=mysqli_fetch_row($flagids)) {
$thisflag_tbl="flag_".$thisflagid[0]; $thisflag_tbl="flag_".$thisflagid[0];
if ($flags[0]=="") $flags=[];
if (in_array($thisflagid[0],$flags)) { if (in_array($thisflagid[0],$flags)) {
if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"maintforms\" and id=\"$maintformid\""))) { if(!mysqli_num_rows(mysqli_query($db,"select id from $thisflag_tbl where target=\"maintforms\" and id=\"$maintformid\""))) {
mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"maintforms\",\"$maintformid\")"); mysqli_query($db,"insert into $thisflag_tbl(target,id) values(\"maintforms\",\"$maintformid\")");
@@ -256,9 +255,7 @@ if ($actionadd) {
} }
// remove cruft from action text // remove cruft from action text
$action=htmlentities($action); $action=htmlentities($action);
if (!get_magic_quotes_gpc()) {
$action=addslashes($action); $action=addslashes($action);
}
// add to maintactions table // add to maintactions table
mysqli_query($db,"insert into maintactions (actiondate,actiontime,maintformnum,actiontech,action) mysqli_query($db,"insert into maintactions (actiondate,actiontime,maintformnum,actiontech,action)
@@ -273,9 +270,8 @@ if ($actionedit) {
// update the action // update the action
// remove cruft from action text // remove cruft from action text
$action=htmlentities($action); $action=htmlentities($action);
if (!get_magic_quotes_gpc()) {
$action=addslashes($action); $action=addslashes($action);
}
// update maintactions table // update maintactions table
mysqli_query($db,"update maintactions set actiondate=\"$actiondate\", actiontime=\"$actiontime\", action=\"$action\" where maintactionid=\"$maintactionid\""); mysqli_query($db,"update maintactions set actiondate=\"$actiondate\", actiontime=\"$actiontime\", action=\"$action\" where maintactionid=\"$maintactionid\"");
} }
@@ -399,6 +395,7 @@ if ($printfmt) {
} }
$flagslist=mysqli_query($db,"select * from flags"); $flagslist=mysqli_query($db,"select * from flags");
while ($flagsymbol=mysqli_fetch_assoc($flagslist)) { while ($flagsymbol=mysqli_fetch_assoc($flagslist)) {
if ($theseflags[0]=="") $theseflags=[];
if (in_array($flagsymbol["flagid"],$theseflags)) { if (in_array($flagsymbol["flagid"],$theseflags)) {
echo $flagsymbol['flagsym']."&nbsp;&nbsp;"; echo $flagsymbol['flagsym']."&nbsp;&nbsp;";
} }
@@ -491,6 +488,7 @@ if ($printfmt) {
$flagsperline=8; $flagsperline=8;
$flagcount=1; $flagcount=1;
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) { while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
if ($theseflags[0]=="") $theseflags=[];
if (in_array($flagcheckbox["flagid"],$theseflags)) { if (in_array($flagcheckbox["flagid"],$theseflags)) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>", printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]); $flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);

View File

@@ -14,50 +14,50 @@ if (isset($_SESSION['login'])) {
} else { } else {
$loggedin=false; $loggedin=false;
} }
$techid=$_SESSION['login']; $techid=$_SESSION['login'] ?? NULL;
$isadmin=dblookup($db,"techs","techid","admin",$techid); $isadmin=dblookup($db,"techs","techid","admin",$techid);
$upcoming=$_REQUEST['upcoming']; $upcoming=$_REQUEST['upcoming'] ?? NULL;
$schedule=$_REQUEST['schedule']; $schedule=$_REQUEST['schedule'] ?? NULL;
$tasks=$_REQUEST['tasks']; $tasks=$_REQUEST['tasks'] ?? NULL;
$devices=$_REQUEST['devices']; $devices=$_REQUEST['devices'] ?? NULL;
$action=$_REQUEST['action']; $action=$_REQUEST['action'] ?? NULL;
$complete=$_REQUEST['complete']; $complete=$_REQUEST['complete'] ?? NULL;
$defer=$_REQUEST['defer']; $defer=$_REQUEST['defer'] ?? NULL;
$add=$_REQUEST['add']; $add=$_REQUEST['add'] ?? NULL;
$edit=$_REQUEST['edit']; $edit=$_REQUEST['edit'] ?? NULL;
$update=$_REQUEST['update']; $update=$_REQUEST['update'] ?? NULL;
$delete=$_REQUEST['delete']; $delete=$_REQUEST['delete'] ?? NULL;
$id=$_REQUEST['id']; $id=$_REQUEST['id'] ?? NULL;
$active_flag=$_REQUEST['active_flag']; $active_flag=$_REQUEST['active_flag'] ?? 0;
$devicename=$_REQUEST['devicename']; $devicename=$_REQUEST['devicename'] ?? NULL;
$devicedesc=$_REQUEST['devicedesc']; $devicedesc=$_REQUEST['devicedesc'] ?? NULL;
$group_flag=$_REQUEST['group_flag']; $group_flag=$_REQUEST['group_flag'] ?? 0;
$members=$_REQUEST['members']; $members=$_REQUEST['members'] ?? [];
$weekdays_only=$_REQUEST['weekdays_only']; $weekdays_only=$_REQUEST['weekdays_only'] ?? NULL;
$nextdue_relative=$_REQUEST['nextdue_relative']; $nextdue_relative=$_REQUEST['nextdue_relative'] ?? NULL;
$taskname=$_REQUEST['taskname']; $taskname=$_REQUEST['taskname'] ?? NULL;
$taskdesc=$_REQUEST['taskdesc']; $taskdesc=$_REQUEST['taskdesc'] ?? NULL;
$frequency=$_REQUEST['frequency']; $frequency=$_REQUEST['frequency'] ?? NULL;
$period=$_REQUEST['period']; $period=$_REQUEST['period'] ?? NULL;
$refdoc_name=$_REQUEST['refdoc_name']; $refdoc_name=$_REQUEST['refdoc_name'] ?? NULL;
$refdoc_url=$_REQUEST['refdoc_url']; $refdoc_url=$_REQUEST['refdoc_url'] ?? NULL;
$deferred_flag=$_REQUEST['deferred_flag']; $deferred_flag=$_REQUEST['deferred_flag'] ?? 0;
$deferred_date=$_REQUEST['deferred_date']; $deferred_date=$_REQUEST['deferred_date'] ?? NULL;
$start_date=$_REQUEST['start_date']; $start_date=$_REQUEST['start_date'] ?? NULL;
$last_date=$_REQUEST['last_date']; $last_date=$_REQUEST['last_date'] ?? NULL;
$task=$_REQUEST['task']; $task=$_REQUEST['task'] ?? NULL;
$device=$_REQUEST['device']; $device=$_REQUEST['device'] ?? NULL;
$deferuntil=$_REQUEST['deferuntil']; $deferuntil=$_REQUEST['deferuntil'] ?? NULL;
$completedate=$_REQUEST['completedate']; $completedate=$_REQUEST['completedate'] ?? NULL;
$addlognote=$_REQUEST['addlognote']; $addlognote=$_REQUEST['addlognote'] ?? NULL;
$logname=LOG_NAME; $logname=LOG_NAME;
$print=$_REQUEST['print']; $print=$_REQUEST['print'] ?? NULL;
if ($print) { if ($print) {
$sbcolor=P_SIDEBAR_COLOR; $sbcolor=P_SIDEBAR_COLOR;
@@ -67,7 +67,6 @@ if ($print) {
$mbgcolor=MENUBG_COLOR; $mbgcolor=MENUBG_COLOR;
} }
// **** BEGIN DATABASE OPERATIONS **** // **** BEGIN DATABASE OPERATIONS ****
$today=mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$tomorrow=mysqli_fetch_row(mysqli_query($db,"select adddate((select current_date),1)"))[0]; $tomorrow=mysqli_fetch_row(mysqli_query($db,"select adddate((select current_date),1)"))[0];
$errorstack=array(); $errorstack=array();
@@ -127,6 +126,9 @@ 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);
@@ -201,6 +203,9 @@ if ($edit) {
$last_date=mysqli_real_escape_string($db,$last_date); $last_date=mysqli_real_escape_string($db,$last_date);
$deferred_date=mysqli_real_escape_string($db,$deferred_date); $deferred_date=mysqli_real_escape_string($db,$deferred_date);
// update the tasks table // update the tasks table
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";
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\"
@@ -401,7 +406,7 @@ if ($action) {
} }
if ($start_date=="0000-00-00") $start_date=$today; if ($start_date=="0000-00-00") $start_date=$today;
if ($last_date=="0000-00-00") $last_date=""; if ($last_date=="0000-00-00") $last_date="";
if ($deferred_date=="0000-00-00") $deferred_date=""; if ($deferred_date=="0000-00-00") $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\">";

View File

@@ -58,20 +58,19 @@ framework("begin","$logname Search","Search",$print);
// ******** begin database manipulation ******** // ******** begin database manipulation ********
// get the date range of lognotes // get the date range of lognotes
$todaysdate = mysqli_fetch_row(mysqli_query($db,"select current_date"))[0];
$logdateqry=mysqli_query($db,"select min(date), max(date) from lognotes"); $logdateqry=mysqli_query($db,"select min(date), max(date) from lognotes");
$logdateresults=mysqli_fetch_row($logdateqry); $logdateresults=mysqli_fetch_row($logdateqry);
$logmindate=$logdateresults[0]; $logmindate=$logdateresults[0];
if ($logmindate == "") $logmindate = $todaysdate; if ($logmindate == "") $logmindate = $today;
$logmaxdate=$logdateresults[1]; $logmaxdate=$logdateresults[1];
if ($logmaxdate == "") $logmaxdate = $todaysdate; if ($logmaxdate == "") $logmaxdate = $today;
// get the date range of maintenance forms // get the date range of maintenance forms
$mfdateqry=mysqli_query($db,"select min(mfdate), max(mfdate) from maintforms"); $mfdateqry=mysqli_query($db,"select min(mfdate), max(mfdate) from maintforms");
$mfdateresults=mysqli_fetch_row($mfdateqry); $mfdateresults=mysqli_fetch_row($mfdateqry);
$mfmindate=$mfdateresults[0]; $mfmindate=$mfdateresults[0];
if ($mfmindate == "") $mfmindate = $todaysdate; if ($mfmindate == "") $mfmindate = $today;
$mfmaxdate=$mfdateresults[1]; $mfmaxdate=$mfdateresults[1];
if ($mfmaxdate == "") $mfmaxdate = $todaysdate; if ($mfmaxdate == "") $mfmaxdate = $today;
// determine entire date range // determine entire date range
$mindate=min($logmindate, $mfmindate); $mindate=min($logmindate, $mfmindate);
$maxdate=max($logmaxdate, $mfmaxdate); $maxdate=max($logmaxdate, $mfmaxdate);
@@ -84,6 +83,7 @@ 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
@@ -188,6 +188,7 @@ if ($search) {
$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
@@ -284,6 +285,7 @@ if ($search) {
$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
@@ -491,6 +493,7 @@ if (!$print) {
echo " echo "
<b>Search in:</b>&nbsp;&nbsp; <b>Search in:</b>&nbsp;&nbsp;
"; ";
if ($target[0]=="") $target=[];
if (in_array("log", $target)) { if (in_array("log", $target)) {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\" checked>Logbook&nbsp;&nbsp;"; echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\" checked>Logbook&nbsp;&nbsp;";
} else { } else {
@@ -589,10 +592,13 @@ if (!$print) {
$flagsperline=8; $flagsperline=8;
$flagcount=1; $flagcount=1;
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) { while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
if ($srchflags) {
if ($srchflags[0]=="") $srchflags=[];
if (in_array($flagcheckbox["flagid"],$srchflags)) { if (in_array($flagcheckbox["flagid"],$srchflags)) {
printf("<font color=\"%s\">%s</font>", printf("<font color=\"%s\">%s</font>",
$flagcheckbox["flagcolor"],$flagcheckbox["flagsym"]); $flagcheckbox["flagcolor"],$flagcheckbox["flagsym"]);
} }
}
if ($flagcount<$flagsperline) { if ($flagcount<$flagsperline) {
echo "&nbsp;&nbsp;&nbsp;"; echo "&nbsp;&nbsp;&nbsp;";
$flagcount++; $flagcount++;
@@ -605,6 +611,7 @@ if (!$print) {
<br><br> <br><br>
"; ";
if ($doparts) { if ($doparts) {
if ($target[0]=="") $target=[];
echo " echo "
<b>Search in:</b>&nbsp;&nbsp; <b>Search in:</b>&nbsp;&nbsp;
"; ";
@@ -627,6 +634,7 @@ if (!$print) {
} }
if ($search) { if ($search) {
if ($target[0]=="") $target=[];
if (in_array("log",$target)) { if (in_array("log",$target)) {
// run lognotes query and show results // run lognotes query and show results
if(mysqli_num_rows($logrowqry)) { if(mysqli_num_rows($logrowqry)) {
@@ -684,6 +692,7 @@ if ($search) {
echo "<font size=\"+1\">No Logbook notes match your search criteria.</font><br><hr>"; echo "<font size=\"+1\">No Logbook notes match your search criteria.</font><br><hr>";
} }
} }
if ($target[0]=="") $target=[];
if (in_array("maintform",$target)) { if (in_array("maintform",$target)) {
// run maintforms query and show results // run maintforms query and show results
if(mysqli_num_rows($mfrowqry)) { if(mysqli_num_rows($mfrowqry)) {
@@ -746,6 +755,7 @@ if ($search) {
echo "<font size=\"+1\">No Maintenance Forms match your search criteria.</font><br><hr>"; echo "<font size=\"+1\">No Maintenance Forms match your search criteria.</font><br><hr>";
} }
} }
if ($target[0]=="") $target=[];
if (in_array("part",$target)) { if (in_array("part",$target)) {
// run parts query and show results // run parts query and show results
if(mysqli_num_rows($prowqry)) { if(mysqli_num_rows($prowqry)) {

View File

@@ -7,6 +7,10 @@
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
// determine today's date and time and assign them to variables
$today = date("Y-m-d");
$now = date("H:i:s");
$sttl=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"session_ttl_days\""))[0]; $sttl=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"session_ttl_days\""))[0];
$ostype=strtoupper(substr(php_uname('s'), 0, 3)); $ostype=strtoupper(substr(php_uname('s'), 0, 3));
if ($ostype == 'WIN') { if ($ostype == 'WIN') {

48
files-update.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
# files_update.sh
install_path=$1
# ---------- version 5.2.1 -------------
# No changes
# --------------------------------------
# ---------- version 5.2.2 -------------
# No changes
# --------------------------------------
# ---------- version 5.2.3 -------------
# No changes
# --------------------------------------
# ---------- version 5.2.4 -------------
# No changes
# --------------------------------------
# ---------- version 5.2.4.1 -----------
# No changes
# --------------------------------------
# ---------- version 5.2.4.2 -----------
# No changes
# --------------------------------------
# ---------- version 5.2.4.3 -----------
# Add AllowOverride Options to the apache conf-available file
install_loc=$(basename $install_path)
if ! grep -q "AllowOverride Options" /etc/apache2/conf-available/$install_loc.conf
then
sed -i '/^<Directory/a\ AllowOverride Options' /etc/apache2/conf-available/$install_loc.conf
systemctl reload apache2
fi
# --------------------------------------
# ---------- version 5.2.4.4 -----------
# No changes
# --------------------------------------
# ---------- version 5.2.5 -------------
# No changes
# --------------------------------------

View File

@@ -8,21 +8,26 @@
APP_NAME="OpenLog" APP_NAME="OpenLog"
DEFAULT_DB_NAME="openlog" DEFAULT_DB_NAME="openlog"
APP_VERSION="5.2.4" APP_VERSION="5.2.5"
DOC_ROOT="/var/www" DOC_ROOT="/var/www"
INSTALL_LOC="openlog" INSTALL_LOC="openlog"
APACHE_USER="www-data"
APACHE_GROUP="www-data"
APACHE_CONF_DIR="/etc/apache2/conf-available" APACHE_CONF_DIR="/etc/apache2/conf-available"
BACKUP_DIR="openlog-previous-installation" BACKUP_DIR="openlog-previous-installation"
INDEX_FILE="lognotes.php" LANDING_PAGE="lognotes.php"
CONFIG_TABLE="configs" CONFIG_TABLE="configs"
CONFIG_NAME_COLUMN="confname" CONFIG_NAME_COLUMN="confname"
CONFIG_VALUE_COLUMN="confvalue" CONFIG_VALUE_COLUMN="confvalue"
CONFIG_DEFAULT_COLUMN="" CONFIG_DEFAULT_COLUMN=""
OFFER_OPTIONAL_PKGS=false
function privilege_check() {
# test for superuser rights
if [[ $EUID -ne 0 ]]; then
echo "This script must be run with superuser privileges. Try sudo $0"
exit 1
fi
}
function get_new_password() { function get_new_password() {
# Stores new password in the variable $newpassword # Stores new password in the variable $newpassword
pwgood=false pwgood=false
@@ -105,11 +110,22 @@ function abort_exit() {
exit 1 exit 1
} }
function spinner() {
local pid="$1"
local delay="0.1"
local spinstr='|/-\\'
local i=0
while ps -p "$pid" > /dev/null; do
i=$(( (i+1) % 4 ))
printf "\r[%c]" "${spinstr:$i:1}"
sleep "$delay"
done
printf "\r \r" # Clear the spinner line
}
# test for superuser rights # test for superuser rights
if [[ $EUID -ne 0 ]]; then privilege_check
echo "This script must be run with superuser privileges. Try sudo ./install.sh"
abort_exit
fi
echo "" echo ""
@@ -122,182 +138,28 @@ echo "Preparing for installation. Please wait..."
# Prevent unattended-upgrades from interfering # Prevent unattended-upgrades from interfering
restart_uu=false restart_uu=false
while systemctl status unattended-upgrades >/dev/null 2>&1 while dpkg -l|grep unattended-upgrades >/dev/null 2>&1
do do
systemctl stop unattended-upgrades systemctl stop unattended-upgrades
sleep 5 sleep 5
restart_uu=true restart_uu=true
done done
apt-get update apt-get update -qq
# Check for prerequisites and prompt to install # Check for prerequisites and prompt to install
echo "Checking for required packages..." echo "Checking for required packages..."
echo "" echo ""
install_required_packages "apache2" "php" "mysql-server or mariadb-server" "uuid-runtime" install_required_packages "apache2" "php" "mysql-server or mariadb-server" "php-mysql" "uuid-runtime"
echo "" echo ""
echo "Finished required package installation." echo "Finished required package installation."
echo "" echo ""
if $OFFER_OPTIONAL_PKGS # Determine the correct Apache2 user and group
then APACHE_USER=$(grep APACHE_RUN_USER /etc/apache2/envvars | cut -d= -f2)
# Check for optional packages and prompt to install APACHE_GROUP=$(grep APACHE_RUN_GROUP /etc/apache2/envvars | cut -d= -f2)
echo "Checking for optional packages..." httpd_user_group="$APACHE_USER:$APACHE_GROUP"
echo ""
echo "Checking for phpmyadmin installation..."
echo ""
if dpkg -l|grep phpmyadmin >/dev/null 2>&1
then
echo ""
echo "phpmyadmin is installed. Continuing."
echo ""
else
echo "phpmyadmin doesn't seem to be installed."
echo "It is an optional package that enables administration of the mysql/mariadb"
echo "database server using a friendly GUI. It is highly recommended."
echo "Note that this has the potential to be a security risk, especially"
echo "if your passwords aren't sufficiently strong."
echo -n "Install it now? [Y/n]: "
read reqinstall
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
then
echo "Proceeding without installing phpmyadmin. Database administration"
echo "will require the use of the mysql/mariadb command line tools."
else
echo ""
echo "Proceeding with phpmyadmin installation"
echo ""
sleep 3
echo ""
echo "During the following installation of phpmyadmin:"
echo ""
echo "- Select apache2 as the web server to configure automatically."
echo ""
echo "- Choose Yes when prompted to install phpmyadmin database and allow it to"
echo " generate a random password(leave the field blank)."
echo ""
echo -n "Press enter to continue."
read continueok
echo ""
apt-get install -y phpmyadmin
echo ""
echo ""
echo "In order to log in to the database using phpmyadmin, there must be a"
echo "database user with a password set who has administrator privileges."
echo "After a fresh installation of the MySQL or MariaDB server, the root"
echo "user doesn't have a password, and is unable to log in to the phpmyadmin"
echo "web GUI. You should create a new user with administrative rights now."
echo ""
read -p "New MySQL/MariaDB administrator username: " -r newdbadminuser
echo ""
get_new_password
newdbadminpass=$newpassword
unset newpassword
mysql -e "CREATE USER '$newdbadminuser'@'localhost'
IDENTIFIED VIA mysql_native_password USING password('$newdbadminpass');
GRANT ALL PRIVILEGES ON *.* TO '$newdbadminuser'@'localhost'
REQUIRE NONE WITH GRANT OPTION
MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0
MAX_USER_CONNECTIONS 0;
flush privileges"
echo ""
echo ""
echo "You can now access phpmyadmin using a web browser pointed to:"
echo ""
echo " http://$HOSTNAME/phpmyadmin"
echo ""
echo "*** WARNING!! this url is accessible via unencrypted (http) connections."
echo "This is a huge security risk since the username and password you enter"
echo "on the phpmyadmin login page can be sent in the clear for any potential"
echo "attacker to sniff! You should enable redirection to https for phpmyadmin"
echo "in your apache2 configuration if your site is reachable from the internet."
echo ""
echo -n "Press enter to continue."
read continueok
echo ""
echo "Finished with phpmyadmin installation"
echo ""
sleep 3
fi
fi
echo ""
echo "Checking for webmin installation..."
echo ""
if dpkg -l|grep webmin >/dev/null 2>&1
then
echo ""
echo "webmin is installed. Continuing."
echo ""
else
echo "webmin doesn't seem to be installed."
echo "It is an optional package that enables system administration"
echo "using a friendly GUI. It is highly recommended, especially for"
echo "headless servers without any way to log in directly on the machine."
echo "Note that this has the potential to be a security risk, especially"
echo "if your passwords aren't sufficiently strong."
echo -n "Install it now? [Y/n]: "
read reqinstall
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
then
echo "Proceeding without installing webmin. System administration"
echo "will require login to the server either directly or via ssh."
else
echo ""
echo "Proceeding with webmin installation"
echo ""
sleep 3
echo "Installing webmin..."
skipwebmin="false"
if ! curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
then
echo "Warning: failed to download Webmin repo setup script."
echo -n "Ignore and [c]ontinue or [A]bort? [c/A]: "
read wmfailchoice
if [ "$wmfailchoice" = "C" -o "$wmfailchoice" = "c" ]
then
skipwebmin="true"
echo "Continuing without installing Webmin. You should investigate the failure"
echo "and install Webmin manually after the server is set up if you would like"
echo "to be able to manage the server from another computer with a GUI instead"
echo "of through ssh only."
echo -n "Press enter to continue."
read continueok
echo ""
fi
fi
if [ "$skipwebmin" = "false" ]
then
sh setup-repos.sh -f
apt-get install -y --install-recommends webmin
fi
echo "...done."
echo ""
echo "You can now access webmin using a web browser pointed to:"
echo "https://$HOSTNAME:10000"
echo "Unless you have obtained valid ssl certificates, your server is"
echo "using self-signed certs. This is not necessarily a problem, but"
echo "your browser will complain. You can tell the browser to accept the"
echo "self signed certificates and the traffic will still be encrypted,"
echo "however you may be vulnerable to man-in-the-middle attacks. You can"
echo "get free valid certificates through LetsEncrypt."
echo "See http://letsencrypt.org for more information."
echo ""
echo -n "Press enter to continue."
read continueok
echo ""
echo "Finished with webmin installation"
echo ""
sleep 3
fi
fi
echo ""
echo "Finished optional package installation."
fi
echo ""
sleep 3 sleep 3
# prompt for install location # prompt for install location
echo "Where would you like to install this version of $APP_NAME? This should" echo "Where would you like to install this version of $APP_NAME? This should"
@@ -322,6 +184,7 @@ fi
install_path="$doc_root_in/$install_loc_in" install_path="$doc_root_in/$install_loc_in"
if [ -d "$install_path" ] if [ -d "$install_path" ]
then then
echo "The installation path you chose already exists."
# Install path exists. # Install path exists.
if [ -e "$install_path/db.php" ] if [ -e "$install_path/db.php" ]
then then
@@ -329,31 +192,59 @@ then
if grep -q -e "$APP_NAME" $install_path/db.php if grep -q -e "$APP_NAME" $install_path/db.php
then then
# the db.php file is part of a previous installation # the db.php file is part of a previous installation
echo "The installation path you chose already exists."
echo "Would you like to upgrade an existing installation or cancel " echo "Would you like to upgrade an existing installation or cancel "
echo "and restart the install using a new installation location." echo "and restart the install using a new installation location."
echo -n "[U]pgrade or [C]ancel? [C] :" echo -n "[U]pgrade or [C]ancel? [U] :"
read upgrade_choice read upgrade_choice
if [ "$upgrade_choice" = "U" -o "$upgrade_choice" = "u" ] # Upgrade chosen if [[ $upgrade_choice == "C" || $upgrade_choice == "c" ]] # Cancel chosen
then then
echo "Cancelling installation"
abort_exit
else
# proceed with upgrade # proceed with upgrade
mkdir -p backups
operation="upgraded" operation="upgraded"
curr_dbname=$(grep dbname $install_path/db.php | head -1 | cut -d\" -f2)
# create mysql option file with data for this installation
mysql_opt_file=$(mktemp --tmpdir=/run/shm/)
echo "[client]" > $mysql_opt_file
echo "user = $(grep username $install_path/db.php | head -1 | cut -d\" -f2)" >> $mysql_opt_file
echo "password = $(grep dbpass $install_path/db.php | head -1 | cut -d\" -f2)" >> $mysql_opt_file
echo "" >> $mysql_opt_file
echo "[mysql]" > $mysql_opt_file
echo "database = $curr_dbname" >> $mysql_opt_file
echo "batch" >> $mysql_opt_file
echo "disable-column-names" >> $mysql_opt_file
# back up existing database # back up existing database
echo "Backing up the current database to the package directory." echo "Backing up the current database to the package directory."
curr_dbname=`grep dbname $install_path/db.php | head -1 | cut -d "\"" -f2` mysqldump --defaults-extra-file=$mysql_opt_file --no-tablespaces $curr_dbname > backups/$curr_dbname-$(date +%Y-%m-%d_%H:%M:%S)-backup.sql
curr_username=`grep username $install_path/db.php | head -1 | cut -d "\"" -f2`
curr_dbpass=`grep dbpass $install_path/db.php | head -1 | cut -d "\"" -f2`
export MYSQL_PWD="$curr_dbpass"
mysqldump --no-tablespaces -u"$curr_username" $curr_dbname > $curr_dbname-`date +%Y-%m-%d_%H:%M:%S`-backup.sql
# back up existing installation # back up existing installation
echo "Backing up current installation to the package directory." echo "Backing up current installation to the package directory."
cp -R $install_path $install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup cp -R $install_path backups/$install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup
# delete all existing installation files except db.php # delete all existing installation files except db.php
find $install_path/ -mindepth 1 -not -name 'db.php' -delete find $install_path/ -mindepth 1 -not -name 'db.php' -delete
# apply database updates
mysql -u"$curr_username" -f -D $curr_dbname < database-update.sql >/dev/null 2>&1 echo "Performing database updates. This may take a while..."
# apply updates to existing db.php # apply database updates from sql file
bash ./db.php_update $install_path (mysql --defaults-extra-file=$mysql_opt_file --force < database-update.sql >/dev/null 2>&1) &
task_pid=$!
spinner $task_pid
# apply database updates via script
(bash ./database-update.sh $mysql_opt_file) &
task_pid=$!
spinner $task_pid
echo "... finished with database updates."
rm -f $mysql_opt_file
# apply updates to other files
bash ./files-update.sh $install_path
# copy distribution to install location # copy distribution to install location
echo "Installing distribution . . ." echo "Installing distribution . . ."
cp -R distfiles/* $install_path cp -R distfiles/* $install_path
@@ -365,27 +256,17 @@ then
# set symlink for index.php # set symlink for index.php
if [ ! -L "$install_path/index.php" ] if [ ! -L "$install_path/index.php" ]
then then
ln -s $install_path/$INDEX_FILE $install_path/index.php ln -s $install_path/$LANDING_PAGE $install_path/index.php
fi fi
# add the local timezone to .htaccess
local_tz=$(timedatectl show -p Timezone|cut -d= -f2)
echo "Your local timezone is $local_tz"
echo "php_value date.timezone \"$local_tz\"">$install_path/.htaccess
# set ownership # set ownership
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the $APP_NAME installation"
echo -n "directory [$APACHE_USER:$APACHE_GROUP] :"
read httpd_user_group
if [ "$httpd_user_group" = "" ]
then
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
fi
echo "" echo ""
echo "Setting file ownership . . ." echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path chown -R $httpd_user_group $install_path
else
echo "Cancelling installation"
abort_exit
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.
@@ -396,9 +277,22 @@ then
else else
# This was a mistake. Exit now to avoid clobbering another app. # This was a mistake. Exit now to avoid clobbering another app.
echo "The installation directory you chose exists, but no previous installation" echo "The installation directory you chose exists, but no previous installation"
echo "of $APP_NAME was found. Please investigate the situation. Aborting now." echo "of $APP_NAME was found."
echo ""
echo " CAUTION: If there is anything else in this directory, it will be deleted!"
echo ""
echo "Would you like to use this location for a fresh installation or quit and"
echo "investigate further? It's probably safest to quit and investigate."
proceed=""
while [[ $proceed != "P" && $proceed != "p" && $proceed != "Q" && $proceed != "q" ]]
do
read proceed -p "[P]roceed with new install or [Q]uit? : "
done
if [[ $proceed == "Q" || $proceed == "q" ]]
then
abort_exit abort_exit
fi fi
fi
else else
# This is a fresh install # This is a fresh install
operation="installed" operation="installed"
@@ -486,21 +380,14 @@ else
fi fi
if [ ! -L "$install_path/index.php" ] if [ ! -L "$install_path/index.php" ]
then then
ln -s $install_path/lognotes.php $install_path/index.php ln -s $install_path/$LANDING_PAGE $install_path/index.php
fi fi
# add the local timezone to .htaccess
local_tz=$(timedatectl show -p Timezone|cut -d= -f2)
echo "Your local timezone is $local_tz"
echo "php_value date.timezone \"$local_tz\"">$install_path/.htaccess
# set ownership # set ownership
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the $APP_NAME installation"
echo -n "directory [$APACHE_USER:$APACHE_GROUP] :"
read httpd_user_group
if [ "$httpd_user_group" = "" ]
then
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
fi
echo "" echo ""
echo "Setting file ownership . . ." echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path chown -R $httpd_user_group $install_path
@@ -521,6 +408,7 @@ then
echo "Alias /$base_url $doc_root_in/$base_url" >> $APACHE_CONF_DIR/$base_url.conf echo "Alias /$base_url $doc_root_in/$base_url" >> $APACHE_CONF_DIR/$base_url.conf
echo "" >> $APACHE_CONF_DIR/$base_url.conf echo "" >> $APACHE_CONF_DIR/$base_url.conf
echo "<Directory $doc_root_in/$base_url>" >> $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 " Options FollowSymLinks" >> $APACHE_CONF_DIR/$base_url.conf
echo " DirectoryIndex index.php" >> $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 "</Directory>" >> $APACHE_CONF_DIR/$base_url.conf