|
Kurt
981 messages
Carte Mère
|
Le 27 Octobre 2004 à 10h50
voilà:
Code ##############################################################
## Avant d'ajouter ce MOD à votre forum, il vous est fortement conseillé
## d'effectuer une sauvegarde des éléments que vous allez modifier.
##############################################################
#
#-----[ COPIER ]------------------------------------------------
#
copier birthday_db_update.php dans birthday_db_update.php
copier root/birthday_popup.php dans birthday_popup.php
copier root/templates/subSilver/greeting_popup.tpl dans templates/subSilver/greeting_popup.tpl
#
# Ce MOD nécéssite une mise à jour de votre base de données.
# Ainsi, après avoir copié le fichier birthday_db_update.php à la
# racine de votre dossier phpBB, exécutez ce fichier via votre
# explorateur internet...
# http://www.yourWebSite.xxx/phpbbRootDir/birthday_db_update.php
#
# ...après, supprimez ce fichier de votre dossier phpBB!!!
#
# Faites-le MAINTENANT! AVANT de modifier les fichiers!!!
# Sinon, vous risquez de recevoir un message d'erreur à votre
# prochaine connexion.
#
#
#-----[ OUVRIR ]------------------------------------------------
#
index.php
#
#-----[ CHERCHER ]------------------------------------------------
#
//
// Start output of page
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Birthday Mod, Show users with birthday
$sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username" :"";
if($result = $db->sql_query($sql))
{
if (!empty($result))
{
$time_now = time();
$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
$date_today = create_date('Ymd', $time_now, $board_config['board_timezone']);
$date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
while ($birthdayrow = $db->sql_fetchrow($result))
{
usleep(2);
$user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] ));
if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
if ( $user_birthday2 > $date_today && $user_birthday2 <= $date_forward )
{
// user are having birthday within the next days
$user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']);
switch ($birthdayrow['user_level'])
{
case ADMIN :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
break;
case MOD :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
break;
default: $style_color = '';
}
$birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
} else if ( $user_birthday2 == $date_today )
{
//user have birthday today
$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] );
switch ($birthdayrow['user_level'])
{
case ADMIN :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
break;
case MOD :
$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
break;
default: $style_color = '';
}
$birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,';
}
}
if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
}
$db->sql_freeresult($result);
}
#
#-----[ CHERCHER ]------------------------------------------------
#
'L_FORUM' =>
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday MOD
'L_WHOSBIRTHDAY_WEEK' => ($board_config['birthday_check_day'] > 1) ? sprintf( (($birthday_week_list) ? $lang['Birthday_week'] : $lang['Nobirthday_week']), $board_config['birthday_check_day']).$birthday_week_list : '',
'L_WHOSBIRTHDAY_TODAY' => ($board_config['birthday_check_day']) ? ($birthday_today_list) ? $lang['Birthday_today'].$birthday_today_list : $lang['Nobirthday_today'] : '',
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
viewtopic.php
#
#-----[ CHERCHER ]------------------------------------------------
#
$sql = "SELECT u.username,
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
, u.user_allowsmile
#
#-----[ DANS LA LIGNE APRES, AJOUTER ]----------------------------------
#
, u.user_birthday, u.user_next_birthday_greeting
#
#-----[ CHERCHER ]------------------------------------------------
#
for($i = 0; $i < $total_posts; $i++)
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday MOD
$this_year = create_date('Y', time(), $board_config['board_timezone']);
$this_date = create_date('md', time(), $board_config['board_timezone']);
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
$poster_id = $postrow[$i]['user_id'];
$poster = ( $poster_id == ANONYMOUS ) ? $lang['Guest'] : $postrow[$i]['username'];
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
if ( $postrow[$i]['user_birthday'] != 999999 )
{
$poster_birthdate=realdate('md', $postrow[$i]['user_birthday']);
$poster_age = $this_year - realdate ('Y',$postrow[$i]['user_birthday']);
if ($this_date < $poster_birthdate) $poster_age--;
$poster_age = $lang['Age'] . ': ' . $poster_age;
} else
{
$poster_age = '';
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
if ( $poster_id == ANONYMOUS && $postrow[$i]['post_username'] != '' )
{
$poster = $postrow[$i]['post_username'];
$poster_rank = $lang['Guest'];
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
$poster_age = '';
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
'POSTER_NAME' =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
'POSTER_AGE' => $poster_age,
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
admin/admin_board.php
#
#-----[ CHERCHER ]------------------------------------------------
#
$prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : "";
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
$birthday_greeting_yes = ( $new['birthday_greeting'] ) ? "checked=\"checked\"" : "";
$birthday_greeting_no = ( !$new['birthday_greeting'] ) ? "checked=\"checked\"" : "";
$birthday_required_yes = ( $new['birthday_required'] ) ? "checked=\"checked\"" : "";
$birthday_required_no = ( !$new['birthday_required'] ) ? "checked=\"checked\"" : "";
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
"L_ENABLE_PRUNE" =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
"L_ENABLE_BIRTHDAY_GREETING" => $lang['Enable_birthday_greeting'],
"L_BIRTHDAY_GREETING_EXPLAIN" => $lang['Birthday_greeting_expain'],
"L_BIRTHDAY_REQUIRED" => $lang['Birthday_required'],
"L_MAX_USER_AGE" => $lang['Max_user_age'],
"L_MIN_USER_AGE" => $lang['Min_user_age'],
"L_MIN_USER_AGE_EXPLAIN" => $lang['Min_user_age_explain'],
"L_BIRTHDAY_LOOKFORWARD" => $lang['Birthday_lookforward'],
"L_BIRTHDAY_LOOKFORWARD_EXPLAIN" => $lang['Birthday_lookforward_explain'],
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
"PRUNE_NO" =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
"BIRTHDAY_GREETING_YES" => $birthday_greeting_yes,
"BIRTHDAY_GREETING_NO" => $birthday_greeting_no,
"BIRTHDAY_REQUIRED_YES" => $birthday_required_yes,
"BIRTHDAY_REQUIRED_NO" => $birthday_required_no,
"MAX_USER_AGE" => $new['max_user_age'],
"MIN_USER_AGE" => $new['min_user_age'],
"BIRTHDAY_LOOKFORWARD" => $new['birthday_check_day'],
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
admin/admin_users.php
#
#-----[ CHERCHER ]------------------------------------------------
#
$interests = ( !empty($HTTP_POST_VARS['interests']) ) ? trim(strip_tags( $HTTP_POST_VARS['interests'] ) ) : '';
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
if (isset($HTTP_POST_VARS['birthday']) )
{
$birthday = intval ($HTTP_POST_VARS['birthday']);
$b_day = realdate('j',$birthday);
$b_md = realdate('n',$birthday);
$b_year = realdate('Y',$birthday);
} else
{
$b_day = ( isset($HTTP_POST_VARS['b_day']) ) ? intval ($HTTP_POST_VARS['b_day']) : 0;
$b_md = ( isset($HTTP_POST_VARS['b_md']) ) ? intval ($HTTP_POST_VARS['b_md']) : 0;
$b_year = ( isset($HTTP_POST_VARS['b_year']) ) ? intval ($HTTP_POST_VARS['b_year']) : 0;
$birthday = mkrealdate($b_day,$b_md,$b_year);
}
$next_birthday_greeting = ( !empty($HTTP_POST_VARS['next_birthday_greeting']) ) ? intval( $HTTP_POST_VARS['next_birthday_greeting'] ) : 0;
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
//
// Update entry in DB
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday MOD
// find the birthday values, reflected by the $lang['Submit_date_format']
if ($b_day || $b_md || $b_year) //if a birthday is submited, then validate it
{
$user_age=(date('md')>=$b_md.(($b_day <= 9) ? '0':'').$b_day) ? date('Y') - $b_year : date('Y') - $b_year - 1 ;
// Check date, maximum / minimum user age
if (!checkdate($b_md,$b_day,$b_year))
{
$error = TRUE;
if( isset($error_msg) )$error_msg .= "";
$error_msg .= $lang['Wrong_birthday_format'];
} else
if ($user_age>$board_config['max_user_age'])
{
$error = TRUE;
if( isset($error_msg) )$error_msg .= "";
$error_msg .= sprintf($lang['Birthday_to_high'],$board_config['max_user_age']);
} else
if ($user_age<$board_config['min_user_age'])
{
$error = TRUE;
if( isset($error_msg) )$error_msg .= "";
$error_msg .= sprintf($lang['Birthday_to_low'],$board_config['min_user_age']);
} else
{
$birthday = ($error) ? $birthday : mkrealdate($b_day,$b_md,$b_year);
}
} else $birthday = ($error) ? '' : 999999;
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
str_replace("\'", "''", $interests) . "'
#
#-----[ DANS LA LIGNE APRES, AJOUTER ]----------------------------------
#
, user_birthday='$birthday', user_next_birthday_greeting=$next_birthday_greeting
#
#-----[ CHERCHER ]------------------------------------------------
#
$interests = htmlspecialchars($this_userdata['user_interests']);
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
$next_birthday_greeting = $this_userdata['user_next_birthday_greeting'];
if ($this_userdata['user_birthday']!=999999)
{
$birthday = realdate($lang['Submit_date_format'],$this_userdata['user_birthday']);
$b_day = realdate('j',$this_userdata['user_birthday']);
$b_md = realdate('n',$this_userdata['user_birthday']);
$b_year = realdate('Y',$this_userdata['user_birthday']);
} else
{
$b_day = '';
$b_md = '';
$b_year = '';
$birthday = '';
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="interests" value="' . str_replace("\"", """, $interests) . '" />';
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
$s_hidden_fields .= '<input type="hidden" name="birthday" value="'.$birthday.'" />';
$s_hidden_fields .= '<input type="hidden" name="next_birthday_greeting" value="'.$next_birthday_greeting.'" />';
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
"body" => "admin/user_edit_body.tpl")
);
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
$s_b_day = '<span class="genmed">' . $lang['Day'] . ' </span><select name="b_day" size="1" class="gensmall">
<option value="0"> - </option>
<option value="1"> 1 </option>
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
<option value="11"> 11 </option>
<option value="12"> 12 </option>
<option value="13"> 13 </option>
<option value="14"> 14 </option>
<option value="15"> 15 </option>
<option value="16"> 16 </option>
<option value="17"> 17 </option>
<option value="18"> 18 </option>
<option value="19"> 19 </option>
<option value="20"> 20 </option>
<option value="21"> 21 </option>
<option value="22"> 22 </option>
<option value="23"> 23 </option>
<option value="24"> 24 </option>
<option value="25"> 25 </option>
<option value="26"> 26 </option>
<option value="27"> 27 </option>
<option value="28"> 28 </option>
<option value="29"> 29 </option>
<option value="30"> 30 </option>
<option value="31"> 31 </option>
</select> ';
$s_b_md = '<span class="genmed">' . $lang['Month'] . ' </span><select name="b_md" size="1" class="gensmall">
<option value="0"> - </option>
<option value="1"> '.$lang['datetime']['January'].' </option>
<option value="2"> '.$lang['datetime']['February'].' </option>
<option value="3"> '.$lang['datetime']['March'].' </option>
<option value="4"> '.$lang['datetime']['April'].' </option>
<option value="5"> '.$lang['datetime']['May'].' </option>
<option value="6"> '.$lang['datetime']['June'].' </option>
<option value="7"> '.$lang['datetime']['July'].' </option>
<option value="8"> '.$lang['datetime']['August'].' </option>
<option value="9"> '.$lang['datetime']['September'].' </option>
<option value="10"> '.$lang['datetime']['October'].' </option>
<option value="11"> '.$lang['datetime']['November'].' </option>
<option value="12"> '.$lang['datetime']['December'].' </option>
</select> ';
$s_b_day= str_replace("value=\"".$b_day."\">", "value=\"".$b_day."\" SELECTED>" ,$s_b_day);
$s_b_md = str_replace("value=\"".$b_md."\">", "value=\"".$b_md."\" SELECTED>" ,$s_b_md);
$s_b_year = '<span class="genmed">' . $lang['Year'] . ' </span><input type="text" class="post" style="width: 50px" name="b_year" size="4" maxlength="4" value="' . $b_year . '" /> ';
$i = 0;
$s_birthday = '';
for ($i=0;$i<=strlen($lang['Submit_date_format']);$i++)
{
switch ($lang['Submit_date_format'][$i])
{
case d: $s_birthday .=$s_b_day;break;
case m: $s_birthday .=$s_b_md;break;
case Y: $s_birthday .=$s_b_year;break;
}
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
'INTERESTS' =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
'NEXT_BIRTHDAY_GREETING' => $next_birthday_greeting,
'S_BIRTHDAY' => $s_birthday,
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
'L_INTERESTS' =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
'L_BIRTHDAY' => $lang['Birthday'],
'L_NEXT_BIRTHDAY_GREETING' => $lang['Next_birthday_greeting'],
'L_NEXT_BIRTHDAY_GREETING_EXPLAIN' => $lang['Next_birthday_greeting_expain'],
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
includes/functions.php
#
#-----[ CHERCHER ]------------------------------------------------
#
?>
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Add function mkrealdate for Birthday MOD
// the originate php "mktime()", does not work proberly on all OS, especially when going back in time
// before year 1970 (year 0), this function "mkrealtime()", has a mutch larger valid date range,
// from 1901 - 2099. it returns a "like" UNIX timestamp divided by 86400, so
// calculation from the originate php date and mktime is easy.
// mkrealdate, returns the number of day (with sign) from 1.1.1970.
function mkrealdate($day,$month,$birth_year)
{
// range check months
if ($month<1 || $month>12) return "error";
// range check days
switch ($month)
{
case 1: if ($day>31) return "error";break;
case 2: if ($day>29) return "error";
$epoch=$epoch+31;break;
case 3: if ($day>31) return "error";
$epoch=$epoch+59;break;
case 4: if ($day>30) return "error" ;
$epoch=$epoch+90;break;
case 5: if ($day>31) return "error";
$epoch=$epoch+120;break;
case 6: if ($day>30) return "error";
$epoch=$epoch+151;break;
case 7: if ($day>31) return "error";
$epoch=$epoch+181;break;
case 8: if ($day>31) return "error";
$epoch=$epoch+212;break;
case 9: if ($day>30) return "error";
$epoch=$epoch+243;break;
case 10: if ($day>31) return "error";
$epoch=$epoch+273;break;
case 11: if ($day>30) return "error";
$epoch=$epoch+304;break;
case 12: if ($day>31) return "error";
$epoch=$epoch+334;break;
}
$epoch=$epoch+$day;
$epoch_Y=sqrt(($birth_year-1970)*($birth_year-1970));
$leapyear=round((($epoch_Y+2) / 4)-.5);
if (($epoch_Y+2)%4==0)
{// curent year is leapyear
$leapyear--;
if ($birth_year >1970 && $month>=3) $epoch=$epoch+1;
if ($birth_year <1970 && $month<3) $epoch=$epoch-1;
} else if ($month==2 && $day>28) return "error";//only 28 days in feb.
//year
if ($birth_year>1970)
$epoch=$epoch+$epoch_Y*365-1+$leapyear;
else
$epoch=$epoch-$epoch_Y*365-1-$leapyear;
return $epoch;
}
// Add function realdate for Birthday MOD
// the originate php "date()", does not work proberly on all OS, especially when going back in time
// before year 1970 (year 0), this function "realdate()", has a mutch larger valid date range,
// from 1901 - 2099. it returns a "like" UNIX date format (only date, related letters may be used, due to the fact that
// the given date value should already be divided by 86400 - leaving no time information left)
// a input like a UNIX timestamp divided by 86400 is expected, so
// calculation from the originate php date and mktime is easy.
// e.g. realdate ("m d Y", 3) returns the string "1 3 1970"
// UNIX users should replace this function with the below code, since this should be faster
//
//function realdate($date_syntax="Ymd",$date=0)
//{ return create_date($date_syntax,$date*86400+1,0); }
function realdate($date_syntax="Ymd",$date=0)
{
global $lang;
$i=2;
if ($date>=0)
{
return create_date($date_syntax,$date*86400+1,0);
} else
{
$year= -(date%1461);
$days = $date + $year*1461;
while ($days<0)
{
$year--;
$days+=365;
if ($i++==3)
{
$i=0;
$days++;
}
}
}
$leap_year = ($i==0) ? TRUE : FALSE;
$months_array = ($i==0) ?
array (0,31,60,91,121,152,182,213,244,274,305,335,366) :
array (0,31,59,90,120,151,181,212,243,273,304,334,365);
for ($month=1;$month<12;$month++)
{
if ($days<$months_array[$month]) break;
}
$day=$days-$months_array[$month-1]+1;
//you may gain speed performance by remove som of the below entry's if they are not needed/used
return strtr ($date_syntax, array(
'a' => '',
'A' => '',
'\\d' => 'd',
'd' => ($day>9) ? $day : '0'.$day,
'\\D' => 'D',
'D' => $lang['day_short'][($date-3)%7],
'\\F' => 'F',
'F' => $lang['month_long'][$month-1],
'g' => '',
'G' => '',
'H' => '',
'h' => '',
'i' => '',
'I' => '',
'\\j' => 'j',
'j' => $day,
'\\l' => 'l',
'l' => $lang['day_long'][($date-3)%7],
'\\L' => 'L',
'L' => $leap_year,
'\\m' => 'm',
'm' => ($month>9) ? $month : '0'.$month,
'\\M' => 'M',
'M' => $lang['month_short'][$month-1],
'\\n' => 'n',
'n' => $month,
'O' => '',
's' => '',
'S' => '',
'\\t' => 't',
't' => $months_array[$month]-$months_array[$month-1],
'w' => '',
'\\y' => 'y',
'y' => ($year>29) ? $year-30 : $year+70,
'\\Y' => 'Y',
'Y' => $year+1970,
'\\z' => 'z',
'z' => $days,
'\\W' => '',
'W' => '') );
}
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
includes/page_header.php
#
#-----[ CHERCHER ]------------------------------------------------
#
if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
// see if user has or have had birthday, also see if greeting are enabled
if ( $userdata['user_birthday']!=999999 && $board_config['birthday_greeting'] && create_date('Ymd', time(), $board_config['default_timezone']) >= $userdata['user_next_birthday_greeting'].realdate ('md',$userdata['user_birthday'] ) )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_next_birthday_greeting = " . (create_date('Y', time(), $board_config['board_timezone'])+1) . "
WHERE user_id = " . $userdata['user_id'];
if( !$status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update next_birthday_greeting for user.", "", __LINE__, __FILE__, $sql);
}
$template->assign_var("GREETING_POPUP",
"<script language=\"Javascript\" type=\"text/javascript\"><!--
window.open('".append_sid('birthday_popup.'.$phpEx)."', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');
//-->
</script>");
} //Sorry user shall not have a greeting this year
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
includes/usercp_avatar.php
#
#-----[ CHERCHER ]------------------------------------------------
#
function display_avatar_gallery(
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
)
#
#-----[ DANS LA LIGNE AVANT, AJOUTER ]---------------------------------
#
, &$birthday
#
#-----[ CHERCHER ]------------------------------------------------
#
$params = array(
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
);
#
#-----[ DANS LA LIGNE AVANT, AJOUTER ]---------------------------------
#
, 'birthday'
#
#-----[ OUVRIR ]------------------------------------------------
#
includes/usercp_register.php
#
#-----[ CHERCHER ]------------------------------------------------
#
$signature = str_replace('', "\n", $signature);
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
if (isset($HTTP_POST_VARS['birthday']) )
{
$birthday = intval ($HTTP_POST_VARS['birthday']);
if ($birthday!=999999)
{
$b_day = realdate('j',$birthday);
$b_md = realdate('n',$birthday);
$b_year = realdate('Y',$birthday);
}
} else
{
$b_day = ( isset($HTTP_POST_VARS['b_day']) ) ? intval ($HTTP_POST_VARS['b_day']) : 0;
$b_md = ( isset($HTTP_POST_VARS['b_md']) ) ? intval ($HTTP_POST_VARS['b_md']) : 0;
$b_year = ( isset($HTTP_POST_VARS['b_year']) ) ? intval ($HTTP_POST_VARS['b_year']) : 0;
if ($b_day && $b_md && $b_year)
{
$birthday = mkrealdate($b_day,$b_md,$b_year);
} else
{
$birthday = 999999;
}
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
$avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local);
}
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
// find the birthday values, reflected by the $lang['Submit_date_format']
if ($b_day || $b_md || $b_year) //if a birthday is submited, then validate it
{
$user_age=(date('md')>=$b_md.(($b_day <= 9) ? '0':'').$b_day) ? date('Y') - $b_year : date('Y') - $b_year - 1 ;
// Check date, maximum / minimum user age
if (!checkdate($b_md,$b_day,$b_year))
{
$error = TRUE;
if( isset($error_msg) )$error_msg .= "";
$error_msg .= $lang['Wrong_birthday_format'];
} else
if ($user_age>$board_config['max_user_age'])
{
$error = TRUE;
if( isset($error_msg) )$error_msg .= "";
$error_msg .= sprintf($lang['Birthday_to_high'],$board_config['max_user_age']);
} else
if ($user_age<$board_config['min_user_age'])
{
$error = TRUE;
if( isset($error_msg) )$error_msg .= "";
$error_msg .= sprintf($lang['Birthday_to_low'],$board_config['min_user_age']);
} else
{
$birthday = ($error) ? $birthday : mkrealdate($b_day,$b_md,$b_year);
$next_birthday_greeting = (date('md')<$b_md.(($b_day <= 9) ? '0':'').$b_day) ? date('Y'):date('Y')+1 ;
}
} else
{
if ($board_config['birthday_required'])
{
$error = TRUE;
if( isset($error_msg) )$error_msg .= "";
$error_msg .= sprintf($lang['Birthday_require']);
}
$birthday = 999999;
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
str_replace("\'", "''", $interests) . "'
#
#-----[ DANS LA LIGNE APRES, AJOUTER ]----------------------------------
#
, user_birthday = '$birthday', user_next_birthday_greeting = '$next_birthday_greeting'
#
#-----[ CHERCHER ]------------------------------------------------
#
# NOTICE - RISQUE IMPORTANT DE SECURITE
#
# Si vous n'effectuez pas l'étape suivante avec BEAUCOUP DE PRECAUTIONS il y a un risque de
# SECURITE concernant votre forum, vos utilisateurs pourraient se mettre ADMIN si vous faites une erreur.
# Beaucoup d'utilisateurs se trompent à cette étape, donc soyez précis, si cela échoue, ne faites pas tourner le code sur un
# vrai forum.
#
$sql = "INSERT INTO " . USERS_TABLE . "
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
, user_active, user_actkey)
#
#-----[ DANS LA LIGNE AVANT, AJOUTER ]---------------------------------
#
, user_birthday, user_next_birthday_greeting
#
#-----[ CHERCHER ]------------------------------------------------
#
VALUES ($user_id,
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
, ";
#
#-----[ DANS LA LIGNE AVANT, AJOUTER ]---------------------------------
#
, '$birthday', '$next_birthday_greeting'
#
#-----[ CHERCHER ]------------------------------------------------
#
$interests = $userdata['user_interests'];
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
$birthday = $userdata['user_birthday'];
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
display_avatar_gallery($mode
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
);
#
#-----[ DANS LA LIGNE AVANT, AJOUTER ]---------------------------------
#
, $birthday
#
#-----[ CHERCHER ]------------------------------------------------
#
if ( $error )
{
$template->set_filenames(array(
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday MOD
if ( $birthday!=999999 )
{
$b_day = realdate('j', $birthday);
$b_md = realdate('n', $birthday);
$b_year = realdate('Y', $birthday);
$birthday = realdate($lang['Submit_date_format'], $birthday);
} else
{
$b_day = '';
$b_md = '';
$b_year = '';
$birthday = '';
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
//
// Let's do an overall check for settings/versions which would prevent
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday MOD
$s_b_day = '<span class="genmed">' . $lang['Day'] . ' </span><select name="b_day" size="1" class="gensmall">
<option value="0"> - </option>
<option value="1"> 1 </option>
<option value="2"> 2 </option>
<option value="3"> 3 </option>
<option value="4"> 4 </option>
<option value="5"> 5 </option>
<option value="6"> 6 </option>
<option value="7"> 7 </option>
<option value="8"> 8 </option>
<option value="9"> 9 </option>
<option value="10"> 10 </option>
<option value="11"> 11 </option>
<option value="12"> 12 </option>
<option value="13"> 13 </option>
<option value="14"> 14 </option>
<option value="15"> 15 </option>
<option value="16"> 16 </option>
<option value="17"> 17 </option>
<option value="18"> 18 </option>
<option value="19"> 19 </option>
<option value="20"> 20 </option>
<option value="21"> 21 </option>
<option value="22"> 22 </option>
<option value="23"> 23 </option>
<option value="24"> 24 </option>
<option value="25"> 25 </option>
<option value="26"> 26 </option>
<option value="27"> 27 </option>
<option value="28"> 28 </option>
<option value="29"> 29 </option>
<option value="30"> 30 </option>
<option value="31"> 31 </option>
</select> ';
$s_b_md = '<span class="genmed">' . $lang['Month'] . ' </span><select name="b_md" size="1" class="gensmall">
<option value="0"> - </option>
<option value="1"> '.$lang['datetime']['January'].' </option>
<option value="2"> '.$lang['datetime']['February'].' </option>
<option value="3"> '.$lang['datetime']['March'].' </option>
<option value="4"> '.$lang['datetime']['April'].' </option>
<option value="5"> '.$lang['datetime']['May'].' </option>
<option value="6"> '.$lang['datetime']['June'].' </option>
<option value="7"> '.$lang['datetime']['July'].' </option>
<option value="8"> '.$lang['datetime']['August'].' </option>
<option value="9"> '.$lang['datetime']['September'].' </option>
<option value="10"> '.$lang['datetime']['October'].' </option>
<option value="11"> '.$lang['datetime']['November'].' </option>
<option value="12"> '.$lang['datetime']['December'].' </option>
</select> ';
$s_b_day= str_replace("value=\"".$b_day."\">", "value=\"".$b_day."\" SELECTED>" ,$s_b_day);
$s_b_md = str_replace("value=\"".$b_md."\">", "value=\"".$b_md."\" SELECTED>" ,$s_b_md);
$s_b_year = '<span class="genmed">' . $lang['Year'] . ' </span><input type="text" class="post" style="width: 50px" name="b_year" size="4" maxlength="4" value="' . $b_year . '" /> ';
$i = 0;
$s_birthday = '';
for ($i=0; $i<=strlen($lang['Submit_date_format']); $i++)
{
switch ($lang['Submit_date_format'][$i])
{
case d: $s_birthday .= $s_b_day;break;
case m: $s_birthday .= $s_b_md;break;
case Y: $s_birthday .= $s_b_year;break;
}
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
'OCCUPATION' =>
'INTERESTS' =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
'S_BIRTHDAY' => $s_birthday,
'BIRTHDAY_REQUIRED' => ($board_config['birthday_required']) ? '*' : '',
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
'L_INTERESTS' =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
'L_BIRTHDAY' => $lang['Birthday'],
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ CHERCHER ]------------------------------------------------
#
//
// Generate page
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday MOD
if ($profiledata['user_birthday']!=999999)
{
$user_birthday = realdate($lang['DATE_FORMAT'], $profiledata['user_birthday']);
} else
{
$user_birthday = $lang['No_birthday_specify'];
}
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
'INTERESTS' =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
'BIRTHDAY' => $user_birthday,
// End add - Birthday MOD
#
#-----[ CHERCHER ]------------------------------------------------
#
'L_INTERESTS' =>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
// Start add - Birthday MOD
'L_BIRTHDAY' => $lang['Birthday'],
// End add - Birthday MOD
#
#-----[ OUVRIR ]------------------------------------------------
#
language/lang_french/lang_admin.php
#
#-----[ CHERCHER ]------------------------------------------------
#
?>
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday Mod
$lang['Birthday_required'] = 'Obliger les membres à valider une date de naissance';
$lang['Enable_birthday_greeting'] = 'Activer la pop-up \'Joyeux Anniversaire\'';
$lang['Birthday_greeting_expain'] = 'Les membres ayant validé leur date de naissance pourront recevoir une pop-up \'Joyeux Anniversaire\' lorsqu\'ils visiteront le forum.';
$lang['Next_birthday_greeting'] = 'Prochaine année du pop-up anniversaire';
$lang['Next_birthday_greeting_expain'] = 'Ce champ garde une trace de la prochaine année à laquelle l\'utilisateur recevra une pop-up \'Joyeux Anniversaire\'.';
$lang['Wrong_next_birthday_greeting'] = 'Le choix de la prochaine année du pop-up Joyeux Anniversaire fourni était incorrect, veuillez réessayer une nouvelle fois.';
$lang['Max_user_age'] = 'Age maximum de l\'utilisateur';
$lang['Min_user_age'] = 'Age minimum de l\'utilisateur';
$lang['Birthday_lookforward'] = 'Regarder les dates d\'anniversaires jusqu\'à';
$lang['Birthday_lookforward_explain'] = 'Il s\'agit du nombre de jours jusqu\'où le script regardera, dans les jours qui suivent, si un membre fête son anniversaire (en jours).';
// End add - Birthday Mod
#
#-----[ OUVRIR ]------------------------------------------------
#
language/lang_french/lang_main.php
#
#-----[ CHERCHER ]------------------------------------------------
#
?>
#
#-----[ AVANT, AJOUTER ]-----------------------------------------
#
// Start add - Birthday Mod
$lang['Birthday'] = 'Date de naissance';
$lang['No_birthday_specify'] = 'Non spécifié';
$lang['Age'] = 'Age';
$lang['Wrong_birthday_format'] = 'Le format de la date de naissance a mal été entré.';
$lang['Birthday_to_high'] = 'Désolé, mais ce site n\'accepte pas les utilisateurs âgés de plus de %d ans';
$lang['Birthday_require'] = 'Votre date de naissance est exigée sur ce site';
$lang['Birthday_to_low'] = 'Désolé, mais ce site n\'accepte pas les utilisateurs âgés de moins de %d ans';
$lang['Submit_date_format'] = 'd-m-Y'; //php date() format - Note: ONLY d, m and Y may be used and SHALL ALL be used (different seperators are accepted)
$lang['Birthday_greeting_today'] = 'Nous voudrions vous souhaiter un joyeux anniversaire pour vos %s ans. L\'Equipe du site';//%s is substituted with the users age
$lang['Birthday_greeting_prev'] = 'Nous voudrions vous souhaiter, avec un peu de retard, un joyeux anniversaire pour vos %s ans obtenus le %s. L\'Equipe du site';//%s is substituted with the users age, and birthday
$lang['Greeting_Messaging'] = 'Félicitations';
$lang['Birthday_today'] = 'Membres fêtant leur anniversaire aujourd\'hui:';
$lang['Birthday_week'] = 'Membres fêtant leur anniversaire dans les %d prochains jours:';
$lang['Nobirthday_week'] = 'Aucun membre ne fête son anniversaire dans les %d prochains jours'; // %d is substitude with the number of days
$lang['Nobirthday_today'] = 'Aucun membre ne fête son anniversaire aujourd\'hui';
$lang['Birthday_Year'] = 'Année';
$lang['Birthday_Month'] = 'Mois';
$lang['Birthday_Day'] = 'Jour';
$lang['day_short'] = array($lang['datetime']['Sun'], $lang['datetime']['Mon'], $lang['datetime']['Tue'], $lang['datetime']['Wed'], $lang['datetime']['Thu'], $lang['datetime']['Fri'], $lang['datetime']['Sat']);
$lang['day_long'] = array($lang['datetime']['Sunday'], $lang['datetime']['Monday'], $lang['datetime']['Tuesday'], $lang['datetime']['Wednesday'], $lang['datetime']['Thursday'], $lang['datetime']['Friday'], $lang['datetime']['Saturday']);
$lang['month_short'] = array($lang['datetime']['Jan'], $lang['datetime']['Feb'], $lang['datetime']['Mar'], $lang['datetime']['Apr'], $lang['datetime']['May'], $lang['datetime']['Jun'], $lang['datetime']['Jul'], $lang['datetime']['Aug'], $lang['datetime']['Sep'], $lang['datetime']['Oct'], $lang['datetime']['Nov'], $lang['datetime']['Dec']);
$lang['month_long'] = array($lang['datetime']['January'], $lang['datetime']['February'], $lang['datetime']['March'], $lang['datetime']['April'], $lang['datetime']['May'], $lang['datetime']['June'], $lang['datetime']['July'], $lang['datetime']['August'], $lang['datetime']['September'], $lang['datetime']['October'], $lang['datetime']['November'], $lang['datetime']['December']);
// Birthday Zodiacs Mod
$lang['Zodiac'] = 'Zodiaque';
$lang['Capricorn'] = 'Capricorne';
$lang['Aquarius'] = 'Verseau';
$lang ['Pisces'] = 'Poissons';
$lang['Aries'] = 'Bélier';
$lang['Taurus'] = 'Taureau';
$lang['Gemini'] = 'Gémeaux';
$lang['Cancer'] = 'Cancer';
$lang['Leo'] = 'Lion';
$lang['Virgo'] = 'Vierge';
$lang['Libra'] = 'Balance';
$lang['Scorpio'] = 'Scorpion';
$lang['Sagittarius'] = 'Sagittaire';
// Chinese Zodiacs Mod
$lang['Chinese_zodiac']= 'Signe Chinois';
$lang['Unknown'] = 'inconnu';
$lang['Rat'] = 'Rat';
$lang['Buffalo'] = 'Buffle';
$lang['Tiger'] = 'Tigre';
$lang['Cat'] = 'Chat';
$lang['Dragon'] = 'Dragon';
$lang['Snake'] = 'Serpent';
$lang['Horse'] = 'Cheval';
$lang['Goat'] = 'Bouc';
$lang['Monkey'] = 'Singe';
$lang['Cock'] = 'Coq';
$lang['Dog'] = 'Chien';
$lang['Pig'] = 'Cochon';
// End add - Birthday Mod
#
#-----[ OUVRIR ]------------------------------------------------
#
# Effectuez les changements pour chaque thème !
#
templates/subSilver/index_body.tpl
#
#-----[ CHERCHER ]------------------------------------------------
#
<td class="row1" align="center" valign="middle" rowspan
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
# Cette valeur peut-être différente, s'il y a d'autres MODs, ajoutez +1
#
2
#
#-----[ DANS LA LIGNE REMPLACER PAR ]--------------------------------
#
# Cette valeur peut-être différente, s'il y a d'autres MODs, ajoutez +1
#
3
#
#-----[ CHERCHER ]------------------------------------------------
#
{LOGGED_IN_USER_LIST}</span></td>
</tr>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
<!-- Start add - Birthday MOD -->
<tr>
<td class="row1" align="left"><span class="gensmall">{L_WHOSBIRTHDAY_TODAY}{L_WHOSBIRTHDAY_WEEK}</span></td>
</tr>
<!-- End add - Birthday MOD -->
#
#-----[ OUVRIR ]------------------------------------------------
#
# Effectuez les changements pour chaque thème !
#
templates/subSilver/overall_header.tpl
#
#-----[ CHERCHER ]------------------------------------------------
#
<!-- END switch_enable_pm_popup -->
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
<!-- Start add - Birthday MOD -->
{GREETING_POPUP}
<!-- End add - Birthday MOD -->
#
#-----[ OUVRIR ]------------------------------------------------
#
# Effectuez les changements pour chaque thème !
#
templates/subSilver/profile_add_body.tpl
#
#-----[ CHERCHER ]------------------------------------------------
#
<input type="text" class="post"style="width: 200px" name="interests" size="35" maxlength="150" value="{INTERESTS}" />
</td>
</tr>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
<!-- Start add - Birthday MOD -->
<tr>
<td class="row1"><span class="gen">{L_BIRTHDAY}:{BIRTHDAY_REQUIRED}</span></td>
<td class="row2"><span class="gen">{S_BIRTHDAY}</span></td>
</tr>
<!-- End add - Birthday MOD -->
#
#-----[ OUVRIR ]------------------------------------------------
#
# Effectuez les changements pour chaque thème !
#
templates/subSilver/profile_view_body.tpl
#
#-----[ CHERCHER ]------------------------------------------------
#
<td> <b><span class="gen">{INTERESTS}</span></b></td>
</tr>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
<!-- Start add - Birthday MOD -->
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_BIRTHDAY}:</span></td>
<td><b><span class="gen">{BIRTHDAY}</span></b></td>
</tr>
<!-- End add - Birthday MOD -->
#
#-----[ OUVRIR ]------------------------------------------------
#
# Effectuez les changements pour chaque thème !
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ CHERCHER ]------------------------------------------------
#
{postrow.POSTER_AVATAR}
#
#-----[ DANS LA LIGNE CHERCHER ]----------------------------------------
#
{postrow.POSTER_AVATAR}
#
#-----[ DANS LA LIGNE APRES, AJOUTER ]----------------------------------
#
{postrow.POSTER_AGE}
#
#-----[ OUVRIR ]------------------------------------------------
#
# Effectuez les changements pour chaque thème !
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ CHERCHER ]------------------------------------------------
#
{PRUNE_NO} /> {L_NO}</td>
</tr>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
<!-- Start add - Birthday MOD -->
<tr>
<td class="row1">{L_BIRTHDAY_REQUIRED}</td>
<td class="row2"><input type="radio" name="birthday_required" value="1" {BIRTHDAY_REQUIRED_YES} /> {L_YES} <input type="radio" name="birthday_required" value="0" {BIRTHDAY_REQUIRED_NO} /> {L_NO}</td>
</tr>
<tr>
<td class="row1">{L_ENABLE_BIRTHDAY_GREETING}<span class="gensmall">{L_BIRTHDAY_GREETING_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="birthday_greeting" value="1" {BIRTHDAY_GREETING_YES} /> {L_YES} <input type="radio" name="birthday_greeting" value="0" {BIRTHDAY_GREETING_NO} /> {L_NO}</td>
</tr>
<tr>
<td class="row1">{L_MAX_USER_AGE}</td>
<td class="row2"><input class="post" type="text" size="4" maxlength="4" name="max_user_age" value="{MAX_USER_AGE}" /></td>
</tr>
<tr>
<td class="row1">{L_MIN_USER_AGE}<span class="gensmall">{L_MIN_USER_AGE_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="4" maxlength="4" name="min_user_age" value="{MIN_USER_AGE}" /></td>
</tr>
<tr>
<td class="row1">{L_BIRTHDAY_LOOKFORWARD}<span class="gensmall">{L_BIRTHDAY_LOOKFORWARD_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="3" name="birthday_check_day" value="{BIRTHDAY_LOOKFORWARD}" /></td>
</tr>
<!-- End add - Birthday MOD -->
#
#-----[ OUVRIR ]------------------------------------------------
#
# Effectuez les changements pour chaque thème !
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ CHERCHER ]------------------------------------------------
#
<input class="post" type="text" name="interests" size="35" maxlength="150" value="{INTERESTS}" />
</td>
</tr>
#
#-----[ APRES, AJOUTER ]------------------------------------------
#
<!-- Start add - Birthday MOD -->
<tr>
<td class="row1"><span class="gen">{L_BIRTHDAY}</span></td>
<td class="row2">{S_BIRTHDAY}</td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_NEXT_BIRTHDAY_GREETING}:</span><span class="gensmall">{L_NEXT_BIRTHDAY_GREETING_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" name="next_birthday_greeting" size="5" maxlength="4" value="{NEXT_BIRTHDAY_GREETING}" /></td>
</tr>
<!-- End add - Birthday MOD -->
#
#-----[ SAUVEGARDEZ/FERMER TOUS LES FICHIERS ]--------------------------------
#
# FdM
|