Vergleich calendar.php - 1.8.5 - 1.8.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
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,calendar_addevent,calendar_move,calendar_year,calendar_day,calendar_select,calendar_repeats,calendar_weekview_day_event_time";
$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";
$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_dayview_event,calendar_dayview,codebuttons,smilieinsert,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty";
$templatelist .= ",calendar_jump,calendar_jump_option,calendar_editevent,calendar_dayview_birthdays_bday,calendar_dayview_birthdays,calendar_dayview_noevents,calendar_addeventlink,calendar_addevent_calendarselect_hidden";
$templatelist .= ",calendar_weekrow_day_birthdays,calendar_weekview_day_birthdays,calendar_year_sel,calendar_event_userstar,calendar_addevent_calendarselect,calendar_eventbit,calendar_event";

$templatelist = "calendar_weekdayheader,calendar_weekrow_day,calendar_weekrow,calendar,calendar_addevent,calendar_year,calendar_day,calendar_select,calendar_repeats,calendar_weekview_day_event_time";
$templatelist .= ",calendar_weekview_day,calendar_weekview_day_event,calendar_mini_weekdayheader,calendar_mini_weekrow_day,calendar_mini_weekrow,calendar_mini,calendar_mini_weekrow_day_link,calendar_move";
$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_dayview_event,calendar_dayview,codebuttons,calendar_weekrow_day_events,calendar_weekview_month,calendar_addeventlink";
$templatelist .= ",calendar_jump,calendar_jump_option,calendar_editevent,calendar_dayview_birthdays_bday,calendar_dayview_birthdays,calendar_dayview_noevents,calendar_addevent_calendarselect_hidden";
$templatelist .= ",calendar_weekrow_day_birthdays,calendar_weekview_day_birthdays,calendar_year_sel,calendar_event_userstar,calendar_addevent_calendarselect,calendar_eventbit,calendar_event,calendar_weekview";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_calendar.php";
require_once MYBB_ROOT."inc/functions_post.php";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_calendar.php";
require_once MYBB_ROOT."inc/functions_post.php";

 
require_once MYBB_ROOT."inc/functions_time.php";

require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;


require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;


Zeile 542Zeile 543
		eval("\$calendar_select .= \"".$templates->get("calendar_addevent_calendarselect_hidden")."\";");
}


		eval("\$calendar_select .= \"".$templates->get("calendar_addevent_calendarselect_hidden")."\";");
}


	$event_errors = '';





	if(!isset($event_errors))
{
$event_errors = '';
}


	$plugins->run_hooks("calendar_addevent_end");

	$plugins->run_hooks("calendar_addevent_end");





	eval("\$addevent = \"".$templates->get("calendar_addevent")."\";");
output_page($addevent);

	eval("\$addevent = \"".$templates->get("calendar_addevent")."\";");
output_page($addevent);

 
}

