git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@109 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
nanosimbiot 2011-07-14 17:31:16 +00:00
commit 7d23779f34
6 changed files with 30 additions and 23 deletions

View file

@ -81,6 +81,7 @@ switch ($field)
} } } }
else else
{ {
$value = 0;
$next_birthday_greeting = 0; } $next_birthday_greeting = 0; }
DB()->query("UPDATE $table SET user_next_birthday_greeting = $next_birthday_greeting WHERE user_id = $user_id LIMIT 1"); DB()->query("UPDATE $table SET user_next_birthday_greeting = $next_birthday_greeting WHERE user_id = $user_id LIMIT 1");

View file

@ -57,8 +57,8 @@ $bb_cfg['css_ver'] = 1;
// Increase number of revision after update // Increase number of revision after update
$bb_cfg['tp_version'] = '2.0.2'; $bb_cfg['tp_version'] = '2.0.2';
$bb_cfg['tp_release_state'] = 'TP II r107'; $bb_cfg['tp_release_state'] = 'TP II r109';
$bb_cfg['tp_release_date'] = '14-07-2011'; $bb_cfg['tp_release_date'] = '15-07-2011';
$bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger $bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger
$bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут"; $bb_cfg['srv_overloaded_msg'] = "Извините, в данный момент сервер перегружен\nПопробуйте повторить запрос через несколько минут";

View file

@ -2059,8 +2059,16 @@ function mkrealdate($day, $month, $birth_year)
function realdate($date, $format = "Ymd") function realdate($date, $format = "Ymd")
{ {
if(!$date) return;
return bb_date($date*86400+1, $format, 0); return bb_date($date*86400+1, $format, 0);
} }
function birthday_age($date)
{
if(!$date) return;
return delta_time(mktime(0, 0, 0, 0, 0, realdate($date, 'Y')));
}
// //
// Pagination routine, generates // Pagination routine, generates
// page number sequence // page number sequence

View file

@ -338,16 +338,16 @@ foreach ($profile_fields as $field => $can_edit)
* Возраст (edit, reg) * Возраст (edit, reg)
*/ */
case 'user_birthday': case 'user_birthday':
if($birthday = $pr_data['user_birthday'])
{
$b_day = (isset($_POST['b_day'])) ? (int) $_POST['b_day'] : realdate($pr_data['user_birthday'], 'j'); $b_day = (isset($_POST['b_day'])) ? (int) $_POST['b_day'] : realdate($pr_data['user_birthday'], 'j');
$b_md = (isset($_POST['b_md'])) ? (int) $_POST['b_md'] : realdate($pr_data['user_birthday'], 'n'); $b_md = (isset($_POST['b_md'])) ? (int) $_POST['b_md'] : realdate($pr_data['user_birthday'], 'n');
$b_year = (isset($_POST['b_year'])) ? (int) $_POST['b_year'] : realdate($pr_data['user_birthday'], 'Y'); $b_year = (isset($_POST['b_year'])) ? (int) $_POST['b_year'] : realdate($pr_data['user_birthday'], 'Y');
if ($b_day || $b_md || $b_year) if ($b_day || $b_md || $b_year)
{ {
if (!checkdate($b_md, $b_day, $b_year)) if (!checkdate($b_md, $b_day, $b_year))
{ {
$errors[] = $lang['WRONG_BIRTHDAY_FORMAT']; $errors[] = $lang['WRONG_BIRTHDAY_FORMAT'];
$birthday = $next_birthday_greeting = 0;
} }
else else
{ {
@ -357,10 +357,9 @@ foreach ($profile_fields as $field => $can_edit)
} }
else else
{ {
$birthday = 0; $birthday = $next_birthday_greeting = 0;
$next_birthday_greeting = 0;
}
} }
if ($submit && $birthday != $pr_data['user_birthday']) if ($submit && $birthday != $pr_data['user_birthday'])
{ {
$pr_data['user_birthday'] = $birthday; $pr_data['user_birthday'] = $birthday;

View file

@ -200,7 +200,7 @@ $template->assign_vars(array(
'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '', 'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '',
'GENDER' => ( $profiledata['user_gender'] ) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '', 'GENDER' => ( $profiledata['user_gender'] ) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => ( $profiledata['user_birthday'] ) ? realdate($profiledata['user_birthday'], 'Y-m-d') : '', 'BIRTHDAY' => ( $profiledata['user_birthday'] ) ? realdate($profiledata['user_birthday'], 'Y-m-d') : '',
'AGE' => ( $profiledata['user_birthday'] ) ? bb_date(TIMENOW, 'Y') - realdate($profiledata['user_birthday'], 'Y') : '', 'AGE' => ( $profiledata['user_birthday'] ) ? birthday_age($profiledata['user_birthday']) : '',
'AVATAR_IMG' => $avatar_img, 'AVATAR_IMG' => $avatar_img,
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']), 'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),

View file

@ -247,9 +247,8 @@ $(document).ready(function(){
</tr> </tr>
<tr> <tr>
<th>{L_AGE}:</th> <th>{L_AGE}:</th>
<td id="user_birthday"><b class="editable">{AGE}</b></td> <td><b>{AGE}</b></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- BEGIN switch_upload_limits --> <!-- BEGIN switch_upload_limits -->
<tr> <tr>