Vergleich calendar.php - 1.8.3 - 1.8.37

  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,calendar_weekview_nextlink";
$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_weekview_prevlink";
$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_dayview_event,calendar_dayview,codebuttons,calendar_weekrow_day_events,calendar_weekview_month,calendar_addeventlink,calendar_weekview";
$templatelist .= ",calendar_jump,calendar_jump_option,calendar_editevent,calendar_dayview_birthdays_bday,calendar_dayview_birthdays,calendar_dayview_noevents,calendar_addevent_calendarselect_hidden,calendar_nextlink";
$templatelist .= ",calendar_weekrow_day_birthdays,calendar_weekview_day_birthdays,calendar_year_sel,calendar_event_userstar,calendar_addevent_calendarselect,calendar_eventbit,calendar_event,calendar_move,calendar_prevlink";


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 57Zeile 58
// Make navigation
add_breadcrumb($lang->nav_calendar, "calendar.php");


// Make navigation
add_breadcrumb($lang->nav_calendar, "calendar.php");


$mybb->input['calendar'] = $mybb->get_input('calendar', 1);

$mybb->input['calendar'] = $mybb->get_input('calendar', MyBB::INPUT_INT);

$calendars = cache_calendars();

$calendar_jump = '';

$calendars = cache_calendars();

$calendar_jump = '';

Zeile 104Zeile 105
		"uid" => $mybb->user['uid'],
"name" => $mybb->get_input('name'),
"description" => $mybb->get_input('description'),

		"uid" => $mybb->user['uid'],
"name" => $mybb->get_input('name'),
"description" => $mybb->get_input('description'),

		"private" => $mybb->get_input('private', 1),

		"private" => $mybb->get_input('private', MyBB::INPUT_INT),

		"type" => $mybb->input['type']
);


		"type" => $mybb->input['type']
);


Zeile 112Zeile 113
	if($mybb->input['type'] == "single")
{
$event['start_date'] = array(

	if($mybb->input['type'] == "single")
{
$event['start_date'] = array(

			"day" => $mybb->get_input('single_day', 1),
"month" => $mybb->get_input('single_month', 1),
"year" => $mybb->get_input('single_year', 1)

			"day" => $mybb->get_input('single_day', MyBB::INPUT_INT),
"month" => $mybb->get_input('single_month', MyBB::INPUT_INT),
"year" => $mybb->get_input('single_year', MyBB::INPUT_INT)

		);
$event['repeats'] = '';
}
else if($mybb->input['type'] == "ranged")
{
$event['start_date'] = array(

		);
$event['repeats'] = '';
}
else if($mybb->input['type'] == "ranged")
{
$event['start_date'] = array(

			"day" => $mybb->get_input('start_day', 1),
"month" => $mybb->get_input('start_month', 1),
"year" => $mybb->get_input('start_year', 1),

			"day" => $mybb->get_input('start_day', MyBB::INPUT_INT),
"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(

			"time" => $mybb->get_input('start_time')
);
$event['end_date'] = array(

			"day" => $mybb->get_input('end_day', 1),
"month" => $mybb->get_input('end_month', 1),
"year" => $mybb->get_input('end_year', 1),

			"day" => $mybb->get_input('end_day', MyBB::INPUT_INT),
"month" => $mybb->get_input('end_month', MyBB::INPUT_INT),
"year" => $mybb->get_input('end_year', MyBB::INPUT_INT),

			"time" => $mybb->get_input('end_time')
);
$event['timezone'] = $mybb->get_input('timezone');

			"time" => $mybb->get_input('end_time')
);
$event['timezone'] = $mybb->get_input('timezone');

		$event['ignoretimezone'] =	$mybb->get_input('ignoretimezone', 1);

		$event['ignoretimezone'] =	$mybb->get_input('ignoretimezone', MyBB::INPUT_INT);

		$repeats = array();
switch($mybb->input['repeats'])
{
case 1:
$repeats['repeats'] = 1;

		$repeats = array();
switch($mybb->input['repeats'])
{
case 1:
$repeats['repeats'] = 1;

				$repeats['days'] = $mybb->get_input('repeats_1_days', 1);

				$repeats['days'] = $mybb->get_input('repeats_1_days', MyBB::INPUT_INT);

				break;
case 2:
$repeats['repeats'] = 2;
break;
case 3:
$repeats['repeats'] = 3;

				break;
case 2:
$repeats['repeats'] = 2;
break;
case 3:
$repeats['repeats'] = 3;

				$repeats['weeks'] = $mybb->get_input('repeats_3_weeks', 1);
$mybb->input['repeats_3_days'] = $mybb->get_input('repeats_3_days', 2);

				$repeats['weeks'] = $mybb->get_input('repeats_3_weeks', MyBB::INPUT_INT);
$mybb->input['repeats_3_days'] = $mybb->get_input('repeats_3_days', MyBB::INPUT_ARRAY);

				ksort($mybb->input['repeats_3_days']);
$days = array();
foreach($mybb->input['repeats_3_days'] as $weekday => $value)

				ksort($mybb->input['repeats_3_days']);
$days = array();
foreach($mybb->input['repeats_3_days'] as $weekday => $value)

Zeile 162Zeile 163
				break;
case 4:
$repeats['repeats'] = 4;

				break;
case 4:
$repeats['repeats'] = 4;

				if($mybb->get_input('repeats_4_type', 1) == 1)

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

				{

				{

					$repeats['day'] = $mybb->get_input('repeats_4_day', 1);
$repeats['months'] = $mybb->get_input('repeats_4_months', 1);

					$repeats['day'] = $mybb->get_input('repeats_4_day', MyBB::INPUT_INT);
$repeats['months'] = $mybb->get_input('repeats_4_months', MyBB::INPUT_INT);

				}
else
{

				}
else
{

					$repeats['months'] = $mybb->get_input('repeats_4_months2', 1);

					$repeats['months'] = $mybb->get_input('repeats_4_months2', MyBB::INPUT_INT);

					$repeats['occurance'] = $mybb->get_input('repeats_4_occurance');

					$repeats['occurance'] = $mybb->get_input('repeats_4_occurance');

					$repeats['weekday'] = $mybb->get_input('repeats_4_weekday', 1);

					$repeats['weekday'] = $mybb->get_input('repeats_4_weekday', MyBB::INPUT_INT);

				}
break;
case 5:
$repeats['repeats'] = 5;

				}
break;
case 5:
$repeats['repeats'] = 5;

				if($mybb->get_input('repeats_5_type', 1) == 1)

				if($mybb->get_input('repeats_5_type', MyBB::INPUT_INT) == 1)

				{

				{

					$repeats['day'] = $mybb->get_input('repeats_5_day', 1);
$repeats['month'] = $mybb->get_input('repeats_5_month', 1);
$repeats['years'] = $mybb->get_input('repeats_5_years', 1);

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

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

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

					$repeats['weekday'] = $mybb->get_input('repeats_5_weekday', 1);
$repeats['month'] = $mybb->get_input('repeats_5_month2', 1);
$repeats['years'] = $mybb->get_input('repeats_5_years', 1);

					$repeats['weekday'] = $mybb->get_input('repeats_5_weekday', MyBB::INPUT_INT);
$repeats['month'] = $mybb->get_input('repeats_5_month2', MyBB::INPUT_INT);
$repeats['years'] = $mybb->get_input('repeats_5_years', MyBB::INPUT_INT);

				}
break;
default:

				}
break;
default:

Zeile 226Zeile 227
	$calendar = $db->fetch_array($query);

// Invalid calendar?

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

// Invalid calendar?

	if(!$calendar['cid'])

	if(!$calendar)

	{
error($lang->invalid_calendar);
}

	{
error($lang->invalid_calendar);
}

Zeile 288Zeile 289

if($mybb->request_method == "post")
{


if($mybb->request_method == "post")
{

		$single_day = $mybb->get_input('single_day', 1);
$single_month[$mybb->get_input('single_month', 1)] = " selected=\"selected\"";
$single_year = $mybb->get_input('single_year', 1);
$start_day = $mybb->get_input('start_day', 1);
$start_month[$mybb->get_input('start_month', 1)] = " selected=\"selected\"";
$start_year = $mybb->get_input('start_year', 1);

		$single_day = $mybb->get_input('single_day', MyBB::INPUT_INT);
$single_month[$mybb->get_input('single_month', MyBB::INPUT_INT)] = " selected=\"selected\"";
$single_year = $mybb->get_input('single_year', MyBB::INPUT_INT);
$start_day = $mybb->get_input('start_day', MyBB::INPUT_INT);
$start_month[$mybb->get_input('start_month', MyBB::INPUT_INT)] = " selected=\"selected\"";
$start_year = $mybb->get_input('start_year', MyBB::INPUT_INT);

		$start_time = htmlspecialchars_uni($mybb->get_input('start_time'));

		$start_time = htmlspecialchars_uni($mybb->get_input('start_time'));

		$end_day = $mybb->get_input('end_day', 1);
$end_month[$mybb->get_input('end_month', 1)] = " selected=\"selected\"";
$end_year = $mybb->get_input('end_year', 1);

		$end_day = $mybb->get_input('end_day', MyBB::INPUT_INT);
$end_month[$mybb->get_input('end_month', MyBB::INPUT_INT)] = " selected=\"selected\"";
$end_year = $mybb->get_input('end_year', MyBB::INPUT_INT);

		$end_time = htmlspecialchars_uni($mybb->get_input('end_time'));
if($mybb->get_input('type') == "single")
{

		$end_time = htmlspecialchars_uni($mybb->get_input('end_time'));
if($mybb->get_input('type') == "single")
{

Zeile 313Zeile 314
		}
if(!empty($mybb->input['repeats']))
{

		}
if(!empty($mybb->input['repeats']))
{

			$repeats_sel[$mybb->get_input('repeats', 1)] = " selected=\"selected\"";

			$repeats_sel[$mybb->get_input('repeats', MyBB::INPUT_INT)] = " selected=\"selected\"";

		}

		}

		$repeats_1_days = $mybb->get_input('repeats_1_days', 1);
$repeats_3_weeks = $mybb->get_input('repeats_3_weeks', 1);
foreach($mybb->get_input('repeats_3_days', 2) 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)
{

		{
if($val != 1)
{

Zeile 327Zeile 328
			$repeats_3_days[$day] = " checked=\"checked\"";
}
$repeats_4_type = array();

			$repeats_3_days[$day] = " checked=\"checked\"";
}
$repeats_4_type = array();

		if($mybb->get_input('repeats_4_type', 1) == 1)

		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
{

		}
else
{

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

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

		$repeats_4_day = $mybb->get_input('repeats_4_day', 1);
$repeats_4_months = $mybb->get_input('repeats_4_months', 1);

		$repeats_4_day = $mybb->get_input('repeats_4_day', MyBB::INPUT_INT);
$repeats_4_months = $mybb->get_input('repeats_4_months', MyBB::INPUT_INT);

		$repeats_4_occurance[$mybb->get_input('repeats_4_occurance')] = "selected=\"selected\"";

		$repeats_4_occurance[$mybb->get_input('repeats_4_occurance')] = "selected=\"selected\"";

		$repeats_4_weekday[$mybb->get_input('repeats_4_weekday', 1)] = "selected=\"selected\"";
$repeats_4_months2 = $mybb->get_input('repeats_4_months2', 1);
if($mybb->get_input('repeats_5_type', 1) == 1)

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

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

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

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

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

		$repeats_5_day = $mybb->get_input('repeats_5_day', 1);
$repeats_5_month[$mybb->get_input('repeats_5_month', 1)] = "selected=\"selected\"";
$repeats_5_years = $mybb->get_input('repeats_5_years', 1);

		$repeats_5_day = $mybb->get_input('repeats_5_day', MyBB::INPUT_INT);
$repeats_5_month[$mybb->get_input('repeats_5_month', MyBB::INPUT_INT)] = "selected=\"selected\"";
$repeats_5_years = $mybb->get_input('repeats_5_years', MyBB::INPUT_INT);

		$repeats_5_occurance[$mybb->get_input('repeats_5_occurance')] = "selected=\"selected\"";

		$repeats_5_occurance[$mybb->get_input('repeats_5_occurance')] = "selected=\"selected\"";

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

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





		$timezone = $mybb->get_input('timezone', 1);

		$timezone = $mybb->get_input('timezone', MyBB::INPUT_INT);

	}
else
{
if(!empty($mybb->input['day']))
{

	}
else
{
if(!empty($mybb->input['day']))
{

			$single_day = $start_day = $end_day = $mybb->get_input('day', 1);

			$single_day = $start_day = $end_day = $mybb->get_input('day', MyBB::INPUT_INT);

		}
else
{

		}
else
{

Zeile 372Zeile 373
		}
if(!empty($mybb->input['month']))
{

		}
if(!empty($mybb->input['month']))
{

			$month = $mybb->get_input('month', 1);

			$month = $mybb->get_input('month', MyBB::INPUT_INT);

		}
else
{

		}
else
{

Zeile 381Zeile 382
		$single_month[$month] = $start_month[$month] = $end_month[$month] = "selected=\"selected\"";
if(!empty($mybb->input['year']))
{

		$single_month[$month] = $start_month[$month] = $end_month[$month] = "selected=\"selected\"";
if(!empty($mybb->input['year']))
{

			$single_year = $start_year = $end_year = $mybb->get_input('year', 1);

			$single_year = $start_year = $end_year = $mybb->get_input('year', MyBB::INPUT_INT);

		}
else
{

		}
else
{

Zeile 408Zeile 409
		$repeats_5_month2[1] = "selected=\"selected\"";
$repeats_5_years2 = 1;
$timezone = $mybb->user['timezone'];

		$repeats_5_month2[1] = "selected=\"selected\"";
$repeats_5_years2 = 1;
$timezone = $mybb->user['timezone'];

	}

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


	}

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


	// Construct option list for years
for($year = my_date('Y'); $year < (my_date('Y') + 5); ++$year)
{

	// Construct option list for years
for($year = my_date('Y'); $year < (my_date('Y') + 5); ++$year)
{

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

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

		else












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

if($year == $start_year)
{
$selected = "selected=\"selected\"";
eval("\$start_years .= \"".$templates->get("calendar_year")."\";");
}
else

		{
$selected = "";

		{
$selected = "";

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

			eval("\$start_years .= \"".$templates->get("calendar_year")."\";");
}





		if($year == $start_year)

		if($year == $end_year)

		{
$selected = "selected=\"selected\"";

		{
$selected = "selected=\"selected\"";

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

if($year == $end_year)
{
$selected = "selected=\"selected\"";
eval("\$end_years .= \"".$templates->get("calendar_year")."\";");

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












		}
else
{

		}
else
{

Zeile 448Zeile 449
			eval("\$end_years .= \"".$templates->get("calendar_year")."\";");
}
}

			eval("\$end_years .= \"".$templates->get("calendar_year")."\";");
}
}





	$single_days = $start_days = $end_days = '';

// Construct option list for days
for($day = 1; $day <= 31; ++$day)
{
if($day == $single_day)

	$single_days = $start_days = $end_days = '';

// Construct option list for days
for($day = 1; $day <= 31; ++$day)
{
if($day == $single_day)

		{

		{

			$selected = "selected=\"selected\"";

			$selected = "selected=\"selected\"";

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

if($day == $start_day)
{
$selected = "selected=\"selected\"";
eval("\$start_days .= \"".$templates->get("calendar_day")."\";");

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












		}
else
{
$selected = "";

		}
else
{
$selected = "";

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

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

		}


		}


		if($day == $end_day)

		if($day == $start_day)

		{
$selected = "selected=\"selected\"";

		{
$selected = "selected=\"selected\"";

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












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

if($day == $end_day)
{
$selected = "selected=\"selected\"";
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);


if($mybb->get_input('ignoretimezone', 1) == 1)


if($mybb->get_input('ignoretimezone', MyBB::INPUT_INT) == 1)

	{
$ignore_timezone = "checked=\"checked\"";
}

	{
$ignore_timezone = "checked=\"checked\"";
}

	else
{
$ignore_timezone = '';
}

if($mybb->get_input('private', 1) == 1)

	else
{
$ignore_timezone = '';
}

if($mybb->get_input('private', MyBB::INPUT_INT) == 1)

	{
$privatecheck = " checked=\"checked\"";
}
else
{
$privatecheck = '';

	{
$privatecheck = " checked=\"checked\"";
}
else
{
$privatecheck = '';

	}


	}


	$select_calendar = $calendar_select = '';
$calendarcount = 0;


	$select_calendar = $calendar_select = '';
$calendarcount = 0;


Zeile 537Zeile 538
	{
eval("\$calendar_select .= \"".$templates->get("calendar_addevent_calendarselect")."\";");
}

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

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

$event_errors = '';





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

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


	$plugins->run_hooks("calendar_addevent_end");

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

	$plugins->run_hooks("calendar_addevent_end");

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
if($mybb->input['action'] == "do_editevent" && $mybb->request_method == "post")
{
$query = $db->simple_select("events", "*", "eid='{$mybb->input['eid']}'");
$event = $db->fetch_array($query);


// Edit an event
if($mybb->input['action'] == "do_editevent" && $mybb->request_method == "post")
{
$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);


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


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', 1) == 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 607Zeile 654
		"eid" => $event['eid'],
"name" => $mybb->get_input('name'),
"description" => $mybb->get_input('description'),

		"eid" => $event['eid'],
"name" => $mybb->get_input('name'),
"description" => $mybb->get_input('description'),

		"private" => $mybb->get_input('private', 1),

		"private" => $mybb->get_input('private', MyBB::INPUT_INT),

		"type" => $mybb->input['type']
);


		"type" => $mybb->input['type']
);


Zeile 615Zeile 662
	if($mybb->input['type'] == "single")
{
$event['start_date'] = array(

	if($mybb->input['type'] == "single")
{
$event['start_date'] = array(

			"day" => $mybb->get_input('single_day', 1),
"month" => $mybb->get_input('single_month', 1),
"year" => $mybb->get_input('single_year', 1)

			"day" => $mybb->get_input('single_day', MyBB::INPUT_INT),
"month" => $mybb->get_input('single_month', MyBB::INPUT_INT),
"year" => $mybb->get_input('single_year', MyBB::INPUT_INT)

		);
$event['repeats'] = '';
}
else if($mybb->input['type'] == "ranged")
{
$event['start_date'] = array(

		);
$event['repeats'] = '';
}
else if($mybb->input['type'] == "ranged")
{
$event['start_date'] = array(

			"day" => $mybb->get_input('start_day', 1),
"month" => $mybb->get_input('start_month', 1),
"year" => $mybb->get_input('start_year', 1),

			"day" => $mybb->get_input('start_day', MyBB::INPUT_INT),
"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(

			"time" => $mybb->get_input('start_time')
);
$event['end_date'] = array(

			"day" => $mybb->get_input('end_day', 1),
"month" => $mybb->get_input('end_month', 1),
"year" => $mybb->get_input('end_year', 1),

			"day" => $mybb->get_input('end_day', MyBB::INPUT_INT),
"month" => $mybb->get_input('end_month', MyBB::INPUT_INT),
"year" => $mybb->get_input('end_year', MyBB::INPUT_INT),

			"time" => $mybb->get_input('end_time')
);
$event['timezone'] = $mybb->get_input('timezone');

			"time" => $mybb->get_input('end_time')
);
$event['timezone'] = $mybb->get_input('timezone');

		$event['ignoretimezone'] =	$mybb->get_input('ignoretimezone', 1);

		$event['ignoretimezone'] =	$mybb->get_input('ignoretimezone', MyBB::INPUT_INT);

		$repeats = array();
switch($mybb->input['repeats'])
{
case 1:
$repeats['repeats'] = 1;

		$repeats = array();
switch($mybb->input['repeats'])
{
case 1:
$repeats['repeats'] = 1;

				$repeats['days'] = $mybb->get_input('repeats_1_days', 1);

				$repeats['days'] = $mybb->get_input('repeats_1_days', MyBB::INPUT_INT);

				break;
case 2:
$repeats['repeats'] = 2;
break;
case 3:
$repeats['repeats'] = 3;

				break;
case 2:
$repeats['repeats'] = 2;
break;
case 3:
$repeats['repeats'] = 3;

				$repeats['weeks'] = $mybb->get_input('repeats_3_weeks', 1);
$mybb->input['repeats_3_days'] = $mybb->get_input('repeats_3_days', 2);

				$repeats['weeks'] = $mybb->get_input('repeats_3_weeks', MyBB::INPUT_INT);
$mybb->input['repeats_3_days'] = $mybb->get_input('repeats_3_days', MyBB::INPUT_ARRAY);

				ksort($mybb->input['repeats_3_days']);
$days = array();
foreach($mybb->input['repeats_3_days'] as $weekday => $value)

				ksort($mybb->input['repeats_3_days']);
$days = array();
foreach($mybb->input['repeats_3_days'] as $weekday => $value)

Zeile 665Zeile 712
				break;
case 4:
$repeats['repeats'] = 4;

				break;
case 4:
$repeats['repeats'] = 4;

				if($mybb->get_input('repeats_4_type', 1) == 1)

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

				{

				{

					$repeats['day'] = $mybb->get_input('repeats_4_day', 1);
$repeats['months'] = $mybb->get_input('repeats_4_months', 1);

					$repeats['day'] = $mybb->get_input('repeats_4_day', MyBB::INPUT_INT);
$repeats['months'] = $mybb->get_input('repeats_4_months', MyBB::INPUT_INT);

				}
else
{

				}
else
{

					$repeats['months'] = $mybb->get_input('repeats_4_months2', 1);

					$repeats['months'] = $mybb->get_input('repeats_4_months2', MyBB::INPUT_INT);

					$repeats['occurance'] = $mybb->get_input('repeats_4_occurance');

					$repeats['occurance'] = $mybb->get_input('repeats_4_occurance');

					$repeats['weekday'] = $mybb->get_input('repeats_4_weekday', 1);

					$repeats['weekday'] = $mybb->get_input('repeats_4_weekday', MyBB::INPUT_INT);

				}
break;
case 5:
$repeats['repeats'] = 5;

				}
break;
case 5:
$repeats['repeats'] = 5;

				if($mybb->get_input('repeats_5_type', 1) == 1)

				if($mybb->get_input('repeats_5_type', MyBB::INPUT_INT) == 1)

				{

				{

					$repeats['day'] = $mybb->get_input('repeats_5_day', 1);
$repeats['month'] = $mybb->get_input('repeats_5_month', 1);
$repeats['years'] = $mybb->get_input('repeats_5_years', 1);

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

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

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

					$repeats['weekday'] = $mybb->get_input('repeats_5_weekday', 1);
$repeats['month'] = $mybb->get_input('repeats_5_month2', 1);
$repeats['years'] = $mybb->get_input('repeats_5_years', 1);

					$repeats['weekday'] = $mybb->get_input('repeats_5_weekday', MyBB::INPUT_INT);
$repeats['month'] = $mybb->get_input('repeats_5_month2', MyBB::INPUT_INT);
$repeats['years'] = $mybb->get_input('repeats_5_years', MyBB::INPUT_INT);

				}
break;
default:

				}
break;
default:

Zeile 733Zeile 780
		$calendar = $db->fetch_array($query);

// Invalid calendar?

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

// Invalid calendar?

		if(!$calendar['cid'])

		if(!$calendar)

		{
error($lang->invalid_calendar);
}

		{
error($lang->invalid_calendar);
}

Zeile 752Zeile 799
	}

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

	}

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

 
	$event['timezone'] = (float)$event['timezone'];


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

Zeile 795Zeile 843
	{
$name = htmlspecialchars_uni($mybb->get_input('name'));
$description = htmlspecialchars_uni($mybb->get_input('description'));

	{
$name = htmlspecialchars_uni($mybb->get_input('name'));
$description = htmlspecialchars_uni($mybb->get_input('description'));

		$single_day = $mybb->get_input('single_day', 1);
$single_month[$mybb->get_input('single_month', 1)] = " selected=\"selected\"";
$single_year = $mybb->get_input('single_year', 1);
$start_day = $mybb->get_input('start_day', 1);
$start_month[$mybb->get_input('start_month', 1)] = " selected=\"selected\"";
$start_year = $mybb->get_input('start_year', 1);

		$single_day = $mybb->get_input('single_day', MyBB::INPUT_INT);
$single_month[$mybb->get_input('single_month', MyBB::INPUT_INT)] = " selected=\"selected\"";
$single_year = $mybb->get_input('single_year', MyBB::INPUT_INT);
$start_day = $mybb->get_input('start_day', MyBB::INPUT_INT);
$start_month[$mybb->get_input('start_month', MyBB::INPUT_INT)] = " selected=\"selected\"";
$start_year = $mybb->get_input('start_year', MyBB::INPUT_INT);

		$start_time = htmlspecialchars_uni($mybb->get_input('start_time'));

		$start_time = htmlspecialchars_uni($mybb->get_input('start_time'));

		$end_day = $mybb->get_input('end_day', 1);
$end_month[$mybb->get_input('end_month', 1)] = " selected=\"selected\"";
$end_year = $mybb->get_input('end_year', 1);

		$end_day = $mybb->get_input('end_day', MyBB::INPUT_INT);
$end_month[$mybb->get_input('end_month', MyBB::INPUT_INT)] = " selected=\"selected\"";
$end_year = $mybb->get_input('end_year', MyBB::INPUT_INT);

		$end_time = htmlspecialchars_uni($mybb->get_input('end_time'));
if($mybb->get_input('type') == "single")
{

		$end_time = htmlspecialchars_uni($mybb->get_input('end_time'));
if($mybb->get_input('type') == "single")
{

Zeile 820Zeile 868
		}
if(!empty($mybb->input['repeats']))
{

		}
if(!empty($mybb->input['repeats']))
{

			$repeats_sel[$mybb->get_input('repeats', 1)] = " selected=\"selected\"";

			$repeats_sel[$mybb->get_input('repeats', MyBB::INPUT_INT)] = " selected=\"selected\"";

		}

		}

		$repeats_1_days = $mybb->get_input('repeats_1_days', 1);
$repeats_3_weeks = $mybb->get_input('repeats_3_weeks', 1);
foreach($mybb->get_input('repeats_3_days', 2) 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)
{

		{
if($val != 1)
{

Zeile 834Zeile 882
			$repeats_3_days[$day] = " checked=\"checked\"";
}
$repeats_4_type = array();

			$repeats_3_days[$day] = " checked=\"checked\"";
}
$repeats_4_type = array();

		if($mybb->get_input('repeats_4_type', 1) == 1)

		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] = '';

Zeile 844Zeile 892
			$repeats_4_type[2] = "checked=\"checked\"";
$repeats_4_type[1] = '';
}

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

		$repeats_4_day = $mybb->get_input('repeats_4_day', 1);
$repeats_4_months = $mybb->get_input('repeats_4_months', 1);

		$repeats_4_day = $mybb->get_input('repeats_4_day', MyBB::INPUT_INT);
$repeats_4_months = $mybb->get_input('repeats_4_months', MyBB::INPUT_INT);

		$repeats_4_occurance[$mybb->get_input('repeats_4_occurance')] = "selected=\"selected\"";

		$repeats_4_occurance[$mybb->get_input('repeats_4_occurance')] = "selected=\"selected\"";

		$repeats_4_weekday[$mybb->get_input('repeats_4_weekday', 1)] = "selected=\"selected\"";
$repeats_4_months2 = $mybb->get_input('repeats_4_months2', 1);
if($mybb->get_input('repeats_5_type', 1) == 1)

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

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

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

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

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

		$repeats_5_day = $mybb->get_input('repeats_5_day', 1);
$repeats_5_month[$mybb->get_input('repeats_5_month', 1)] = "selected=\"selected\"";
$repeats_5_years = $mybb->get_input('repeats_5_years', 1);

		$repeats_5_day = $mybb->get_input('repeats_5_day', MyBB::INPUT_INT);
$repeats_5_month[$mybb->get_input('repeats_5_month', MyBB::INPUT_INT)] = "selected=\"selected\"";
$repeats_5_years = $mybb->get_input('repeats_5_years', MyBB::INPUT_INT);

		$repeats_5_occurance[$mybb->get_input('repeats_5_occurance')] = "selected=\"selected\"";

		$repeats_5_occurance[$mybb->get_input('repeats_5_occurance')] = "selected=\"selected\"";

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

		$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', 1) == 1)

		if($mybb->get_input('private', MyBB::INPUT_INT) == 1)

		{
$privatecheck = " checked=\"checked\"";
}

		{
$privatecheck = " checked=\"checked\"";
}

Zeile 874Zeile 922
			$privatecheck = '';
}


			$privatecheck = '';
}


		if($mybb->get_input('ignoretimezone', 1) == 1)

		if($mybb->get_input('ignoretimezone', MyBB::INPUT_INT) == 1)

		{
$ignore_timezone = "checked=\"checked\"";
}

		{
$ignore_timezone = "checked=\"checked\"";
}

Zeile 889Zeile 937
	{
$event_errors = '';
$mybb->input['calendar'] = $event['cid'];

	{
$event_errors = '';
$mybb->input['calendar'] = $event['cid'];

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

		$name = $event['name'];

		$description = htmlspecialchars_uni($event['description']);
if($event['private'] == 1)
{

		$description = htmlspecialchars_uni($event['description']);
if($event['private'] == 1)
{

Zeile 899Zeile 947
		{
$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 964
		}
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 1063Zeile 1111
		}

if($year == $end_year)

		}

if($year == $end_year)

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

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

			eval("\$end_years .= \"".$templates->get("calendar_year")."\";");
}
}

			eval("\$end_years .= \"".$templates->get("calendar_year")."\";");
}
}

Zeile 1091Zeile 1139
		}

if($day == $start_day)

		}

if($day == $start_day)

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

		{
$selected = "selected=\"selected\"";






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

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

		}

if($day == $end_day)






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

if($day == $end_day)

		{
$selected = "selected=\"selected\"";

		{
$selected = "selected=\"selected\"";

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

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

		}
else
{

		}
else
{

Zeile 1119Zeile 1167

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


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

Zeile 1130Zeile 1178
	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);


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

Zeile 1141Zeile 1189
		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)
{
error_no_permission();






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

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

	}


	}


	if($calendar_permissions[$calendar['cid']]['canmoderateevents'] != 1)
{
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($lang->nav_move_event);

$plugins->run_hooks("calendar_move_start");


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





	$calendar_select = $selected = '';

// Build calendar select

	$calendar_select = $selected = '';

// Build calendar select

Zeile 1178Zeile 1226

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

Zeile 1188Zeile 1236

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

Zeile 1206Zeile 1254
	// 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)


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

	{
error_no_permission();
}

$query = $db->simple_select("calendars", "*", "cid='".$mybb->get_input('new_calendar', 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)

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

if(!$new_calendar)

Zeile 1227Zeile 1275
	{
error_no_permission();
}

	{
error_no_permission();
}





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

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

	);

$plugins->run_hooks("calendar_do_move_start");

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

$plugins->run_hooks("calendar_do_move_end");


	);

$plugins->run_hooks("calendar_do_move_start");

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

Zeile 1269Zeile 1317
	if($calendar_permissions['canviewcalendar'] != 1)
{
error_no_permission();

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

$plugins->run_hooks("calendar_approve_end");

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

// Unapprove an event
if($mybb->input['action'] == "unapprove")
{
// 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']}'");

$plugins->run_hooks("calendar_approve_end");

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

// Unapprove an event
if($mybb->input['action'] == "unapprove")
{
// 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)

	}

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

Zeile 1367Zeile 1415
	if($calendar_permissions['canviewcalendar'] != 1 || ($calendar_permissions['canmoderateevents'] != 1 && $event['visible'] == 0))
{
error_no_permission();

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


Zeile 1383Zeile 1431
		"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)
{


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

		$event_parser_options['allow_imgcode'] = 0;

		$event_parser_options['allow_imgcode'] = 0;

	}

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

	}

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

		$event_parser_options['allow_videocode'] = 0;
}

		$event_parser_options['allow_videocode'] = 0;
}





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

// Get the usergroup

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

// Get the usergroup

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

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





	else
{

	else
{

		$user_usergroup = $groupscache[1];














		$user_usergroup = usergroup_permissions(1);
}

$displaygroupfields = array("title", "description", "namestyle", "usertitle", "stars", "starimage", "image");

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

$display_group = usergroup_displaygroup($event['displaygroup']);
if(is_array($display_group))
{
$user_usergroup = array_merge($user_usergroup, $display_group);

	}

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

	}

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

Zeile 1415Zeile 1472
	// 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;

			// Do nothing, no need for an extra variable..

		}

		}


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

		elseif($user_usergroup['usertitle'] != "")
{


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

			$event['usertitle'] = $user_usergroup['usertitle'];
}
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;

Zeile 1475Zeile 1528
			$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['profilelink'] = format_name($event['username'], 1);

if($user_usergroup['usertitle'])

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


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


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

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


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


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

		$offset = $event['timezone'];

		$offset = (float)$event['timezone'];

	}
else
{

	}
else
{

		$offset = $mybb->user['timezone'];

		$offset = (float)$mybb->user['timezone'];

	}

$event['starttime_user'] = $event['starttime']+$offset*3600;

	}

$event['starttime_user'] = $event['starttime']+$offset*3600;

Zeile 1506Zeile 1560
	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 1620Zeile 1674
	}

// Incoming year?

	}

// Incoming year?

	$mybb->input['year'] = $mybb->get_input('year', 1);
if($mybb->input['year'] && $mybb->input['year'] <= my_date("Y")+5)

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


	{

	{

		$year = $mybb->input['year'];

		$year = $mybb->get_input('year', MyBB::INPUT_INT);

	}
else
{

	}
else
{

Zeile 1631Zeile 1684
	}

// Then the month

	}

// Then the month

	$mybb->input['month'] = $mybb->get_input('month', 1);

	$mybb->input['month'] = $mybb->get_input('month', MyBB::INPUT_INT);

	if($mybb->input['month'] >= 1 && $mybb->input['month'] <= 12)
{
$month = $mybb->input['month'];

	if($mybb->input['month'] >= 1 && $mybb->input['month'] <= 12)
{
$month = $mybb->input['month'];

Zeile 1642Zeile 1695
	}

// And day?

	}

// And day?

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

	$mybb->input['day'] = $mybb->get_input('day', MyBB::INPUT_INT);
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 1733
						$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;

Zeile 1701Zeile 1754
		}
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 1728Zeile 1781
				"allow_videocode" => $calendar['allowvideocode']
);


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


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

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

			{
$event_parser_options['allow_imgcode'] = 0;
}


			{
$event_parser_options['allow_imgcode'] = 0;
}


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

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

			{
$event_parser_options['allow_videocode'] = 0;
}

			{
$event_parser_options['allow_videocode'] = 0;
}

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

// Get the usergroup

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

// Get the usergroup

			if($event['username'])

			if($event['usergroup'])

			{

			{

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

				$user_usergroup = usergroup_permissions($event['usergroup']);





			}
else
{

			}
else
{

				$user_usergroup = $groupscache[1];

				$user_usergroup = usergroup_permissions(1);

			}

			}

















$displaygroupfields = array("title", "description", "namestyle", "usertitle", "stars", "starimage", "image");

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

$display_group = usergroup_displaygroup($event['displaygroup']);
if(is_array($display_group))
{
$user_usergroup = array_merge($user_usergroup, $display_group);
}


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

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

					$event['usertitle'] = $user_usergroup['usertitle'];
}
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']))

				{

				{

					$event['starimage'] = $user_usergroup['starimage'];

					$event['starimage'] = $user_usergroup['starimage'];

				}


				}


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

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

Zeile 1806Zeile 1864
				}

if($event['userstars'] && $event['starimage'] && $event['stars'])

				}

if($event['userstars'] && $event['starimage'] && $event['stars'])

				{

				{

					$event['userstars'] .= "<br />";

					$event['userstars'] .= "<br />";

				}

				}

			}
// Created by a guest or an unknown user
else

			}
// Created by a guest or an unknown user
else

Zeile 1816Zeile 1874
				if(!$event['username'])
{
$event['username'] = $lang->guest;

				if(!$event['username'])
{
$event['username'] = $lang->guest;

				}

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


				}

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


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

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

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


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


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

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


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


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

				$offset = $event['timezone'];

				$offset = (float)$event['timezone'];

			}
else
{

			}
else
{

				$offset = $mybb->user['timezone'];

				$offset = (float)$mybb->user['timezone'];

			}

$event['starttime_user'] = $event['starttime']+$offset*3600;

			}

$event['starttime_user'] = $event['starttime']+$offset*3600;

Zeile 1850Zeile 1908
			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 1863Zeile 1921
					if($start_time != 0000 && $end_time != 2359)
{
$time_period .= $lang->comma.gmdate($mybb->settings['timeformat'], $event['starttime_user'])." - ".gmdate($mybb->settings['timeformat'], $event['endtime_user']);

					if($start_time != 0000 && $end_time != 2359)
{
$time_period .= $lang->comma.gmdate($mybb->settings['timeformat'], $event['starttime_user'])." - ".gmdate($mybb->settings['timeformat'], $event['endtime_user']);

					}
else

					}
else

					{
$time_period .= $lang->comma.$lang->all_day;
}

					{
$time_period .= $lang->comma.$lang->all_day;
}

Zeile 1875Zeile 1933
					$time_period .= " - ";
$time_period .= gmdate($mybb->settings['dateformat'], $event['endtime_user']).", ".gmdate($mybb->settings['timeformat'], $event['endtime_user']);
}

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

			}

			}

			else
{
$time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']);

			else
{
$time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']);

Zeile 1885Zeile 1943
			if($repeats)
{
eval("\$repeats = \"".$templates->get("calendar_repeats")."\";");

			if($repeats)
{
eval("\$repeats = \"".$templates->get("calendar_repeats")."\";");

			}

			}


$edit_event = $moderator_options = $event_class = "";
if($calendar_permissions['canmoderateevents'] == 1 || ($mybb->user['uid'] > 0 && $mybb->user['uid'] == $event['uid']))


$edit_event = $moderator_options = $event_class = "";
if($calendar_permissions['canmoderateevents'] == 1 || ($mybb->user['uid'] > 0 && $mybb->user['uid'] == $event['uid']))

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

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

	}

if(!$events)
{

	}

if(!$events)
{

		$lang->no_events = $lang->sprintf($lang->no_events, $calendar['cid'], $day, $month, $year);
eval("\$events = \"".$templates->get("calendar_dayview_noevents")."\";");
}

		$lang->no_events = $lang->sprintf($lang->no_events, $calendar['cid'], $day, $month, $year);
eval("\$events = \"".$templates->get("calendar_dayview_noevents")."\";");
}

Zeile 1946Zeile 2004
	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
else
{

	// Showing the default calendar
else
{

Zeile 1980Zeile 2038
	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
{
$mybb->input['week'] = (int)str_replace("n", "-", $mybb->get_input('week'));

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

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

		// Nothing before 1901 please ;)
if($mybb->input['week'] < -2177625600)

		{

		{

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

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

		}

		}

	}

	}


// This is where we've come from and where we're headed
$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']);


// This is where we've come from and where we're headed
$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);





	add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
add_breadcrumb("{$monthnames[$week_from[1]]} {$week_from[2]}", get_calendar_link($calendar['cid'], $week_from[2], $week_from[1]));
add_breadcrumb($lang->weekly_overview);

	add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
add_breadcrumb("{$monthnames[$week_from[1]]} {$week_from[2]}", get_calendar_link($calendar['cid'], $week_from[2], $week_from[1]));
add_breadcrumb($lang->weekly_overview);

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

	}

	}

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

	else
{
$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 2030Zeile 2088
	}

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

$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_week = $mybb->input['week'] - 604800;

	$prev_link = get_calendar_week_link($calendar['cid'], $prev_week);

























$prev_week_link = '';
if(my_date("Y", $prev_week) >= 1901)
{
$prev_link = get_calendar_week_link($calendar['cid'], $prev_week);

eval("\$prev_week_link = \"".$templates->get("calendar_weekview_prevlink")."\";");
}

$next_week = $mybb->input['week'] + 604800;

$next_week_link = '';
if(my_date("Y", $next_week)+1 <= my_date("Y")+5)
{
$next_link = get_calendar_week_link($calendar['cid'], $next_week);

eval("\$next_week_link = \"".$templates->get("calendar_weekview_nextlink")."\";");
}

$sep = '';
if(!empty($prev_week_link) && !empty($next_week_link))
{
$sep = " | ";
}


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



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


Zeile 2077Zeile 2156
				$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 2172Zeile 2251
		}
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

	}

// Now we build our month headers

Zeile 2221Zeile 2300
	}

// Invalid calendar?

	}

// Invalid calendar?

	if(!$calendar['cid'])

	if(!$calendar)

	{
error($lang->invalid_calendar);
}

	{
error($lang->invalid_calendar);
}

Zeile 2237Zeile 2316
	$plugins->run_hooks("calendar_main_view");

// Incoming year?

	$plugins->run_hooks("calendar_main_view");

// Incoming year?

	$mybb->input['year'] = $mybb->get_input('year', 1);
if($mybb->input['year'] && $mybb->input['year'] <= my_date("Y")+5)

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


	{

	{

		$year = $mybb->input['year'];

		$year = $mybb->get_input('year', MyBB::INPUT_INT);

	}
else
{

	}
else
{

Zeile 2248Zeile 2326
	}

// Then the month

	}

