source: trunk/calendar/freebusy.php @ 2

Revision 2, 2.7 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare - freebusy times as iCals                                     *
4        * http://www.egroupware.org                                                *
5        * Written by RalfBecker@outdoor-training.de                                *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12
13
14        $GLOBALS['phpgw_info'] = array(
15                'flags' => array(
16                        'currentapp' => 'calendar',
17                        'noheader'   => True,
18                        'nofooter'   => True,
19                ),
20        );
21        // check if we are loged in, by checking sessionid and kp3, as the sessionid get set automaticaly by php for php4-sessions
22        $sessionid = isset($_COOKIE['sessionid']) ? $_COOKIE['sessionid'] : @$_GET['sessionid'];
23        $kp3 = isset($_COOKIE['kp3']) ? $_COOKIE['kp3'] : @$_GET['kp3'];
24
25        if (!($loged_in = $sessionid && $kp3))
26        {
27                $GLOBALS['phpgw_info']['flags']['currentapp'] = 'login';
28                $GLOBALS['phpgw_info']['flags']['noapi'] = True;
29        }
30        include ('../header.inc.php');
31
32        function fail_exit($msg)
33        {
34                echo "<html>\n<head>\n<title>$msg</title>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=".
35                        $GLOBALS['phpgw']->translation->charset()."\" />\n</head>\n<body><h1>$msg</h1>\n</body>\n</html>\n";
36
37                $GLOBALS['phpgw']->common->phpgw_exit();
38        }
39
40        if (!$loged_in)
41        {
42                include ('../phpgwapi/inc/functions.inc.php');
43                $GLOBALS['phpgw_info']['flags']['currentapp'] = 'calendar';
44        }
45        $user  = is_numeric($_GET['user']) ? (int) $_GET['user'] : $GLOBALS['phpgw']->accounts->name2id($_GET['user']);
46
47        if (!($username = $GLOBALS['phpgw']->accounts->id2name($user)))
48        {
49                fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!",$_GET['user']));
50        }
51        if (!$loged_in)
52        {
53                $GLOBALS['phpgw']->preferences->account_id = $user;
54                $GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->read_repository();
55                $GLOBALS['phpgw_info']['user']['account_id'] = $user;
56                $GLOBALS['phpgw_info']['user']['account_lid'] = $username;
57
58                $cal_prefs = &$GLOBALS['phpgw_info']['user']['preferences']['calendar'];
59                if (!$cal_prefs['freebusy'] || !empty($cal_prefs['freebusy_pw']) && $cal_prefs['freebusy_pw'] != $_GET['password'])
60                {
61                        fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!",$_GET['user']));
62                }
63        }
64        ExecMethod('calendar.boicalendar.freebusy');
Note: See TracBrowser for help on using the repository browser.