phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] calendar ical.php,1.3


From: skwashd
Subject: [Phpgroupware-cvs] calendar ical.php,1.3
Date: Sat, 15 Oct 2005 01:58:00 +0200

Update of calendar

Modified Files:
     Branch: MAIN
            ical.php lines: +20 -17

Log Message:
rfc compliance, optimizations and new auth option

====================================================
Index: calendar/ical.php
diff -u calendar/ical.php:1.2 calendar/ical.php:1.3
--- calendar/ical.php:1.2       Sun May 15 06:57:37 2005
+++ calendar/ical.php   Fri Oct 14 23:58:48 2005
@@ -53,13 +53,13 @@
        exit;

        // ** DO NOT EDIT BELOW THIS LINE ** //
-       if(!$_SERVER['PHP_AUTH_USER'])
+       if( !( (isset($_GET['user']) && isset($_GET['pass']) ) || 
isset($_SERVER['PHP_AUTH_USER']) ) )
        {
                header('WWW-Authenticate: Basic realm="phpGW-iCal"');
                header('HTTP/1.0 401 Unauthorized');
                echo '<p>You must call this script using ';
                list($ignore, $url) = explode('//', $_SERVER['PHP_SELF']);
-               echo  '"webcal://phpgw_user:password@' . $url . '"</p>';
+               echo  "'webcal://phpgw_user:address@hidden' OR 
'webcal://{$url}?user=phpgw_user&amp;pass=password'</p>";
                exit;
        }
        @set_time_limit(0);
@@ -67,17 +67,19 @@
        //multiple domain support hack
        $_GET['domain'] = $domain;

-       $GLOBALS['phpgw_info']['flags'] = array(
-               'disable_Template_class' => True,
-               'login' => True,
-               'currentapp' => 'login',
-               'noheader'  => True
-       );
+       $GLOBALS['phpgw_info']['flags'] = array
+                                       (
+                                               'disable_Template_class'        
=> True,
+                                               'login'                         
=> True,
+                                               'currentapp'                    
=> 'login',
+                                               'noheader'                      
=> True
+                                       );
+
        include('../header.inc.php');
-       header('Content-type: text/calendar');

-       $login  = $_SERVER['PHP_AUTH_USER'];
-       $passwd = $_SERVER['PHP_AUTH_PW'];
+       $login  = (isset($_GET['user']) ? $_GET['user'] : 
$_SERVER['PHP_AUTH_USER']);
+       $passwd = (isset($_GET['pass']) ? $_GET['pass'] : 
$_SERVER['PHP_AUTH_PW']);
+
        $uid = $GLOBALS['phpgw']->accounts->name2id($login);

        $sessionid = $GLOBALS['phpgw']->session->create($login,$passwd,'text');
@@ -91,9 +93,10 @@
        list($end['d'], $end['m'], $end['y']) = explode('-', date('d-n-Y', 
strtotime("+$adv months")));
        $ids = $so->list_events($start['y'], $start['m'], $start['d'], 
$end['y'], $end['m'], $end['d']);

-       //this is done so there is streaming output
-       foreach($ids as $id)
-       {
-               echo $export->export( array('l_event_id' => $id) );
-       }
+       $browser = createObject('phpgwapi.browser');
+       $browser->content_header($login . '.ics','text/calendar');
+
+       echo $export->export( array('l_event_id' => $ids) );
+
+       $GLOBALS['phpgw']->session->destroy($sessionid, 
$GLOBALS['phpgw']->session->kp3);
 ?>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]