diff --git a/CHANGELOG b/CHANGELOG
index f689d11..ad8f633 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -232,3 +232,11 @@
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.
diff --git a/database-initial.sql b/database-initial.sql
index ed4dbf9..0c9d064 100644
--- a/database-initial.sql
+++ b/database-initial.sql
@@ -69,7 +69,7 @@ CREATE TABLE `configs` (
LOCK TABLES `configs` WRITE;
/*!40000 ALTER TABLE `configs` DISABLE KEYS */;
INSERT INTO `configs` VALUES
-(1,'ol_version','5.2.4.3'),
+(1,'ol_version','5.2.4.4'),
(2,'log_name','OpenLog'),
(3,'banner','1'),
(4,'background_color','#003333'),
diff --git a/database-update.sh b/database-update.sh
index ccd6f05..91ee04e 100755
--- a/database-update.sh
+++ b/database-update.sh
@@ -29,3 +29,7 @@ margs="--defaults-extra-file=$mysql_opt_file"
# ---------- version 5.2.4.3 ----------
# Nothing to do
# -------------------------------------
+
+# ---------- version 5.2.4.4 ----------
+# Nothing to do
+# -------------------------------------
diff --git a/database-update.sql b/database-update.sql
index 5178a15..52b4684 100644
--- a/database-update.sql
+++ b/database-update.sql
@@ -45,3 +45,8 @@ UPDATE configs SET confvalue="5.2.4.2" WHERE confname="ol_version";
-- 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";
+-- --------------------------------------
diff --git a/distfiles/CHANGELOG b/distfiles/CHANGELOG
index 7627654..bbf0cab 100644
--- a/distfiles/CHANGELOG
+++ b/distfiles/CHANGELOG
@@ -232,3 +232,11 @@
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.
diff --git a/distfiles/functions.php b/distfiles/functions.php
index d74737b..baafb08 100644
--- a/distfiles/functions.php
+++ b/distfiles/functions.php
@@ -721,7 +721,7 @@ function showlinklist($print) {
function nag($tech_id) {
// nags the user if something is pending
- global $db;
+ global $db, $today;
// maintenance forms
$mfpending=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$tech_id\" and pending=1"));
if ($mfpending) {
@@ -819,7 +819,7 @@ function get_upcoming_events() {
// build array of upcoming events
// takes no arguments
// returns an array containing arrays of upcoming event data
- global $db;
+ global $db, $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();
while ($uceventrow=mysqli_fetch_assoc($uceventsqry)) {
diff --git a/distfiles/schedmaint.php b/distfiles/schedmaint.php
index 22c3d00..62a983a 100644
--- a/distfiles/schedmaint.php
+++ b/distfiles/schedmaint.php
@@ -14,50 +14,50 @@ if (isset($_SESSION['login'])) {
} else {
$loggedin=false;
}
-$techid=$_SESSION['login'];
+$techid=$_SESSION['login'] ?? NULL;
$isadmin=dblookup($db,"techs","techid","admin",$techid);
-$upcoming=$_REQUEST['upcoming'];
-$schedule=$_REQUEST['schedule'];
-$tasks=$_REQUEST['tasks'];
-$devices=$_REQUEST['devices'];
-$action=$_REQUEST['action'];
-$complete=$_REQUEST['complete'];
-$defer=$_REQUEST['defer'];
-$add=$_REQUEST['add'];
-$edit=$_REQUEST['edit'];
-$update=$_REQUEST['update'];
-$delete=$_REQUEST['delete'];
-$id=$_REQUEST['id'];
-$active_flag=$_REQUEST['active_flag'];
+$upcoming=$_REQUEST['upcoming'] ?? NULL;
+$schedule=$_REQUEST['schedule'] ?? NULL;
+$tasks=$_REQUEST['tasks'] ?? NULL;
+$devices=$_REQUEST['devices'] ?? NULL;
+$action=$_REQUEST['action'] ?? NULL;
+$complete=$_REQUEST['complete'] ?? NULL;
+$defer=$_REQUEST['defer'] ?? NULL;
+$add=$_REQUEST['add'] ?? NULL;
+$edit=$_REQUEST['edit'] ?? NULL;
+$update=$_REQUEST['update'] ?? NULL;
+$delete=$_REQUEST['delete'] ?? NULL;
+$id=$_REQUEST['id'] ?? NULL;
+$active_flag=$_REQUEST['active_flag'] ?? 0;
-$devicename=$_REQUEST['devicename'];
-$devicedesc=$_REQUEST['devicedesc'];
-$group_flag=$_REQUEST['group_flag'];
-$members=$_REQUEST['members'];
+$devicename=$_REQUEST['devicename'] ?? NULL;
+$devicedesc=$_REQUEST['devicedesc'] ?? NULL;
+$group_flag=$_REQUEST['group_flag'] ?? 0;
+$members=$_REQUEST['members'] ?? [];
-$weekdays_only=$_REQUEST['weekdays_only'];
-$nextdue_relative=$_REQUEST['nextdue_relative'];
-$taskname=$_REQUEST['taskname'];
-$taskdesc=$_REQUEST['taskdesc'];
-$frequency=$_REQUEST['frequency'];
-$period=$_REQUEST['period'];
-$refdoc_name=$_REQUEST['refdoc_name'];
-$refdoc_url=$_REQUEST['refdoc_url'];
+$weekdays_only=$_REQUEST['weekdays_only'] ?? NULL;
+$nextdue_relative=$_REQUEST['nextdue_relative'] ?? NULL;
+$taskname=$_REQUEST['taskname'] ?? NULL;
+$taskdesc=$_REQUEST['taskdesc'] ?? NULL;
+$frequency=$_REQUEST['frequency'] ?? NULL;
+$period=$_REQUEST['period'] ?? NULL;
+$refdoc_name=$_REQUEST['refdoc_name'] ?? NULL;
+$refdoc_url=$_REQUEST['refdoc_url'] ?? NULL;
-$deferred_flag=$_REQUEST['deferred_flag'];
-$deferred_date=$_REQUEST['deferred_date'];
-$start_date=$_REQUEST['start_date'];
-$last_date=$_REQUEST['last_date'];
-$task=$_REQUEST['task'];
-$device=$_REQUEST['device'];
-$deferuntil=$_REQUEST['deferuntil'];
-$completedate=$_REQUEST['completedate'];
-$addlognote=$_REQUEST['addlognote'];
+$deferred_flag=$_REQUEST['deferred_flag'] ?? 0;
+$deferred_date=$_REQUEST['deferred_date'] ?? NULL;
+$start_date=$_REQUEST['start_date'] ?? NULL;
+$last_date=$_REQUEST['last_date'] ?? NULL;
+$task=$_REQUEST['task'] ?? NULL;
+$device=$_REQUEST['device'] ?? NULL;
+$deferuntil=$_REQUEST['deferuntil'] ?? NULL;
+$completedate=$_REQUEST['completedate'] ?? NULL;
+$addlognote=$_REQUEST['addlognote'] ?? NULL;
$logname=LOG_NAME;
-$print=$_REQUEST['print'];
+$print=$_REQUEST['print'] ?? NULL;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
@@ -126,6 +126,9 @@ if ($add) {
}
// run through the memberlist and modify the table
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)
values(\"$task\",\"$memberdev\",\"$start_date\",\"$last_date\",\"$deferred_flag\",\"$deferred_date\",\"$active_flag\")");
mysqli_query($db,$addqry);
@@ -200,6 +203,9 @@ if ($edit) {
$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 ($last_date==NULL) $last_date="0000-00-00";
+ if ($deferred_date==NULL) $deferred_date="0000-00-00";
mysqli_query($db,"update events
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\"
@@ -400,7 +406,7 @@ if ($action) {
}
if ($start_date=="0000-00-00") $start_date=$today;
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="";
$startdatetag="";
$lastdatetag="";
diff --git a/files-update.sh b/files-update.sh
index c1f3a7e..962ad47 100755
--- a/files-update.sh
+++ b/files-update.sh
@@ -38,3 +38,6 @@ then
fi
# --------------------------------------
+# ---------- version 5.2.4.4 -----------
+# No changes
+# --------------------------------------
diff --git a/install.sh b/install.sh
index 89e372f..1854974 100755
--- a/install.sh
+++ b/install.sh
@@ -8,7 +8,7 @@
APP_NAME="OpenLog"
DEFAULT_DB_NAME="openlog"
-APP_VERSION="5.2.4.3"
+APP_VERSION="5.2.4.4"
DOC_ROOT="/var/www"
INSTALL_LOC="openlog"
APACHE_CONF_DIR="/etc/apache2/conf-available"
@@ -194,10 +194,13 @@ then
# the db.php file is part of a previous installation
echo "Would you like to upgrade an existing installation or cancel "
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
- if [ "$upgrade_choice" = "U" -o "$upgrade_choice" = "u" ] # Upgrade chosen
+ if [[ $upgrade_choice == "C" || $upgrade_choice == "c" ]] # Cancel chosen
then
+ echo "Cancelling installation"
+ abort_exit
+ else
# proceed with upgrade
mkdir -p backups
operation="upgraded"
@@ -264,9 +267,6 @@ then
echo ""
echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path
- else
- echo "Cancelling installation"
- abort_exit
fi
else
# This was a mistake. Exit now to avoid clobbering another app.