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 4656 2009-12-24 10:14:20Z Tomm $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 475 | Zeile 475 |
---|
{ error($lang->error_invalidevent); }
|
{ 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 484 | Zeile 483 |
---|
if(!$calendar['cid']) { error($lang->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)
|
// 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();
|
}
if(($event['uid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0) && $calendar_permissions['canmoderateevents'] != 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 539 |
---|
"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 611 | Zeile 617 |
---|
$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()) { $event_errors = $eventhandler->get_friendly_errors(); $event_errors = inline_error($event_errors); $mybb->input['action'] = "editevent";
|
// 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";
|
}
| }
|
else
|
else
|
{
| {
|
$details = $eventhandler->update_event(); $plugins->run_hooks("calendar_do_editevent_end"); redirect(get_event_link($event['eid']), $lang->redirect_eventupdated);
| $details = $eventhandler->update_event(); $plugins->run_hooks("calendar_do_editevent_end"); redirect(get_event_link($event['eid']), $lang->redirect_eventupdated);
|
Zeile 631 | Zeile 637 |
---|
}
if($mybb->input['action'] == "editevent")
|
}
if($mybb->input['action'] == "editevent")
|
{ $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("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);
| $query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
|
Zeile 652 | Zeile 658 |
---|
// 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(); }
if(($event['uid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0) && $calendar_permissions['canmoderateevents'] != 1) { error_no_permission();
|
error_no_permission(); }
if(($event['uid'] != $mybb->user['uid'] || $mybb->user['uid'] == 0) && $calendar_permissions['canmoderateevents'] != 1) { error_no_permission();
|
}
| }
|
add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid'])); add_breadcrumb(htmlspecialchars_uni($event['name']), get_event_link($event['eid'])); add_breadcrumb($lang->nav_editevent);
|
add_breadcrumb(htmlspecialchars_uni($calendar['name']), get_calendar_link($calendar['cid'])); add_breadcrumb(htmlspecialchars_uni($event['name']), get_event_link($event['eid'])); add_breadcrumb($lang->nav_editevent);
|
|
|
$plugins->run_hooks("calendar_editevent_start");
// If MyCode is on for this forum and the MyCode editor is enabled inthe Admin CP, draw the code buttons and smilie inserter.
| $plugins->run_hooks("calendar_editevent_start");
// If MyCode is on for this forum and the MyCode editor is enabled inthe Admin CP, draw the code buttons and smilie inserter.
|
Zeile 679 | Zeile 685 |
---|
// Previous selections if($event_errors)
|
// Previous selections if($event_errors)
|
{
| {
|
$name = htmlspecialchars_uni($mybb->input['name']); $description = htmlspecialchars_uni($mybb->input['description']); $single_day = $mybb->input['single_day'];
| $name = htmlspecialchars_uni($mybb->input['name']); $description = htmlspecialchars_uni($mybb->input['description']); $single_day = $mybb->input['single_day'];
|
Zeile 694 | Zeile 700 |
---|
$end_year = $mybb->input['end_year']; $end_time = htmlspecialchars_uni($mybb->input['end_time']); if($mybb->input['type'] == "single")
|
$end_year = $mybb->input['end_year']; $end_time = htmlspecialchars_uni($mybb->input['end_time']); if($mybb->input['type'] == "single")
|
{
| {
|
$type_single = "checked=\"checked\""; $type = "single";
|
$type_single = "checked=\"checked\""; $type = "single";
|
} else { $type_ranged = "checked=\"checked\"";
| } else { $type_ranged = "checked=\"checked\"";
|
$type = "ranged"; } if($mybb->input['repeats'])
| $type = "ranged"; } if($mybb->input['repeats'])
|
Zeile 799 | Zeile 805 |
---|
{ case 1: $repeats_1_days = $repeats['days'];
|
{ case 1: $repeats_1_days = $repeats['days'];
|
$repeats_3_weeks = 1; $repeats_4_type[1] = "checked=\"checked\""; $repeats_4_day = 1;
| $repeats_3_weeks = 1; $repeats_4_type[1] = "checked=\"checked\""; $repeats_4_day = 1;
|
$repeats_4_months = 1; $repeats_4_months2 = 1; $repeats_5_type[1] = "checked=\"checked\"";
| $repeats_4_months = 1; $repeats_4_months2 = 1; $repeats_5_type[1] = "checked=\"checked\"";
|
Zeile 817 | Zeile 823 |
---|
{ $repeats_3_days[$weekday] = " checked=\"checked\""; }
|
{ $repeats_3_days[$weekday] = " checked=\"checked\""; }
|
} $repeats_4_type[1] = "checked=\"checked\""; $repeats_4_day = 1;
| } $repeats_4_type[1] = "checked=\"checked\""; $repeats_4_day = 1;
|
$repeats_4_months = 1; $repeats_4_months2 = 1; $repeats_5_type[1] = "checked=\"checked\"";
| $repeats_4_months = 1; $repeats_4_months2 = 1; $repeats_5_type[1] = "checked=\"checked\"";
|
Zeile 858 | Zeile 864 |
---|
{ $repeats_5_type[1] = "checked=\"checked\""; $repeats_5_day = $repeats['day'];
|
{ $repeats_5_type[1] = "checked=\"checked\""; $repeats_5_day = $repeats['day'];
|
$repeats_5_month[$repeats['month']] = $repeats_5_month2[$repeats['month']] = "selected=\"selected\""; $repeats_5_years = $repeats_5_years2 = $repeats['years'];
| $repeats_5_month[$repeats['month']] = $repeats_5_month2[$repeats['month']] = "selected=\"selected\""; $repeats_5_years = $repeats_5_years2 = $repeats['years'];
|
} else {
| } else {
|
Zeile 899 | Zeile 905 |
---|
if($i == $single_year) { $single_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
if($i == $single_year) { $single_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
} else {
| } else {
|
$single_years .= "<option value=\"{$i}\">{$i}</option>\n";
|
$single_years .= "<option value=\"{$i}\">{$i}</option>\n";
|
}
| }
|
if($i == $start_year) { $start_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
if($i == $start_year) { $start_years .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
} else
| } else
|
{ $start_years .= "<option value=\"{$i}\">{$i}</option>\n";
|
{ $start_years .= "<option value=\"{$i}\">{$i}</option>\n";
|
}
| }
|
if($i == $end_year)
|
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 929 | Zeile 935 |
---|
{ $single_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n"; }
|
{ $single_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n"; }
|
else { $single_days .= "<option value=\"{$i}\">{$i}</option>\n"; } if($i == $start_day)
| else { $single_days .= "<option value=\"{$i}\">{$i}</option>\n"; } if($i == $start_day)
|
{ $start_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n"; } else { $start_days .= "<option value=\"{$i}\">{$i}</option>\n";
|
{ $start_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n"; } else { $start_days .= "<option value=\"{$i}\">{$i}</option>\n";
|
}
| }
|
if($i == $end_day) { $end_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
| if($i == $end_day) { $end_days .= "<option value=\"{$i}\" selected=\"selected\">{$i}</option>\n";
|
Zeile 950 | Zeile 956 |
---|
$end_days .= "<option value=\"{$i}\">{$i}</option>\n"; } }
|
$end_days .= "<option value=\"{$i}\">{$i}</option>\n"; } }
|
|
|
$timezones = build_timezone_select("timezone", $timezone);
$plugins->run_hooks("calendar_editevent_end");
| $timezones = build_timezone_select("timezone", $timezone);
$plugins->run_hooks("calendar_editevent_end");
|
Zeile 958 | Zeile 964 |
---|
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")
|
{ $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);
|
}
| }
|
$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);
|
|
|
// Invalid calendar? if(!$calendar['cid'])
|
// Invalid calendar? if(!$calendar['cid'])
|
{
| {
|
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();
|
Zeile 1016 | Zeile 1022 |
---|
// 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); }
| { // 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);
| $query = $db->simple_select("calendars", "*", "cid='{$event['cid']}'"); $calendar = $db->fetch_array($query);
|
Zeile 1040 | Zeile 1046 |
---|
// 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(); }
if($calendar_permissions[$calendar['cid']]['canmoderateevents'] != 1) { error_no_permission();
| { error_no_permission(); }
if($calendar_permissions[$calendar['cid']]['canmoderateevents'] != 1) { error_no_permission();
|
}
| }
|
Zeile 1087 | Zeile 1093 |
---|
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 1126 | Zeile 1132 |
---|
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 1616 | Zeile 1622 |
---|
} for($i = 0; $i < $post['stars']; ++$i)
|
} for($i = 0; $i < $post['stars']; ++$i)
|
{
| {
|
$event['userstars'] .= "<img src=\"".$event['starimage']."\" border=\"0\" alt=\"*\" />";
|
$event['userstars'] .= "<img src=\"".$event['starimage']."\" border=\"0\" alt=\"*\" />";
|
}
| }
|
if($event['userstars'] && $event['starimage'] && $event['stars']) { $event['userstars'] .= "<br />";
| if($event['userstars'] && $event['starimage'] && $event['stars']) { $event['userstars'] .= "<br />";
|
Zeile 1637 | Zeile 1643 |
---|
$event['profilelink'] = format_name($event['username'], 1); if($user_usergroup['usertitle'])
|
$event['profilelink'] = format_name($event['username'], 1); if($user_usergroup['usertitle'])
|
{
| {
|
$event['usertitle'] = $user_usergroup['usertitle']; } else
| $event['usertitle'] = $user_usergroup['usertitle']; } else
|
Zeile 1697 | Zeile 1703 |
---|
if($repeats) { $repeats = "<span class=\"smalltext\"><strong>{$lang->repeats}</strong><br />{$repeats}</span>";
|
if($repeats) { $repeats = "<span class=\"smalltext\"><strong>{$lang->repeats}</strong><br />{$repeats}</span>";
|
}
| }
|
$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 1780 | Zeile 1786 |
---|
}
$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 1800 |
---|
$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 1982 |
---|
$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]];
|