Birthday mod

Βοήθεια λύσεις και νέα από τον χώρο των open source ή έτοιμων εφαρμογών που έχουν φτιαχτεί με την PHP όπως oscommerce, κ.α.

Συντονιστές: WebDev Moderators, Super-Moderators, PHP Moderators

Απάντηση
Άβαταρ μέλους
Sfinaki
Δημοσιεύσεις: 541
Εγγραφή: 08 Ιουν 2003 22:41
Τοποθεσία: Ηράκλειο Κρήτη
Επικοινωνία:

Birthday mod

Δημοσίευση από Sfinaki » 05 Απρ 2004 12:18

Καλή σας μέρα,
Έχω εγκαταστήσει το Birthday mod στο Forum του Sfinaki.gr, αλλά στο index του Forum δεν εμφανίζονται τα μέλη που έχουν γενέθλια σήμερα ή τις επόμενς ημέρες.
Τι μπορεί να έχω κάνει λάθος?
Όλα τ' άλα λειτουργούν μια χαρά αλλά τι να το κάνω αν δε λειτουργεί η ενημέρωση για τα γενέθλια των μελών?

Άβαταρ μέλους
Sfinaki
Δημοσιεύσεις: 541
Εγγραφή: 08 Ιουν 2003 22:41
Τοποθεσία: Ηράκλειο Κρήτη
Επικοινωνία:

Birthday mod

Δημοσίευση από Sfinaki » 05 Απρ 2004 12:21

Οι αλλαγές που έκανα είναι οι παρακάτω:

Κώδικας: Επιλογή όλων

###############################################
## Mod Title:      Birthday PART 1 
## Mod Version:    1.2.1.
## Author&#58;       Niels Chr. Denmark < ncr@db9.dk > &#40;Niels Chr. Rψd&#41; HTTP&#58;//mods.db9.dk
## 
## This mod is modified by Dennis Donker in order to make it work under phpnuke ported version of phpbb &#40;version 2.0.6&#41;
## from bbtonuke.sourceforge.net if you have found bugs or problems Just visit my site &#58;&#58; http&#58;//portedmods.sourceforge.net
##
## Description&#58;  This mod will add a birthday field into your users' profile. 
## and make users age vieweble to others, when viewing posts 
## Users who not specify a birthday, the script will default to "None Specified."                      
# 
## At the day of the users birthday &#40;or on next visit&#41; the board 
## can be configured to display a birthday greeting 
## when users changing there profile they automatically, enable greeting on there new birthhday 
## the admin configuration part of the mod will follow in a PART 2. 
## 
## 
## Installation Level&#58;  advanced
## Installation Time&#58;   20-40 Minutes 
## Files To Edit&#58;      14
##   moduels/Forums/includes/usercp_register.php
##   moduels/Forums/includes/usercp_viewprofile.php
##   moduels/Forums/includes/usercp_avatar.php
##   moduels/Forums/viewtopic.php
##   modules/Private_Messages/index.php
##   moduels/Forums/includes/page_header.php
##   moduels/Forums/index.php
##   moduels/Forums/includes/functions.php
##   moduels/Forums/language/lang_english/lang_main.php
##   moduels/Forums/templates/subsilver/index_body.tpl
##   moduels/Forums/templates/subsilver/overall_header.tpl
##   moduels/Forums/templates/subsilver/profile_view_body.tpl
##   moduels/Forums/templates/subsilver/profile_add_body.tpl
##   moduels/Forums/templates/subsilver/viewtopic_body.tpl
## Included Files&#58; 	1
##   moduels/Forums//templates/subsilver/greeting_popup.tpl
##
##	History&#58;
##	0.9.0. -  initial BETA release phpBB2 RC-2
##	1.0.0. -  initial release
##	1.1.0. -  initial relese phpBB2 ver 2.0.0.
##	1.1.8. -  history started, improved page_header.php
##	1.1.9. -  fix a missing </span> tag in profile_add_body.tpl
##	1.1.10. - minor change the lang_main.php, $lang&#91;'Birthday_explain'&#93; to properly support different birthday formats
##	1.1.11. - the english language file, have now changed a few places thanks to "mr Cru"
##	1.1.12. - speed improvements, I have moved some of the code from page_header.php to index.php, it turn out that none was using the info on other pages, so no need for them there
##	1.1.13. - fixed a wrong &#91;FIND&#93; after the speed improvements
##	1.1.14. - fixed a mistake in index.php, that causes no users to have birthday
##	1.2.0. - now confirmed for phpBB2 version 2.0.2
##	1.2.1. - have missed to include some changes in the how-to, regarding viewtopic.php
##
##
############################################################## 
## This MOD is released under the GPL License. 
## Intellectual Property is retained by the MOD Author&#40;s&#41; listed above 
############################################################## 
## For Security Purposes, Please Check&#58; http&#58;//www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at&#58; http&#58;//www.phpbb.com/mods/downloads/ 
############################################################## 
## Authors Notes&#58; 
## 
## if you are using a prefix to you DB tabels then you have to add this to 
## the SQL commands, e.g. "phpbb_users" instead of just "users" - ONLY 
## in the initial SQL commands, not in the php code ! 
## if in doubt run the included db_update.php file instead of the initial &#91;ADD SQL&#93; commands
## 
## The most important thing to keep in mind is, take your time, make 
## sure you are finding the correct lines to modify, then take care to paste the new code. 
## Please also keep in mind, if you are using more than one language file or theme at your 
## site, you will need to edit the corrosponding files for each occurrence.  Good Luck! 
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
## and the Database
################################################################# 


# 
#-----&#91; ADD SQL &#93;------------------------------------------ 
# 

ALTER TABLE nuke_users ADD user_birthday INT DEFAULT '999999'

# 
#-----&#91; ADD SQL &#93;------------------------------------------ 
# 
ALTER TABLE nuke_users ADD user_next_birthday_greeting INT DEFAULT '0'

# 
#-----&#91; ADD SQL &#93;------------------------------------------ 
# 
INSERT INTO nuke_bbconfig &#40;config_name, config_value&#41; VALUES &#40;'birthday_greeting', '1'&#41;

# 
#-----&#91; ADD SQL &#93;------------------------------------------ 
# 
INSERT INTO nuke_bbconfig &#40;config_name, config_value&#41; VALUES &#40;'max_user_age', '100'&#41;

# 
#-----&#91; ADD SQL &#93;------------------------------------------ 
# 
INSERT INTO nuke_bbconfig &#40;config_name, config_value&#41; VALUES &#40;'min_user_age', '5'&#41;

# 
#-----&#91; ADD SQL &#93;------------------------------------------ 
# 
INSERT INTO nuke_bbconfig &#40;config_name, config_value&#41; VALUES &#40;'birthday_check_day', '7'&#41; 

####################################################################

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
# &#40;make sure to edit this file for every language your board uses&#41;. 
moduels/Forums/language/lang_english/lang_main.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
#  AT THE BOTTOM OF THE PAGE 
// 
// That's all Folks! 

