fixed the double-display bug

master
Michał 'rysiek' Woźniak 2014-02-04 18:52:20 +01:00
parent 0b822a26cd
commit 0e7ce0624b
2 changed files with 13 additions and 1 deletions

View File

@ -42,6 +42,13 @@ if (OCP\User::isLoggedIn()) {
header('HTTP/1.0 404 Not Found');
exit();
}
// check if we're being asked for something we can provide
if ($_GET['calendar_id'] !== 'shared_events') {
header('HTTP/1.0 404 Not Found');
exit();
}
// get the data
$linkItem = OCP\Share::getShareByToken(
\OC::$session->get('public_link_token')

View File

@ -20,6 +20,7 @@ $l = OCP\Util::getL10N('calendar');
// Get the event sources
$eventSources = array();
// only for a logged-in user
if (OCP\User::isLoggedIn()) {
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser());
foreach($calendars as $calendar) {
@ -32,6 +33,7 @@ if (OCP\User::isLoggedIn()) {
}
}
// this is needed also when displaying a link-shared calendar
$events_baseURL = OCP\Util::linkTo('calendar', 'ajax/events.php');
$eventSources[] = array('url' => $events_baseURL.'?calendar_id=shared_events',
'backgroundColor' => '#1D2D44',
@ -39,7 +41,10 @@ $eventSources[] = array('url' => $events_baseURL.'?calendar_id=shared_events',
'textColor' => 'white',
'editable' => 'false');
OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources));
// only for a logged-in user
if (OCP\User::isLoggedIn()) {
OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources));
}
$firstDay = null;
$firstDayConfig = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo');