File: info.php

package info (click to toggle)
kronolith2 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,936 kB
  • ctags: 3,577
  • sloc: php: 14,001; xml: 1,494; sql: 489; makefile: 68
file content (53 lines) | stat: -rw-r--r-- 1,790 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
 * $Horde: kronolith/calendars/info.php,v 1.2.2.3 2008/04/09 23:01:49 jan Exp $
 *
 * Copyright 2002-2008 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

@define('KRONOLITH_BASE', dirname(dirname(__FILE__)));
require_once KRONOLITH_BASE . '/lib/base.php';
require_once 'Horde/RPC.php';
if (@include_once 'HTTP/WebDAV/Server.php') {
    require_once 'Horde/RPC/webdav.php';
}

// Exit if this isn't an authenticated user.
if (!Auth::getAuth()) {
    exit;
}

$calendar = null;
$calendarId = Util::getFormData('c');
if (strncmp($calendarId, 'remote_', 7) === 0) {
    $calendarId = substr($calendarId, 7);
    $remote_calendars = unserialize($prefs->getValue('remote_cals'));
    foreach ($remote_calendars as $remote_calendar) {
        if ($remote_calendar['url'] == $calendarId) {
            $calendar = $remote_calendar;
            break;
        }
    }
} elseif (isset($GLOBALS['all_calendars'][$calendarId])) {
    $calendar = $GLOBALS['all_calendars'][$calendarId];

    $webdav = is_callable(array('HTTP_WebDAV_Server_Horde', 'DELETE'));
    $rewrite = isset($conf['urls']['pretty']) &&
        $conf['urls']['pretty'] == 'rewrite';
    $subscribe_url = $webdav
        ? Horde::url($registry->get('webroot', 'horde')
                     . ($rewrite ? '/rpc/kronolith/' : '/rpc.php/kronolith/'),
                     true, -1)
          . $calendar->get('owner') . '/' . $calendar->getName() . '.ics'
        : Util::addParameter(Horde::applicationUrl('ics.php', true, -1), 'c',
                             $calendar->getName());
}

if (is_null($calendar)) {
    exit;
}

require KRONOLITH_TEMPLATES . '/calendar_info.php';