# 
#-----&#91; BEFORE, ADD &#93;------------------------------------------ 
# 
 
//Add on for Birthday Mod 
$lang&#91;'Birthday'&#93; = 'Birthday'; 
$lang&#91;'No_birthday_specify'&#93; = 'None Specified'; 
$lang&#91;'Age'&#93; = 'Age'; 
$lang&#91;'Birthday_explain'&#93; = 'The syntax used is %s, e.g. %s, remember prefixed zeros'; 
$lang&#91;'Wrong_birthday_format'&#93; = 'The birthday format was entered incorrectly.'; 
$lang&#91;'Submit_date_format'&#93; = 'd-m-Y'; //php date&#40;&#41; format - Note&#58; ONLY d, m and Y may be used and SHALL ALL be used &#40;different seperators are accepted&#41; 
$lang&#91;'Birthday_greeting_today'&#93; ='We would like to wish you congratulatons on reaching %s years old today.<br /><br /> The Management';//%s is substituted with the users age 
$lang&#91;'Birthday_greeting_prev'&#93; ='We would like to give you a belated congratulatons for becoming %s years old on the %s.<br /><br /> The Management';//%s is substituted with the users age, and birthday 
$lang&#91;'Greeting_Messaging'&#93; ='Congratulations'; 
$lang &#91;'Birthday_today'&#93; = 'Users with a birthday today&#58;'; 
$lang &#91;'Birthday_week'&#93; = 'Users with a birthday within the next %d days&#58;'; 
$lang &#91;'Nobirthday_week'&#93; = 'No users are having a birthday in the upcoming %d days'; // %d is substitude with the number of days 
$lang &#91;'Nobirthday_today'&#93;='No users have a birthday today'; 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/includes/usercp_register.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$strip_var_list = array&#40;

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
&#41;; 

# 
#-----&#91; IN-LINE, BEFORE ADD &#93;------------------------------------------ 
#  
, 'birthday' => 'birthday' 


# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$interests = stripslashes&#40;$interests&#41;; 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
$birthday = stripslashes&#40;$birthday&#41;; 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
if &#40; !$error &#41; 
&#123; 
   if &#40; $avatar_sql == '' &#41; 

# 
#-----&#91; BEFORE, ADD &#93;------------------------------------------ 
# 
// find the birthday values, reflected by the $lang&#91;'Submit_date_format'&#93; 
if &#40;$birthday || !$board_config&#91;'min_user_age'&#93;&#41; //if a birthday is submited, then validate it 
&#123; 
   for &#40;$i=0;$i<=strlen&#40;$lang&#91;'Submit_date_format'&#93;&#41;;$i++&#41; 
   &#123; 
      switch &#40;$lang&#91;'Submit_date_format'&#93;&#91;$i&#93;&#41; 
      &#123; 
        case d&#58;   $day=$birthday_lengt;$date_count++; 
         $birthday_lengt++;break; 
        case m&#58;   $md=$birthday_lengt;$date_count++; 
         $birthday_lengt++;break; 
       case Y&#58;   $year=$birthday_lengt;$date_count++; 
         $birthday_lengt=$birthday_lengt+3;break; 
      &#125; 
      $birthday_lengt++; 
   &#125; 
   // did we find both day,month and year 
   if &#40;$date_count<3&#41; 
   &#123; 
      $error = TRUE; 
      if&#40; isset&#40;$error_msg&#41; &#41;$error_msg .= "<br />"; 
      $error_msg .= $lang&#91;'Wrong_birthday_format'&#93;; 
   &#125; else 
   &#123; 
      $day=$birthday&#91;$day&#93;.$birthday&#91;$day+1&#93;; 
      $md=$birthday&#91;$md&#93;.$birthday&#91;$md+1&#93;; 
      $year=$birthday&#91;$year&#93;.$birthday&#91;$year+1&#93;.$birthday&#91;$year+2&#93;.$birthday&#91;$year+3&#93;; 
      $user_age=&#40;date&#40;'md'&#41;>=$md.$day&#41; ? date&#40;'Y'&#41; - $year &#58; date&#40;'Y'&#41; - $year - 1 ; 
      // Check maximum user age 
      if &#40;$user_age>$board_config&#91;'max_user_age'&#93;&#41; $md=13  ; 
      // Check minimum user age 
      if &#40;$user_age<$board_config&#91;'min_user_age'&#93;&#41; $md=13  ; 
      if &#40;!checkdate&#40;$md,$day,$year&#41;&#41; 
      &#123; 
         $error = TRUE; 
         if&#40; isset&#40;$error_msg&#41; &#41;$error_msg .= "<br />"; 
         $error_msg .= $lang&#91;'Wrong_birthday_format'&#93;; 
      &#125; else 
      &#123; 
         $birthday = &#40;$error&#41; ? $birthday &#58; mkrealdate&#40;$day,$md,$year&#41;; 
         $next_birthday_greeting = &#40;date&#40;'md'&#41;<$md.$day&#41; ? date&#40;'Y'&#41;&#58;date&#40;'Y'&#41;+1 ; 
      &#125; 
   &#125;    
&#125; else $birthday = &#40;$error&#41; ? '' &#58; 999999; 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$sql = "UPDATE " . USERS_TABLE . " 
SET 
# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
$avatar_sql . "

# 
#-----&#91; IN-LINE, AFTER ADD &#93;------------------------------------------ 
#  
, user_birthday='$birthday', user_next_birthday_greeting='$next_birthday_greeting'

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$sql = "INSERT INTO " . USERS_TABLE . " &#40;
VALUES &#40;

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
, user_allow_pm

# 
#-----&#91; IN-LINE AFTER,ADD &#93;------------------------------------------ 
# 
,user_birthday, user_next_birthday_greeting

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
,";

# 
#-----&#91; IN-LINE BEFORE,ADD &#93;------------------------------------------ 
# 
,'$birthday','$next_birthday_greeting'

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$interests = htmlspecialchars&#40;stripslashes&#40;$interests&#41;&#41;;
    
# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
$birthday = htmlspecialchars&#40;stripslashes&#40;$birthday&#41;&#41;;

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$interests = htmlspecialchars&#40;$userdata&#91;'user_interests'&#93;&#41;;

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
$birthday = &#40;$userdata&#91;'user_birthday'&#93;!=999999&#41; ? realdate&#40;$lang&#91;'Submit_date_format'&#93;,$userdata&#91;'user_birthday'&#93;&#41;&#58;''; 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
display_avatar_gallery&#40;

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
&#41;; 

# 
#-----&#91; IN-LINE BEFORE ADD &#93;------------------------------------------ 
# 
, $birthday

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
	$template->assign_vars&#40;array&#40;
		'USERNAME' => $username, 
		'CUR_PASSWORD' => $cur_password,
		'NEW_PASSWORD' => $new_password,
		'PASSWORD_CONFIRM' => $password_confirm,
		'EMAIL' => $email,
		'YIM' => $yim,
		'ICQ' => $icq,
		'MSN' => $msn,
		'AIM' => $aim,
		'OCCUPATION' => $occupation,
		'INTERESTS' => $interests,

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
'BIRTHDAY' => $birthday, 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'L_INTERESTS' => $lang&#91;'Interests'&#93;, 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
'L_BIRTHDAY' => $lang&#91;'Birthday'&#93;, 
'L_BIRTHDAY_EXPLAIN' =>sprintf&#40;$lang&#91;'Birthday_explain'&#93;,$lang&#91;'Submit_date_format'&#93;,date&#40;$lang&#91;'Submit_date_format'&#93;&#41;&#41;, 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/includes/usercp_viewprofile.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'INTERESTS' => &#40; $profiledata&#91;'user_interests'&#93; &#41; ? $profiledata&#91;'user_interests'&#93; &#58; '&nbsp;', 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
'BIRTHDAY' => &#40;$profiledata&#91;'user_birthday'&#93;!=999999&#41; ? $poster_birthday=realdate&#40;$lang&#91;'DATE_FORMAT'&#93;, $profiledata&#91;'user_birthday'&#93;&#41; &#58; $poster_birthday=$lang&#91;'No_birthday_specify'&#93;, 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'L_INTERESTS' => $lang&#91;'Interests'&#93;, 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
'L_BIRTHDAY' => $lang&#91;'Birthday'&#93;, 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/includes/usercp_avatar.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
function display_avatar_gallery&#40;

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
&#41;

# 
#-----&#91; IN-LINE BEFORE ADD &#93;------------------------------------------ 
# 
, &$birthday

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$params = array&#40;

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
&#41;; 

# 
#-----&#91; IN-LINE BEFORE ADD &#93;------------------------------------------ 
# 
, 'birthday'


# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/includes/functions.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
?>

# 
#-----&#91; BEFORE, ADD &#93;------------------------------------------ 
# 
// Add function mkrealdate for Birthday MOD 
// the originate php "mktime&#40;&#41;", does not work proberly on all OS, especially when going back in time 
// before year 1970 &#40;year 0&#41;, this function "mkrealtime&#40;&#41;", 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 &#40;with sign&#41; from 1.1.1970. 

function mkrealdate&#40;$day,$month,$year&#41; 
&#123; 
   // range check months 
   if &#40;$month<1 || $month>12&#41; return "error"; 
   // range check days 
   switch &#40;$month&#41; 
   &#123; 
      case 1&#58; if &#40;$day>31&#41; return "error";break; 
      case 2&#58; if &#40;$day>29&#41; return "error"; 
         $epoch=$epoch+31;break; 
      case 3&#58; if &#40;$day>31&#41; return "error"; 
         $epoch=$epoch+59;break; 
      case 4&#58; if &#40;$day>30&#41; return "error" ; 
         $epoch=$epoch+90;break; 
      case 5&#58; if &#40;$day>31&#41; return "error"; 
         $epoch=$epoch+120;break; 
      case 6&#58; if &#40;$day>30&#41; return "error"; 
         $epoch=$epoch+151;break; 
      case 7&#58; if &#40;$day>31&#41; return "error"; 
         $epoch=$epoch+181;break; 
      case 8&#58; if &#40;$day>31&#41; return "error"; 
         $epoch=$epoch+212;break; 
      case 9&#58; if &#40;$day>30&#41; return "error"; 
         $epoch=$epoch+243;break; 
      case 10&#58; if &#40;$day>31&#41; return "error"; 
         $epoch=$epoch+273;break; 
      case 11&#58; if &#40;$day>30&#41; return "error"; 
         $epoch=$epoch+304;break; 
      case 12&#58; if &#40;$day>31&#41; return "error"; 
         $epoch=$epoch+334;break; 
   &#125; 
   $epoch=$epoch+$day; 
   $epoch_Y=sqrt&#40;&#40;$year-1970&#41;*&#40;$year-1970&#41;&#41;; 
   $leapyear=round&#40;&#40;&#40;$epoch_Y+2&#41; / 4&#41;-.5&#41;; 
   if &#40;&#40;$epoch_Y+2&#41;%4==0&#41; 
   &#123;// curent year is leapyear 
      $leapyear--; 
      if &#40;$year >1970 && $month>=3&#41; $epoch=$epoch+1; 
      if &#40;$year <1970 && $month<3&#41; $epoch=$epoch-1; 
   &#125; else if &#40;$month==2 && $day>28&#41; return "error";//only 28 days in feb. 
   //year 
   if &#40;$year>1970&#41; 
      $epoch=$epoch+$epoch_Y*365-1+$leapyear; 
   else 
      $epoch=$epoch-$epoch_Y*365-1-$leapyear; 
   return $epoch; 
&#125; 

// Add function realdate for Birthday MOD 
// the originate php "date&#40;&#41;", does not work proberly on all OS, especially when going back in time 
// before year 1970 &#40;year 0&#41;, this function "realdate&#40;&#41;", has a mutch larger valid date range, 
// from 1901 - 2099. it returns a "like" UNIX date format &#40;only d,m and Y, may be used&#41; 
// is expect a input like a UNIX timestamp divided by 86400, so 
// calculation from the originate php date and mktime is easy. 
// e.g. realdate &#40;"m d Y", 3&#41; returns the string "1 3 1970" 

function realdate&#40;$date_syntax,$date&#41; 
&#123; 
   global $lang; 
   $year=0; 
   $date_mid=$date; 
   $i=2; 
   if &#40;$date>=0&#41; 
   &#123; 
      while &#40;$date_mid>364&#41; 
      &#123; 
         $date_mid=$date_mid-365; 
         $year++; 
         if &#40;$i==3&#41; 
         &#123; 
            $i=0; 
            if &#40;$date_mid>365&#41; 
            &#123; 
               $date_mid--; 
            &#125; 
         &#125; else $i++; 
      &#125; 
   &#125; else if &#40;$date<0&#41; 
   &#123; 
      while &#40;$date_mid<0&#41; 
      &#123; 
         $year--; 
         $date_mid=$date_mid+365; 
         if &#40;$i==3&#41; 
         &#123; 
            $i=0; 
            $date_mid++; 
         &#125; else $i++; 
      &#125; 
   &#125; 
   $days=$days+$date_mid; 
   if &#40;&#40;$year+2&#41;%4==0&#41; 
   &#123; 
      if &#40;$date_mid>334&#41; 
      &#123; 
         $day=$date_mid-334; 
         $month=12; 
      &#125; else if &#40;$date_mid>304&#41; 
      &#123; 
         $day=$date_mid-304; 
         $month=11; 
      &#125; else if &#40;$date_mid>273&#41; 
      &#123; 
         $day=$date_mid-273; 
         $month=10; 
      &#125; else if &#40;$date_mid>243&#41; 
      &#123; 
         $day=$date_mid-243; 
         $month=9; 
      &#125; else if &#40;$date_mid>212&#41; 
      &#123; 
         $day=$date_mid-212; 
         $month=8; 
      &#125; else if &#40;$date_mid>181&#41; 
      &#123; 
         $day=$date_mid-181; 
         $month=7; 
      &#125; else if &#40;$date_mid>151&#41; 
      &#123; 
         $day=$date_mid-151; 
         $month=6; 
      &#125; else if &#40;$date_mid>120&#41; 
      &#123; 
         $day=$date_mid-120; 
         $month=5; 
      &#125; else if &#40;$date_mid>90&#41; 
      &#123; 
         $day=$date_mid-90; 
         $month=4; 
      &#125; else if &#40;$date_mid>59&#41; 
      &#123; 
         $day=$date_mid-59; 
         $month=3; 
      &#125; else if &#40;$date_mid>30&#41; 
      &#123; 
         $day=$date_mid-30; 
         $month=2; 
      &#125; else 
      &#123; 
         $month=1; 
         $day=$date_mid+1; 
      &#125; 
   &#125; else 
   &#123; 
      if &#40;$date_mid>333&#41; 
      &#123; 
         $day=$date_mid-333; 
         $month=12; 
      &#125; else if &#40;$date_mid>303&#41; 
      &#123; 
         $day=$date_mid-303; 
         $month=11; 
      &#125; else if &#40;$date_mid>272&#41; 
      &#123; 
         $day=$date_mid-272; 
         $month=10; 
      &#125; else if &#40;$date_mid>242&#41; 
      &#123; 
         $day=$date_mid-242; 
         $month=9; 
      &#125; else if &#40;$date_mid>211&#41; 
      &#123; 
         $day=$date_mid-211; 
         $month=8; 
      &#125; else if &#40;$date_mid>180&#41; 
      &#123; 
         $day=$date_mid-180; 
         $month=7; 
      &#125; else if &#40;$date_mid>150&#41; 
      &#123; 
         $day=$date_mid-150; 
         $month=6; 
      &#125; else if &#40;$date_mid>119&#41; 
      &#123; 
         $day=$date_mid-119; 
         $month=5; 
      &#125; else if &#40;$date_mid>89&#41; 
      &#123; 
         $day=$date_mid-89; 
         $month=4; 
      &#125; else if &#40;$date_mid>58&#41; 
      &#123; 
         $day=$date_mid-58; 
         $month=3; 
      &#125; else if &#40;$date_mid>30&#41; 
      &#123; 
         $day=$date_mid-30; 
         $month=2; 
      &#125; else 
      &#123; 
         $month=1; 
         $day=$date_mid+1; 
      &#125; 
   &#125; 
if &#40;!&#40;strrpos&#40;$date_syntax, "j"&#41; ===false&#41;&#41; 
$date_syntax = str_replace&#40;'j',$day,$date_syntax&#41;; 
else 
&#123; 
if &#40;$day<10&#41;$day='0'.&#40;$day&#41;; 
$date_syntax = str_replace&#40;'d',$day,$date_syntax&#41;; 
&#125; 
if &#40;!&#40;strrpos&#40;$date_syntax, "n"&#41; ===false&#41;&#41; 
$date_syntax = str_replace&#40;'n',$month,$date_syntax&#41;; 
else 
&#123; 
if &#40;$month<10&#41;$month='0'.&#40;$month&#41;; 
$date_syntax = str_replace&#40;'m',$month,$date_syntax&#41;; 
$month--; 
$date_table = array &#40;'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'&#41;; 
$date_syntax = str_replace&#40;'M',$lang&#91;'datetime'&#93;&#91;$date_table&#91;$month&#93;&#93;,$date_syntax&#41;; 
&#125; 
$year=$year+1970; 
$date_syntax = str_replace&#40;'Y',$year,$date_syntax&#41;; 

   return $date_syntax; 
&#125; 


# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/viewtopic.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid 

# 
#-----&#91; IN LINE FIND&#93;------------------------------------------ 
# 
u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, 

# 
#-----&#91; REPLACE WITH &#93;------------------------------------------ 
# 
u.* ,


# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$poster_id = $postrow&#91;$i&#93;&#91;'user_id'&#93;;
$poster = &#40; $poster_id == ANONYMOUS &#41; ? $lang&#91;'Guest'&#93; &#58; $postrow&#91;$i&#93;&#91;'username'&#93;;

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
if &#40; $postrow&#91;$i&#93;&#91;'user_birthday'&#93; != 999999 &#41; 
&#123; 
   $poster_age =realdate&#40;'Y',&#40;time&#40;&#41;/86400&#41;&#41;- realdate &#40;'Y',$postrow&#91;$i&#93;&#91;'user_birthday'&#93;&#41;; 
   if &#40;date&#40;'md'&#41;<realdate&#40;'md',$postrow&#91;$i&#93;&#91;'user_birthday'&#93;&#41;&#41; $poster_age--; 
   $poster_age = $lang&#91;'Age'&#93; . '&#58;' . $poster_age .' '; 
&#125; else $poster_age = ' '; 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
if &#40; $poster_id == ANONYMOUS && $postrow&#91;$i&#93;&#91;'post_username'&#93; != '' &#41;
&#123;
	$poster = $postrow&#91;$i&#93;&#91;'post_username'&#93;;
	$poster_rank = $lang&#91;'Guest'&#93;;

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
$poster_age=''; 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'POSTER_NAME' => $poster, 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
'POSTER_AGE' => $poster_age, 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Private_Messages/index.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
// ---------- 
// Start main 
// 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
if&#40; $mode == 'birthday' &#41; 
&#123; 
   $gen_simple_header = TRUE; 
   $page_title = $lang&#91;'Greeting_Messaging'&#93;; 
   include&#40;$phpbb_root_path . 'includes/page_header.'.$phpEx&#41;; 
   $l_greeting = &#40; date&#40;'dm'&#41;==realdate&#40;'dm',$userdata&#91;'user_birthday'&#93;&#41;&#41; ? 
      sprintf &#40; $lang&#91;'Birthday_greeting_today'&#93;, 
         date&#40;'Y'&#41;-realdate&#40;'Y',$userdata&#91;'user_birthday'&#93;&#41; &#41; &#58; 
      sprintf &#40; $lang&#91;'Birthday_greeting_prev'&#93;, 
         date&#40;'Y'&#41;-realdate&#40;'Y',$userdata&#91;'user_birthday'&#93;&#41; , 
         realdate&#40;str_replace&#40;'Y','',$lang&#91;'DATE_FORMAT'&#93;&#41;,$userdata&#91;'user_birthday'&#93;&#41; &#41;; 
   $template->set_filenames&#40;array&#40; 
      'body' => 'greeting_popup.tpl'&#41;&#41;; 
   $template->assign_vars&#40;array&#40; 
      'L_CLOSE_WINDOW' => $lang&#91;'Close_window'&#93;, 
      'L_MESSAGE' => $l_greeting &#41;&#41;; 
   $template->pparse&#40;'body'&#41;; 
   include&#40;$phpbb_root_path . 'includes/page_tail.'.$phpEx&#41;; 
&#125; else 


# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/includes/page_header.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
//
// Obtain number of new private messages

