$catid = empty($_SGET['catid']) ? 0 : intval($_SGET['catid']); $rssdateformat = 'D, d M Y H:i:s T'; $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('categories') . " WHERE catid='{$catid}'"); $catvalue = $_SGLOBAL['db']->fetch_array($query); if (empty($catvalue)) { $catid = 0; } $itemsarr = $wherearr = array(); $rssarr = array('charset' => $_SCONFIG['charset'], 'title' => $_SCONFIG['sitename'], 'link' => S_URL_ALL, 'description' => $_SCONFIG['sitename'], 'copyright' => 'Copyright(C) ' . $_SCONFIG['sitename'], 'generator' => 'SupeSite', 'lastBuildDate' => sgmdate($_SGLOBAL['timestamp'], $rssdateformat), 'items' => array()); if (!empty($catid)) { $rssarr['title'] = $catvalue['name']; $rssarr['link'] = geturl('action/category/catid/' . $catvalue['catid'], 1); $rssarr['description'] = $catvalue['name']; $rssarr['copyright'] = 'Copyright(C) ' . $_SCONFIG['sitename']; } $itemsarr = getrss($catid); if (!empty($itemsarr)) { foreach ($itemsarr as $key => $value) { $rssarr['items'][] = array('title' => $value['subject'], 'link' => geturl('action/viewnews/itemid/' . $value['itemid'], 1), 'description' => $value['message'], 'category' => $value['name'], 'author' => $value['username'], 'pubDate' => sgmdate($value['dateline'], $rssdateformat)); } } showrss($rssarr); function showrss($rssarr) { header("Content-type: application/xml"); echo '<?xml version="1.0" encoding="' . $rssarr['charset'] . '"?> <rss version="2.0"> <channel> <title>' . $rssarr['title'] . '</title> <link>' . $rssarr['link'] . '</link> <description>' . $rssarr['description'] . '</description>
$catvalue = $_SGLOBAL['db']->fetch_array($query); if (empty($catvalue)) { $catid = 0; } $itemsarr = $wherearr = array(); $rssarr = array('charset' => $_SCONFIG['charset'], 'title' => $_SCONFIG['sitename'], 'link' => S_URL_ALL, 'description' => $_SCONFIG['sitename'], 'copyright' => 'Copyright(C) ' . $_SCONFIG['sitename'], 'generator' => 'SupeSite', 'lastBuildDate' => sgmdate($_SGLOBAL['timestamp'], $rssdateformat), 'items' => array()); if (!empty($catid)) { $rssarr['title'] = $catvalue['name']; $rssarr['link'] = geturl('action/category/catid/' . $catvalue['catid'], 1); $rssarr['description'] = $catvalue['name']; $itemsarr = getrss($catvalue['subcatid'], $channel); } else { $rssarr['title'] = $_SCONFIG['sitename']; $rssarr['link'] = geturl('action/category/catid/0', 1); $rssarr['description'] = $_SCONFIG['sitename']; $itemsarr = getrss('0', $channel); } $rssarr['copyright'] = 'Copyright(C) ' . $_SCONFIG['sitename']; //$itemsarr = getrss($catvalue['subcatid']); if (!empty($itemsarr)) { foreach ($itemsarr as $key => $value) { $rssarr['items'][] = array('title' => $value['subject'], 'link' => geturl('action/viewnews/itemid/' . $value['itemid'], 1), 'description' => $value['message'], 'category' => $value['name'], 'author' => $value['username'], 'pubDate' => sgmdate($value['dateline'], $rssdateformat)); } } showrss($rssarr); function showrss($rssarr) { global $sql; header("Content-type: application/xml"); echo "<?xml version=\"1.0\" encoding=\"" . $rssarr['charset'] . "\"?>\n<rss version=\"2.0\">\n\t<channel>\n\t\t<title>" . xmlencode($rssarr['title']) . "</title>\n\t\t<link>" . xmlencode($rssarr['link']) . "</link>\n\t\t<description>" . xmlencode($rssarr['description']) . "</description>\n\t\t<copyright>" . xmlencode($rssarr['copyright']) . "</copyright>\n\t\t<generator>" . xmlencode($rssarr['generator']) . "</generator>\n\t\t<sql>" . $sql . "</sql>\n\t\t<lastBuildDate>" . $rssarr['lastBuildDate'] . "</lastBuildDate>\r\n"; if (!empty($rssarr['items'])) {