Vergleich calendar.php - 1.6.4 - 1.6.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: calendar.php 5420 2011-04-05 08:20:02Z Tomm $

 * $Id$

 */

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'calendar.php');


 */

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'calendar.php');


$templatelist = "calendar_weekdayheader,calendar_weekrow_day,calendar_weekrow,calendar_eventbit_public,calendar_eventbit_private,calendar";

$templatelist = "calendar_weekdayheader,calendar_weekrow_day,calendar_weekrow,calendar,calendar_addevent,calendar_move";

$templatelist .= ",calendar_weekview_day,calendar_weekview_day_event,calendar_mini_weekdayheader,calendar_mini_weekrow_day,calendar_mini_weekrow,calendar_mini,calendar_weekview_month,calendar_weekview,calendar_eventbit,calendar_addeventlink";

$templatelist .= ",calendar_weekview_day,calendar_weekview_day_event,calendar_mini_weekdayheader,calendar_mini_weekrow_day,calendar_mini_weekrow,calendar_mini,calendar_weekview_month,calendar_weekview,calendar_eventbit,calendar_addeventlink";

$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_event,calendar_dayview_event,calendar_dayview,codebuttons,smilieinsert,calendar_editevent,calendar_dayview_birthdays_bday,calendar_dayview_birthdays,calendar_dayview_noevents,calendar_dayview_noevents";

$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_event,calendar_dayview_event,calendar_dayview,codebuttons,smilieinsert,smilieinsert_getmore,calendar_editevent,calendar_dayview_birthdays_bday,calendar_dayview_birthdays,calendar_dayview_noevents";


require_once "./global.php";



require_once "./global.php";


Zeile 673Zeile 673
		error_no_permission();
}


		error_no_permission();
}


 
	$event['name'] = htmlspecialchars_uni($event['name']);


	add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));

	add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));

	add_breadcrumb(htmlspecialchars_uni($event['name']), get_event_link($event['eid']));

	add_breadcrumb($event['name'], get_event_link($event['eid']));

	add_breadcrumb($lang->nav_editevent);

$plugins->run_hooks("calendar_editevent_start");

	add_breadcrumb($lang->nav_editevent);

$plugins->run_hooks("calendar_editevent_start");

Zeile 854Zeile 856
							$repeats_4_months2 = $repeats_4_months = $repeats['months'];
$repeats_4_occurance[$repeats['occurance']] = "selected=\"selected\"";
$repeats_4_weekday[$repeats['weekday']] = "selected=\"selected\"";

							$repeats_4_months2 = $repeats_4_months = $repeats['months'];
$repeats_4_occurance[$repeats['occurance']] = "selected=\"selected\"";
$repeats_4_weekday[$repeats['weekday']] = "selected=\"selected\"";

						}

						}

						$repeats_5_type[1] = "checked=\"checked\"";
$repeats_5_day = 1;
$repeats_5_years = $repeats_5_years2 = 1;

						$repeats_5_type[1] = "checked=\"checked\"";
$repeats_5_day = 1;
$repeats_5_years = $repeats_5_years2 = 1;

Zeile 919Zeile 921
		if($i == $start_year)
{
$start_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

		if($i == $start_year)
{
$start_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

		}
else
{

		}
else
{

			$start_years .= "<option value=\"{$i}\">{$i}</option>\n";
}
if($i == $end_year)
{
$end_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

			$start_years .= "<option value=\"{$i}\">{$i}</option>\n";
}
if($i == $end_year)
{
$end_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

		}
else
{

		}
else
{

			$end_years .= "<option value=\"{$i}\">{$i}</option>\n";
}
}

			$end_years .= "<option value=\"{$i}\">{$i}</option>\n";
}
}

Zeile 940Zeile 942
		if($i == $single_day)
{
$single_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

		if($i == $single_day)
{
$single_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

		}
else
{

		}
else
{

			$single_days .= "<option value=\"{$i}\">{$i}</option>\n";

			$single_days .= "<option value=\"{$i}\">{$i}</option>\n";

		}

		}

		if($i == $start_day)
{
$start_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

		if($i == $start_day)
{
$start_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";

		}
else

		}
else

		{
$start_days .= "<option value=\"{$i}\">{$i}</option>\n";

		{
$start_days .= "<option value=\"{$i}\">{$i}</option>\n";

		}

		}

		if($i == $end_day)

		if($i == $end_day)

		{

		{

			$end_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
}
else
{
$end_days .= "<option value=\"{$i}\">{$i}</option>\n";

			$end_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
}
else
{
$end_days .= "<option value=\"{$i}\">{$i}</option>\n";

		}
}

$timezones = build_timezone_select("timezone", $timezone);

		}
}

$timezones = build_timezone_select("timezone", $timezone);


$plugins->run_hooks("calendar_editevent_end");



$plugins->run_hooks("calendar_editevent_end");


Zeile 1002Zeile 1004
	{
error_no_permission();
}

	{
error_no_permission();
}

 

$event['name'] = htmlspecialchars_uni($event['name']);


add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));


add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));

	add_breadcrumb(htmlspecialchars_uni($event['name']), get_event_link($event['eid']));

	add_breadcrumb($event['name'], get_event_link($event['eid']));

	add_breadcrumb($lang->nav_move_event);

	add_breadcrumb($lang->nav_move_event);





	$plugins->run_hooks("calendar_move_start");

// Build calendar select
$query = $db->simple_select("calendars", "*", "", array("order_by" => "name", "order_dir" => "asc"));
while($calendar_option = $db->fetch_array($query))

	$plugins->run_hooks("calendar_move_start");

// Build calendar select
$query = $db->simple_select("calendars", "*", "", array("order_by" => "name", "order_dir" => "asc"));
while($calendar_option = $db->fetch_array($query))

	{

	{

		if($calendar_permissions[$calendar['cid']]['canviewcalendar'] == 1)
{
$calendar_option['name'] = htmlspecialchars_uni($calendar_option['name']);

		if($calendar_permissions[$calendar['cid']]['canviewcalendar'] == 1)
{
$calendar_option['name'] = htmlspecialchars_uni($calendar_option['name']);

Zeile 1025Zeile 1029
	eval("\$moveevent = \"".$templates->get("calendar_move")."\";");
output_page($moveevent);
}

	eval("\$moveevent = \"".$templates->get("calendar_move")."\";");
output_page($moveevent);
}





// Actually move the event
if($mybb->input['action'] == "do_move" && $mybb->request_method == "post")

// Actually move the event
if($mybb->input['action'] == "do_move" && $mybb->request_method == "post")

{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'");
$event = $db->fetch_array($query);

if(!is_numeric($event['eid']))
{
error($lang->error_invalidevent);
}

{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'");
$event = $db->fetch_array($query);

if(!is_numeric($event['eid']))
{
error($lang->error_invalidevent);
}


$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);


$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);





	// Invalid calendar?
if(!$calendar['cid'])

	// Invalid calendar?
if(!$calendar['cid'])

	{

	{

		error($lang->invalid_calendar);

		error($lang->invalid_calendar);

	}


	}


	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions();
if($calendar_permissions[$calendar['cid']]['canviewcalendar'] != 1)

	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions();
if($calendar_permissions[$calendar['cid']]['canviewcalendar'] != 1)

Zeile 1057Zeile 1061
	}

if($calendar_permissions[$calendar['cid']]['canmoderateevents'] != 1)

	}

if($calendar_permissions[$calendar['cid']]['canmoderateevents'] != 1)

	{
error_no_permission();
}

	{
error_no_permission();
}



$query = $db->simple_select("calendars", "*", "cid='".intval($mybb->input['new_calendar'])."'");



$query = $db->simple_select("calendars", "*", "cid='".intval($mybb->input['new_calendar'])."'");

Zeile 1076Zeile 1080
	}

$plugins->run_hooks("calendar_do_move_start");

	}

$plugins->run_hooks("calendar_do_move_start");





	$updated_event = array(
"cid" => $new_calendar['cid']

	$updated_event = array(
"cid" => $new_calendar['cid']

	);
$db->update_query("events", $updated_event, "eid='{$event['eid']}'");

$plugins->run_hooks("calendar_do_move_end");


	);
$db->update_query("events", $updated_event, "eid='{$event['eid']}'");

$plugins->run_hooks("calendar_do_move_end");


	redirect(get_event_link($event['eid']), $lang->redirect_eventmoved);
}

	redirect(get_event_link($event['eid']), $lang->redirect_eventmoved);
}





// Approve an event
if($mybb->input['action'] == "approve")

// Approve an event
if($mybb->input['action'] == "approve")

{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'");
$event = $db->fetch_array($query);

if(!is_numeric($event['eid']))
{
error($lang->error_invalidevent);
}

$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);

// Invalid calendar?

{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'");
$event = $db->fetch_array($query);

if(!is_numeric($event['eid']))
{
error($lang->error_invalidevent);
}

$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);

// Invalid calendar?

	if(!$calendar['cid'])
{
error($lang->invalid_calendar);

	if(!$calendar['cid'])
{
error($lang->invalid_calendar);

Zeile 1113Zeile 1117
	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions($calendar['cid']);
if($calendar_permissions['canviewcalendar'] != 1)

	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions($calendar['cid']);
if($calendar_permissions['canviewcalendar'] != 1)

	{
error_no_permission();
}


	{
error_no_permission();
}


	if($calendar_permissions['canmoderateevents'] != 1)
{
error_no_permission();

	if($calendar_permissions['canmoderateevents'] != 1)
{
error_no_permission();

Zeile 1126Zeile 1130

$updated_event = array(
"visible" => 1


$updated_event = array(
"visible" => 1

	);
$db->update_query("events", $updated_event, "eid='{$event['eid']}'");


	);
$db->update_query("events", $updated_event, "eid='{$event['eid']}'");


	$plugins->run_hooks("calendar_approve_end");

	$plugins->run_hooks("calendar_approve_end");





	redirect(get_event_link($event['eid']), $lang->redirect_eventapproved);
}


	redirect(get_event_link($event['eid']), $lang->redirect_eventapproved);
}


Zeile 1139Zeile 1143
{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);





	$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'");
$event = $db->fetch_array($query);

if(!is_numeric($event['eid']))

	$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'");
$event = $db->fetch_array($query);

if(!is_numeric($event['eid']))

	{
error($lang->error_invalidevent);
}

$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);


	{
error($lang->error_invalidevent);
}

$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);


	// Invalid calendar?