# 
#-----&#91; BEFORE, ADD &#93;------------------------------------------ 
# 
$year=create_date&#40;'Y', time&#40;&#41;, $board_config&#91;'board_timezone'&#93;&#41;; 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
// 
// Obtain number of new private messages 
// if user is logged in 
// 
if&#40; $userdata&#91;'session_logged_in'&#93; &#41; 
&#123; 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
      // see if user has or have had birthday, also see if greeting are enabled 
	$year=create_date&#40;'Y', time&#40;&#41;, $board_config&#91;'default_timezone'&#93;&#41;;
	if &#40;$userdata&#91;'user_birthday'&#93;!=999999 && $board_config&#91;'birthday_greeting'&#93; && create_date&#40;'Ymd', time&#40;&#41;, $board_config&#91;'default_timezone'&#93;&#41; >= $userdata&#91;'user_next_birthday_greeting'&#93;.realdate &#40;'md',$userdata&#91;'user_birthday'&#93;&#41;&#41; 
      &#123; 
         $sql = "UPDATE " . USERS_TABLE . " 
            SET user_next_birthday_greeting = " . &#40;$year+1&#41; . " 
            WHERE user_id = " . $userdata&#91;'user_id'&#93;;
         if&#40; !$status = $db->sql_query&#40;$sql&#41; &#41; 
         &#123; 
            message_die&#40;GENERAL_ERROR, "Could not update next_birthday_greeting for user.", "", __LINE__, __FILE__, $sql&#41;; 
         &#125; 
		$db->sql_freeresult&#40;$status&#41;;
         $greeting_flag=1; 
      &#125; else $greeting_flag=0;//Sorry user shall not have a greeting this year

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new, 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
'GREETING_FLAG' => $greeting_flag, 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'U_PRIVATEMSGS_POPUP' => append_sid&#40;'privmsg.'.$phpEx.'?mode=newpm'&#41;,

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
'U_GREETING_POPUP' => append_sid&#40;'privmsg.'.$phpEx.'?mode=birthday'&#41;, 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
if &#40; !empty&#40;$userdata&#91;'user_popup_pm'&#93;&#41; &#41; 
&#123; 
	$template->assign_block_vars&#40;'switch_enable_pm_popup', array&#40;&#41;&#41;; 
&#125;

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
if&#40; date&#40;'Y'&#41; == $userdata&#91;'user_next_birthday_greeting'&#93;&#41; 
   $template->assign_block_vars&#40;'switch_enable_greeting_popup', array&#40;&#41;&#41;; 


# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/index.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
//
// Start output of page

# 
#-----&#91; BEFORE, ADD &#93;------------------------------------------ 
# 
// Birthday Mod, Show users with birthday 
$sql = "SELECT uid, uname, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY uname"; 
if&#40;$result = $db->sql_query&#40;$sql&#41;&#41; 
&#123; 
$birthdayrow = $db->sql_fetchrowset&#40;$result&#41;; 
if &#40;!empty&#40;$birthdayrow&#41;&#41; 
&#123; 
	$year=create_date&#40;'Y', time&#40;&#41;, $board_config&#91;'board_timezone'&#93;&#41;; 
	$date_today = create_date&#40;'Ymd', time&#40;&#41;, $board_config&#91;'board_timezone'&#93;&#41;; 
	$date_forward = create_date&#40;'Ymd', time&#40;&#41;+&#40;$board_config&#91;'birthday_check_day'&#93;*86400&#41;, $board_config&#91;'board_timezone'&#93;&#41;; 
      for&#40;$i = 0; $i < count&#40;$birthdayrow&#41;; $i++&#41; 
      &#123; 
	      $user_birthday=realdate&#40;"md",$birthdayrow&#91;$i&#93;&#91;'user_birthday'&#93;&#41;; 
      	$user_birthday2=&#40;&#40;$year.$user_birthday<$date_today&#41;? $year+1&#58;$year&#41;.$user_birthday; 
		if &#40;$user_birthday2==$date_today&#41; 
      	&#123; 
			//user have birthday today 
			$user_age=$year- realdate &#40;'Y',$birthdayrow&#91;$i&#93;&#91;'user_birthday'&#93;&#41;; 
			$style_color = &#40;$birthdayrow&#91;$i&#93;&#91;'user_level'&#93; == ADMIN &#41;?'style="color&#58;#' . $theme&#91;'fontcolor3'&#93; . '"'&#58;&#40;&#40; $birthdayrow&#91;$i&#93;&#91;'user_level'&#93; == MOD &#41;?'style="color&#58;#' . $theme&#91;'fontcolor2'&#93; . '"'&#58;''&#41;; 
			$birthday_today_list .= ' <a href="' . append_sid&#40;"profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow&#91;$i&#93;&#91;'uid'&#93;&#41; . '"' . $style_color .'><b>' . $birthdayrow&#91;$i&#93;&#91;'uname'&#93; . ' &#40;'.$user_age.'&#41;</b></a>'; 
	      &#125;
		else if &#40;$user_birthday2>$date_today  && $user_birthday2<=$date_forward&#41; 
		&#123; 
			// user are having birthday within the next days 
			$user_age=&#40;$year.$user_birthday<$date_today&#41;?$year- realdate &#40;'Y',$birthdayrow&#91;$i&#93;&#91;'user_birthday'&#93;&#41;+1&#58;$year- realdate &#40;'Y',$birthdayrow&#91;$i&#93;&#91;'user_birthday'&#93;&#41;; 
			$style_color = &#40;$birthdayrow&#91;$i&#93;&#91;'user_level'&#93; == ADMIN &#41;?'style="color&#58;#' . $theme&#91;'fontcolor3'&#93; . '"'&#58;&#40;&#40; $birthdayrow&#91;$i&#93;&#91;'user_level'&#93; == MOD &#41;?'style="color&#58;#' . $theme&#91;'fontcolor2'&#93; . '"'&#58;''&#41;; 
			$birthday_week_list .= ' <a href="' . append_sid&#40;"profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $birthdayrow&#91;$i&#93;&#91;'uid'&#93;&#41; . '"' . $style_color .'><b>' . $birthdayrow&#91;$i&#93;&#91;'uname'&#93; . ' &#40;'.$user_age.'&#41;</b></a>';
		&#125; 
	&#125; 
&#125; 
&#125;
$db->sql_freeresult&#40;$result&#41;;

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'L_FORUM' => $lang&#91;'Forum'&#93;,

# 
#-----&#91; BEFORE, ADD &#93;------------------------------------------ 
# 
'L_WHOSBIRTHDAY_WEEK' => sprintf&#40;&#40;&#40;$birthday_week_list&#41;? $lang &#91;'Birthday_week'&#93;.$birthday_week_list&#58;$lang &#91;'Nobirthday_week'&#93;&#41;,$board_config&#91;'birthday_check_day'&#93;&#41;, 
'L_WHOSBIRTHDAY_TODAY' =>&#40;$birthday_today_list&&$board_config&#91;'birthday_check_day'&#93;&#41;? $lang &#91;'Birthday_today'&#93;.$birthday_today_list&#58;$lang &#91;'Nobirthday_today'&#93;, 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
# &#40;make sure to edit this file for every theme you use&#41;. 
templates/Subsilver/profile_view_body.tpl 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
<tr> 
  <td valign="top" align="right" nowrap="nowrap"><span class="gen">&#123;L_INTERESTS&#125;&#58;</span></td>
  <td> <b><span class="gen">&#123;INTERESTS&#125;</span></b></td>
