Vergleich calendar.php - 1.6.8 - 1.6.15

  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 5746 2012-02-03 10:03:25Z 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 1548Zeile 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 1818Zeile 1818
	else
{
$mybb->input['week'] = (int)str_replace("n", "-", $mybb->input['week']);

	else
{
$mybb->input['week'] = (int)str_replace("n", "-", $mybb->input['week']);

 
		// No negative years please ;)
if($mybb->input['week'] < -62167219200)
{
$mybb->input['week'] = -62167219200;
}

	}

// This is where we've come from and where we're headed

	}

// This is where we've come from and where we're headed

Zeile 1834Zeile 1839

// 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]);

		$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]);

Zeile 1843Zeile 1848
	{
$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 1855Zeile 1860
	$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);
$prev_week = $mybb->input['week'] - 604800;
$prev_link = get_calendar_week_link($calendar['cid'], $prev_week);

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





	$weekday_date = $mybb->input['week'];

while($weekday_date <= $week_to_stamp)

	$weekday_date = $mybb->input['week'];

while($weekday_date <= $week_to_stamp)

Zeile 1873Zeile 1878
		$weekday_month = gmdate("n", $weekday_date);
$weekday_year = gmdate("Y", $weekday_date);
$weekday_day = gmdate("j", $weekday_date);

		$weekday_month = gmdate("n", $weekday_date);
$weekday_year = gmdate("Y", $weekday_date);
$weekday_day = gmdate("j", $weekday_date);





		// Special shading for today
$day_shaded = '';
if(gmdate("dnY", $weekday_date) == $today)

		// Special shading for today
$day_shaded = '';
if(gmdate("dnY", $weekday_date) == $today)

		{

		{

			$day_shaded = ' trow_shaded';
}


			$day_shaded = ' trow_shaded';
}


Zeile 1896Zeile 1901
				// Events over more than one day
$time_period = '';
if($event['endtime'] > 0 && $event['endtime'] != $event['starttime'])

				// Events over more than one day
$time_period = '';
if($event['endtime'] > 0 && $event['endtime'] != $event['starttime'])

				{

				{

					$start_day = gmmktime(0, 0, 0, gmdate("n", $event['starttime_user']), gmdate("j", $event['starttime_user']), gmdate("Y", $event['starttime_user']));
$end_day = gmmktime(0, 0, 0, gmdate("n", $event['endtime_user']), gmdate("j", $event['endtime_user']), gmdate("Y", $event['endtime_user']));
$start_time = gmdate("Hi", $event['starttime_user']);

					$start_day = gmmktime(0, 0, 0, gmdate("n", $event['starttime_user']), gmdate("j", $event['starttime_user']), gmdate("Y", $event['starttime_user']));
$end_day = gmmktime(0, 0, 0, gmdate("n", $event['endtime_user']), gmdate("j", $event['endtime_user']), gmdate("Y", $event['endtime_user']));
$start_time = gmdate("Hi", $event['starttime_user']);

Zeile 2013Zeile 2018

eval("\$weekview = \"".$templates->get("calendar_weekview")."\";");
output_page($weekview);


eval("\$weekview = \"".$templates->get("calendar_weekview")."\";");
output_page($weekview);

}

}


// View yearly calendar
if($mybb->input['action'] == "yearview")


// View yearly calendar
if($mybb->input['action'] == "yearview")

Zeile 2027Zeile 2032
	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
{

Zeile 2038Zeile 2043

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


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

	{

	{

		error($lang->invalid_calendar);
}


		error($lang->invalid_calendar);
}


Zeile 2052Zeile 2057

// Incoming month/year?
if($mybb->input['year'] && $mybb->input['year'] <= my_date("Y")+5)


// Incoming month/year?
if($mybb->input['year'] && $mybb->input['year'] <= my_date("Y")+5)

	{

	{

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

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

Zeile 2062Zeile 2067
	
// 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

	{

	{

		$month = my_date("n");
}


		$month = my_date("n");
}


Zeile 2080Zeile 2085
	$next_link = get_calendar_link($calendar['cid'], $next_month['year'], $next_month['month']);

// Start constructing the calendar

	$next_link = get_calendar_link($calendar['cid'], $next_month['year'], $next_month['month']);

// Start constructing the calendar





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

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





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

	$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 2100Zeile 2112
		$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));


if($day > 31 && in_array($next_month['month'], array(4, 6, 11, 9)))





	
$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)

	{

	{

		// 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);

		$next_days -= 7;



	}

	}


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











	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);
}

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


	// Fetch birthdays
if($calendar['showbirthdays'])
{
$bday_months = array($month, $prev_month['month'], $next_month['month']);
$birthdays = get_birthdays($bday_months);

	// Fetch birthdays
if($calendar['showbirthdays'])
{
$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 2133Zeile 2151
	{
$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)