Vergleich inc/functions_calendar.php - 1.6.1 - 1.6.5

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

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

 * $Id: functions_calendar.php 5016 2010-06-12 00:24:02Z RyanGordon $

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

 */

/**

 */

/**

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

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

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

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

	if($month_start_weekday != $weekdays[0])

	if($month_start_weekday != $weekdays[0] || $calendar['startofweek'] != 0)

	{
$day = gmdate("t", gmmktime(0, 0, 0, $prev_month['month'], 1, $prev_month['year']));
$day -= array_search(($month_start_weekday), $weekdays);
$day += $calendar['startofweek']+1;
$calendar_month = $prev_month['month'];
$calendar_year = $prev_month['year'];

	{
$day = gmdate("t", gmmktime(0, 0, 0, $prev_month['month'], 1, $prev_month['year']));
$day -= array_search(($month_start_weekday), $weekdays);
$day += $calendar['startofweek']+1;
$calendar_month = $prev_month['month'];
$calendar_year = $prev_month['year'];

 

if($day > 31 && $calendar['startofweek'] == 1 && $prev_month_days == 30)
{
// We need to fix it for these days
$day = 25;
}

	}
else
{
$day = $calendar['startofweek']+1;
$calendar_month = $month;
$calendar_year = $year;

	}
else
{
$day = $calendar['startofweek']+1;
$calendar_month = $month;
$calendar_year = $year;

	}

	}


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



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


Zeile 69Zeile 75
	if(!$events_cache)
{
$events_cache = get_events($calendar['cid'], $start_timestamp, $end_timestamp, $calendar_permissions['canmoderateevents']);

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

	}

$today = my_date("dnY");

	}

$today = my_date("dnY");


// Build weekday headers
foreach($weekdays as $weekday)


// Build weekday headers
foreach($weekdays as $weekday)

Zeile 86Zeile 92
		{
// Current month always starts on 1st row
if($row == 0 && $day == $calendar['startofweek']+1)

		{
// Current month always starts on 1st row
if($row == 0 && $day == $calendar['startofweek']+1)

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

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

			else if($calendar_month == $prev_month['month'] && $day > $prev_month_days)
{
$day = 1;

			else if($calendar_month == $prev_month['month'] && $day > $prev_month_days)
{
$day = 1;

Zeile 114Zeile 120
			{
$week_stamp = gmmktime(0, 0, 0, $calendar_month, $day, $calendar_year);
$week_link = get_calendar_week_link($calendar['cid'], $week_stamp);

			{
$week_stamp = gmmktime(0, 0, 0, $calendar_month, $day, $calendar_year);
$week_link = get_calendar_week_link($calendar['cid'], $week_stamp);

			}


			}


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

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

			}


			}


			// Any events on this specific day?
if(@count($events_cache["$day-$calendar_month-$calendar_year"]) > 0)
{

			// Any events on this specific day?
if(@count($events_cache["$day-$calendar_month-$calendar_year"]) > 0)
{

Zeile 129Zeile 135

// 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";
}
// Not in this month
else if($in_month == 0)

				$day_class = "trow_sep";
}
// Not in this month
else if($in_month == 0)

			{

			{

				$day_class = "trow1";
}
// Just a normal day in this month

				$day_class = "trow1";
}
// Just a normal day in this month

			else
{

			else
{

				$day_class = "trow2";
}
if($link_to_day)

				$day_class = "trow2";
}
if($link_to_day)

Zeile 168Zeile 174
 * Cache available calendars in to memory or return the cached calendars
*
* @return array Cached calendars

 * Cache available calendars in to memory or return the cached calendars
*
* @return array Cached calendars

 */

 */

function cache_calendars()
{
global $db;

function cache_calendars()
{
global $db;

Zeile 177Zeile 183
	if(is_array($calendar_cache))
{
return $calendar_cache;

	if(is_array($calendar_cache))
{
return $calendar_cache;

	}

	}


$query = $db->simple_select("calendars", "*", "", array("order_by" => "disporder", "order_dir" => "asc"));
while($calendar = $db->fetch_array($query))


$query = $db->simple_select("calendars", "*", "", array("order_by" => "disporder", "order_dir" => "asc"));
while($calendar = $db->fetch_array($query))

Zeile 186Zeile 192
	}
return $calendar_cache;
}

	}
return $calendar_cache;
}





/**
* Fetch the calendar permissions for the current user for one or more calendars
*

/**
* Fetch the calendar permissions for the current user for one or more calendars
*

Zeile 206Zeile 212
		"canbypasseventmod" => $mybb->usergroup['canbypasseventmod'],
"canmoderateevents" => $mybb->usergroup['canmoderateevents']
);

		"canbypasseventmod" => $mybb->usergroup['canbypasseventmod'],
"canmoderateevents" => $mybb->usergroup['canmoderateevents']
);


if(!is_array($calendars))


if(!is_array($calendars))

	{
return $group_permissions;
}

	{
return $group_permissions;
}

Zeile 217Zeile 223
	if(isset($mybb->user['additionalgroups']))
{
$gid .= ",".$mybb->user['additionalgroups'];

	if(isset($mybb->user['additionalgroups']))
{
$gid .= ",".$mybb->user['additionalgroups'];

	}

	}


if(!is_array($calendar_permissions))
{


if(!is_array($calendar_permissions))
{

Zeile 226Zeile 232
		while($permission = $db->fetch_array($query))
{
$calendar_permissions[$permission['cid']][$permission['gid']] = $permission;

		while($permission = $db->fetch_array($query))
{
$calendar_permissions[$permission['cid']][$permission['gid']] = $permission;

		}
}



















		}

// Add in our usergroup permissions (if custom ones are set, these aren't added)
if(is_array($calendar_permissions))
{
foreach($calendar_permissions as $calendar => $permission)
{
if(is_array($calendar_permissions[$calendar][$mybb->user['usergroup']]))
{
// Already has permissions set
continue;
}

// Use the group permissions!
$calendar_permissions[$calendar][$mybb->user['usergroup']] = $group_permissions;
$calendar_permissions[$calendar][$mybb->user['usergroup']]['cid'] = $calendar;
$calendar_permissions[$calendar][$mybb->user['usergroup']]['gid'] = $mybb->user['usergroup'];
}
}
}


if($cid > 0)
{


if($cid > 0)
{

Zeile 245Zeile 269
			if(!$permissions[$calendar['cid']])
{
$permissions[$calendar['cid']] = $group_permissions;

			if(!$permissions[$calendar['cid']])
{
$permissions[$calendar['cid']] = $group_permissions;

			}
}

			}
}

	}
return $permissions;
}

	}
return $permissions;
}

Zeile 322Zeile 346
		$jump_options .= "<option value=\"{$calendar['cid']}\" $sel>{$calendar['name']}</option>\n";
}
return "<select name=\"calendar\">\n{$jump_options}</select>";

		$jump_options .= "<option value=\"{$calendar['cid']}\" $sel>{$calendar['name']}</option>\n";
}
return "<select name=\"calendar\">\n{$jump_options}</select>";

}

/**

}

/**

 * Fetch the next calendar month from a specified month/year
*
* @param int The month

 * Fetch the next calendar month from a specified month/year
*
* @param int The month

Zeile 333Zeile 357
 */
function get_next_month($month, $year)
{

 */
function get_next_month($month, $year)
{

 
	global $monthnames;


	if($month == 12)

	if($month == 12)

	{

	{

		$nextmonth = 1;
$nextyear = $year+1;

		$nextmonth = 1;
$nextyear = $year+1;

	}
else
{

	}
else
{

		$nextmonth = $month+1;
$nextyear = $year;
}

		$nextmonth = $month+1;
$nextyear = $year;
}

	return array("month" => $nextmonth, "year" => $nextyear);
}



return array("month" => $nextmonth, "year" => $nextyear, "name" => $monthnames[$nextmonth]);
}


/**
* Fetch the previous calendar month from a specified month/year


/**
* Fetch the previous calendar month from a specified month/year

Zeile 355Zeile 382
 */
function get_prev_month($month, $year)
{

 */
function get_prev_month($month, $year)
{

 
	global $monthnames;


	if($month == 1)
{
$prevmonth = 12;

	if($month == 1)
{
$prevmonth = 12;

Zeile 365Zeile 394
		$prevmonth = $month-1;
$prevyear = $year;
}

		$prevmonth = $month-1;
$prevyear = $year;
}

	return array("month" => $prevmonth, "year" => $prevyear);



return array("month" => $prevmonth, "year" => $prevyear, "name" => $monthnames[$prevmonth]);

}

/**

}

/**

Zeile 863Zeile 893
 * @param array The array of the event
* @return string The friendly repetition string
*/

 * @param array The array of the event
* @return string The friendly repetition string
*/

function fetch_friendly_repitition($event)

function fetch_friendly_repetition($event)

{
global $lang;


{
global $lang;


Zeile 916Zeile 946
					{
$weekdays .= $lang->comma;
}

					{
$weekdays .= $lang->comma;
}

					else if(!$event['repeats']['days'][$id+1])

					else if(!$event['repeats']['days'][$id+1] && $weekdays)

					{
$weekdays .= " {$lang->and} ";
}

					{
$weekdays .= " {$lang->and} ";
}