</tr>

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
<tr> 
  <td valign="top" align="right" nowrap="nowrap"><span class="gen">&#123;L_BIRTHDAY&#125;&#58;</span></td>
  <td> <b><span class="gen">&#123;BIRTHDAY&#125;</span></b></td>
</tr>


# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
# &#40;make sure to edit this file for every theme you use&#41;. 
moduels/Forums/templates/subsilver/profile_add_body.tpl

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
<tr> 
      <td class="row1"><span class="gen">&#123;L_INTERESTS&#125;&#58;</span></td> 
      <td class="row2"> 
      <input type="text" class="post"style="width&#58; 200px"  name="interests" size="35" maxlength="150" value="&#123;INTERESTS&#125;" /> 
      </td> 
</tr> 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
<tr> 
   <td class="row1"><span class="gen">&#123;L_BIRTHDAY&#125;&#58;</span><br /><span class="gensmall">&#123;L_BIRTHDAY_EXPLAIN&#125;<br /></span></td> 
   <td class="row2"><input type="text" class="post"style="width&#58; 80px"  name="birthday" size="10" maxlength="10" value="&#123;BIRTHDAY&#125;" /></td> 
</tr> 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
# &#40;make sure to edit this file for every theme you use&#41;. 
templates/Subsilver/viewtopic_body.tpl

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
     &#123;postrow.RANK_IMAGE&#125;&#123;postrow.POSTER_AVATAR&#125;<br /> 
     <br /> 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
&#123;postrow.POSTER_AGE&#125;<br /> 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
# &#40;make sure to edit this file for every theme you use&#41;. 
phpBB2/templates/Subsilver/overall_header.tpl

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
<!-- END switch_enable_pm_popup --> 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
<!-- BEGIN switch_enable_greeting_popup --> 
<script language="Javascript" type="text/javascript"> 
<!-- 
   var greeting_flag = &#123;GREETING_FLAG&#125;; 

   if&#40; greeting_flag &#41; 
   &#123; 
      window.open&#40;'&#123;U_GREETING_POPUP&#125;', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400'&#41;; 
   &#125; 
//--> 
</script> 
<!-- END switch_enable_greeting_popup --> 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
# &#40;make sure to edit this file for every theme you use&#41;. 
templates/Subsilver/index_body.tpl

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
<td class="row1" align="center" valign="middle" rowspan="2">

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
#
# This value can be different, if other mods, add 1 to the value 
2

# 
#-----&#91; IN-LINE REPLACE WITH &#93;------------------------------------------ 
#
3

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
&#123;LOGGED_IN_USER_LIST&#125;</span></td> 
</tr> 

# 
#-----&#91; AFTER, ADD &#93;------------------------------------------ 
# 
  <tr> 
   <td class="row1" align="left"><span class="gensmall">&#123;L_WHOSBIRTHDAY_TODAY&#125;<br />&#123;L_WHOSBIRTHDAY_WEEK&#125;</span></td>    
  </tr> 

# 
#-----&#91; COPY &#93;------------------------------------------ 
# 
copy greeting_popup.tpl.tpl to templates/Subsilver/greeting_popup.tpl 


# 
#-----&#91; SAVE/CLOSE ALL FILES &#93;------------------------------------------ 
# 
#EoM

Κώδικας: Επιλογή όλων

########################################################
## Mod Title&#58;   Birthday Admin Mod 
## Mod Version&#58; 1.2.1.
## Author&#58;       Niels Chr. Denmark < ncr@db9.dk > &#40;Niels Chr. Rψd&#41; HTTP&#58;//mods.db9.dk
## Modified by Dennis Donker in order to make it work under phpnuke ported version of phpbb &#40;version 2.0.6&#41;
## from bbtonuke.sourceforge.net if you have found bugs or problems Just visit my site &#58;&#58; http&#58;//portedmods.sourceforge.net
## Description&#58;  This mod is part 2, of a birthday mod. 
## It will make it easyer for a administrator to control how 
## the birthday mod works. 
## Fetures &#40;all in admin panel&#41;&#58; 
##   board configuation, ability to enable/disable birthday greeting popup 
##   board configuration, ability to specify max/min user age 
##   board configuration, ability to specify days to look forward, to show users with birthday 
##   users profile, posible for admin to change users birthday 
##   Users profile, witch year next popup will ocoure - if user submit a profile with a birthday - this will though be overwritten ! 
## 
## This mod is for phpBB2!! ver 2.0.0 
## 
## 
## Installation Level&#58;  Easy 
## Installation Time&#58;   10-20 Minutes 
## Files To Edit&#58;      5
##   moduels/Forums/Admin/admin_board.php
##   moduels/Forums/Admin/admin_users.php
##   moduels/Forums/language/lang_english/lang_admin.php
##   moduels/Forums/templates/subsilver/board_config_body.tpl
##   moduels/Forums/templates/subsilver/user_edit_body.tpl
##
##	History&#58;
##	0.9.0. - initial BETA release phpBB2 RC-2
##	1.0.0. - initial release
##	1.1.0. - initial relese phpBB2 ver 2.0.0.
##	1.1.2. - history started
##	1.1.3. - missed some </span> tags in user_edit_body.tpl
##	1.1.4. - lang_admin.php changed
##	1.2.0. - now confirmed for phpBB2 version 2.0.2
##	1.2.1. - corrected that admin could manual set the next birthday popup year
##
##
############################################################## 
## This MOD is released under the GPL License. 
## Intellectual Property is retained by the MOD Author&#40;s&#41; listed above 
############################################################## 
## For Security Purposes, Please Check&#58; http&#58;//www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at&#58; http&#58;//www.phpbb.com/mods/downloads/ 
############################################################## 
## Authors Notes&#58; 
##
## Asumes part 1 have already been done
## 
## The most important thing to keep in mind is, take your time, make 
## sure you are finding the correct lines to modify, then take care to paste the new code. 
## Please also keep in mind, if you are using more than one language file or theme at your 
## site, you will need to edit the corrosponding files for each occurrence.  Good Luck! 
######################################################## 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
#  &#40;make sure to edit this file for every language your admin uses&#41;. 
moduels/Forums/language/lang_english/lang_admin.php

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
#  AT THE BOTTOM OF THE PAGE 
// 
// That's all Folks! 

