From b1af1f9cc2497087e5de47970024c235a17ea4c2 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Tue, 15 Aug 2017 23:05:43 +0200 Subject: [PATCH 1/4] Change default value for datetime fields to valid range --- db/install.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/install.sql b/db/install.sql index 0222dc08..3c3e41e6 100644 --- a/db/install.sql +++ b/db/install.sql @@ -205,7 +205,7 @@ DROP TABLE IF EXISTS `NewsComments`; CREATE TABLE `NewsComments` ( `ID` bigint(11) NOT NULL, `Refid` int(11) NOT NULL DEFAULT '0', - `Datum` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `Datum` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `Text` text NOT NULL, `UID` int(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -395,7 +395,7 @@ CREATE TABLE `User` ( `Sprache` char(64) NOT NULL, `Menu` char(1) NOT NULL DEFAULT 'L', `lastLogIn` int(11) NOT NULL, - `CreateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `CreateDate` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `Art` varchar(30) DEFAULT NULL, `kommentar` text, `Hometown` varchar(255) NOT NULL DEFAULT '', From dc6fb49f44c12e2bc354d7355d5cd903017568e9 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Wed, 16 Aug 2017 00:19:16 +0200 Subject: [PATCH 2/4] fix only_full_group_by mysql default behaviour --- includes/model/UserAngelTypes_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php index 11366cdf..410a292f 100644 --- a/includes/model/UserAngelTypes_model.php +++ b/includes/model/UserAngelTypes_model.php @@ -59,7 +59,7 @@ function User_unconfirmed_AngelTypes($user) { AND `UserAngelTypes`.`supporter`=TRUE AND `AngelTypes`.`restricted`=TRUE AND `UnconfirmedMembers`.`confirm_user_id` IS NULL - GROUP BY `UserAngelTypes`.`angeltype_id` + GROUP BY `UserAngelTypes`.`angeltype_id`, `UserAngelTypes`.`id` ORDER BY `AngelTypes`.`name`"); if ($result === false) { engelsystem_error("Unable to load user angeltypes."); From 5f305121a4fb6a21bedcd82d845909aed38cec0c Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Wed, 16 Aug 2017 00:45:56 +0200 Subject: [PATCH 3/4] fix order by not in select clause for >mysql-5.7 --- includes/pages/user_shifts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index c990ee4a..30f129c7 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -89,7 +89,7 @@ function load_days() { $days = sql_select_single_col(" SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name` FROM `Shifts` - ORDER BY `start`"); + ORDER BY `id`, `name`"); if (count($days) == 0) { error(_("The administration has not configured any shifts yet.")); redirect('?'); From eeae07e625890cee9a3cb90ee87e07530b7bf192 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Wed, 16 Aug 2017 01:31:53 +0200 Subject: [PATCH 4/4] add edited_at_timestamp to shift creation to fix mysql error --- includes/model/Shifts_model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 29156423..baaf4c28 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -334,6 +334,7 @@ function Shift_create($shift) { `URL`=" . sql_null($shift['URL']) . ", `PSID`=" . sql_null($shift['PSID']) . ", `created_by_user_id`='" . sql_escape($user['UID']) . "', + `edited_at_timestamp`=" . time() .", `created_at_timestamp`=" . time()); if ($result === false) { return false;