aboutsummaryrefslogtreecommitdiffstats
path: root/rss/rss2.0.php
blob: 7e37ec3612f848d0852d627dd7d02375a17a4f1c (plain) (blame)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php

/********************************************************************************
*	Modified from phpicalendar 2.0a distribution by Jim Hu
*	philosophical changes 
*		- instead of having separate generators, use a date range for all views (done)
*		- change the rss generation method to conform to standards(not done)
*	PHP note: #@ is error control operator to suppress execution halt on error
*		- used below to deal with undef?
*
*	using rssview, RSS feeds can be specified to return events for a given day, week, month, or year 
*	feeds can be specified for a number of days to or from a given date
*	feeds can be specified for a range of dates
*
*********************************************************************************/

/* Modified from 2.21 by dyfrin 2006/03/08 19:09:28
   Changes:
   -RSS changed to 2.0, encoding removed, languages converted to ISO standard for feeds
   -RSS title changed to be set by config.inc.php.  Make sure that is added to it. 
   Lines modified: 135-165, 208-223
*/
   
define('BASE', '../');
require(BASE.'rss/rss_common.php');
function rss_top(){
	global $cal_displayname, $theview, $phpiCal_config, $cpath, $lang, $rss_link, $rss_language;

	$rss = 	"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n";
	/* Use 2.0 and strip encoding, use rss_language */
	$rss .= '<rss version="2.0"'."\n";
	$rss .= 	'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  
	xmlns:ev="http://purl.org/rss/1.0/modules/event/" 
	xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n";
	$rss .= '<channel>'."\n";
	$rss .= '<title>'.$cal_displayname;
	if ($theview !=""){$rss .= ' - '.$theview;} 
	$rss .= "</title>\n";
	
	$rss .= '<link>'.$phpiCal_config->default_path.'/rss/rss2.0.php/';
	if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath";
	$rss .='</link>'."\n";
	$rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n";
	$rss .= '<language>'.$rss_language.'</language>'."\n";
	return $rss;
}

function rss_li($rss_link, $uid){
	$return = "";
}

function enclose_items($rss_items){
	return $rss_items;
}

function rss_item(){
	global $uid,$event_start,$rss_title,$rss_link, $dayofweek, $event_text, $rss_description, $val, $thisdate;
	$rss = '<item>'."\n";
	/* Create guid, and use uid to make link unique */
	$rss .= '<guid isPermaLink="false">'.$rss_link.'&amp;uid='.$uid.'</guid>'."\n";
	/* End guid modification */
	$rss .= '<title>'.$rss_title.'</title>'."\n";
	$rss .= '<ev:startdate>'.date("Y-m-d\TH:i:s", @$val["start_unixtime"]).'</ev:startdate>'."\n";
	$rss .= '<ev:enddate>'.date("Y-m-d\TH:i:s", @$val["end_unixtime"]).'</ev:enddate>'."\n";

	$rss .= '<link>'.$rss_link.'</link>'."\n";
	$rss .= '<description>'.$rss_description.'</description>'."\n";
	if (isset($val['location']) && $val['location'] !=''){
		$location		= str_replace('&','&amp;',$val['location']);
		$location		= str_replace('&amp;amp;','&amp;',$location);
		$rss .= '<ev:location>'.$location."</ev:location>\n";
	}	
	$rss .= '</item>'."\n";
	return $rss;
}

function rss_noitems(){
	$rss = '<item>'."\n";
	$rss .= '<guid isPermaLink="false">'.$default_path.'&amp;uid='.$thisdate.'</guid>'."\n";
	$rss .= '<title>No events found</title>'."\n";
	$rss .= '<link>'.htmlspecialchars ("$default_path").'</link>'."\n";
	$rss .= '</item>'."\n";
	return $rss;	
}

function rss_close(){
	return "\n</channel>\n</rss>\n";
}
?>

© 2014-2024 Faster IT GmbH | imprint | privacy policy