-
Notifications
You must be signed in to change notification settings - Fork 3
/
rss.php
141 lines (104 loc) · 5.47 KB
/
rss.php
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
header("Content-Type: application/xml; charset=utf-8");
require_once(dirname(__FILE__) . "/config.php");
_load_language_file("/rss.inc");
include $xerte_toolkits_site->php_library_path . "url_library.php";
$query_modifier = "rss";
$action_modifder = "play";
if(isset($_GET['export'])){
$query_modifier = "export";
$action_modifder = "export";
}
if(isset($_GET['html5'])){
$query_modifier = "rss";
$action_modifder = "play_html5";
}
if(!isset($_GET['username'])){
/*
* Change this to reflect site settings
*/
echo "<rss version=\"2.0\">
<channel><title>{$xerte_toolkits_site->name}</title>
<link>{$xerte_toolkits_site->site_url}</link>
<description>" . RSS_DESCRIPTION . " " . $xerte_toolkits_site->name . "</description>
<language>" . RSS_LANGUAGE . "</language>
<image><title>{$xerte_toolkits_site->name}</title>
<url>{$xerte_toolkits_site->site_url}website_code/images/xerteLogo.jpg</url>
<link>{$xerte_toolkits_site->site_url}</link></image>";
}else{
$temp_array = explode("_",$_GET['username']);
$query_created_by = "select login_id from {$xerte_toolkits_site->database_table_prefix}logindetails where (firstname=? AND surname = ?)";
$rows = db_query($query_created_by, array($temp_array[0], $temp_array[1]));
if(sizeof($rows) == 0) {
header("HTTP/1.0 404 Not Found");
exit(0);
}else{
$folder_string = 'public';
if(isset($_GET['folder_name'])){
$folder_string = " - " . _html_escape(str_replace("_", " ", $_GET['folder_name']));
}
echo "<rss version=\"2.0\">
<channel><title>{$xerte_toolkits_site->name}</title>
<link>{$xerte_toolkits_site->site_url}</link>
<description>" . RSS_DESCRIPTION . " " . $xerte_toolkits_site->name . "</description>
<language>" . RSS_LANGUAGE . "</language>
<image><title>{$xerte_toolkits_site->name}</title>
<url>{$xerte_toolkits_site->site_url}website_code/images/xerteLogo.jpg</url>
<link>{$xerte_toolkits_site->site_url}</link></image>";
$row_create = $rows[0];
}
}
$params = array();
if(!isset($_GET['username'])){
$query = "select {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id,creator_id,date_created,template_name,description
FROM {$xerte_toolkits_site->database_table_prefix}templatedetails, {$xerte_toolkits_site->database_table_prefix}templatesyndication
WHERE $query_modifier='true' AND {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id = {$xerte_toolkits_site->database_table_prefix}templatesyndication.template_id";
}else{
if(!isset($_GET['folder_name'])){
$query = "select {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id,creator_id,date_created,template_name,description
FROM {$xerte_toolkits_site->database_table_prefix}templatedetails, {$xerte_toolkits_site->database_table_prefix}templatesyndication
WHERE $query_modifier='true' AND creator_id=? AND {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id = {$xerte_toolkits_site->database_table_prefix}templatesyndication.template_id";
$params[] = $row_create['login_id'];
}else{
$row_folder = db_query_one("SELECT folder_id FROM {$xerte_toolkits_site->database_table_prefix}folderdetails WHERE folder_name = ?", array(str_replace("_", " ", $_GET['folder_name'])));
if(empty($row_folder)) {
die("Invalid folder name");
}
$query = "select * from {$xerte_toolkits_site->database_table_prefix}templaterights, {$xerte_toolkits_site->database_table_prefix}templatedetails, {$xerte_toolkits_site->database_table_prefix}templatesyndication
WHERE folder = ?
AND {$xerte_toolkits_site->database_table_prefix}templaterights.template_id = {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id
AND {$xerte_toolkits_site->database_table_prefix}templatesyndication.template_id = {$xerte_toolkits_site->database_table_prefix}templaterights.template_id and rss = 'true'";
$params[] = $row_folder['folder_id'];
}
}
$rows = db_query($query, $params);
foreach($rows as $row) {
if(!isset($_GET['username'])){
$row_creator = db_query_one("SELECT firstname,surname from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row['creator_id']));
$user = $row_creator['firstname'] . " " . $row_creator['surname'];
}else{
// revert back to $_GET['usenrame'] parsed value(s)
$user = $temp_array[0] . " " . $temp_array[1];
}
$action = 'play';
if(isset($_GET['export'])){
$action = 'export';
}
if(isset($_GET['html5'])){
$action = 'play_html5';
}
echo "<item>
<title>" . str_replace("_"," ",$row['template_name']) . "</title>
<link><![CDATA[" . $xerte_toolkits_site->site_url . url_return($action, $row['template_id']) . "]]></link>
<description><![CDATA[" . $row['description'] . "<br><br>" . str_replace("_"," ",$row['template_name']) . " " . RSS_DEVELOP . $user . "]]></description>
<pubDate>" . date(DATE_RSS, strtotime($row['date_created'])) . "</pubDate>
<guid><![CDATA[" . $xerte_toolkits_site->site_url . url_return($action, $row['template_id']) . "]]></guid>
</item>\n";
}
echo "
</channel>
</rss>";
function _html_escape($string) {
return htmlentities($string, ENT_QUOTES, null, false);
}
?>