validating RSS feed

This commit is contained in:
Claude 2012-05-06 20:06:54 +02:00
parent 509f29db42
commit 497cdc3c40
3 changed files with 7 additions and 2 deletions

View File

@ -301,6 +301,7 @@ class Main extends CI_Controller
if ($check) if ($check)
{ {
$this->load->helper('text');
$paste = $this->pastes->getPaste(3); $paste = $this->pastes->getPaste(3);
$data = $this->pastes->getReplies(3); $data = $this->pastes->getReplies(3);
$data['page_title'] = $paste['title'] . ' - ' . $this->config->item('site_name'); $data['page_title'] = $paste['title'] . ' - ' . $this->config->item('site_name');
@ -352,6 +353,7 @@ class Main extends CI_Controller
if ($this->uri->segment(2) == 'rss') if ($this->uri->segment(2) == 'rss')
{ {
$this->load->helper('text');
$data['page_title'] = $this->config->item('site_name'); $data['page_title'] = $this->config->item('site_name');
$data['feed_url'] = site_url('lists/rss'); $data['feed_url'] = site_url('lists/rss');
$data['replies'] = $data['pastes']; $data['replies'] = $data['pastes'];

View File

@ -311,7 +311,7 @@ class Pastes extends CI_Model
{ {
$pid = $this->uri->segment($seg); $pid = $this->uri->segment($seg);
} }
$this->db->select('title, name, created, pid, paste'); $this->db->select('title, name, created, pid, paste, raw');
$this->db->where('replyto', $pid); $this->db->where('replyto', $pid);
$this->db->order_by('id', 'desc'); $this->db->order_by('id', 'desc');
$this->db->limit($amount); $this->db->limit($amount);
@ -327,6 +327,7 @@ class Pastes extends CI_Model
$data['replies'][$n]['created'] = $row['created']; $data['replies'][$n]['created'] = $row['created'];
$data['replies'][$n]['pid'] = $row['pid']; $data['replies'][$n]['pid'] = $row['pid'];
$data['replies'][$n]['paste'] = $row['paste']; $data['replies'][$n]['paste'] = $row['paste'];
$data['replies'][$n]['raw'] = $row['raw'];
$n++; $n++;
} }
} }

View File

@ -9,6 +9,7 @@ xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel> <channel>
<title><?php echo $page_title; ?></title> <title><?php echo $page_title; ?></title>
<description><?php echo $page_title; ?></description>
<atom:link href="<?php echo $feed_url; ?>" rel="self" type="application/rss+xml" /> <atom:link href="<?php echo $feed_url; ?>" rel="self" type="application/rss+xml" />
<link><?php echo base_url(); ?></link> <link><?php echo base_url(); ?></link>
<language>en</language> <language>en</language>
@ -16,9 +17,10 @@ xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<item> <item>
<title><?php echo $paste['title']; ?></title> <title><?php echo $paste['title']; ?></title>
<link><?php echo site_url('view/' . $paste['pid']) ?></link> <link><?php echo site_url('view/' . $paste['pid']) ?></link>
<pubDate><?php echo date('c', $paste['created']); ?></pubDate> <pubDate><?php echo date('r', $paste['created']); ?></pubDate>
<dc:creator><?php echo $paste['name']; ?></dc:creator> <dc:creator><?php echo $paste['name']; ?></dc:creator>
<guid isPermaLink="false"><?php echo site_url('view/' . $paste['pid']) ?></guid> <guid isPermaLink="false"><?php echo site_url('view/' . $paste['pid']) ?></guid>
<description><![CDATA[<?php echo character_limiter($paste['raw'], 200); ?>]]></description>
<content:encoded><![CDATA[<?php echo $paste['paste']; ?>]]></content:encoded> <content:encoded><![CDATA[<?php echo $paste['paste']; ?>]]></content:encoded>
</item> </item>
<?php endforeach; ?> <?php endforeach; ?>