mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
Merge pull request #449 from yukoff/bugfix/nullable-user-birthday
Default value for user_birthday causes exception on user password change
This commit is contained in:
commit
4050326324
5 changed files with 9 additions and 8 deletions
|
@ -379,7 +379,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
|
||||||
$week_all = true;
|
$week_all = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday'] - 1) . ')</span>';
|
$week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday']) . ')</span>';
|
||||||
}
|
}
|
||||||
$week_all = ($week_all) ? ' <a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
|
$week_all = ($week_all) ? ' <a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
|
||||||
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
|
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
|
||||||
|
|
|
@ -76,6 +76,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
|
||||||
FROM " . BB_USERS . "
|
FROM " . BB_USERS . "
|
||||||
WHERE user_id NOT IN(" . EXCLUDED_USERS . ")
|
WHERE user_id NOT IN(" . EXCLUDED_USERS . ")
|
||||||
AND user_birthday != '0000-00-00'
|
AND user_birthday != '0000-00-00'
|
||||||
|
AND user_birthday IS NOT NULL
|
||||||
AND user_active = 1
|
AND user_active = 1
|
||||||
ORDER BY user_level DESC, username
|
ORDER BY user_level DESC, username
|
||||||
");
|
");
|
||||||
|
|
|
@ -321,9 +321,9 @@ foreach ($profile_fields as $field => $can_edit) {
|
||||||
* Возраст (edit)
|
* Возраст (edit)
|
||||||
*/
|
*/
|
||||||
case 'user_birthday':
|
case 'user_birthday':
|
||||||
$user_birthday = isset($_POST['user_birthday']) ? (string)$_POST['user_birthday'] : $pr_data['user_birthday'];
|
$user_birthday = !empty($_POST['user_birthday']) ? (string)$_POST['user_birthday'] : $pr_data['user_birthday'];
|
||||||
|
|
||||||
if ($submit && $user_birthday != $pr_data['user_birthday']) {
|
if ($submit && $user_birthday !== $pr_data['user_birthday']) {
|
||||||
$birthday_date = date_parse($user_birthday);
|
$birthday_date = date_parse($user_birthday);
|
||||||
|
|
||||||
if (!empty($birthday_date['year'])) {
|
if (!empty($birthday_date['year'])) {
|
||||||
|
@ -336,8 +336,7 @@ foreach ($profile_fields as $field => $can_edit) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pr_data['user_birthday'] = $user_birthday;
|
$pr_data['user_birthday'] = $db_data['user_birthday'] = !empty($user_birthday) ? $user_birthday : null;
|
||||||
$db_data['user_birthday'] = $user_birthday;
|
|
||||||
}
|
}
|
||||||
$tp_data['USER_BIRTHDAY'] = $pr_data['user_birthday'];
|
$tp_data['USER_BIRTHDAY'] = $pr_data['user_birthday'];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -114,8 +114,8 @@ $template->assign_vars(array(
|
||||||
'TWITTER' => $profiledata['user_twitter'],
|
'TWITTER' => $profiledata['user_twitter'],
|
||||||
'USER_POINTS' => $profiledata['user_points'],
|
'USER_POINTS' => $profiledata['user_points'],
|
||||||
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
||||||
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
|
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
|
||||||
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
|
'AGE' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
|
||||||
|
|
||||||
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
|
||||||
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
|
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
|
||||||
|
|
|
@ -587,7 +587,8 @@ $this_date = bb_date(TIMENOW, 'md', false);
|
||||||
for ($i = 0; $i < $total_posts; $i++) {
|
for ($i = 0; $i < $total_posts; $i++) {
|
||||||
$poster_id = $postrow[$i]['user_id'];
|
$poster_id = $postrow[$i]['user_id'];
|
||||||
$poster = ($poster_id == GUEST_UID) ? $lang['GUEST'] : $postrow[$i]['username'];
|
$poster = ($poster_id == GUEST_UID) ? $lang['GUEST'] : $postrow[$i]['username'];
|
||||||
$poster_birthday = ($poster_id != GUEST_UID && $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'] != '0000-00-00')
|
||||||
|
? date('md', strtotime($postrow[$i]['user_birthday'])) : '';
|
||||||
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
|
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
|
||||||
$max_post_time = max($max_post_time, $postrow[$i]['post_time']);
|
$max_post_time = max($max_post_time, $postrow[$i]['post_time']);
|
||||||
$poster_posts = ($poster_id != GUEST_UID) ? $postrow[$i]['user_posts'] : '';
|
$poster_posts = ($poster_id != GUEST_UID) ? $postrow[$i]['user_posts'] : '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue