From: Jan Schneider Date: Sun, 1 Mar 2009 14:36:41 +0000 (+0100) Subject: Drop ics.php. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=69fd446760c496584b06a6db2d6015574708b331;p=horde.git Drop ics.php. --- diff --git a/kronolith/ics.php b/kronolith/ics.php deleted file mode 100644 index 6236e5b20..000000000 --- a/kronolith/ics.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @package Kronolith - */ - -@define('AUTH_HANDLER', true); -@define('KRONOLITH_BASE', dirname(__FILE__)); -$session_control = 'none'; -require_once KRONOLITH_BASE . '/lib/base.php'; - -// We want to always generate UTF-8 iCalendar data. -NLS::setCharset('UTF-8'); - -// Determine which calendar to export. -$calendar = Util::getFormData('c'); -if (empty($calendar) && $pathInfo = Util::getPathInfo()) { - $calendar = basename($pathInfo); -} - -$share = $kronolith_shares->getShare($calendar); -if (is_a($share, 'PEAR_Error')) { - header('HTTP/1.0 400 Bad Request'); - echo '400 Bad Request'; - exit; -} - -// First try guest permissions. -if (!$share->hasPermission('', PERMS_READ)) { - // Authenticate. - $auth = &Auth::singleton($conf['auth']['driver']); - if (!isset($_SERVER['PHP_AUTH_USER']) - || !$auth->authenticate($_SERVER['PHP_AUTH_USER'], - array('password' => isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : null)) - || !$share->hasPermission(Auth::getAuth(), PERMS_READ)) { - header('WWW-Authenticate: Basic realm="Kronolith iCalendar Interface"'); - header('HTTP/1.0 401 Unauthorized'); - echo '401 Unauthorized'; - exit; - } -} - -// If we've authenticated, we need to re-load global share variables -// now. -if (Auth::getAuth()) { - Kronolith::initialize(); -} - -$cache = &Horde_Cache::singleton($conf['cache']['driver'], Horde::getDriverConfig('cache', $conf['cache']['driver'])); -$key = 'kronolith.ics.' . $calendar; - -$ics = $cache->get($key, 360); -if (!$ics) { - $kronolith_driver = Kronolith::getDriver(null, $calendar); - $events = $kronolith_driver->listEvents(); - - $iCal = new Horde_iCalendar(); - $iCal->setAttribute('X-WR-CALNAME', String::convertCharset($share->get('name'), NLS::getCharset(), 'utf-8')); - - foreach ($events as $id) { - $event = $kronolith_driver->getEvent($id); - if (is_a($event, 'PEAR_Error')) { - continue; - } - $iCal->addComponent($event->toiCalendar($iCal)); - } - - $ics = $iCal->exportvCalendar(); - $cache->set($key, $ics); -} - -$browser->downloadHeaders($calendar . '.ics', - 'text/calendar; charset=' . NLS::getCharset(), - true, - strlen($ics)); -echo $ics;