Files
dokuwiki-plugin-task/ics.php
Michael Klier 0780279cbb fixed vim modeline
darcs-hash:20080628184628-23886-3280a8ed3ae4331d68f40cb5bbb8ba1738d22373.gz
2008-06-28 20:46:28 +02:00

41 lines
1.2 KiB
PHP

<?php
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Esther Brunner <wikidesign@gmail.com>
*/
if (!defined('CRLF')) define('CRLF', "\r\n");
if(!defined('DOKU_INC')) define('DOKU_INC', realpath(dirname(__FILE__)).'/../../../');
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/common.php');
require_once(DOKU_INC.'inc/infoutils.php');
require_once(DOKU_INC.'inc/pageutils.php');
require_once(DOKU_INC.'inc/parserutils.php');
$id = $_REQUEST['id'];
$data = unserialize(io_readFile(metaFN($id, '.task'), false));
if (!$data['vtodo']) msg('No VTODO data for this task.', -1);
$title = p_get_metadata($id, 'title');
if($title) {
$filename = $title . '.ics';
} else {
$filename = str_replace(':', '/', cleanID($id)) . '.ics';
}
$output = 'BEGIN:VCALENDAR'.CRLF.
'PRODID:-//Wikidesign//NONSGML Task Plugin for DokuWiki//EN'.CRLF.
'VERSION:2.0'.CRLF.
$data['vtodo'].
'END:VCALENDAR'.CRLF;
header("Content-Disposition: attachment; filename='$filename'");
header('Content-Length: '.strlen($output));
header('Connection: close');
header("Content-Type: text/Calendar; name='$filename'");
echo $output;
// vim:ts=4:sw=4:et:enc=utf-8: