Vergleich calendar.php - 1.8.4 - 1.8.8

  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 "./global.php";
require_once MYBB_ROOT."inc/functions_calendar.php";

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

Zeile 573Zeile 628
	// 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)

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


		error_no_permission();
}


Zeile 584Zeile 639

// 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 899Zeile 945
		{
$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 962
		}
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 1230Zeile 1276

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


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

	);

$plugins->run_hooks("calendar_do_move_start");

	);

$plugins->run_hooks("calendar_do_move_start");


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

$plugins->run_hooks("calendar_do_move_end");


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

$plugins->run_hooks("calendar_do_move_end");





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

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





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

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

{
// Verify incoming POST request
verify_post_check($mybb->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);
}


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


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


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

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

	{
error_no_permission();
}


	{
error_no_permission();
}


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

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

Zeile 1278Zeile 1324

$updated_event = array(
"visible" => 1


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

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

Zeile 1296Zeile 1342
	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 1415Zeile 1461
	// 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 1517
			$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 1531
		$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 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;

Zeile 1694Zeile 1737
		if($bdayhidden > 0)
{
if($birthday_list)

		if($bdayhidden > 0)
{
if($birthday_list)

			{
$birthday_list .= " - ";
}
$birthday_list .= "{$bdayhidden} {$lang->birthdayhidden}";
}

			{
$birthday_list .= " - ";
}
$birthday_list .= "{$bdayhidden} {$lang->birthdayhidden}";
}

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

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

Zeile 1727Zeile 1770
				"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['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;

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

			}

			}


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



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


Zeile 1746Zeile 1789
				if(!$event['displaygroup'])
{
$event['displaygroup'] = $event['usergroup'];

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

				}

				}

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

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

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

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 2163Zeile 2202

$calendar_link = get_calendar_link($calendar['cid'], $weekday_year, $weekday_month, $weekday_day);
eval("\$day_birthdays = \"".$templates->get("calendar_weekview_day_birthdays")."\";");


$calendar_link = get_calendar_link($calendar['cid'], $weekday_year, $weekday_month, $weekday_day);
eval("\$day_birthdays = \"".$templates->get("calendar_weekview_day_birthdays")."\";");

		}


		}


		$day_link = get_calendar_link($calendar['cid'], $weekday_year, $weekday_month, $weekday_day);
if(!isset($day_bits[$weekday_month]))
{

		$day_link = get_calendar_link($calendar['cid'], $weekday_year, $weekday_month, $weekday_day);
if(!isset($day_bits[$weekday_month]))
{

Zeile 2193Zeile 2232

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


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

	{

	{

		eval("\$addevent = \"".$templates->get("calendar_addeventlink")."\";");
}


		eval("\$addevent = \"".$templates->get("calendar_addeventlink")."\";");
}


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

	// 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 = $mybb->input['month'];
}
else

Zeile 2307Zeile 2346
	if($next_days >= 7)
{
$next_days -= 7;

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

	}

	}

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

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

Zeile 2364Zeile 2403
				$calendar_year = $next_month['year'];
$day = 1;
if($calendar_month == $month)

				$calendar_year = $next_month['year'];
$day = 1;
if($calendar_month == $month)

				{

				{

					$in_month = 1;
}

					$in_month = 1;
}

			}


			}


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

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

Zeile 2379Zeile 2418
			{
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
{