Code: Selecteer alles
#################################################################
## Mod Title: Today's Events Hack (Calendar Add-on)
## Mod Version: 1.2
## Author: Burning_Cyclope
## Description: This hack is an add-on to the popular Calendar hack. It take the day's
## events, and displays them in a seperate table under the "Who's Online" table.
##
## Installation Level: Moderate
## Installation Time: ~10 mins.
## Files To Edit: includes/page_header.php, templates/xxx/index_body.tpl, calendar.php
## Included Files: cal_day_events_lite_nh.tpl
#################################################################
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites
#################################################################
## Author Notes:
##
## - I am aware of the bug that creates an outline around the events on some themes, I will try to fix this in a later version.
##
## - YOU *MUST* HAVE THE "Allow anonymous viewing" OPTION SET TO "YES" UNDER CALENDAR OPTIONS FOR THIS HACK TO DISPLAY PROPERLY FOR GUESTS
##
#################################################################
##
## Installation
##
## 1) Upload all files to their respective location in this format.
##
## /templates/{template name}/cal_day_events_lite_nh.tpl
##
## 2) Read below to make the rest of the changes.
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ OPEN ]------------------------------------------
#
/includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
$l_online_users = sprintf($l_t_user_s, $total_online_users);
$l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
$l_online_users .= sprintf($l_g_user_s, $guests_online);
}
#
#-----[ ADD, UNDERNEATH ]------------------------------------------
#
//
// Calculate What day it is, and set a link for the iframe
//
$d_var = date ("j");
$m_var = date ("m");
$y_var = date ("Y");
$day_events_link = "calendar.$phpEx?day=$d_var&month=$m_var&year=$y_var&mode=displaytoday";
$h_day_events_link = "calendar.$phpEx?day=$d_var&month=$m_var&year=$y_var&mode=display";
#
#-----[ FIND ]------------------------------------------
#
'T_SPAN_CLASS3' => $theme['span_class3'],
#
#-----[ ADD, UNDERNEATH ]------------------------------------------
#
'DAY_EVENTS_LINK' => $day_events_link,
'U_DAY_EVENTS_LINK' => $h_day_events_link,
#
#-----[ OPEN ]------------------------------------------
#
# repeat this step for each template you have installed on your board
inside templates/xxx/index_body.tpl:
#
#-----[ FIND ]------------------------------------------
#
# This is to have the "Today's Events" UNDER the "Who's Online?" box.
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td>
</table>
#
#-----[ ADD, UNDERNEATH ]------------------------------------------
#
# Modify this code to fit your theme's overall style, if needed
# Also, if you would like to change how tall the box is, modify the height=175 part of the code.
<br />
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="{U_DAY_EVENTS_LINK}" class="cattitle">Today's Events</a></span></td>
</tr>
<tr>
<td>
<IFRAME name=dayevents src="{DAY_EVENTS_LINK}" width="100%" height=175 allowTransparency="true" style="background-color:transparent" frameborder=0></IFRAME>
</td>
</tr></table>
#
#-----[ OPEN ]------------------------------------------
#
calendar.php
#
#-----[ FIND ]------------------------------------------
#
elseif ($mode == 'display') { display(); }
#
#-----[ ADD, UNDERNEATH ]------------------------------------------
#
elseif ($mode == 'displaytoday') { displaytoday(); }
#
#-----[ FIND ]------------------------------------------
#
include ($phpbb_root_path . "includes/page_header.php");
#
#-----[ ADD, *ABOVE* ]------------------------------------------
#
if ($mode == 'displaytoday') {
$gen_simple_header = TRUE;
}
#
#-----[ FIND ]------------------------------------------
#
include_once($phpbb_root_path . 'includes/page_tail.php');
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ($mode != 'displaytoday'){
include_once($phpbb_root_path . 'includes/page_tail.php');
}
#
#-----[ FIND ]------------------------------------------
#
'BUTTON_PREV' => $button_prev,
'BUTTON_NEXT' => $button_next,
'BUTTON_HOME' => $button_home,
'BUTTON_ADD' => $button_add,
'BUTTON_VAL' => $button_val)
);
$template->pparse('body');
return;
}
#
#-----[ ADD, UNDERNEATH ]------------------------------------------
#
function displaytoday()
{
global $thisscript, $phpbb_root_path, $phpEx, $action, $homeurl, $images, $phpbbheaders,
$id, $day, $month, $year, $userdata, $lang, $config_footer, $footer, $caluser,
$endday, $endmonth, $endyear, $board_config, $bbcode_uid, $template, $db, $cal_version;
$currentmonth = create_date("m", time(), $userdata['user_timezone']);
$template->set_filenames(array(
'body' => 'cal_day_events_lite_nh.tpl')
);
$lastseconds = mktime(0,0,0,$month,$day,$year)-(24*60*60);
$lastday = date('j', $lastseconds);
$lastmonth = date('m', $lastseconds);
$lastyear = date('Y', $lastseconds);
$nextseconds = mktime(0,0,0,$month,$day,$year)+(24*60*60);
$nextday = date('j', $nextseconds);
$nextmonth = date('m', $nextseconds);
$nextyear = date('Y', $nextseconds);
$sql = "SELECT * FROM ".CAL_TABLE." WHERE valid = 'yes' AND ";
if ($id) {
$sql .= "id = '$id'";
}
else {
$sql .= "eventspan >= \"$year-$month-$day 00:00:00\" AND stamp <= \"$year-$month-$day 23:59:59\" ORDER BY stamp";
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Event data', '', __LINE__, __FILE__, $sql);
}
$check=0;
while ($row = $db->sql_fetchrow($result))
{
$subject=stripslashes($row['subject']);
$zdesc=stripslashes($row['description']);
$bbcode_uid = $row['bbcode_uid'];
if( $board_config['allow_bbcode'] ) {
$zdesc = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($zdesc, $bbcode_uid) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $zdesc);
}
if ( $board_config['allow_smilies'] )
{
$zdesc = smilies_pass($zdesc);
}
// Delete icon
$today = strtotime(date("Y-m-d"));
$not_old_check = (strtotime($row['stamp']) < $today) ? 1 : 0;
if ((($caluser >=4) && ($userdata['user_id']==$row['user_id'])) || ($caluser >=5)) {
if (!$not_old_check) {
$edit_img = '<a href="'. $thisscript .'?action=Modify_marked&id='.$row['id'].'"><img src="' . $images['icon_edit'] . '" alt="' . $lang['Edit_delete_post'] . '" title="' . $lang['Edit_delete_post'] . '" border="0" /></a>';
}
$delpost_img = '<a href="' . $thisscript .'?action=Delete_marked&id='.$row['id'].'"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
}
else {
$edit_img = '';
$delpost_img = '';
}
$zdesc = make_clickable($zdesc);
$start_date = mydateformat($row['stamp'], $userdata['user_dateformat']);
$end_date = mydateformat($row['eventspan'], $userdata['user_dateformat'], 1);
$template->assign_block_vars('event_row', array(
'SUBJECT' => $subject,
'DATE' => $start_date,
'END_DATE' => $end_date,
'AUTHOR' => stripslashes($row['username']),
'DESC' => $zdesc,
'BUTTON_DEL' => $delpost_img,
'BUTTON_MOD' => $edit_img)
);
$check++;
//echo $row['stamp']; exit;
}
if($check == 0)
{
$template->assign_block_vars('no_events', array(
'NO_EVENTS' => $lang["No events"])
);
}
$template->assign_vars(array(
'SUBJECT' => $lang['Subject'],
'DATE' => $lang['Date'],
'END_DATE' => $lang['End_day'],
'AUTHOR' => $lang['Author'])
);
$template->pparse('body');
return;
}
#
#-----[ SAVE ALL FILES, AND UPLOAD. ]------------------------------------------
#