if(!$calendar['cid'])
{

	// Invalid calendar?
if(!$calendar['cid'])
{

Zeile 1195Zeile 1199
	if(!is_numeric($event['eid']) || ($event['private'] == 1 && $event['uid'] != $mybb->user['uid']))
{
error($lang->error_invalidevent);

	if(!is_numeric($event['eid']) || ($event['private'] == 1 && $event['uid'] != $mybb->user['uid']))
{
error($lang->error_invalidevent);

	}


	}


	$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);


	$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'");
$calendar = $db->fetch_array($query);


Zeile 1204Zeile 1208
	if(!$calendar['cid'])
{
error($lang->invalid_calendar);

	if(!$calendar['cid'])
{
error($lang->invalid_calendar);

	}


	}


	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions($calendar['cid']);
if($calendar_permissions['canviewcalendar'] != 1 || ($calendar_permissions['canmoderateevents'] != 1 && $event['visible'] == 0))

	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions($calendar['cid']);
if($calendar_permissions['canviewcalendar'] != 1 || ($calendar_permissions['canmoderateevents'] != 1 && $event['visible'] == 0))

	{
error_no_permission();
}

add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
add_breadcrumb(htmlspecialchars_uni($event['name']), get_event_link($event['eid']));

$plugins->run_hooks("calendar_event_start");

$event['name'] = htmlspecialchars_uni($event['name']);

	{
error_no_permission();
}

$event['name'] = htmlspecialchars_uni($event['name']);

add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
add_breadcrumb($event['name'], get_event_link($event['eid']));

$plugins->run_hooks("calendar_event_start");


$event_parser_options = array(
"allow_html" => $calendar['allowhtml'],


$event_parser_options = array(
"allow_html" => $calendar['allowhtml'],

Zeile 1544Zeile 1548
	$start_timestamp = gmmktime(0, 0, 0, $month, $day, $year);
$end_timestamp = gmmktime(23, 59, 59, $month, $day, $year);


	$start_timestamp = gmmktime(0, 0, 0, $month, $day, $year);
$end_timestamp = gmmktime(23, 59, 59, $month, $day, $year);


	$events_cache = get_events($calendar['cid'], $start_timestamp, $end_timestamp, $calendar_permissions['canmoderateevents']);

	$events_cache = get_events($calendar, $start_timestamp, $end_timestamp, $calendar_permissions['canmoderateevents']);


if(is_array($events_cache["$day-$month-$year"]))
{


if(is_array($events_cache["$day-$month-$year"]))
{

Zeile 1581Zeile 1585
				// Get user titles (i guess we should improve this, maybe in version3.
$query = $db->simple_select("usertitles", "*", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($usertitle = $db->fetch_array($query))

				// Get user titles (i guess we should improve this, maybe in version3.
$query = $db->simple_select("usertitles", "*", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($usertitle = $db->fetch_array($query))

				{

				{

					$titles_cache[$usertitle['posts']] = $usertitle;
}
unset($usertitle);

					$titles_cache[$usertitle['posts']] = $usertitle;
}
unset($usertitle);

Zeile 1627Zeile 1631
				if(!$event['starimage'])
{
$event['starimage'] = $user_usergroup['starimage'];

				if(!$event['starimage'])
{
$event['starimage'] = $user_usergroup['starimage'];

				}

				}

				
for($i = 0; $i < $post['stars']; ++$i)
{

				
for($i = 0; $i < $post['stars']; ++$i)
{

Zeile 1762Zeile 1766

eval("\$day_view = \"".$templates->get("calendar_dayview")."\";");
output_page($day_view);


eval("\$day_view = \"".$templates->get("calendar_dayview")."\";");
output_page($day_view);

}

}


// View all events for a specific week
if($mybb->input['action'] == "weekview")


// View all events for a specific week
if($mybb->input['action'] == "weekview")

Zeile 1771Zeile 1775
	if($mybb->input['calendar'])
{
$query = $db->simple_select("calendars", "*", "cid='".intval($mybb->input['calendar'])."'");

	if($mybb->input['calendar'])
{
$query = $db->simple_select("calendars", "*", "cid='".intval($mybb->input['calendar'])."'");

		$calendar = $db->fetch_array($query);
}

		$calendar = $db->fetch_array($query);
}

	// Showing the default calendar
else

	// Showing the default calendar
else

	{

	{

		$query = $db->simple_select("calendars", "*", "disporder='1'");
$calendar = $db->fetch_array($query);

		$query = $db->simple_select("calendars", "*", "disporder='1'");
$calendar = $db->fetch_array($query);

	}

	}


// Invalid calendar?
if(!$calendar['cid'])
{
error($lang->invalid_calendar);


// Invalid calendar?
if(!$calendar['cid'])
{
error($lang->invalid_calendar);

	}


	}


	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions($calendar['cid']);
if($calendar_permissions['canviewcalendar'] != 1)

	// Do we have permission to view this calendar?
$calendar_permissions = get_calendar_permissions($calendar['cid']);
if($calendar_permissions['canviewcalendar'] != 1)

Zeile 1830Zeile 1834

// Establish if we have a month ending in this week
if($week_from[1] != $week_to[1])


// Establish if we have a month ending in this week
if($week_from[1] != $week_to[1])

	{

	{

		$different_months = true;
$week_months = array(array($week_from[1], $week_from[2]), array($week_to[1], $week_to[2]));
$bday_months = array($week_from[1], $week_to[1]);
}
else

		$different_months = true;
$week_months = array(array($week_from[1], $week_from[2]), array($week_to[1], $week_to[2]));
$bday_months = array($week_from[1], $week_to[1]);
}
else

	{

	{

		$week_months = array(array($week_from[1], $week_from[2]));
$bday_months = array($week_from[1]);

		$week_months = array(array($week_from[1], $week_from[2]));
$bday_months = array($week_from[1]);

	}

	}


// Load Birthdays for this month
if($calendar['showbirthdays'] == 1)


// Load Birthdays for this month
if($calendar['showbirthdays'] == 1)

Zeile 1851Zeile 1855
	$events_from = gmmktime(0, 0, 0, $week_from[1], 1, $week_from[2]);
$events_to = gmmktime(0, 0, 0, $week_to[1], $week_to[3], $week_to[2]);


	$events_from = gmmktime(0, 0, 0, $week_from[1], 1, $week_from[2]);
$events_to = gmmktime(0, 0, 0, $week_to[1], $week_to[3], $week_to[2]);


	$events_cache = get_events($calendar['cid'], $events_from, $events_to, $calendar_permissions['canmoderateevents']);

$today = my_date("dnY");

	$events_cache = get_events($calendar, $events_from, $events_to, $calendar_permissions['canmoderateevents']);

$today = my_date("dnY");


$next_week = $mybb->input['week'] + 604800;
$next_link = get_calendar_week_link($calendar['cid'], $next_week);


$next_week = $mybb->input['week'] + 604800;
$next_link = get_calendar_week_link($calendar['cid'], $next_week);

Zeile 1899Zeile 1903
					$end_time = gmdate("Hi", $event['endtime_user']);
// Event only runs over one day
if($start_day == $end_day || $event['repeats'] > 0)

					$end_time = gmdate("Hi", $event['endtime_user']);
// Event only runs over one day
if($start_day == $end_day || $event['repeats'] > 0)

					{

					{

						// Event runs all day
if($start_time == 0000 && $end_time == 2359)

						// Event runs all day
if($start_time == 0000 && $end_time == 2359)

						{
$time_period = $lang->all_day;
}

						{
$time_period = $lang->all_day;
}

						else
{
$time_period = gmdate($mybb->settings['timeformat'], $event['starttime_user'])." - ".gmdate($mybb->settings['timeformat'], $event['endtime_user']);

						else
{
$time_period = gmdate($mybb->settings['timeformat'], $event['starttime_user'])." - ".gmdate($mybb->settings['timeformat'], $event['endtime_user']);

						}
}

						}
}

					// Event starts on this day
else if($start_day == $weekday_date)
{
// Event runs all day
if($start_time == 0000)

					// Event starts on this day
else if($start_day == $weekday_date)
{
// Event runs all day
if($start_time == 0000)

						{

						{

							$time_period = $lang->all_day;
}
else
{
$time_period = $lang->starts.gmdate($mybb->settings['timeformat'], $event['starttime_user']);

							$time_period = $lang->all_day;
}
else
{
$time_period = $lang->starts.gmdate($mybb->settings['timeformat'], $event['starttime_user']);

						}
}

						}
}

					// Event finishes on this day
else if($end_day == $weekday_date)

					// Event finishes on this day
else if($end_day == $weekday_date)

					{

					{

						// Event runs all day
if($end_time == 2359)

						// Event runs all day
if($end_time == 2359)

						{

						{

							$time_period = $lang->all_day;
}
else

							$time_period = $lang->all_day;
}
else

Zeile 1944Zeile 1948
				}
$event_time = '';
if($time_period)

				}
$event_time = '';
if($time_period)

				{

				{

					$event_time = "<span class=\"smalltext\"> ({$time_period})</span>";
}
if($event['private'] == 1)

					$event_time = "<span class=\"smalltext\"> ({$time_period})</span>";
}
if($event['private'] == 1)

Zeile 2058Zeile 2062
	
// Then the month
if($mybb->input['month'] >=1 && $mybb->input['month'] <= 12)

	
// Then the month
if($mybb->input['month'] >=1 && $mybb->input['month'] <= 12)

	{

	{

		$month = intval($mybb->input['month']);
}
else

		$month = intval($mybb->input['month']);
}
else

Zeile 2080Zeile 2084
	$weekdays = fetch_weekday_structure($calendar['startofweek']);

$month_start_weekday = gmdate("w", gmmktime(0, 0, 0, $month, $calendar['startofweek']+1, $year));

	$weekdays = fetch_weekday_structure($calendar['startofweek']);

$month_start_weekday = gmdate("w", gmmktime(0, 0, 0, $month, $calendar['startofweek']+1, $year));

	




$prev_month_days = gmdate("t", gmmktime(0, 0, 0, $prev_month['month'], 1, $prev_month['year']));


	// This is if we have days in the previous month to show
if($month_start_weekday != $weekdays[0] || $calendar['startofweek'] != 0)

	// This is if we have days in the previous month to show
if($month_start_weekday != $weekdays[0] || $calendar['startofweek'] != 0)

	{
$day = gmdate("t", gmmktime(0, 0, 0, $prev_month['month'], 1, $prev_month['year']));

	{
$prev_days = $day = gmdate("t", gmmktime(0, 0, 0, $prev_month['month'], 1, $prev_month['year']));

		$day -= array_search(($month_start_weekday), $weekdays);
$day += $calendar['startofweek']+1;

		$day -= array_search(($month_start_weekday), $weekdays);
$day += $calendar['startofweek']+1;

 
		if($day > $prev_month_days+1)
{
// Go one week back
$day -= 7;
}

		$calendar_month = $prev_month['month'];
$calendar_year = $prev_month['year'];
}

		$calendar_month = $prev_month['month'];
$calendar_year = $prev_month['year'];
}

Zeile 2096Zeile 2107
		$calendar_month = $month;
$calendar_year = $year;
}

		$calendar_month = $month;
$calendar_year = $year;
}


$prev_month_days = gmdate("t", gmmktime(0, 0, 0, $prev_month['month'], 1, $prev_month['year']));

 
	
// So now we fetch events for this month (nb, cache events for past month, current month and next month for mini calendars too)

	
// So now we fetch events for this month (nb, cache events for past month, current month and next month for mini calendars too)

	$start_timestamp = gmmktime(0, 0, 0, $prev_month['month'], $day, $prev_month['year']);
$num_days = gmdate("t", gmmktime(0, 0, 0, $next_month['month'], 1, $next_month['year']));
$end_timestamp = gmmktime(23, 59, 59, $next_month['month'], $num_days, $next_month['year']);


	$start_timestamp = gmmktime(0, 0, 0, $calendar_month, $day, $calendar_year);




	$num_days = gmdate("t", gmmktime(0, 0, 0, $month, 1, $year));

	$num_days = gmdate("t", gmmktime(0, 0, 0, $month, 1, $year));

 
	
$month_end_weekday = gmdate("w", gmmktime(0, 0, 0, $month, $num_days, $year));
$next_days = 6-$month_end_weekday+$calendar['startofweek'];

// More than a week? Go one week back
if($next_days >= 7)
{
$next_days -= 7;
}
if($next_days > 0)
{
$end_timestamp = gmmktime(23, 59, 59, $next_month['month'], $next_days, $next_month['year']);
}
else
{
// We don't need days from the next month
$end_timestamp = gmmktime(23, 59, 59, $month, $num_days, $year);
}





	if($day > 31 && in_array($next_month['month'], array(4, 6, 11, 9)))
{
// If we're a day over a 30 day month, gather the events from a week before too.
// Otherwise it will start on events for the 2nd - not the 'start' date for the month.
$start_timestamp -= (86400 * 7);
}

$events_cache = get_events($calendar['cid'], $start_timestamp, $end_timestamp, $calendar_permissions['canmoderateevents']);

	$events_cache = get_events($calendar, $start_timestamp, $end_timestamp, $calendar_permissions['canmoderateevents']);








	
// Fetch birthdays
if($calendar['showbirthdays'])

	
// Fetch birthdays
if($calendar['showbirthdays'])

Zeile 2121Zeile 2138
		$bday_months = array($month, $prev_month['month'], $next_month['month']);
$birthdays = get_birthdays($bday_months);
}

		$bday_months = array($month, $prev_month['month'], $next_month['month']);
$birthdays = get_birthdays($bday_months);
}





	$today = my_date("dnY");

// Build weekday headers

	$today = my_date("dnY");

// Build weekday headers

Zeile 2129Zeile 2146
	{
$weekday_name = fetch_weekday_name($weekday);
eval("\$weekday_headers .= \"".$templates->get("calendar_weekdayheader")."\";");

	{
$weekday_name = fetch_weekday_name($weekday);
eval("\$weekday_headers .= \"".$templates->get("calendar_weekdayheader")."\";");

	}

// Fix offset for Start Of Week being Saturday
if($calendar_month == $prev_month['month'] && $calendar['startofweek'] > 0)
{
$day -= 7;

// Lets make sure we don't have a whole extra column for the last month
if($prev_month_days-7 >= ($day-1))
{
$day += 7;
}

 
	}

for($row = 0; $row < 6; ++$row) // Iterate weeks (each week gets a row)

	}

for($row = 0; $row < 6; ++$row) // Iterate weeks (each week gets a row)