Habe gerade noch etwas in der functions_calendar.php gefunden.
Code: Alles auswählen
//
// birthday (only with PCP)
//
function get_event_PCP_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;
global $tree;
// init results
$number = 0;
if ($max_limit < 0)
{
$max_limit = $board_config['topics_per_page'];
}
// add birthday events (only with Profile Control Panel) for logged people eyes
if ($board_config['calendar_birthday'] && isset($lang['Happy_birthday']) && isset($userdata['user_birthday']) && ($userdata['user_id'] != ANONYMOUS))
{
// get start month
$sql_where = '';
$work_date = $start_date;
while ( intval(date('Ym', $work_date)) <= intval(date('Ym', $end_date)) )
{
$start_month = date('md', $work_date );
$end_month = date('m', $work_date) . '99';
if ( intval(date('Ym', $work_date)) == intval(date('Ym', $end_date)) )
{
$end_month = date('md', $end_date);
}
$sql_where .= !empty($sql_where) ? ' OR' : '';
$sql_where .= " ( RIGHT(u.user_birthday, 4) >= $start_month AND RIGHT(u.user_birthday, 4) < $end_month )";
// go to next month
$work_year = intval(date('Y', $work_date));
$work_month = intval(date('m', $work_date));
$work_month++;
if ($work_month > 12)
{
$work_month = 1;
$work_year++;
}
$work_date = mktime( 0,0,0, $work_month, 01, $work_year );
}
// select now profiles
if (!empty($sql_where))
{
$user_id = $userdata['user_id'];
$sql = "SELECT u.*,
(CASE WHEN b.buddy_ignore = 0 THEN 1 ELSE 0 END) as user_friend,
i.buddy_ignore AS user_ignore,
b.buddy_visible AS user_visible
FROM ((" . USERS_TABLE . " AS u
LEFT JOIN " . BUDDYS_TABLE . " AS b ON b.user_id=u.user_id AND b.buddy_id=$user_id)
LEFT JOIN " . BUDDYS_TABLE . " AS i ON i.user_id=$user_id AND i.buddy_id=u.user_id)
WHERE u.user_id <> " . ANONYMOUS . "
AND u.user_birthday <> 0
AND u.user_birthday <> ''
AND ( $sql_where )
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
if ($limit)
{
$sql .= " LIMIT $start, $max_limit";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topics information', '', __LINE__, __FILE__, $sql);
}
}
// read users
while ($row = $db->sql_fetchrow($result))
{
// user info
$user_id = $row['user_id'];
$username = $row['username'];
$user_birthday = $row['user_birthday'];
// get user relational status
$ignore = $row['user_ignore'];
$friend = $row['user_friend'];
$always_visible = $row['user_visible'];
// get the status of each info
$real_display = ( !$ignore && $userdata['user_allow_real'] && $row['user_allow_real'] && ( ($row['user_viewreal'] == YES) || ( ($row['user_viewreal'] == FRIEND_ONLY) && $friend ) ) );
// take care of admin status
if ( is_admin($userdata) || ($user_id == $userdata['user_id']) )
{
$real_display = true;
}
if ($real_display)
{
$txt_class = get_user_level_class($row['user_level'], 'genmed', $row);
if ($row['user_allow_viewonline'] != YES)
{
$username = '<i>' . $username . '</i>';
}
$username_link = append_sid($phpbb_root_path . "./profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
$event_month = intval(substr($user_birthday, 4, 2));
$event_day = intval(substr($user_birthday, 6, 2));
$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 );
// build the overview
$det_handler = '_overview_profil_' . $user_id;
$template->set_filenames(array(
$det_handler => 'calendar_overview_profil.tpl')
);
$age = $event_year - intval(substr($user_birthday, 0, 4));
if ( intval(substr($user_birthday, 4, 4)) > intval(date('md', $event_time)) ) $age--;
if ($age <= 0) $age = '';
// avatar
$avatar_display = ( $userdata['user_viewavatar'] && $row['user_allowavatar'] );
if ( is_admin($userdata)|| ($view_user_id == $user_id) )
{
$avatar_display = true;
}
$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;
}
}
$template->assign_vars(array(
'L_TITLE' => $lang['Happy_birthday'],
'L_USERNAME' => $username,
'TXT_CLASS' => $txt_class,
'L_AGE' => $lang['Age'],
'AVATAR' => $avatar,
'AGE' => $age,
)
);
$template->assign_var_from_handle('_calendar_overview', $det_handler);
$message = $template->_tpldata['.'][0]['_calendar_overview'];
// remove \n remaining from the template
$message = preg_replace("/[\n\r]{1,2}/", '', $message);
// store only the new values
$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'] = $images['icon_birthday'];
$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;
}
}
}
}
}
function display_calendar($main_template, $nb_days=0, $start=0)
{
global $template, $lang, $images, $userdata, $board_config, $db, $phpbb_root_path, $phpEx;
global $tree;
static $handler;
if (empty($handler))
{
$handler = 1;
}
else
{
$handler++;
}
$day_of_week = array(
$lang['datetime']['Sunday'],
$lang['datetime']['Monday'],
$lang['datetime']['Tuesday'],
$lang['datetime']['Wednesday'],
$lang['datetime']['Thursday'],
$lang['datetime']['Friday'],
$lang['datetime']['Saturday'],
);
$months = 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'],
);
// get some parameter
$first_day_of_week = isset($board_config['calendar_week_start']) ? intval($board_config['calendar_week_start']) : 1;
$nb_row_per_cell = isset($board_config['calendar_nb_row']) ? intval($board_config['calendar_nb_row']) : 5;
// get the start date - calendar doesn't go before 1971
$cur_date = (empty($start) || (intval(date('Y', $start)) < 1971) ) ? time() : $start;
$cur_date = mktime( 0,0,0, intval(date('m', $cur_date)), intval(date('d', $cur_date)), intval(date('Y', $cur_date)) );
// the full month is displayed
if (empty($nb_days))
{
// set indicator
$full_month = true;
// set the start day on the start of the month
$start_date = mktime( 0,0,0, intval(date('m', $cur_date)), 01, intval(date('Y', $cur_date)) );
// get the day number set as start of the display
$cfg_week_day_start = $first_day_of_week;
// get the number of blank cells
$start_inc = intval(date('w', $start_date )) - $cfg_week_day_start;
if ($start_inc < 0)
{
$start_inc = 7 + $start_inc;
}
// get the end date
$year = intval(date('Y', $start_date));
$month = intval(date('m', $start_date))+1;
if ($month > 12)
{
$year++;
$month = 1;
}
$end_date = mktime( 0,0,0, $month, 01, $year);
// set the number of cells per line
$nb_cells = 7;
// get the number of rows
$nb_rows = intval( ($start_inc + intval(($end_date - $start_date) / 86400)) / $nb_cells ) + 1;
}
else
{
// set indicator
$full_month = false;
// set the start date to the day before the date selected
$start_date = mktime( 0,0,0, date('m', $cur_date), date('d', $cur_date)-1, date('Y', $cur_date));
// get the day number set as start of the week
$cfg_week_day_start = intval(date('w', $start_date));
// get the numbe of blank cells
$start_inc = 0;
// get the end date
$end_date = mktime( 0,0,0, date('m', $start_date), date('d', $start_date) + $nb_days, date('Y', $start_date));
// set the number of cells per line
$nb_cells = $nb_days;
// set the number of rows
$nb_rows = 1;
}
//
// Ok, let's get the various events :)
//
$events = array();
$number = 0;
// topics
get_event_topics($events, $number, $start_date, $end_date);
// birthday
get_event_PCP_birthday($events, $number, $start_date, $end_date);
//
// And now display them
//
Die Birthday Funktion benötigt also nicht nur die functions_profile.php des PCP, sondern um das ganze überhaupt zu starten wird auch noch ein eintrag in der lang_main.php abgefragt der ohne PCP ebenfalls nicht vorhanden ist!
Nachdem ich den lang eintrag gemacht und die functions_profile.php zugefügt habe, bekomme ich eine nette fehlermeldung die mir sagt das die buddy tabelle nicht vorhanden ist und ein generierren dieser tabelle (kopiert aus einem board mit PCP) hat leider an dem fehler nix geändert!
Schaun ma mal weiter ...