Dit is het stukje mod dat weer nodig is om de twee mods samen te laten
werken.
##############################################################
## MOD Title: Birthday Extension for Topic Calender & Birthday Mod
## MOD Author: Flani <
info@flanisoft.at >
## MOD Description: This mod will add birthdays to your Topic Calender.
## You don't need the PCP for it.
## MOD Version: 0.9.4
## MOD Compatibility: 2.0.6
##
## Requierements: Topic Calender
## Birthday Mod (Niels <
ncr@db9.dk > (Niels Chr. Rød) )
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit: 2
## includes/functions_calender.php
## language/lang_english/lang_extend_topic_calendar.php
##
## Included Files: 1
## cake.gif
##
##############################################################
## For Security Purposes, Please Check:
http://www.phpbb.com/mods/ 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:
http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## Avatar routine coded by Polar
##
## 1. Full MOD description
## -----------
## This mod, will add all members birthdays to the Topic Calender.
## You'll need Topic Calender and the Birthday Mod installed to run this Mod.
## A link leads to the users profile.
##
## 2. Official last version link
## -----------
## ??
##
## 3. Todo - Next Version
## -----------
## Optimizing.
## Read only informations out that are valid for a specific timerange
##
##
##
##############################################################
## MOD History:
##
##
## 2004-02-04 - Version 0.9.0
## - initial beta
##
## 2004-02-06 - Version 0.9.1
## - Date problem fixed
## should now work with any dateformat
##
## 2004-02-26 - Version 0.9.2
## - Age added
## Age is now displayed in the Calendar
##
## 2004-02-26 - Version 0.9.3
## - Bug fixed (sprintf (to few paramenters..))
##
## 2004-04-01 - Version 0.9.4
## - Avatar included (thanks to Polar)
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#
#-----[ COPY ]------------------------------------------------
#
cake.gif --> ./images/cake.gif
#
#-----[ OPEN ]------------------------------------------------
#
includes/functions_calendar.php
#
#-----[ FIND ]------------------------------------------------
#
//
// birthday (only with PCP)
//
#
#-----[ BEVORE, ADD ]------------------------------------------
#
//
// Birthday Mod for Topic Calendar & Birthday Mod without PCP
//
function get_birthday(&$events, &$number, $start_date, $end_date, $limit=false, $start=0, $max_limit=-1)
{
global $template, $lang, $images, $userdata, $board_config, $db, $phpbb_root_path, $phpEx;
$sql = "SELECT u.*
FROM " . USERS_TABLE . " AS u
WHERE u.user_id <> " . ANONYMOUS . "
AND u.user_birthday <> 999999
ORDER BY username";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not read user table to get birthday today info', '', __LINE__, __FILE__, $sql);
}
// get the number of occurences
$number = $db->sql_numrows($result);
// if limit per page asked, limit the number of results
// read users
while ($row = $db->sql_fetchrow($result))
{
$user_id = $row['user_id'];
$username = $row['username'];
$user_birthday = realdate($lang['DATE_FORMAT'], $row['user_birthday']);
$ignore = $row['user_ignore'];
$friend = $row['user_friend'];
$always_visible = $row['user_visible'];
$username_link = append_sid($phpbb_root_path . "./profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
$event_day = realdate('d',$row['user_birthday']);
$event_month = realdate('n',$row['user_birthday']);
$event_year2 = realdate('Y',$row['user_birthday']);
$start_month = intval(date('m', $start_date));
$event_year = intval(date('Y', $start_date));
if ($event_month < $start_month) $event_year++;
$event_time = mktime( 0,0,0, $event_month, $event_day, $event_year );
// avatar
$avatar_display = ( $userdata['user_viewavatar'] && $row['user_allowavatar'] );
$avatar = '';
if ( $avatar_display && $row['user_avatar_type'] )
{
switch( $row['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}
// Alter berrechnen
$age = $event_year - $event_year2;
if ( intval(substr($user_birthday, 4, 4)) > intval(date('md', $event_time)) ) $age--;
if ($age <= 0) $age = '';
$tmp_message = sprintf($lang['birthday_message'],"<img src='".$phpbb_root_path."images/cake.gif'>",$username,$avatar,$age);
$message = htmlspecialchars("<table cellspacing='1' cellpadding='2' border='0' width='100%' class='forumline'><tr><td class='row1' nowrap='nowrap'><b>".$lang['birthday_header']."</b><span class='topictitle'></span><hr /><span class='genmed'>".$tmp_message."</span></td></tr></table>");
$message = preg_replace("/[\n\r]{1,2}/", '', $message);
$new_row = array();
$new_row['event_id'] = POST_USERS_URL . $user_id;
$new_row['event_author_id'] = $user_id;
$new_row['event_author'] = $username;
$new_row['event_time'] = $event_time;
$new_row['event_last_author_id'] = '';
$new_row['event_last_author'] = '';
$new_row['event_last_time'] = '';
$new_row['event_replies'] = '';
$new_row['event_views'] = '';
$new_row['event_type'] = POST_BIRTHDAY;
$new_row['event_vote'] = '';
$new_row['event_status'] = '';
$new_row['event_moved_id'] = '';
$new_row['event_last_id'] = '';
$new_row['event_forum_id'] = '';
$new_row['event_forum_name'] = '';
$new_row['event_icon'] = '';
$new_row['event_title'] = $username;
$new_row['event_short_title'] = $username;
$new_row['event_message'] = $message;
$new_row['event_calendar_time'] = $event_time;
$new_row['event_calendar_duration'] = '';
$new_row['event_link'] = $username_link;
$new_row['event_txt_class'] = $txt_class;
$new_row['event_type_icon'] = '<img src="' . $images['icon_tiny_profile'] . '" border="0" align="absbottom" hspace="2" />';
$events[] = $new_row;
}
}
#
#-----[ FIND ]------------------------------------------------
#
# around line 401
#
$message = $row['post_text'];
#
#-----[ REPLACE WITH ]------------------------------------------------
#
$message = htmlspecialchars($row['post_text']);
#
#-----[ FIND ]------------------------------------------------
#
get_event_PCP_birthday($events, $number, $start_date, $end_date);
#
#-----[ AFTER, ADD ]------------------------------------------------
#
get_birthday($events, $number, $start_date, $end_date);
#
#-----[ OPEN ]------------------------------------------------
#
# do the same with all other languages you've installed
#
language/lang_english/lang_extend_topic_calendar.php
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
$lang['birthday_header'] = 'Happy Birthday!';
$lang['birthday_message'] = '<center>%s <br />Hi, <b> %s </b><br /> %s <br /> Die Administratoren<br /> Gratuliert Dir Herzlich zu<br /> Deinem %s Geburtstag !</center>';
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM