Mówisz masz...
Powinno być git, ale robiłem na czuja (tylko ten plik ściągnąłem), a zatem niech ktoś sprawdzi:
<?
DEFINE('COYOTE', true);
$root_dir = './';
include_once($root_dir . 'extension.inc');
include_once($root_dir . 'common.' . $phpEx);
/* budowanie specyficznego dla RSS, formatu daty */
$time = strftime('%a,%d %b %Y %H:%M:%S +0100', time());
switch ($_GET['time'])
{
case 'hour':
$notolder = strtotime('-1 hour');
break;
case 'day':
$notolder = strtotime('-1 day');
break;
case 'week':
$notolder = strtotime('-1 week');
break;
case 'month':
$notolder = strtotime('-1 month');
break;
default:
$notolder = 0;
}
/*
tablica zawiera informacje na temat RSS_TABLE. Klucze z tablicy stanowia
znaczniki, ktore zostana zapisane w dokumencie
*/
$rss_info['link'] = $config['SITE_URL'] ;//. 'rss.php';
$rss_info['description'] = 'Serwis ' . $config['SITE_TITLE'];
$rss_info['language'] = 'pl';
$rss_info['copyright'] = '';
$rss_info['pubDate'] = $time;
$rss_info['lastBuildDate'] = $time;
$rss_info['docs'] = $config['SITE_URL'] . 'rss.php';
function change_codepage($text, $codepage)
{
if ( !function_exists('iconv') || ($codepage == 'UTF-8') )
{
return $text;
}
$text = iconv('UTF-8', $codepage, $text);
if ( $text == false )
{
trigger_error($user->lang['E_SCRIPT_ERROR']);
}
return $text;
}
function validate($text)
{
/* dlugosc pobranego z bazy tekstu */
if (($len = (isset($_GET['len']) ? intval($_GET['len']) : 255)) > 500)
{
$len = 500;
}
if ( ord($text[$len -1]) > 127 )
{
while ( ord($text[$len -1]) > 127 )
{
$text = substr($text, 0, $len -1);
--$len;
}
}
else
{
$text = substr($text, 0, $len - 1);
}
return $text;
}
$codepage = isset($_GET['cp']) ? trim($_GET['cp']) : 'UTF-8';
/* wysylamy naglowek */
header('Content-type: application/xml; charset='. $codepage);
/* prolog XML */
echo "<?xml version=\"1.0\" encoding=\"$codepage\"?>\n";
/* wersja RSS_TABLE */
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
//
while ( list($key, $value) = each($rss_info) )
{
/* wypisanie znacznikow XML */
echo "<$key>$value</$key>\n";
}
/*
ponizsze instrukcje w zaleznosci od wybranej opcji umozliwiaja pobranie 20 ostatnich
wpisow w danej tabeli. Pobrane dane sa "ubarwiane" w znaczniki XML i wyswietlane
*/
switch ( $_GET['rss'] )
{
case 'article':
case 'news':
case 'faq':
case 'download':
case 'text':
echo "<title>$config[SITE_TITLE]</title>";
$sql = 'SELECT article_id,
article_subject,
article_namespace,
text_time,
text_content,
cat_id
FROM (' . ARTICLE_TABLE . ', ' . TEXT_TABLE . ')
LEFT JOIN ' . CAT_TABLE . ' ON cat_article = article_id
WHERE article_id = text_id
AND text_current = 1
AND article_exists = 1
AND text_time >= ' . $notolder . '
GROUP BY text_id
ORDER BY text_time
DESC LIMIT 20';
$result = $db->sql_query($sql);
while ( $row = $db->sql_fetch($result) )
{
$row['text_content'] = validate($row['text_content']);
$path = $tree->get_article_path($row['cat_id'], $row['article_subject'], $row['article_namespace']);
echo '<item>';
echo ' <title> ' . change_codepage(htmlspecialchars(stripslashes(unstrip($row['article_subject']))), $codepage) . '</title>';
echo ' <link>' . $config['SITE_URL'] . $path . '</link>';
echo ' <description>' . change_codepage(htmlspecialchars(strip_tags(stripslashes($row['text_content']))), $codepage) . '</description>';
echo ' <pubDate>' . strftime('%a,%d %b %Y %H:%M:%S +0100', $row['text_time']) . '</pubDate>';
echo '</item>';
}
break;
//////////////////////////////////////////////////////////////////////////////////
case 'topic':
echo "<title>$config[SITE_TITLE] - Forum</title>";
$useraccess = $user->get_access();
if ( $_GET['f'] )
{
$sql_forum = 'AND topic_forum = ' . intval($_GET['f']);
}
$sql = 'SELECT t.topic_id,
t.topic_subject,
p.post_time,
p.post_forum,
p.post_post
FROM (' . TOPIC_TABLE . ' t, ' . POST_TABLE . ' p)
LEFT JOIN ' . FORUM_TABLE . ' f ON f.forum_id = t.topic_forum
WHERE p.post_id = t.topic_first_post_id ' . $sql_forum . '
AND p.post_time >= ' . $notolder . '
AND f.forum_lock != 1
ORDER BY t.topic_id DESC LIMIT 20';
$db->sql_query($sql);
while ( $row = $db->sql_fetch() )
{
if ( isset($useraccess[$row['post_forum']]) )
{
if ( $useraccess[$row['post_forum']] == NO )
{
continue;
}
}
$row['text_text'] = validate($row['text_text']);
echo '<item>';
echo ' <title> [' . $row['post_forum']. '] ' . change_codepage(strip_tags(stripslashes($row['topic_subject'])), $codepage) . '</title>';
echo ' <link>' . $config['FORUM_URL'] . 'viewtopic.' . $phpEx . '?id=' . $row['topic_id'] . '</link>';
echo ' <description>' . change_codepage(htmlspecialchars(strip_tags(stripslashes($row['post_post']))), $codepage) . '</description>';
echo ' <pubDate>' . strftime('%a,%d %b %Y %H:%M:%S +0100', $row['post_time']) . '</pubDate>';
echo '</item>';
}
break;
//////////////////////////////////////////////////////////////////////////////
}
echo "</channel>\n";
echo "</rss>\n";
?>
ps. jaki jest proces commitowania zmian przez osoby trzecie???