Fix some bugs with MySQL strict mode (#111)

This commit is contained in:
Roman Kelesidis 2023-04-01 14:29:01 +07:00 committed by GitHub
parent a5ac7791d7
commit 012ae17fd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 13 deletions

View File

@ -170,8 +170,8 @@ switch ($mode)
'CRON_SCRIPT' => '',
'RUN_TIME' => '',
'RUN_ORDER' => 255,
'LAST_RUN' => '0000-00-00 00:00:00',
'NEXT_RUN' => '0000-00-00 00:00:00',
'LAST_RUN' => '1900-01-01 00:00:00',
'NEXT_RUN' => '1900-01-01 00:00:00',
'RUN_INTERVAL' => '',
'LOG_ENABLED' => 0,
'LOG_FILE' => '',

View File

@ -544,8 +544,8 @@ CREATE TABLE IF NOT EXISTS `bb_cron` (
`run_day` enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28') DEFAULT NULL,
`run_time` time DEFAULT '04:00:00',
`run_order` tinyint(4) unsigned NOT NULL DEFAULT '0',
`last_run` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`next_run` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_run` datetime NOT NULL DEFAULT '1900-01-01 00:00:00',
`next_run` datetime NOT NULL DEFAULT '1900-01-01 00:00:00',
`run_interval` time DEFAULT NULL DEFAULT '0',
`log_enabled` tinyint(1) NOT NULL DEFAULT '0',
`log_file` char(120) NOT NULL DEFAULT '',
@ -811,7 +811,7 @@ CREATE TABLE IF NOT EXISTS `bb_posts` (
`post_edit_count` smallint(5) unsigned NOT NULL DEFAULT '0',
`post_attachment` tinyint(1) NOT NULL DEFAULT '0',
`user_post` tinyint(1) NOT NULL DEFAULT '1',
`mc_comment` text NOT NULL,
`mc_comment` text NOT NULL DEFAULT '',
`mc_type` tinyint(1) NOT NULL DEFAULT '0',
`mc_user_id` mediumint(8) NOT NULL DEFAULT '0',
PRIMARY KEY (`post_id`),
@ -1172,7 +1172,7 @@ CREATE TABLE IF NOT EXISTS `bb_users` (
`user_rank` int(11) NOT NULL DEFAULT '0',
`avatar_ext_id` tinyint(4) NOT NULL DEFAULT '0',
`user_gender` tinyint(1) NOT NULL DEFAULT '0',
`user_birthday` date NOT NULL DEFAULT '0000-00-00',
`user_birthday` date NOT NULL DEFAULT '1900-01-01',
`user_email` varchar(255) NOT NULL DEFAULT '',
`user_skype` varchar(32) NOT NULL DEFAULT '',
`user_twitter` varchar(15) NOT NULL DEFAULT '',
@ -1197,9 +1197,9 @@ CREATE TABLE IF NOT EXISTS `bb_users` (
-- ----------------------------
-- Records of bb_users
-- ----------------------------
INSERT INTO `bb_users` VALUES ('-1', '0', 'Guest', 'd41d8cd98f00b204e9800998ecf8427e', '0', '0', '0', UNIX_TIMESTAMP(), '0', '0', '0', '', 'ru', '0', '0', '0', '0', '0', '0', '0', '0000-00-00', '', '', '', '', '', '', '', '', '', '', '', '', '0', '0.00', 'default');
INSERT INTO `bb_users` VALUES ('-746', '0', 'bot', 'd41d8cd98f00b204e9800998ecf8427e', '0', '0', '0', UNIX_TIMESTAMP(), '0', '0', '0', '', 'ru', '0', '0', '0', '144', '0', '0', '0', '0000-00-00', 'bot@torrentpier.com', '', '', '', '', '', '', '', '', '', '', '', '0', '0.00', 'default');
INSERT INTO `bb_users` VALUES ('2', '1', 'admin', 'c3284d0f94606de1fd2af172aba15bf3', '0', '0', '0', UNIX_TIMESTAMP(), '0', '1', '1', '', 'ru', '0', '0', '0', '304', '1', '0', '0', '0000-00-00', 'admin@torrentpier.com', '', '', '', '', '', '', '', '', '', '', '', '0', '0.00', 'default');
INSERT INTO `bb_users` VALUES ('-1', '0', 'Guest', 'd41d8cd98f00b204e9800998ecf8427e', '0', '0', '0', UNIX_TIMESTAMP(), '0', '0', '0', '', 'ru', '0', '0', '0', '0', '0', '0', '0', '1900-01-01', '', '', '', '', '', '', '', '', '', '', '', '', '0', '0.00', 'default');
INSERT INTO `bb_users` VALUES ('-746', '0', 'bot', 'd41d8cd98f00b204e9800998ecf8427e', '0', '0', '0', UNIX_TIMESTAMP(), '0', '0', '0', '', 'ru', '0', '0', '0', '144', '0', '0', '0', '1900-01-01', 'bot@torrentpier.com', '', '', '', '', '', '', '', '', '', '', '', '0', '0.00', 'default');
INSERT INTO `bb_users` VALUES ('2', '1', 'admin', 'c3284d0f94606de1fd2af172aba15bf3', '0', '0', '0', UNIX_TIMESTAMP(), '0', '1', '1', '', 'ru', '0', '0', '0', '304', '1', '0', '0', '1900-01-01', 'admin@torrentpier.com', '', '', '', '', '', '', '', '', '', '', '', '0', '0.00', 'default');
-- ----------------------------
-- Table structure for `bb_user_group`

View File

@ -56,6 +56,10 @@ INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php',
// 2.1.5 (LTS 2023.03)
UPDATE `bb_config` SET `config_value` = 'http://whatismyipaddress.com/ip/' WHERE `config_name` = 'whois_info';
ALTER TABLE `bb_cron` CHANGE `last_run` `last_run` DATETIME NOT NULL DEFAULT '1900-01-01 00:00:00';
ALTER TABLE `bb_cron` CHANGE `next_run` `next_run` DATETIME NOT NULL DEFAULT '1900-01-01 00:00:00';
ALTER TABLE `bb_users` CHANGE `user_birthday` `user_birthday` DATE NOT NULL DEFAULT '1900-01-01';
ALTER TABLE `bb_posts` CHANGE `mc_comment` `mc_comment` TEXT NOT NULL DEFAULT '';
ALTER TABLE `bb_users` CHANGE `user_sig` `user_sig` TEXT NOT NULL DEFAULT '';
ALTER TABLE `bb_groups` CHANGE `group_signature` `group_signature` TEXT NOT NULL DEFAULT '';
ALTER TABLE `bb_groups` CHANGE `group_description` `group_description` TEXT NOT NULL DEFAULT '';

View File

@ -53,7 +53,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled'])
$sql = DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
FROM ". BB_USERS ."
WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")
AND user_birthday != '0000-00-00'
AND user_birthday != '1900-01-01'
AND user_birthday IS NOT NULL
AND user_active = 1
ORDER BY user_level DESC, username

View File

@ -104,8 +104,8 @@ $template->assign_vars(array(
'TWITTER' => $profiledata['user_twitter'],
'USER_POINTS' => $profiledata['user_points'],
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
'AGE' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? $profiledata['user_birthday'] : '',
'AGE' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? birthday_age($profiledata['user_birthday']) : '',
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),

View File

@ -651,7 +651,7 @@ for($i = 0; $i < $total_posts; $i++)
{
$poster_id = $postrow[$i]['user_id'];
$poster = ($poster_id == GUEST_UID) ? $lang['GUEST'] : $postrow[$i]['username'];
$poster_birthday = ($poster_id != GUEST_UID && !empty($postrow[$i]['user_birthday']) && $postrow[$i]['user_birthday'] != '0000-00-00') ? date('md', strtotime($postrow[$i]['user_birthday'])) : '';
$poster_birthday = ($poster_id != GUEST_UID && !empty($postrow[$i]['user_birthday']) && $postrow[$i]['user_birthday'] != '1900-01-01') ? date('md', strtotime($postrow[$i]['user_birthday'])) : '';
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
$max_post_time = max($max_post_time, $postrow[$i]['post_time']);
$poster_posts = ($poster_id != GUEST_UID) ? $postrow[$i]['user_posts'] : '';