Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: calendar.php 4351 2009-04-17 02:37:21Z Tikitiki $
| * $Id: calendar.php 4673 2009-12-30 12:09:43Z RyanGordon $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 285 | Zeile 285 |
---|
{ foreach($mybb->input['repeats_3_days'] as $day => $val) {
|
{ foreach($mybb->input['repeats_3_days'] as $day => $val) {
|
if($val != 1) continue;
| if($val != 1) { continue; }
|
$day = intval($day); $repeats_3_days[$day] = " checked=\"checked\""; }
| $day = intval($day); $repeats_3_days[$day] = " checked=\"checked\""; }
|
Zeile 326 | Zeile 330 |
---|
if($mybb->input['day']) { $single_day = $start_day = $end_day = intval($mybb->input['day']);
|
if($mybb->input['day']) { $single_day = $start_day = $end_day = intval($mybb->input['day']);
|
} else {
| } else {
|
$single_day = $start_day = $end_day = my_date("j"); } if($mybb->input['month'])
| $single_day = $start_day = $end_day = my_date("j"); } if($mybb->input['month'])
|
Zeile 374 | Zeile 378 |
---|
for($i = my_date('Y'); $i < (my_date('Y') + 5); ++$i) { if($i == $single_year)
|
for($i = my_date('Y'); $i < (my_date('Y') + 5); ++$i) { if($i == $single_year)
|
{
| {
|
$single_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
$single_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
}
| }
|
else { $single_years .= "<option value=\"{$i}\">{$i}</option>\n"; } if($i == $start_year)
|
else { $single_years .= "<option value=\"{$i}\">{$i}</option>\n"; } if($i == $start_year)
|
{
| {
|
$start_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
$start_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
}
| }
|
else { $start_years .= "<option value=\"{$i}\">{$i}</option>\n"; } if($i == $end_year)
|
else { $start_years .= "<option value=\"{$i}\">{$i}</option>\n"; } if($i == $end_year)
|
{
| {
|
$end_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n"; } else { $end_years .= "<option value=\"{$i}\">{$i}</option>\n";
|
$end_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n"; } else { $end_years .= "<option value=\"{$i}\">{$i}</option>\n";
|
} }
| } }
|
// Construct option list for days for($i = 1; $i <= 31; ++$i)
| // Construct option list for days for($i = 1; $i <= 31; ++$i)
|
Zeile 467 | Zeile 471 |
---|
// Edit an event if($mybb->input['action'] == "do_editevent" && $mybb->request_method == "post")
|
// Edit an event if($mybb->input['action'] == "do_editevent" && $mybb->request_method == "post")
|
{ $query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent); }
$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
// Invalid calendar? if(!$calendar['cid']) { 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(); }
| { $query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent); }
$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
// Invalid calendar? if(!$calendar['cid']) { 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->input['my_post_key']);
|
// Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
|
|
|
// Are we going to delete this event or just edit it? if($mybb->input['delete'] == 1)
|
// Are we going to delete this event or just edit it? if($mybb->input['delete'] == 1)
|
{
| {
|
$db->delete_query("events", "eid='{$event['eid']}'");
// Redirect back to the main calendar view. redirect("calendar.php", $lang->redirect_eventdeleted);
|
$db->delete_query("events", "eid='{$event['eid']}'");
// Redirect back to the main calendar view. redirect("calendar.php", $lang->redirect_eventdeleted);
|
| }
// Have we made a private event public? if(!$mybb->input['private']) { $mybb->input['private'] = 0;
|
}
$plugins->run_hooks("calendar_do_editevent_start");
| }
$plugins->run_hooks("calendar_do_editevent_start");
|
Zeile 534 | Zeile 543 |
---|
"month" => $mybb->input['single_month'], "year" => $mybb->input['single_year'] );
|
"month" => $mybb->input['single_month'], "year" => $mybb->input['single_year'] );
|
| $event['repeats'] = '';
|
} else if($mybb->input['type'] == "ranged") {
| } else if($mybb->input['type'] == "ranged") {
|
Zeile 542 | Zeile 552 |
---|
"month" => $mybb->input['start_month'], "year" => $mybb->input['start_year'], "time" => $mybb->input['start_time']
|
"month" => $mybb->input['start_month'], "year" => $mybb->input['start_year'], "time" => $mybb->input['start_time']
|
);
| );
|
$event['end_date'] = array( "day" => $mybb->input['end_day'], "month" => $mybb->input['end_month'],
| $event['end_date'] = array( "day" => $mybb->input['end_day'], "month" => $mybb->input['end_month'],
|
Zeile 557 | Zeile 567 |
---|
case 1: $repeats['repeats'] = 1; $repeats['days'] = $mybb->input['repeats_1_days'];
|
case 1: $repeats['repeats'] = 1; $repeats['days'] = $mybb->input['repeats_1_days'];
|
break;
| break;
|
case 2: $repeats['repeats'] = 2; break;
| case 2: $repeats['repeats'] = 2; break;
|
Zeile 565 | Zeile 575 |
---|
$repeats['repeats'] = 3; $repeats['weeks'] = $mybb->input['repeats_3_weeks']; if(!is_array($mybb->input['repeats_3_days']))
|
$repeats['repeats'] = 3; $repeats['weeks'] = $mybb->input['repeats_3_weeks']; if(!is_array($mybb->input['repeats_3_days']))
|
{
| {
|
$mybb->input['repeats_3_days'] = array(); } ksort($mybb->input['repeats_3_days']);
| $mybb->input['repeats_3_days'] = array(); } ksort($mybb->input['repeats_3_days']);
|
Zeile 611 | Zeile 621 |
---|
$repeats['repeats'] = 0; } $event['repeats'] = $repeats;
|
$repeats['repeats'] = 0; } $event['repeats'] = $repeats;
|
}
| }
|
$eventhandler->set_data($event);
// Now let the eventhandler do all the hard work.
| $eventhandler->set_data($event);
// Now let the eventhandler do all the hard work.
|
Zeile 657 | Zeile 667 |
---|
}
if(($event['uid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0) && $calendar_permissions['canmoderateevents'] != 1)
|
}
if(($event['uid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0) && $calendar_permissions['canmoderateevents'] != 1)
|
{ error_no_permission();
| { error_no_permission();
|
}
add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
| }
add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid']));
|
Zeile 1016 | Zeile 1026 |
---|
// 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")
|
{ // Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent); }
$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
// Invalid calendar? if(!$calendar['cid'])
| { // Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent); }
$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
// Invalid calendar? if(!$calendar['cid'])
|
{ error($lang->invalid_calendar);
|
{ error($lang->invalid_calendar);
|
}
| }
|
// Do we have permission to view this calendar? $calendar_permissions = get_calendar_permissions(); if($calendar_permissions[$calendar['cid']]['canviewcalendar'] != 1)
|
// Do we have permission to view this calendar? $calendar_permissions = get_calendar_permissions(); if($calendar_permissions[$calendar['cid']]['canviewcalendar'] != 1)
|
{ error_no_permission();
| { error_no_permission();
|
}
if($calendar_permissions[$calendar['cid']]['canmoderateevents'] != 1)
| }
if($calendar_permissions[$calendar['cid']]['canmoderateevents'] != 1)
|
Zeile 1054 | Zeile 1064 |
---|
$new_calendar = $db->fetch_array($query);
if(!$new_calendar['cid'])
|
$new_calendar = $db->fetch_array($query);
if(!$new_calendar['cid'])
|
{ error($lang->invalid_calendar); }
| { error($lang->invalid_calendar); }
|
if($calendar_permissions[$mybb->input['new_calendar']]['canviewcalendar'] != 1) { error_no_permission(); }
|
if($calendar_permissions[$mybb->input['new_calendar']]['canviewcalendar'] != 1) { error_no_permission(); }
|
|
|
$plugins->run_hooks("calendar_do_move_start");
$updated_event = array(
| $plugins->run_hooks("calendar_do_move_start");
$updated_event = array(
|
Zeile 1071 | Zeile 1081 |
---|
$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); }
// Approve an event if($mybb->input['action'] == "approve")
|
redirect(get_event_link($event['eid']), $lang->redirect_eventmoved); }
// Approve an event if($mybb->input['action'] == "approve")
|
{ // Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent); }
$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
// Invalid calendar? if(!$calendar['cid']) { 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(); }
| { // Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent); }
$query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
// Invalid calendar? if(!$calendar['cid']) { 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(); }
|
if($calendar_permissions['canmoderateevents'] != 1) { error_no_permission(); }
|
|
|
$plugins->run_hooks("calendar_approve_start");
$updated_event = array(
| $plugins->run_hooks("calendar_approve_start");
$updated_event = array(
|
Zeile 1118 | Zeile 1128 |
---|
$db->update_query("events", $updated_event, "eid='{$event['eid']}'");
$plugins->run_hooks("calendar_approve_end");
|
$db->update_query("events", $updated_event, "eid='{$event['eid']}'");
$plugins->run_hooks("calendar_approve_end");
|
|
|
redirect(get_event_link($event['eid']), $lang->redirect_eventapproved); }
| redirect(get_event_link($event['eid']), $lang->redirect_eventapproved); }
|
Zeile 1126 | Zeile 1136 |
---|
if($mybb->input['action'] == "unapprove") { // Verify incoming POST request
|
if($mybb->input['action'] == "unapprove") { // Verify incoming POST request
|
verify_post_check($mybb->input['my_post_key']);
| verify_post_check($mybb->input['my_post_key']);
|
$query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
| $query = $db->simple_select("events", "*", "eid='".intval($mybb->input['eid'])."'"); $event = $db->fetch_array($query);
|
Zeile 1134 | Zeile 1144 |
---|
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent);
|
if(!is_numeric($event['eid'])) { 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 1148 | Zeile 1158 |
---|
// 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)
| }
if($calendar_permissions['canmoderateevents'] != 1)
|
Zeile 1219 | Zeile 1229 |
---|
// Get the usergroup if($event['username'])
|
// Get the usergroup if($event['username'])
|
{
| {
|
if(!$event['displaygroup']) { $event['displaygroup'] = $event['usergroup'];
| if(!$event['displaygroup']) { $event['displaygroup'] = $event['usergroup'];
|
Zeile 1227 | Zeile 1237 |
---|
$user_usergroup = $groupscache[$event['displaygroup']]; } else
|
$user_usergroup = $groupscache[$event['displaygroup']]; } else
|
{
| {
|
$user_usergroup = $groupscache[1];
|
$user_usergroup = $groupscache[1];
|
}
| }
|
if(!is_array($titles_cache)) {
| if(!is_array($titles_cache)) {
|
Zeile 1240 | Zeile 1250 |
---|
$titles_cache[$usertitle['posts']] = $usertitle; } unset($usertitle);
|
$titles_cache[$usertitle['posts']] = $usertitle; } unset($usertitle);
|
}
| }
|
// Event made by registered user if($event['uid'] > 0 && $event['username'])
| // Event made by registered user if($event['uid'] > 0 && $event['username'])
|
Zeile 1305 | Zeile 1315 |
---|
$event['username'] = $event['username']; $event['profilelink'] = format_name($event['username'], 1);
|
$event['username'] = $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 1347 | Zeile 1357 |
---|
if($start_time != 0000 && $end_time != 2359) { $time_period .= ", ".gmdate($mybb->settings['timeformat'], $event['starttime_user'])." - ".gmdate($mybb->settings['timeformat'], $event['endtime_user']);
|
if($start_time != 0000 && $end_time != 2359) { $time_period .= ", ".gmdate($mybb->settings['timeformat'], $event['starttime_user'])." - ".gmdate($mybb->settings['timeformat'], $event['endtime_user']);
|
} else
| } else
|
{ $time_period .= ", {$lang->all_day}"; }
|
{ $time_period .= ", {$lang->all_day}"; }
|
}
| }
|
else { $time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']).", ".gmdate($mybb->settings['timeformat'], $event['starttime_user']);
| else { $time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']).", ".gmdate($mybb->settings['timeformat'], $event['starttime_user']);
|
Zeile 1363 | Zeile 1373 |
---|
else { $time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']);
|
else { $time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']);
|
}
| }
|
$repeats = fetch_friendly_repitition($event); if($repeats) { $repeats = "<span class=\"smalltext\"><strong>{$lang->repeats}</strong><br />{$repeats}</span>";
|
$repeats = fetch_friendly_repitition($event); if($repeats) { $repeats = "<span class=\"smalltext\"><strong>{$lang->repeats}</strong><br />{$repeats}</span>";
|
}
| }
|
if($calendar_permissions['canmoderateevents'] == 1 || ($mybb->user['uid'] > 0 && $mybb->user['uid'] == $event['uid'])) { eval("\$edit_event = \"".$templates->get("calendar_event_editbutton")."\";");
| if($calendar_permissions['canmoderateevents'] == 1 || ($mybb->user['uid'] > 0 && $mybb->user['uid'] == $event['uid'])) { eval("\$edit_event = \"".$templates->get("calendar_event_editbutton")."\";");
|
Zeile 1392 | Zeile 1402 |
---|
if($event['visible'] == 0) { $event_class = " trow_shaded";
|
if($event['visible'] == 0) { $event_class = " trow_shaded";
|
} }
$month = my_date("n");
$yearsel = ''; for($i = my_date("Y"); $i < (my_date("Y") + 5); ++$i) { $yearsel .= "<option value=\"$i\">$i</option>\n"; }
if($mybb->usergroup['canaddevents'] == 1) { eval("\$addevent = \"".$templates->get("calendar_addeventlink")."\";"); }
| } }
$month = my_date("n");
$yearsel = ''; for($i = my_date("Y"); $i < (my_date("Y") + 5); ++$i) { $yearsel .= "<option value=\"$i\">$i</option>\n"; }
if($mybb->usergroup['canaddevents'] == 1) { eval("\$addevent = \"".$templates->get("calendar_addeventlink")."\";"); }
|
// Now output the page $plugins->run_hooks("calendar_event_end");
| // Now output the page $plugins->run_hooks("calendar_event_end");
|
Zeile 1780 | Zeile 1790 |
---|
}
$weekdays = fetch_weekday_structure($calendar['startofweek']);
|
}
$weekdays = fetch_weekday_structure($calendar['startofweek']);
|
| $yearsel = ''; for($i = my_date("Y"); $i < (my_date("Y") + 5); ++$i) { $yearsel .= "<option value=\"$i\">$i</option>\n"; }
|
// No incoming week, show THIS week if(!$mybb->input['week'])
| // No incoming week, show THIS week if(!$mybb->input['week'])
|
Zeile 1788 | Zeile 1804 |
---|
$php_weekday = gmdate("w", 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
|
$php_weekday = gmdate("w", 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-$php_weekday;
| $start_day = $day-$my_weekday;
|
$mybb->input['week'] = gmmktime(0, 0, 0, $month, $start_day, $year); } else
| $mybb->input['week'] = gmmktime(0, 0, 0, $month, $start_day, $year); } else
|
Zeile 1970 | Zeile 1986 |
---|
$weekday_year = $month[1];
// Fetch mini calendar for each month in this week
|
$weekday_year = $month[1];
// Fetch mini calendar for each month in this week
|
$mini_calendars .= build_mini_calendar($calendar, $month[0], $year[1], $events_cache)."<br />";
| $mini_calendars .= build_mini_calendar($calendar, $month[0], $weekday_year, $events_cache)."<br />";
|
// Fetch out the days for this month $days = $day_bits[$month[0]];
| // Fetch out the days for this month $days = $day_bits[$month[0]];
|