phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] calendar ical.php, 1.2 index.php, 1.49 preferences.ph


From: skwashd
Subject: [Phpgroupware-cvs] calendar ical.php, 1.2 index.php, 1.49 preferences.php, 1.44
Date: Sun, 15 May 2005 08:57:00 +0200

Update of calendar

Added Files:
     Branch: MAIN
            ical.php lines: +99 -0
Modified Files:
     Branch: MAIN
            index.php lines: +4 -3
            preferences.php lines: +4 -3

Log Message:
merge changes from 16

====================================================
Index: ical.php
<?php
        
/**************************************************************************\
        * phpGroupWare - iCal readonly exporter                                 
   *
        * http://www.phpgroupware.org                                           
   *
        * Copyright (c) 2003 Free Software Foundation Inc                       
   *
        * Written by Dave Hall - dave.hall at mbox.com.au                       
   *
        * Based on anon_wrapper written by Dan Kuykendall <address@hidden>*
        * --------------------------------------------                          
   *
        *  This program is free software; you can redistribute it and/or modify 
it *
        *  under the terms of the GNU General Public License as published by 
the   *
        *  Free Software Foundation; either version 2 of the License, or (at 
your  *
        *  option) any later version.                                           
   *
        
\**************************************************************************/

        /* $Id: ical.php,v 1.2 2005/05/15 06:57:37 skwashd Exp $ */

        /**
        * NOTES:
        *
        * This code is experimental - use it at your own risk
        *
        * Configuration
        * Change only the following 3 lines
        * login
        * - the login you want to use for the iCal script to establish a session
        * - make sure the user exists and has access to NO apps! this user just 
establishes a session
        *
        * passwd
        * - change this password to match what you have setup for this account
        *
        * domain
        * - change this if you want to only allow access to this script from a 
single domain
        *   for single domains and hostname based domain detection leave as is.
        *
        * prev & adv
        * - change these at your own risk
        *
        * exit; comment this line below (so it reads //exit;) to enable this 
script
        *
        * If you don't understand these instructions, you should not use this 
script
        *
        * Usage
        * Call this script using a url similar to 
https://phpgw_user:address@hidden/phpgroupware/calendar/ical.php
        * As the password is sent in the url, it should only be run using HTTPS
        */

        $login  = 'user';
        $passwd = 'changeme';
        $domain = $_SERVER['SERVER_NAME']; //'default';

        $prev = 1; // number of previous months
        $adv = 3; // number of months in advance
        exit;

        // ** DO NOT EDIT BELOW THIS LINE ** //
        if(!$_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>';
                exit;
        }
        @set_time_limit(0);

        //multiple domain support hack
        $_GET['domain'] = $domain;

        $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'];
        $uid = $GLOBALS['phpgw']->accounts->name2id($login);

        $sessionid = $GLOBALS['phpgw']->session->create($login,$passwd,'text');

        $params = array('owner' => 
$GLOBALS['phpgw']->accounts->name2id($login));

        $so = createObject('calendar.socalendar', array('owner' => $uid) );
        $export = createObject('calendar.boicalendar');

        list($start['d'], $start['m'], $start['y']) = explode('-', 
date('d-n-Y', strtotime("-$prev months")));
        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) );
        }
?>

====================================================
Index: calendar/index.php
diff -u calendar/index.php:1.48 calendar/index.php:1.49
--- calendar/index.php:1.48     Sun May 15 05:48:34 2005
+++ calendar/index.php  Sun May 15 06:57:37 2005
@@ -35,8 +35,9 @@
                'menuaction'=> 'calendar.uicalendar.index',
                'date'          => 
date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime)
        );
+
+//     echo 'Local DateTime: '.date('Ymd 
H:i:s',$GLOBALS['phpgw']->datetime->users_localtime).'<br />'."\n";

        Header('Location: '.$GLOBALS['phpgw']->link('/index.php',$parms));
-       $GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
-       exit;
+       $GLOBALS['phpgw']->common->phpgw_exit();
 ?>

====================================================
Index: calendar/preferences.php
diff -u calendar/preferences.php:1.43 calendar/preferences.php:1.44
--- calendar/preferences.php:1.43       Sun May 15 05:48:34 2005
+++ calendar/preferences.php    Sun May 15 06:57:37 2005
@@ -88,8 +88,7 @@
                $phpgw->preferences->save_repository(True);

                Header('Location: '.$phpgw->link('/preferences/index.php'));
-               $GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
-               exit;
+               $phpgw->common->phpgw_exit();
        }

        function display_item($field,$data)
@@ -107,6 +106,7 @@
        }

        $phpgw->common->phpgw_header();
+       echo parse_navbar();

        $p = 
CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
        $templates = Array(
@@ -235,4 +235,5 @@
        display_item(lang('Print calendars in black & white'),$str);

        $p->pparse('out','pref');
+       $phpgw->common->phpgw_footer();
 ?>






reply via email to

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