// Delete an event
if($mybb->input['action'] == "do_deleteevent" && $mybb->request_method == "post")
{
$query = $db->simple_select("events", "*", "eid='{$mybb->input['eid']}'");
$event = $db->fetch_array($query);

if(!$event)
{
error($lang->error_invalidevent);
}

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

// Invalid calendar?
if(!$calendar)
{
error($lang->invalid_calendar);
}

// Do we have permission to view this calendar or post events?
$calendar_permissions = get_calendar_permissions($calendar['cid']);
if($calendar_permissions['canviewcalendar'] != 1 || $calendar_permissions['canaddevents'] != 1)
{
error_no_permission();
}

if(($event['uid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0) && $calendar_permissions['canmoderateevents'] != 1)
{
error_no_permission();
}

// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

$plugins->run_hooks("calendar_do_deleteevent_start");

// Is the checkbox set?
if($mybb->get_input('delete', MyBB::INPUT_INT) == 1)
{
$db->delete_query("events", "eid='{$event['eid']}'");
$plugins->run_hooks("calendar_do_deleteevent_end");

// Redirect back to the main calendar view.
redirect("calendar.php", $lang->redirect_eventdeleted);
}
else
{
error($lang->delete_no_checkbox);
}

}

// Edit an event

}

// Edit an event

Zeile 584Zeile 640

// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


// Are we going to delete this event or just edit it?
if($mybb->get_input('delete', MyBB::INPUT_INT) == 1)
{
$db->delete_query("events", "eid='{$event['eid']}'");

// Redirect back to the main calendar view.
redirect("calendar.php", $lang->redirect_eventdeleted);
}

 

$plugins->run_hooks("calendar_do_editevent_start");



$plugins->run_hooks("calendar_do_editevent_start");


Zeile 628Zeile 675
			"month" => $mybb->get_input('start_month', MyBB::INPUT_INT),
"year" => $mybb->get_input('start_year', MyBB::INPUT_INT),
"time" => $mybb->get_input('start_time')

			"month" => $mybb->get_input('start_month', MyBB::INPUT_INT),
"year" => $mybb->get_input('start_year', MyBB::INPUT_INT),
"time" => $mybb->get_input('start_time')

		);

		);

		$event['end_date'] = array(
"day" => $mybb->get_input('end_day', MyBB::INPUT_INT),
"month" => $mybb->get_input('end_month', MyBB::INPUT_INT),

		$event['end_date'] = array(
"day" => $mybb->get_input('end_day', MyBB::INPUT_INT),
"month" => $mybb->get_input('end_month', MyBB::INPUT_INT),

Zeile 683Zeile 730
				{
$repeats['day'] = $mybb->get_input('repeats_5_day', MyBB::INPUT_INT);
$repeats['month'] = $mybb->get_input('repeats_5_month', MyBB::INPUT_INT);

				{
$repeats['day'] = $mybb->get_input('repeats_5_day', MyBB::INPUT_INT);
$repeats['month'] = $mybb->get_input('repeats_5_month', MyBB::INPUT_INT);

					$repeats['years'] = $mybb->get_input('repeats_5_years', MyBB::INPUT_INT);
}

					$repeats['years'] = $mybb->get_input('repeats_5_years', MyBB::INPUT_INT);
}

				else
{
$repeats['occurance'] = $mybb->get_input('repeats_5_occurance');

				else
{
$repeats['occurance'] = $mybb->get_input('repeats_5_occurance');

Zeile 766Zeile 813
		if($calendar['allowsmilies'] == 1)
{
$smilieinserter = build_clickable_smilies();

		if($calendar['allowsmilies'] == 1)
{
$smilieinserter = build_clickable_smilies();

		}
}


		}
}


	$single_month = $start_month = $end_month = $repeats_sel = $repeats_3_days = $repeats_4_occurance = $repeats_4_weekday = $repeats_5_month = $repeats_5_occurance = $repeats_5_weekday = $repeats_5_month2 = array();
foreach(range(1, 12) as $number)
{

	$single_month = $start_month = $end_month = $repeats_sel = $repeats_3_days = $repeats_4_occurance = $repeats_4_weekday = $repeats_5_month = $repeats_5_occurance = $repeats_5_weekday = $repeats_5_month2 = array();
foreach(range(1, 12) as $number)
{

Zeile 825Zeile 872
		$repeats_1_days = $mybb->get_input('repeats_1_days', MyBB::INPUT_INT);
$repeats_3_weeks = $mybb->get_input('repeats_3_weeks', MyBB::INPUT_INT);
foreach($mybb->get_input('repeats_3_days', MyBB::INPUT_ARRAY) as $day => $val)

		$repeats_1_days = $mybb->get_input('repeats_1_days', MyBB::INPUT_INT);
$repeats_3_weeks = $mybb->get_input('repeats_3_weeks', MyBB::INPUT_INT);
foreach($mybb->get_input('repeats_3_days', MyBB::INPUT_ARRAY) as $day => $val)

		{

		{

			if($val != 1)
{
continue;

			if($val != 1)
{
continue;

Zeile 835Zeile 882
		}
$repeats_4_type = array();
if($mybb->get_input('repeats_4_type', MyBB::INPUT_INT) == 1)

		}
$repeats_4_type = array();
if($mybb->get_input('repeats_4_type', MyBB::INPUT_INT) == 1)

		{

		{

			$repeats_4_type[1] = "checked=\"checked\"";
$repeats_4_type[2] = '';

			$repeats_4_type[1] = "checked=\"checked\"";
$repeats_4_type[2] = '';

		}

		}

		else
{
$repeats_4_type[2] = "checked=\"checked\"";

		else
{
$repeats_4_type[2] = "checked=\"checked\"";

Zeile 852Zeile 899
		if($mybb->get_input('repeats_5_type', MyBB::INPUT_INT) == 1)
{
$repeats_5_type[1] = "checked=\"checked\"";

		if($mybb->get_input('repeats_5_type', MyBB::INPUT_INT) == 1)
{
$repeats_5_type[1] = "checked=\"checked\"";

		}
else

		}
else

		{
$repeats_5_type[2] = "checked=\"checked\"";
}

		{
$repeats_5_type[2] = "checked=\"checked\"";
}

Zeile 864Zeile 911
		$repeats_5_weekday[$mybb->get_input('repeats_5_weekday', MyBB::INPUT_INT)] = "selected=\"selected\"";
$repeats_5_month2[$mybb->get_input('repeats_5_month2', MyBB::INPUT_INT)] = "selected=\"selected\"";
$repeats_5_years2 = $mybb->get_input('repeats_5_years2', MyBB::INPUT_INT);

		$repeats_5_weekday[$mybb->get_input('repeats_5_weekday', MyBB::INPUT_INT)] = "selected=\"selected\"";
$repeats_5_month2[$mybb->get_input('repeats_5_month2', MyBB::INPUT_INT)] = "selected=\"selected\"";
$repeats_5_years2 = $mybb->get_input('repeats_5_years2', MyBB::INPUT_INT);





		if($mybb->get_input('private', MyBB::INPUT_INT) == 1)
{
$privatecheck = " checked=\"checked\"";

		if($mybb->get_input('private', MyBB::INPUT_INT) == 1)
{
$privatecheck = " checked=\"checked\"";

Zeile 881Zeile 928
		else
{
$ignore_timezone = '';

		else
{
$ignore_timezone = '';

		}

		}


$timezone = $mybb->get_input('timezone');
}


$timezone = $mybb->get_input('timezone');
}

Zeile 899Zeile 946
		{
$privatecheck = '';
}

		{
$privatecheck = '';
}

		$start_date = explode("-", gmdate("j-n-Y-g:i A", $event['starttime']+$event['timezone']*3600));

		$start_date = explode("-", gmdate("j-n-Y", $event['starttime']+$event['timezone']*3600));

		$single_day = $start_date[0];
$single_month[$start_date[1]] = " selected=\"selected\"";
$single_year = $start_date[2];

		$single_day = $start_date[0];
$single_month[$start_date[1]] = " selected=\"selected\"";
$single_year = $start_date[2];

Zeile 916Zeile 963
		}
if($event['endtime'])
{

		}
if($event['endtime'])
{

			$end_date = explode("-", gmdate("j-n-Y-g:i A", $event['endtime']+$event['timezone']*3600));

			$end_date = explode("-", gmdate("j-n-Y", $event['endtime']+$event['timezone']*3600));

			$end_day = $end_date[0];
$end_month[$end_date[1]] = " selected=\"selected\"";
$end_year = $end_date[2];

			$end_day = $end_date[0];
$end_month[$end_date[1]] = " selected=\"selected\"";
$end_year = $end_date[2];

Zeile 939Zeile 986
				{
case 1:
$repeats_1_days = $repeats['days'];

				{
case 1:
$repeats_1_days = $repeats['days'];

						$repeats_3_weeks = 1;
$repeats_4_type[1] = "checked=\"checked\"";
$repeats_4_day = 1;
$repeats_4_months = 1;
$repeats_4_months2 = 1;
$repeats_5_type[1] = "checked=\"checked\"";
$repeats_5_day = 1;
$repeats_5_years = $repeats_5_years2 = 1;

						$repeats_3_weeks = 1;
$repeats_4_type[1] = "checked=\"checked\"";
$repeats_4_day = 1;
$repeats_4_months = 1;
$repeats_4_months2 = 1;
$repeats_5_type[1] = "checked=\"checked\"";
$repeats_5_day = 1;
$repeats_5_years = $repeats_5_years2 = 1;

						break;
case 3:
$repeats_1_days = 1;

						break;
case 3:
$repeats_1_days = 1;

Zeile 967Zeile 1014
						$repeats_5_years = $repeats_5_years2 = 1;
break;
case 4:

						$repeats_5_years = $repeats_5_years2 = 1;
break;
case 4:

						$repeats_1_days = 1;

						$repeats_1_days = 1;

						$repeats_3_weeks = 1;
if($repeats['day'])
{
$repeats_4_type[1] = "checked=\"checked\"";
$repeats_4_day = $repeats['day'];
$repeats_4_months = $repeats_4_months2 = $repeats['months'];

						$repeats_3_weeks = 1;
if($repeats['day'])
{
$repeats_4_type[1] = "checked=\"checked\"";
$repeats_4_day = $repeats['day'];
$repeats_4_months = $repeats_4_months2 = $repeats['months'];

						}

						}

						else
{
$repeats_4_type[2] = "checked=\"checked\"";

						else
{
$repeats_4_type[2] = "checked=\"checked\"";

Zeile 995Zeile 1042
						$repeats_4_months = 1;
$repeats_4_months2 = 1;
if($repeats['day'])

						$repeats_4_months = 1;
$repeats_4_months2 = 1;
if($repeats['day'])

						{

						{

							$repeats_5_type[1] = "checked=\"checked\"";
$repeats_5_day = $repeats['day'];

							$repeats_5_type[1] = "checked=\"checked\"";
$repeats_5_day = $repeats['day'];

							$repeats_5_month[$repeats['month']] = $repeats_5_month2[$repeats['month']] = "selected=\"selected\"";
$repeats_5_years = $repeats_5_years2 = $repeats['years'];

							$repeats_5_month[$repeats['month']] = $repeats_5_month2[$repeats['month']] = "selected=\"selected\"";
$repeats_5_years = $repeats_5_years2 = $repeats['years'];

						}
else
{

						}
else
{

Zeile 1022Zeile 1069
				$timezone = $event['timezone'];
$ignore_timezone = '';
}

				$timezone = $event['timezone'];
$ignore_timezone = '';
}

		}
else
{

		}
else
{

			$type_single = "checked=\"checked\"";
$type_ranged = $ignore_timezone = $repeats_1_days = $repeats_3_weeks = $repeats_4_day = $repeats_4_months = $repeats_4_months2 = $repeats_5_day = $repeats_5_years = $timezone = $end_time = '';
$type = "single";

			$type_single = "checked=\"checked\"";
$type_ranged = $ignore_timezone = $repeats_1_days = $repeats_3_weeks = $repeats_4_day = $repeats_4_months = $repeats_4_months2 = $repeats_5_day = $repeats_5_years = $timezone = $end_time = '';
$type = "single";

Zeile 1032Zeile 1079
			$end_day = $start_day;
$end_month = $start_month;
$end_year = $start_year;

			$end_day = $start_day;
$end_month = $start_month;
$end_year = $start_year;

		}

		}

	}

$single_years = $start_years = $end_years = '';

	}

$single_years = $start_years = $end_years = '';

Zeile 1041Zeile 1088
	for($year = my_date('Y'); $year < (my_date('Y') + 5); ++$year)
{
if($year == $single_year)

	for($year = my_date('Y'); $year < (my_date('Y') + 5); ++$year)
{
if($year == $single_year)

		{

		{

			$selected = "selected=\"selected\"";
eval("\$single_years .= \"".$templates->get("calendar_year")."\";");

			$selected = "selected=\"selected\"";
eval("\$single_years .= \"".$templates->get("calendar_year")."\";");

		}
else
{
$selected = "";
eval("\$single_years .= \"".$templates->get("calendar_year")."\";");
}


		}
else
{
$selected = "";
eval("\$single_years .= \"".$templates->get("calendar_year")."\";");
}


		if($year == $start_year)
{
$selected = "selected=\"selected\"";

		if($year == $start_year)
{
$selected = "selected=\"selected\"";

Zeile 1104Zeile 1151
		if($day == $end_day)
{
$selected = "selected=\"selected\"";

		if($day == $end_day)
{
$selected = "selected=\"selected\"";

			eval("\$end_days .= \"".$templates->get("calendar_day")."\";");
}

			eval("\$end_days .= \"".$templates->get("calendar_day")."\";");
}

		else
{
$selected = "";
eval("\$end_days .= \"".$templates->get("calendar_day")."\";");
}

		else
{
$selected = "";
eval("\$end_days .= \"".$templates->get("calendar_day")."\";");
}

	}

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

	}

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


$plugins->run_hooks("calendar_editevent_end");

eval("\$editevent = \"".$templates->get("calendar_editevent")."\";");
output_page($editevent);
}


$plugins->run_hooks("calendar_editevent_end");

eval("\$editevent = \"".$templates->get("calendar_editevent")."\";");
output_page($editevent);
}





// Move an event to another calendar
if($mybb->input['action'] == "move")

// Move an event to another calendar
if($mybb->input['action'] == "move")

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

if(!$event)
{
error($lang->error_invalidevent);
}

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

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

if(!$event)
{
error($lang->error_invalidevent);
}

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


// Invalid calendar?
if(!$calendar)


// Invalid calendar?
if(!$calendar)

	{

	{

		error($lang->invalid_calendar);

		error($lang->invalid_calendar);

	}


	}


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

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

	{
error_no_permission();
}


	{
error_no_permission();
}


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

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

Zeile 1158Zeile 1205
	add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
add_breadcrumb($event['name'], get_event_link($event['eid']));
add_breadcrumb($lang->nav_move_event);

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


$plugins->run_hooks("calendar_move_start");



$plugins->run_hooks("calendar_move_start");


	$calendar_select = $selected = '';

// Build calendar select

	$calendar_select = $selected = '';

// Build calendar select

Zeile 1188Zeile 1235

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


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





	if(!$event)
{
error($lang->error_invalidevent);

	if(!$event)
{
error($lang->error_invalidevent);

	}

	}


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

// Invalid calendar?
if(!$calendar)


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

// Invalid calendar?
if(!$calendar)

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

	{
error_no_permission();
}


	{
error_no_permission();
}


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

$query = $db->simple_select("calendars", "*", "cid='".$mybb->get_input('new_calendar', MyBB::INPUT_INT)."'");

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

$query = $db->simple_select("calendars", "*", "cid='".$mybb->get_input('new_calendar', MyBB::INPUT_INT)."'");

	$new_calendar = $db->fetch_array($query);

if(!$new_calendar)
{
error($lang->invalid_calendar);
}


	$new_calendar = $db->fetch_array($query);

if(!$new_calendar)
{
error($lang->invalid_calendar);
}


	if($calendar_permissions[$mybb->input['new_calendar']]['canviewcalendar'] != 1)
{
error_no_permission();

	if($calendar_permissions[$mybb->input['new_calendar']]['canviewcalendar'] != 1)
{
error_no_permission();

Zeile 1243Zeile 1290

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


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

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

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

if(!$event)
{
error($lang->error_invalidevent);
}

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

// Invalid calendar?
if(!$calendar)
{
error($lang->invalid_calendar);
}

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

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

$updated_event = array(

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

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

if(!$event)
{
error($lang->error_invalidevent);
}

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

// Invalid calendar?
if(!$calendar)
{
error($lang->invalid_calendar);
}

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

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

$updated_event = array(

		"visible" => 1
);

$plugins->run_hooks("calendar_approve_start");

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

		"visible" => 1
);

$plugins->run_hooks("calendar_approve_start");

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





	$plugins->run_hooks("calendar_approve_end");

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

	$plugins->run_hooks("calendar_approve_end");

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

Zeile 1296Zeile 1343
	verify_post_check($mybb->get_input('my_post_key'));

$query = $db->simple_select("events", "*", "eid='{$mybb->input['eid']}'");

	verify_post_check($mybb->get_input('my_post_key'));

$query = $db->simple_select("events", "*", "eid='{$mybb->input['eid']}'");

	$event = $db->fetch_array($query);

if(!$event)
{
error($lang->error_invalidevent);
}

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

	$event = $db->fetch_array($query);

if(!$event)
{
error($lang->error_invalidevent);
}

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


// Invalid calendar?
if(!$calendar)


// Invalid calendar?
if(!$calendar)

Zeile 1360Zeile 1407
	if(!$calendar)
{
error($lang->invalid_calendar);

	if(!$calendar)
{
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))
{
error_no_permission();


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

	}

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


	}

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

	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(

	$plugins->run_hooks("calendar_event_start");

$event_parser_options = array(

Zeile 1383Zeile 1430
		"allow_imgcode" => $calendar['allowimgcode'],
"allow_videocode" => $calendar['allowvideocode']
);

		"allow_imgcode" => $calendar['allowimgcode'],
"allow_videocode" => $calendar['allowvideocode']
);





	if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)
{
$event_parser_options['allow_imgcode'] = 0;

	if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)
{
$event_parser_options['allow_imgcode'] = 0;

	}


	}


	if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
{
$event_parser_options['allow_videocode'] = 0;

	if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
{
$event_parser_options['allow_videocode'] = 0;

	}

$event['description'] = $parser->parse_message($event['description'], $event_parser_options);


	}

$event['description'] = $parser->parse_message($event['description'], $event_parser_options);


	// Get the usergroup
if($event['username'])
{

	// Get the usergroup
if($event['username'])
{

Zeile 1406Zeile 1453
		$user_usergroup = $groupscache[$event['displaygroup']];
}
else

		$user_usergroup = $groupscache[$event['displaygroup']];
}
else

	{

	{

		$user_usergroup = $groupscache[1];
}

		$user_usergroup = $groupscache[1];
}





	$titles_cache = $cache->read("usertitles");

// Event made by registered user
if($event['uid'] > 0 && $event['username'])
{

	$titles_cache = $cache->read("usertitles");

// Event made by registered user
if($event['uid'] > 0 && $event['username'])
{

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

		$event['profilelink'] = build_profile_link(format_name($event['username'], $event['usergroup'], $event['displaygroup']), $event['uid']);

		$event['profilelink'] = build_profile_link(format_name($event['username'], $event['usergroup'], $event['displaygroup']), $event['uid']);


$hascustomtitle = 0;




		if(trim($event['usertitle']) != "")
{

		if(trim($event['usertitle']) != "")
{

			$hascustomtitle = 1;
}

if($user_usergroup['usertitle'] != "" && !$hascustomtitle)
{
$event['usertitle'] = $user_usergroup['usertitle'];

			// Do nothing, no need for an extra variable..
}
elseif($user_usergroup['usertitle'] != "")
{
$event['usertitle'] = $user_usergroup['usertitle'];


		}
elseif(is_array($titles_cache) && !$user_usergroup['usertitle'])
{
reset($titles_cache);

		}
elseif(is_array($titles_cache) && !$user_usergroup['usertitle'])
{
reset($titles_cache);

			foreach($titles_cache as $key => $title)

			foreach($titles_cache as $title)

			{

			{

				if($event['postnum'] >= $key)

				if($event['postnum'] >= $title['posts'])

				{

				{

					if(!$hascustomtitle)
{
$event['usertitle'] = $title['title'];
}

					$event['usertitle'] = $title['title'];




					$event['stars'] = $title['stars'];
$event['starimage'] = $title['starimage'];
break;
}
}

					$event['stars'] = $title['stars'];
$event['starimage'] = $title['starimage'];
break;
}
}

		}


		}


		if($user_usergroup['stars'])
{
$event['stars'] = $user_usergroup['stars'];
}

if(empty($event['starimage']))

		if($user_usergroup['stars'])
{
$event['stars'] = $user_usergroup['stars'];
}

if(empty($event['starimage']))

		{

		{

			$event['starimage'] = $user_usergroup['starimage'];
}
$event['starimage'] = str_replace("{theme}", $theme['imgdir'], $event['starimage']);

			$event['starimage'] = $user_usergroup['starimage'];
}
$event['starimage'] = str_replace("{theme}", $theme['imgdir'], $event['starimage']);





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

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

Zeile 1475Zeile 1518
			$event['username'] = $lang->guest;
}


			$event['username'] = $lang->guest;
}


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

		$event['profilelink'] = format_name($event['username'], 1);

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

		$event['profilelink'] = format_name($event['username'], 1);

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

		}

		}

		else
{
$event['usertitle'] = $lang->guest;

		else
{
$event['usertitle'] = $lang->guest;

Zeile 1488Zeile 1532
		$event['userstars'] = '';
}


		$event['userstars'] = '';
}


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

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


if($event['ignoretimezone'] == 0)
{


if($event['ignoretimezone'] == 0)
{

Zeile 1506Zeile 1550
	if($event['endtime'] > 0 && $event['endtime'] != $event['starttime'])
{
$event['endtime_user'] = $event['endtime']+$offset*3600;

	if($event['endtime'] > 0 && $event['endtime'] != $event['starttime'])
{
$event['endtime_user'] = $event['endtime']+$offset*3600;

		$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_day = adodb_gmmktime(0, 0, 0, gmdate("n", $event['starttime_user']), gmdate("j", $event['starttime_user']), gmdate("Y", $event['starttime_user']));
$end_day = adodb_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']);
$end_time = gmdate("Hi", $event['endtime_user']);


		$start_time = gmdate("Hi", $event['starttime_user']);
$end_time = gmdate("Hi", $event['endtime_user']);


Zeile 1595Zeile 1639
{
// Showing a particular calendar
if($mybb->input['calendar'])

{
// Showing a particular calendar
if($mybb->input['calendar'])

	{

	{

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

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

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

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

	// Showing the default calendar

	// Showing the default calendar

	else
{

	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)
{
error($lang->invalid_calendar);


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

	}

	}


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


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

Zeile 1620Zeile 1664
	}

// Incoming year?

	}

// Incoming year?

	$mybb->input['year'] = $mybb->get_input('year', MyBB::INPUT_INT);
if($mybb->input['year'] && $mybb->input['year'] <= my_date("Y")+5)
{
$year = $mybb->input['year'];
}
else
{

	if(isset($mybb->input['year']) && $mybb->get_input('year', MyBB::INPUT_INT) <= my_date("Y")+5)
{
$year = $mybb->get_input('year', MyBB::INPUT_INT);
}
else
{


		$year = my_date("Y");
}


		$year = my_date("Y");
}


Zeile 1643Zeile 1686

// And day?
$mybb->input['day'] = $mybb->get_input('day', MyBB::INPUT_INT);


// And day?
$mybb->input['day'] = $mybb->get_input('day', MyBB::INPUT_INT);

	if($mybb->input['day'] && $mybb->input['day'] <= gmdate("t", gmmktime(0, 0, 0, $month, 1, $year)))

	if($mybb->input['day'] && $mybb->input['day'] <= gmdate("t", adodb_gmmktime(0, 0, 0, $month, 1, $year)))

	{
$day = $mybb->input['day'];
}

	{
$day = $mybb->input['day'];
}

Zeile 1680Zeile 1723
						$age = '';
}


						$age = '';
}


					$birthday['username'] = format_name($birthday['username'], $birthday['usergroup'], $birthday['displaygroup']);

					$birthday['username'] = format_name(htmlspecialchars_uni($birthday['username']), $birthday['usergroup'], $birthday['displaygroup']);

					$birthday['profilelink'] = build_profile_link($birthday['username'], $birthday['uid']);
eval("\$birthday_list .= \"".$templates->get("calendar_dayview_birthdays_bday", 1, 0)."\";");
$comma = $lang->comma;

					$birthday['profilelink'] = build_profile_link($birthday['username'], $birthday['uid']);
eval("\$birthday_list .= \"".$templates->get("calendar_dayview_birthdays_bday", 1, 0)."\";");
$comma = $lang->comma;

				}

				}

				else
{
++$bdayhidden;

				else
{
++$bdayhidden;

Zeile 1701Zeile 1744
		}
if($birthday_list)
{

		}
if($birthday_list)
{

			$bdaydate = my_date($mybb->settings['dateformat'], gmmktime(0, 0, 0, $month, $day, $year), 0, 0);

			$bdaydate = my_date($mybb->settings['dateformat'], adodb_gmmktime(0, 0, 0, $month, $day, $year), 0, 0);

			$lang->birthdays_on_day = $lang->sprintf($lang->birthdays_on_day, $bdaydate);
eval("\$birthdays = \"".$templates->get("calendar_dayview_birthdays", 1, 0)."\";");
}
}

// So now we fetch events for this month

			$lang->birthdays_on_day = $lang->sprintf($lang->birthdays_on_day, $bdaydate);
eval("\$birthdays = \"".$templates->get("calendar_dayview_birthdays", 1, 0)."\";");
}
}

// So now we fetch events for this month

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

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


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



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


Zeile 1736Zeile 1779
			if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
{
$event_parser_options['allow_videocode'] = 0;

			if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
{
$event_parser_options['allow_videocode'] = 0;

			}

$event['description'] = $parser->parse_message($event['description'], $event_parser_options);


			}

$event['description'] = $parser->parse_message($event['description'], $event_parser_options);


			// Get the usergroup
if($event['username'])

			// Get the usergroup
if($event['username'])

			{

			{

				if(!$event['displaygroup'])
{
$event['displaygroup'] = $event['usergroup'];
}
$user_usergroup = $groupscache[$event['displaygroup']];

				if(!$event['displaygroup'])
{
$event['displaygroup'] = $event['usergroup'];
}
$user_usergroup = $groupscache[$event['displaygroup']];

			}

			}

			else
{
$user_usergroup = $groupscache[1];
}

$titles_cache = $cache->read("usertitles");

			else
{
$user_usergroup = $groupscache[1];
}

$titles_cache = $cache->read("usertitles");





			// Event made by registered user
if($event['uid'] > 0 && $event['username'])
{

			// Event made by registered user
if($event['uid'] > 0 && $event['username'])
{

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

				$event['profilelink'] = build_profile_link(format_name($event['username'], $event['usergroup'], $event['displaygroup']), $event['uid']);


				$event['profilelink'] = build_profile_link(format_name($event['username'], $event['usergroup'], $event['displaygroup']), $event['uid']);


				$hascustomtitle = 0;

 
				if(trim($event['usertitle']) != "")

				if(trim($event['usertitle']) != "")

				{
$hascustomtitle = 1;
}

if($user_usergroup['usertitle'] != "" && !$hascustomtitle)
{
$event['usertitle'] = $user_usergroup['usertitle'];

				{
// Do nothing, no need for an extra variable..
}
elseif($user_usergroup['usertitle'] != "")
{
$event['usertitle'] = $user_usergroup['usertitle'];


				}
elseif(is_array($titles_cache) && !$user_usergroup['usertitle'])
{
reset($titles_cache);

				}
elseif(is_array($titles_cache) && !$user_usergroup['usertitle'])
{
reset($titles_cache);

					foreach($titles_cache as $key => $title)

					foreach($titles_cache as $title)

					{

					{

						if($event['postnum'] >= $key)

						if($event['postnum'] >= $title['posts'])

						{

						{

							if(!$hascustomtitle)
{
$event['usertitle'] = $title['title'];
}

							$event['usertitle'] = $title['title'];




							$event['stars'] = $title['stars'];
$event['starimage'] = $title['starimage'];
break;
}
}

							$event['stars'] = $title['stars'];
$event['starimage'] = $title['starimage'];
break;
}
}

				}


				}


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

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

				}

				}


if(empty($event['starimage']))
{


if(empty($event['starimage']))
{

Zeile 1801Zeile 1840

$event['userstars'] = '';
for($i = 0; $i < $event['stars']; ++$i)


$event['userstars'] = '';
for($i = 0; $i < $event['stars']; ++$i)

				{

				{

					eval("\$event['userstars'] .= \"".$templates->get("calendar_event_userstar", 1, 0)."\";");
}


					eval("\$event['userstars'] .= \"".$templates->get("calendar_event_userstar", 1, 0)."\";");
}


Zeile 1818Zeile 1857
					$event['username'] = $lang->guest;
}


					$event['username'] = $lang->guest;
}


				$event['username'] = $event['username'];

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

				$event['profilelink'] = format_name($event['username'], 1);

if($user_usergroup['usertitle'])

				$event['profilelink'] = format_name($event['username'], 1);

if($user_usergroup['usertitle'])

Zeile 1832Zeile 1871
				$event['userstars'] = '';
}


				$event['userstars'] = '';
}


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

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


if($event['ignoretimezone'] == 0)
{


if($event['ignoretimezone'] == 0)
{

Zeile 1850Zeile 1889
			if($event['endtime'] > 0 && $event['endtime'] != $event['starttime'])
{
$event['endtime_user'] = $event['endtime']+$offset*3600;

			if($event['endtime'] > 0 && $event['endtime'] != $event['starttime'])
{
$event['endtime_user'] = $event['endtime']+$offset*3600;

				$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_day = adodb_gmmktime(0, 0, 0, gmdate("n", $event['starttime_user']), gmdate("j", $event['starttime_user']), gmdate("Y", $event['starttime_user']));
$end_day = adodb_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']);
$end_time = gmdate("Hi", $event['endtime_user']);


				$start_time = gmdate("Hi", $event['starttime_user']);
$end_time = gmdate("Hi", $event['endtime_user']);


Zeile 1911Zeile 1950
				}
}
eval("\$events .= \"".$templates->get("calendar_dayview_event")."\";");

				}
}
eval("\$events .= \"".$templates->get("calendar_dayview_event")."\";");

		}
}

