-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss.php
More file actions
209 lines (154 loc) · 4.95 KB
/
Copy pathrss.php
File metadata and controls
209 lines (154 loc) · 4.95 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php session_start(); ?>
<?php error_reporting(0); ?>
<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?>
<?php
/*
Crezione rss.xml per crowler dei motori di ricerca
*/
?>
<?php
require_once("utility/connessione.php");
require_once("utility/funzioni.php");
require_once("custom/costanti.php");
$sql = "SELECT * FROM datirss LIMIT 1";
$rssql = mysql_query($sql);
$rss = mysql_fetch_assoc($rssql);
?>
<?php
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">";
echo "<channel>";
$nomeserver = _URLSITO;
echo "<title>$rss[titolo]</title>";
echo "<link>$nomeserver</link>";
echo "<description>$rss[descrizione]</description>";
echo "<language>".strtolower($_SESSION['lingua'])."</language>";
echo "<copyright>$rss[copyright]</copyright>";
if ( $rss['image'] != '' ) {
echo "
<image>
<url>$rss[image]</url>
<title>$rss[titolo]</title>
<link>$nomeserver</link>
</image>
";
}
/* Genero pagine statiche */
$url_product = $nomeserver.'/index.php';
echo
"
<item>
<title><![CDATA["._SITO."]]></title>
<link>$url_product</link>
<description><![CDATA[ "._META_DESCRIPTION." ]]></description>
<author>"._SITO."</author>
<guid isPermaLink=\"true\">$url_product</guid>
</item>
";
//select them and put them into a dataset called $result
$query = "SELECT ID, titolo, description FROM statiche ORDER BY id DESC LIMIT 100";
$result = mysql_query( $query );
if ( mysql_num_rows( $result ) > 0 ) {
//loop through the entire resultset
while( $control = mysql_fetch_row( $result ) ) {
//your url-product as we worked out in #4
$url_product = rurl( $control[0], 'static' );
$control[1] = formatta_xml($control[1]);
$control[2] = formatta_xml($control[2]);
//you can assign whatever changefreq and priority you like
echo
"
<item>
<title><![CDATA[$control[1]]]></title>
<link>$url_product</link>
<description><![CDATA[$control[2]]]></description>
<author>"._SITO."</author>
<guid isPermaLink=\"true\">$url_product</guid>
</item>
";
}
}
/* Genero notizie */
//select them and put them into a dataset called $result
$query = "
SELECT n.ID, DATE_FORMAT( n.data, '%Y-%m-%d' ), n.titolo, n.description, a.argomenti, a.id
FROM notizie n
INNER JOIN argomenti a ON n.argomento = a.id
WHERE n.autorizza='si'
ORDER BY n.data DESC
LIMIT 100
";
$result = mysql_query( $query );
if ( mysql_num_rows( $result ) > 0 ) {
//loop through the entire resultset
while( $control = mysql_fetch_row( $result ) ) {
$url_product = rurl( $control[0], 'news' );
$url_product_argo = rurl( $control[5], 'argo' );
$control[2] = formatta_xml($control[2]);
$control[3] = formatta_xml($control[3]);
$control[4] = formatta_xml($control[4]);
//you can assign whatever changefreq and priority you like
echo
"
<item>
<title><![CDATA[$control[2]]]></title>
<link>$url_product</link>
<description><![CDATA[ $control[3] ]]></description>
<author>"._SITO."</author>
<pubDate>$control[1]</pubDate>
<category domain=\"$url_product_argo\">$control[4]</category>
<guid isPermaLink=\"true\">$url_product</guid>
</item>
";
}
}
/* Genero gallerie */
$query = "SELECT id, cartella, descrizione FROM galleria WHERE id_padre > 0 AND cartella != '' ORDER BY id DESC LIMIT 100";
$result = mysql_query( $query );
if ( mysql_num_rows( $result ) > 0 ) {
while ( $control = mysql_fetch_row( $result ) ){
$url_product = rurl( $control[0], 'gals-sub' );
//you can assign whatever changefreq and priority you like
echo
"
<item>
<title><![CDATA[$control[1]]]></title>
<link>$url_product</link>
<description><![CDATA[ $control[2] ]]></description>
<author>"._SITO."</author>
<guid isPermaLink=\"true\">$url_product</guid>
</item>
";
}
}
/* Genero e-commerce */
$query = "
SELECT e.id, e.titolo, ec.categoria
FROM ecommerce e
INNER JOIN ecommercecategoria ec ON ec.id = e.categoria
ORDER BY e.id DESC
LIMIT 100
";
$result = mysql_query( $query );
if ( mysql_num_rows( $result ) > 0 ) {
while ( $control = mysql_fetch_row( $result ) ){
$url_product = rurl( $control[0], 'ecommerce-dettaglio' );
$descrizione = "$control[1] in vendita su " . _SITO . ", cerca offerte e prezzi per $control[2].";
//you can assign whatever changefreq and priority you like
echo
"
<item>
<title><![CDATA[$control[1]]]></title>
<link>$url_product</link>
<description><![CDATA[ $descrizione ]]></description>
<author>"._SITO."</author>
<guid isPermaLink=\"true\">$url_product</guid>
</item>
";
}
}
//close the XML attribute that we opened in #3
echo "</channel>";
echo "</rss>";
mysql_close(); //close connection
header("Content-Type: text/xml;charset=utf-8");
?>