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 4546 2009-11-28 02:34:09Z RyanGordon $
| * $Id: calendar.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
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 612 | Zeile 621 |
---|
$repeats['repeats'] = 0; } $event['repeats'] = $repeats;
|
$repeats['repeats'] = 0; } $event['repeats'] = $repeats;
|
}
| }
|
$eventhandler->set_data($event);
|
$eventhandler->set_data($event);
|
|
|
// Now let the eventhandler do all the hard work. if(!$eventhandler->validate_event())
|
// Now let the eventhandler do all the hard work. if(!$eventhandler->validate_event())
|
{
| {
|
$event_errors = $eventhandler->get_friendly_errors(); $event_errors = inline_error($event_errors); $mybb->input['action'] = "editevent";
| $event_errors = $eventhandler->get_friendly_errors(); $event_errors = inline_error($event_errors); $mybb->input['action'] = "editevent";
|
Zeile 635 | Zeile 644 |
---|
{ $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);
|
|
|
if(!is_numeric($event['eid'])) { error($lang->error_invalidevent);
| if(!is_numeric($event['eid'])) { error($lang->error_invalidevent);
|
Zeile 658 | 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(); }
|
Zeile 1017 | 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?
| { // 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);
| if(!$calendar['cid']) { error($lang->invalid_calendar);
|
Zeile 1393 | 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
| }
// Now output the page
|
Zeile 1781 | 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 1789 | 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 1971 | 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]];
|