# 
#-----&#91; ADD BEFORE &#93;------------------------------------------ 
# 
//Added birthday mod 
$lang&#91;'Enable_birthday_greeting'&#93; = 'Enable birthday greetings'; 
$lang&#91;'Birthday_greeting_expain'&#93; = 'Users who have submitted a birthday can have a birthday greeting, when thy visit the board'; 
$lang&#91;'Next_birthday_greeting'&#93; = 'Next birthday popup year'; 
$lang&#91;'Next_birthday_greeting_expain'&#93; = 'This field keeps track of the next year the user shall have a birthday greeting'; 
$lang&#91;'Wrong_next_birthday_greeting'&#93; = 'The supplied, next birthday popup year, was not valid, please try again'; 
$lang&#91;'Max_user_age'&#93; = 'Maximum user age'; 
$lang&#91;'Min_user_age'&#93; = 'Minimum user age'; 
$lang&#91;'Min_user_age_explain'&#93; = 'Setting this value to 0, will force user to enter a birthday';
$lang&#91;'Birthday_lookforward'&#93; = 'Birthday look forward'; 
$lang&#91;'Birthday_lookforward_explain'&#93; = 'Number of days the script shall look forward for users with a birthday'; 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/admin/admin_board.php

#
#-----&#91; FIND &#93;------------------------------------------ 
# 
$prune_no = &#40; !$new&#91;'prune_enable'&#93; &#41; ? "checked=\"checked\"" &#58; ""; 


# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
$birthday_greeting_yes = &#40; $new&#91;'birthday_greeting'&#93; &#41; ? "checked=\"checked\"" &#58; ""; 
$birthday_greeting_no = &#40; !$new&#91;'birthday_greeting'&#93; &#41; ? "checked=\"checked\"" &#58; ""; 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
"L_ENABLE_PRUNE" => $lang&#91;'Enable_prune'&#93;, 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
'L_ENABLE_BIRTHDAY_GREETING' => $lang&#91;'Enable_birthday_greeting'&#93;, 
'L_BIRTHDAY_GREETING_EXPLAIN' => $lang&#91;'Birthday_greeting_expain'&#93;, 
'L_MAX_USER_AGE' => $lang&#91;'Max_user_age'&#93;, 
'L_MIN_USER_AGE' => $lang&#91;'Min_user_age'&#93;, 
'L_MIN_USER_AGE_EXPLAIN' => $lang&#91;'Min_user_age_explain'&#93;, 
'L_BIRTHDAY_LOOKFORWARD' => $lang&#91;'Birthday_lookforward'&#93;, 
'L_BIRTHDAY_LOOKFORWARD_EXPLAIN' => $lang&#91;'Birthday_lookforward_explain'&#93;, 

# 
#-----&#91; FIND &#93;------------------------------------------ 
#
 "PRUNE_NO" => $prune_no, 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
'BIRTHDAY_GREETING_YES' => $birthday_greeting_yes, 
'BIRTHDAY_GREETING_NO' => $birthday_greeting_no, 
'MAX_USER_AGE' => $new&#91;'max_user_age'&#93;, 
'MIN_USER_AGE' => $new&#91;'min_user_age'&#93;,
'BIRTHDAY_LOOKFORWARD' => $new&#91;'birthday_check_day'&#93;,

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
# &#40;make sure to edit this file for every theme your admin uses&#41;. 
templates/SubSilver/admin/board_config_body.tpl

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
&#123;PRUNE_NO&#125; /> &#123;L_NO&#125;</td>
</tr> 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
<tr> 
   <td class="row1">&#123;L_ENABLE_BIRTHDAY_GREETING&#125;<br /><span class="gensmall">&#123;L_BIRTHDAY_GREETING_EXPLAIN&#125;</span></td> 
   <td class="row2"><input type="radio" name="birthday_greeting" value="1" &#123;BIRTHDAY_GREETING_YES&#125; /> &#123;L_YES&#125;&nbsp;&nbsp;<input type="radio" name="birthday_greeting" value="0" &#123;BIRTHDAY_GREETING_NO&#125; /> &#123;L_NO&#125;</td> 
</tr> 
<tr> 
   <td class="row1">&#123;L_MAX_USER_AGE&#125;<br /></td> 
   <td class="row2"><input type="text" size="4" maxlength="4" name="max_user_age" value="&#123;MAX_USER_AGE&#125;" /></td> 
</tr> 
<tr> 
   <td class="row1">&#123;L_MIN_USER_AGE&#125;<br /><span class="gensmall">&#123;L_MIN_USER_AGE_EXPLAIN&#125;</span></td> 
   <td class="row2"><input type="text" size="4" maxlength="4" name="min_user_age" value="&#123;MIN_USER_AGE&#125;" /></td> 
</tr> 
<tr> 
   <td class="row1">&#123;L_BIRTHDAY_LOOKFORWARD&#125;<br /><span class="gensmall">&#123;L_BIRTHDAY_LOOKFORWARD_EXPLAIN&#125;</span></td> 
   <td class="row2"><input type="text" size="3" maxlength="3" name="birthday_check_day" value="&#123;BIRTHDAY_LOOKFORWARD&#125;" /></td> 
</tr>


# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
moduels/Forums/admin/admin_users.php
 
# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$interests = &#40; !empty&#40;$HTTP_POST_VARS&#91;'interests'&#93;&#41; &#41; ? trim&#40;strip_tags&#40; $HTTP_POST_VARS&#91;'interests'&#93; &#41; &#41; &#58; '';

     
# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
$birthday = &#40; !empty&#40;$HTTP_POST_VARS&#91;'birthday'&#93;&#41; &#41; ? trim&#40;strip_tags&#40; $HTTP_POST_VARS&#91;'birthday'&#93; &#41; &#41; &#58; '';
$next_birthday_greeting = &#40; !empty&#40;$HTTP_POST_VARS&#91;'next_birthday_greeting'&#93;&#41; &#41; ? intval&#40; $HTTP_POST_VARS&#91;'next_birthday_greeting'&#93; &#41; &#58; 0;
        
# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$interests = stripslashes&#40;$interests&#41;; 
          
# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
$birthday = stripslashes&#40;$birthday&#41;; 
          
# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
// Update entry in DB 
// 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 

// validation of next_birthday_greeting field value 
if &#40;!empty&#40;$next_birthday_greeting&#41;&#41; 
&#123; 
   if &#40;!&#40;$next_birthday_greeting>2000 && $next_birthday_greeting<2099&#41;&#41; 
   &#123; 
      $error = TRUE; 
      if&#40; isset&#40;$error_msg&#41; &#41;   $error_msg .= '<br />'; 
      $error_msg .= $lang&#91;'Wrong_next_birthday_greeting'&#93;; 
   &#125;// value is alrigt parse it trough 