// Then the month

	$mybb->input['month'] = $mybb->get_input('month', 1);

	$mybb->input['month'] = $mybb->get_input('month', MyBB::INPUT_INT);

	if($mybb->input['month'] >= 1 && $mybb->input['month'] <= 12)
{
$month = $mybb->input['month'];

	if($mybb->input['month'] >= 1 && $mybb->input['month'] <= 12)
{
$month = $mybb->input['month'];

Zeile 2261Zeile 2339
	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));


	$next_month = get_next_month($month, $year);

 
	$prev_month = get_prev_month($month, $year);

	$prev_month = get_prev_month($month, $year);


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
























$prev_month_link = '';
if($prev_month['year'] >= 1901)
{
$prev_link = get_calendar_link($calendar['cid'], $prev_month['year'], $prev_month['month']);

eval("\$prev_month_link = \"".$templates->get("calendar_prevlink")."\";");
}

$next_month = get_next_month($month, $year);

$next_month_link = '';
if($next_month['year'] <= my_date("Y")+5)
{
$next_link = get_calendar_link($calendar['cid'], $next_month['year'], $next_month['month']);

eval("\$next_month_link = \"".$templates->get("calendar_nextlink")."\";");
}

$sep = '';
if(!empty($prev_month_link) && !empty($next_month_link))
{
$sep = " | ";
}


	// Start constructing the calendar

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


	// Start constructing the calendar

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

	$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 2288Zeile 2386
		}
$calendar_month = $prev_month['month'];
$calendar_year = $prev_month['year'];

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

	}
else

	}
else

	{
$day = $calendar['startofweek']+1;
$calendar_month = $month;

	{
$day = $calendar['startofweek']+1;
$calendar_month = $month;

Zeile 2297Zeile 2395
	}

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

	$next_days = 6-$month_end_weekday+$calendar['startofweek'];

// More than a week? Go one week back

Zeile 2310Zeile 2408
	}
if($next_days > 0)
{

	}
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 2351Zeile 2449
				$calendar_year = $year;
}
else if($calendar_month == $prev_month['month'] && $day > $prev_month_days)

				$calendar_year = $year;
}
else if($calendar_month == $prev_month['month'] && $day > $prev_month_days)

			{
$day = 1;

			{
$day = 1;

				$in_month = 1;
$calendar_month = $month;
$calendar_year = $year;

				$in_month = 1;
$calendar_month = $month;
$calendar_year = $year;

Zeile 2371Zeile 2469

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

			}

			}


if($weekday_id == 0 && $calendar_month == $next_month['month'])


if($weekday_id == 0 && $calendar_month == $next_month['month'])

			{

			{

				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
{

Zeile 2448Zeile 2548
			// Is the current day
if($day.$calendar_month.$year == $today && $month == $calendar_month)
{

			// Is the current day
if($day.$calendar_month.$year == $today && $month == $calendar_month)
{

				$day_class = "trow_sep";

				eval("\$day_bits .= \"".$templates->get("calendar_weekrow_currentday")."\";");

			}
// Not in this month
else if($in_month == 0)
{

			}
// Not in this month
else if($in_month == 0)
{

				$day_class = "trow1";

				eval("\$day_bits .= \"".$templates->get("calendar_weekrow_day")."\";");

			}
// Just a normal day in this month
else
{

			}
// Just a normal day in this month
else
{

				$day_class = "trow2";

				eval("\$day_bits .= \"".$templates->get("calendar_weekrow_thismonth")."\";");

			}

			}

			eval("\$day_bits .= \"".$templates->get("calendar_weekrow_day")."\";");

 
			$day_birthdays = $day_events = "";
++$day;
}

			$day_birthdays = $day_events = "";
++$day;
}