$yearsel = '';
for($year_sel = my_date("Y"); $year_sel < (my_date("Y") + 5); ++$year_sel)
{
eval("\$yearsel .= \"".$templates->get("calendar_year_sel")."\";");
}

$addevent = '';
if($mybb->usergroup['canaddevents'] == 1)
{
eval("\$addevent = \"".$templates->get("calendar_addeventlink")."\";");

		}
}

$yearsel = '';
for($year_sel = my_date("Y"); $year_sel < (my_date("Y") + 5); ++$year_sel)
{
eval("\$yearsel .= \"".$templates->get("calendar_year_sel")."\";");
}

$addevent = '';
if($mybb->usergroup['canaddevents'] == 1)
{
eval("\$addevent = \"".$templates->get("calendar_addeventlink")."\";");

	}

if(!$events)

	}

if(!$events)

Zeile 1980Zeile 2019
	if(empty($mybb->input['week']))
{
list($day, $month, $year) = explode("-", my_date("j-n-Y"));

	if(empty($mybb->input['week']))
{
list($day, $month, $year) = explode("-", my_date("j-n-Y"));

		$php_weekday = gmdate("w", gmmktime(0, 0, 0, $month, $day, $year));

		$php_weekday = gmdate("w", adodb_gmmktime(0, 0, 0, $month, $day, $year));

		$my_weekday = array_search($php_weekday, $weekdays);
// So now we have the start day of this week to show
$start_day = $day-$my_weekday;

		$my_weekday = array_search($php_weekday, $weekdays);
// So now we have the start day of this week to show
$start_day = $day-$my_weekday;

		$mybb->input['week'] = gmmktime(0, 0, 0, $month, $start_day, $year);

		$mybb->input['week'] = adodb_gmmktime(0, 0, 0, $month, $start_day, $year);

	}
else
{

	}
else
{

Zeile 2000Zeile 2039
	$week_from = explode("-", gmdate("j-n-Y", $mybb->input['week']));
$week_from_one = $week_from[1];
$friendly_week_from = gmdate($mybb->settings['dateformat'], $mybb->input['week']);

	$week_from = explode("-", gmdate("j-n-Y", $mybb->input['week']));
$week_from_one = $week_from[1];
$friendly_week_from = gmdate($mybb->settings['dateformat'], $mybb->input['week']);

	$week_to_stamp = gmmktime(0, 0, 0, $week_from[1], $week_from[0]+6, $week_from[2]);

	$week_to_stamp = adodb_gmmktime(0, 0, 0, $week_from[1], $week_from[0]+6, $week_from[2]);

	$week_to = explode("-", gmdate("j-n-Y-t", $week_to_stamp));
$friendly_week_to = gmdate($mybb->settings['dateformat'], $week_to_stamp);


	$week_to = explode("-", gmdate("j-n-Y-t", $week_to_stamp));
$friendly_week_to = gmdate($mybb->settings['dateformat'], $week_to_stamp);


Zeile 2030Zeile 2069
	}

// We load events for the entire month date range - for our mini calendars too

	}

// We load events for the entire month date range - for our mini calendars too

	$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 = adodb_gmmktime(0, 0, 0, $week_from[1], 1, $week_from[2]);
$events_to = adodb_gmmktime(0, 0, 0, $week_to[1], $week_to[3], $week_to[2]);


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



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


Zeile 2041Zeile 2080
	$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_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 2077Zeile 2116
				$time_period = '';
if($event['endtime'] > 0 && $event['endtime'] != $event['starttime'])
{

				$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_day = adodb_gmmktime(0, 0, 0, gmdate("n", $event['starttime_user']), gmdate("j", $event['starttime_user']), gmdate("Y", $event['starttime_user']));
$end_day = adodb_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']);
$end_time = gmdate("Hi", $event['endtime_user']);
// Event only runs over one day

					$start_time = gmdate("Hi", $event['starttime_user']);
$end_time = gmdate("Hi", $event['endtime_user']);
// Event only runs over one day

Zeile 2099Zeile 2138
					{
// Event runs all day
if($start_time == 0000)

					{
// Event runs all day
if($start_time == 0000)

						{

						{

							$time_period = $lang->all_day;
}
else

							$time_period = $lang->all_day;
}
else

Zeile 2155Zeile 2194
			if($bday_count > 1)
{
$birthday_lang = $lang->birthdays;

			if($bday_count > 1)
{
$birthday_lang = $lang->birthdays;

			}

			}

			else
{
$birthday_lang = $lang->birthday;

			else
{
$birthday_lang = $lang->birthday;

Zeile 2172Zeile 2211
		}
eval("\$day_bits[$weekday_month] .= \"".$templates->get("calendar_weekview_day")."\";");
$day_events = $day_birthdays = "";

		}
eval("\$day_bits[$weekday_month] .= \"".$templates->get("calendar_weekview_day")."\";");
$day_events = $day_birthdays = "";

		$weekday_date = gmmktime(0, 0, 0, $weekday_month, $weekday_day+1, $weekday_year);

		$weekday_date = adodb_gmmktime(0, 0, 0, $weekday_month, $weekday_day+1, $weekday_year);

	}

	}





	// Now we build our month headers
$mini_calendars = $weekday_bits = '';
foreach($week_months as $month)

	// Now we build our month headers
$mini_calendars = $weekday_bits = '';
foreach($week_months as $month)

Zeile 2184Zeile 2223

// Fetch mini calendar for each month in this week
$mini_calendars .= build_mini_calendar($calendar, $month[0], $weekday_year, $events_cache)."<br />";


// Fetch mini calendar for each month in this week
$mini_calendars .= build_mini_calendar($calendar, $month[0], $weekday_year, $events_cache)."<br />";





		// Fetch out the days for this month
$days = $day_bits[$month[0]];

		// Fetch out the days for this month
$days = $day_bits[$month[0]];





		eval("\$weekday_bits .= \"".$templates->get("calendar_weekview_month")."\";");

		eval("\$weekday_bits .= \"".$templates->get("calendar_weekview_month")."\";");

	}


	}


	$addevent = '';
if($mybb->usergroup['canaddevents'] == 1)
{

	$addevent = '';
if($mybb->usergroup['canaddevents'] == 1)
{

Zeile 2211Zeile 2250
	if($mybb->input['calendar'])
{
$query = $db->simple_select("calendars", "*", "cid='{$mybb->input['calendar']}'");

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

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

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

	// Showing the default calendar

	// Showing the default calendar

	else

	else

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

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

Zeile 2230Zeile 2269
	$calendar_permissions = get_calendar_permissions($calendar['cid']);

if($calendar_permissions['canviewcalendar'] != 1)

	$calendar_permissions = get_calendar_permissions($calendar['cid']);

if($calendar_permissions['canviewcalendar'] != 1)

	{

	{

		error_no_permission();

		error_no_permission();

	}


	}


	$plugins->run_hooks("calendar_main_view");

// Incoming year?

	$plugins->run_hooks("calendar_main_view");

// Incoming year?

	$mybb->input['year'] = $mybb->get_input('year', MyBB::INPUT_INT);
if($mybb->input['year'] && $mybb->input['year'] <= my_date("Y")+5)
{
$year = $mybb->input['year'];
}
else
{

	if(isset($mybb->input['year']) && $mybb->get_input('year', MyBB::INPUT_INT) <= my_date("Y")+5)
{
$year = $mybb->get_input('year', MyBB::INPUT_INT);
}
else
{


		$year = my_date("Y");
}

// Then the month
$mybb->input['month'] = $mybb->get_input('month', MyBB::INPUT_INT);
if($mybb->input['month'] >= 1 && $mybb->input['month'] <= 12)

		$year = my_date("Y");
}

// Then the month
$mybb->input['month'] = $mybb->get_input('month', MyBB::INPUT_INT);
if($mybb->input['month'] >= 1 && $mybb->input['month'] <= 12)

	{

	{

		$month = $mybb->input['month'];
}
else
{
$month = my_date("n");
}

		$month = $mybb->input['month'];
}
else
{
$month = my_date("n");
}





	add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
add_breadcrumb("$monthnames[$month] $year", get_calendar_link($calendar['cid'], $year, $month));


	add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
add_breadcrumb("$monthnames[$month] $year", get_calendar_link($calendar['cid'], $year, $month));


Zeile 2271Zeile 2309

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

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


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

$prev_month_days = gmdate("t", adodb_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)
{

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

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

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

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

Zeile 2297Zeile 2335
	}

// 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, $calendar_month, $day, $calendar_year);
$num_days = gmdate("t", gmmktime(0, 0, 0, $month, 1, $year));

	$start_timestamp = adodb_gmmktime(0, 0, 0, $calendar_month, $day, $calendar_year);
$num_days = gmdate("t", adodb_gmmktime(0, 0, 0, $month, 1, $year));





	$month_end_weekday = gmdate("w", gmmktime(0, 0, 0, $month, $num_days, $year));

	$month_end_weekday = gmdate("w", adodb_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 = 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)
{

		$next_days -= 7;
}
if($next_days > 0)
{

		$end_timestamp = gmmktime(23, 59, 59, $next_month['month'], $next_days, $next_month['year']);

		$end_timestamp = adodb_gmmktime(23, 59, 59, $next_month['month'], $next_days, $next_month['year']);

	}
else
{
// We don't need days from the next month

	}
else
{
// We don't need days from the next month

		$end_timestamp = gmmktime(23, 59, 59, $month, $num_days, $year);

		$end_timestamp = adodb_gmmktime(23, 59, 59, $month, $num_days, $year);

	}

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

	}

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

Zeile 2371Zeile 2409

if($weekday_id == 0)
{


if($weekday_id == 0)
{

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

				$week_stamp = adodb_gmmktime(0, 0, 0, $calendar_month, $day, $calendar_year);

				$week_link = get_calendar_week_link($calendar['cid'], $week_stamp);
}


				$week_link = get_calendar_week_link($calendar['cid'], $week_stamp);
}


Zeile 2379Zeile 2417
			{
break;
}

			{
break;
}


$day_events = '';

 

// Any events on this specific day?


// Any events on this specific day?

 
			$day_events = $event_lang = '';

			if(is_array($events_cache) && array_key_exists("{$day}-{$calendar_month}-{$calendar_year}", $events_cache))
{
$total_events = count($events_cache["$day-$calendar_month-$calendar_year"]);
if($total_events > $calendar['eventlimit'] && $calendar['eventlimit'] != 0)
{
if($total_events > 1)

			if(is_array($events_cache) && array_key_exists("{$day}-{$calendar_month}-{$calendar_year}", $events_cache))
{
$total_events = count($events_cache["$day-$calendar_month-$calendar_year"]);
if($total_events > $calendar['eventlimit'] && $calendar['eventlimit'] != 0)
{
if($total_events > 1)

					{
$day_events = "<div style=\"margin-bottom: 4px;\"><a href=\"".get_calendar_link($calendar['cid'], $calendar_year, $calendar_month, $day)."\" class=\"smalltext\">{$total_events} {$lang->events}</a></div>\n";
}

					{
$event_lang = $lang->events;
}

					else
{

					else
{

						$day_events = "<div style=\"margin-bottom: 4px;\"><a href=\"".get_calendar_link($calendar['cid'], $calendar_year, $calendar_month, $day)."\" class=\"smalltext\">1 {$lang->event}</a></div>\n";

						$event_lang = $lang->event;

					}

					}

 

$calendar['link'] = get_calendar_link($calendar['cid'], $calendar_year, $calendar_month, $day);
eval("\$day_events = \"".$templates->get("calendar_weekrow_day_events")."\";");

				}
else
{

				}
else
{