&#125; else $next_birthday_greeting =0; 
// find the birthday values, reflected by the $lang&#91;'Submit_date_format'&#93; 
if &#40;$birthday&#41; //if a birthday is submited, then validate it 
&#123; 
   for &#40;$i=0;$i<=strlen&#40;$lang&#91;'Submit_date_format'&#93;&#41;;$i++&#41; 
   &#123; 
      switch &#40;$lang&#91;'Submit_date_format'&#93;&#91;$i&#93;&#41; 
      &#123; 
           case d&#58;   $day=$birthday_lengt;$date_count++; 
            $birthday_lengt++;break; 
           case m&#58;   $md=$birthday_lengt;$date_count++; 
            $birthday_lengt++;break; 
          case Y&#58;   $year=$birthday_lengt;$date_count++; 
            $birthday_lengt=$birthday_lengt+3;break; 
      &#125; 
      $birthday_lengt++; 
   &#125; 
   // did we find both day,month and year 
   if &#40;$date_count<3&#41; 
   &#123; 
      $error = TRUE; 
      if&#40; isset&#40;$error_msg&#41; &#41;   $error_msg .= '<br />'; 
      $error_msg .= $lang&#91;'Wrong_birthday_format'&#93;; 
   &#125; else 
   &#123; 
      $day=$birthday&#91;$day&#93;.$birthday&#91;$day+1&#93;; 
      $md=$birthday&#91;$md&#93;.$birthday&#91;$md+1&#93;; 
      $year=$birthday&#91;$year&#93;.$birthday&#91;$year+1&#93;.$birthday&#91;$year+2&#93;.$birthday&#91;$year+3&#93;; 
      if &#40;!checkdate&#40;$md,$day,$year&#41;&#41; 
      &#123; 
         $error = TRUE; 
         if&#40; isset&#40;$error_msg&#41; &#41;   $error_msg .= '<br />'; 
         $error_msg .= $lang&#91;'Wrong_birthday_format'&#93;; 
      &#125; else 

      &#123; 
         $birthday = &#40;$error&#41; ? $birthday &#58; mkrealdate&#40;$day,$md,$year&#41;; 
         $next_birthday_greeting = &#40;$next_birthday_greeting&#41; ? $next_birthday_greeting &#58; &#40;&#40;date&#40;'md'&#41;<$md.$day&#41; ? date&#40;'Y'&#41;&#58;date&#40;'Y'&#41;+1&#41; ; 
      &#125; 
   &#125;    
&#125; else $birthday = &#40;$error&#41; ? '' &#58; 999999;	

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$sql = "UPDATE " . USERS_TABLE . " 
SET "

# 
#-----&#91; IN-LINE FIND &#93;------------------------------------------ 
# 
" . $avatar_sql . "

# 
#-----&#91; IN-LINE BEFORE ADD &#93;------------------------------------------ 
# 
, user_birthday = $birthday, user_next_birthday_greeting=$next_birthday_greeting

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$interests = stripslashes&#40;$interests&#41;; 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
$birthday = stripslashes&#40;$birthday&#41;; 
          
# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$interests = $this_userdata&#91;'user_interests'&#93;; 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
$birthday = &#40;$this_userdata&#91;'user_birthday'&#93;!=999999&#41; ? realdate&#40;$lang&#91;'Submit_date_format'&#93;,$this_userdata&#91;'user_birthday'&#93;&#41;&#58;''; 
$next_birthday_greeting=&#40;$this_userdata&#91;'user_next_birthday_greeting'&#93;&#41;?$this_userdata&#91;'user_next_birthday_greeting'&#93;&#58;''; 
        
# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
$s_hidden_fields .= '<input type="hidden" name="interests" value="' . str_replace&#40;"\"", "&quot;", $interests&#41; . '" />';

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
$s_hidden_fields .= '<input type="hidden" name="birthday" value="' . str_replace&#40;"\"", "&quot;", $birthday&#41; . '" />'; 
$s_hidden_fields .= '<input type="hidden" name="next_birthday_greeting" value="' . str_replace&#40;"\"", "&quot;", $next_birthday_greeting&#41; . '" />';    

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'INTERESTS' => $interests, 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
'BIRTHDAY' => $birthday, 
'NEXT_BIRTHDAY_GREETING' => $next_birthday_greeting, 

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
'L_INTERESTS' => $lang&#91;'Interests'&#93;, 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
'L_BIRTHDAY' => $lang&#91;'Birthday'&#93;, 
'L_BIRTHDAY_EXPLAIN' =>sprintf&#40;$lang&#91;'Birthday_explain'&#93;,$lang&#91;'Submit_date_format'&#93;,date&#40;$lang&#91;'Submit_date_format'&#93;&#41;&#41;, 
'L_NEXT_BIRTHDAY_GREETING'=>$lang&#91;'Next_birthday_greeting'&#93;, 
'L_NEXT_BIRTHDAY_GREETING_EXPLAIN'=> $lang&#91;'Next_birthday_greeting_expain'&#93;, 

# 
#-----&#91; OPEN &#93;------------------------------------------ 
# 
#&#40;make sure to edit this file for every theme you use&#41;.   
moduels/Forums/templates/subsilver/admin/user_edit_body.tpl

# 
#-----&#91; FIND &#93;------------------------------------------ 
# 
<input type="text" name="interests" size="35" maxlength="150" value="&#123;INTERESTS&#125;" /> 
</td> 
</tr> 

# 
#-----&#91; ADD AFTER &#93;------------------------------------------ 
# 
<tr> 
   <td class="row1"><span class="gen">&#123;L_BIRTHDAY&#125;&#58;</span><br /><span class="gensmall">&#123;L_BIRTHDAY_EXPLAIN&#125;<br /></span></td> 
   <td class="row2"><input type="text" class="post"style="width&#58; 80px"  name="birthday" size="10" maxlength="10" value="&#123;BIRTHDAY&#125;" /></td> 
</tr> 
<tr> 
   <td class="row1"><span class="gen">&#123;L_NEXT_BIRTHDAY_GREETING&#125;&#58;</span><br /><span class="gensmall">&#123;L_NEXT_BIRTHDAY_GREETING_EXPLAIN&#125;<br /></span></td> 
   <td class="row2"><input type="text" class="post"style="width&#58; 40px"  name="next_birthday_greeting" size="5" maxlength="4" value="&#123;NEXT_BIRTHDAY_GREETING&#125;" /></td> 
</tr> 

# 
#-----&#91; SAVE/CLOSE ALL FILES &#93;------------------------------------------ 
# 
#EoM

Άβαταρ μέλους
xmavidis
Honorary Member
Δημοσιεύσεις: 1217
Εγγραφή: 02 Δεκ 2003 19:59
Τοποθεσία: Ηράκλειο

Birthday mod

Δημοσίευση από xmavidis » 05 Απρ 2004 12:47

Έχει βάλει κανείς στο προφίλ του την ημερομηνία γέννησης?
I want to know God’s thoughts; the rest are details.
Albert Einstein

Άβαταρ μέλους
Sfinaki
Δημοσιεύσεις: 541
Εγγραφή: 08 Ιουν 2003 22:41
Τοποθεσία: Ηράκλειο Κρήτη
Επικοινωνία:

Birthday mod

Δημοσίευση από Sfinaki » 05 Απρ 2004 16:50

Μα και φυσικά έχουν βάλει ημερομηνία γεννήσεως πολλά μέλη και πρώτος εγώ για να τσεκάρω, με ημερομηνία γεννήσεως τη χθεσινή και τη σημερινή αλλάζοντας το προφίλ μου.

Απάντηση

Επιστροφή στο “PHP έτοιμες εφαρμογές”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες