| Server IP : 23.111.136.34 / Your IP : 216.73.216.136 Web Server : Apache System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : meusitei ( 1072) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, proc_open MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/meusitei/public_html/central/ajuda/ |
Upload File : |
<?php
/******************************************************************************
* rss.php
*
* This file will create an RSS Feed for the given category
*
* Author: Michael McMullen <michael.mcmullen@tutelagesystems.com>
******************************************************************************/
// Include our Configuration
require_once '../System/configuration.php';
// Step 1
// What Category are we trying
$category_id = intval($_GET['category_id']);
// Step 2
// Query that category
$category_db = DB_DataObject::factory('categories');
$category_db->category_id = $category_id;
$category_db->category_active = 1;
if(! $category_db->find(true))
{
// No category with that id was found to be active
die;
}
// Step 3
// Query for the articles found in that Category
$article_db = DB_DataObject::factory('articles');
$article_db->article_active = 1;
$article_db->article_category_id = $category_id;
$article_db->limit($configuration['rss']['max_items']);
$article_db->find();
// Step 4
// Start writing the RSS Feed
header('Content-Type: application/rss+xml; charset=ISO-8859-1');
print '<?xml version="1.0" encoding="ISO-8859-1"?>';
print '<rss version="2.0">';
print '<channel>';
print '<title>'. $configuration['site']['name'] .'</title>';
print '<link>'. $configuration['directory_www'] .'</link>';
print '<description>RSS Feed for '. $configuration['site']['name'] .'</description>';
print '<language>en-us</language>';
print '<copyright>Copyright (C) '. date('Y') .' '. $configuration['site']['name'] .'</copyright>';
// Step 5
// Write the Articles
while($article_db->fetch())
{
// Convert any HTML tags
$article_db->article_name = htmlentities($article_db->article_name);
$article_db->article_text = htmlentities($article_db->article_text);
print '<item>';
print '<title>'. $article_db->article_name .'</title>';
print '<description>'. $article_db->article_text .'</description>';
print '<link>'. $configuration['directory_www'] .'/article.php?id='. $article_db->article_id .'</link>';
print '</item>';
}
// Step 6
// End RSS
print '</channel>';
print '</rss>';