CMS
Version 3.9
rss.inc
Go to the documentation of this file.
1
<?php
2
/**************************************************************
3
4
Copyright (c) 2010 Sonjara, Inc
5
6
Permission is hereby granted, free of charge, to any person
7
obtaining a copy of this software and associated documentation
8
files (the "Software"), to deal in the Software without
9
restriction, including without limitation the rights to use,
10
copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the
12
Software is furnished to do so, subject to the following
13
conditions:
14
15
The above copyright notice and this permission notice shall be
16
included in all copies or substantial portions of the Software.
17
18
Except as contained in this notice, the name(s) of the above
19
copyright holders shall not be used in advertising or otherwise
20
to promote the sale, use or other dealings in this Software
21
without prior written authorization.
22
23
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30
OTHER DEALINGS IN THE SOFTWARE.
31
32
*****************************************************************/
33
34
Fakoli::using
(
"blog"
,
"article"
);
35
36
$blog_id
= checkNumeric($_GET[
"blog_id"
]);
37
$identifier
= checkIdentifier($_GET[
"blog"
]);
38
39
if
(!
$blog_id
&& !
$identifier
)
40
{
41
throw
new
FakoliException
(
"No blog specified"
);
42
}
43
44
if
(
$blog_id
)
45
{
46
$blog
=
new
Blog
(
$blog_id
);
47
}
48
else
49
{
50
$blog
=
Blog::findByIdentifier
(
$identifier
);
51
}
52
53
if
(!
$blog
->published || !
$blog
->enable_rss_feed || !checkRole(
$blog
->allow_read))
54
{
55
throw
new
FakoliException
(
"Access Denied"
);
56
}
57
58
$url
=
$blog
->getURL();
59
60
$constraint
= (
$blog
->max_rss_articles) ?
"LIMIT {$blog->max_rss_articles}"
:
""
;
61
62
$articles
=
$blog
->Articles();
63
$timestamp
= date(
"r"
);
64
65
$xmlArticles
= formatItems(
$articles
,
"<item>\n\t<title>{title:xml}</title>\n\t<description>{message:xml}</description>\n\t<link>{$url}?article_id={article_id}</link>\n\t<author>{author:xml}</author>\n\t<guid>{$url}?article_id={article_id}</guid>\n\t<pubDate>{publish_date:r}</pubDate>\n</item>"
,
"\n"
);
66
67
header(
"Content-Type: text/xml"
);
68
69
echo
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
;
70
?>
71
<rss version=
"2.0"
>
72
<channel>
73
<
title
><?echo
$blog
->format(
"{title:xml}"
)?></
title
>
74
<description><?echo
$blog
->format(
"{description:xml}"
)?></description>
75
<link><?echo
$url
?></link>
76
<lastBuildDate><?echo
$timestamp
?></lastBuildDate>
77
<pubDate><?echo
$blog
->format(
"{created_date:r}"
)?></pubDate>
78
<ttl>1800</ttl>
79
<?echo
$xmlArticles
?>
80
</channel>
81
</rss>
82
83
84
85
86
87
88
89
90
91
92
93
94
95
$blog
$blog
Definition:
blog_article_form.inc:46
title
$bookmark title
Definition:
bookmark_popup.inc:19
Blog
Definition:
blog.inc:41
Blog\findByIdentifier
static findByIdentifier($identifier)
Definition:
blog.inc:155
FakoliException
FakoliException is the base exception class for all Fakoli errors.
Definition:
core.inc:53
Fakoli\using
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition:
core.inc:116
$articles
$articles
Definition:
rss.inc:62
$timestamp
$timestamp
Definition:
rss.inc:63
$blog_id
$blog_id
Definition:
rss.inc:36
$constraint
$constraint
Definition:
rss.inc:60
$identifier
$identifier
Definition:
rss.inc:37
$xmlArticles
$xmlArticles
Definition:
rss.inc:65
$url
if(! $blog->published||! $blog->enable_rss_feed||!checkRole($blog->allow_read)) $url
Definition:
rss.inc:58
code
cms.sonjara.com
cms
components
blog
handlers
rss.inc
Generated on Tue Mar 23 2021 15:36:12 for CMS by
1.9.1