This commit is contained in:
Claude 2012-05-04 09:23:22 +02:00
parent 5b3eff3b72
commit 98b514f500
3 changed files with 49 additions and 9 deletions

View File

@ -6,6 +6,7 @@
* - _form_prep()
* - index()
* - raw()
* - rss()
* - embed()
* - download()
* - lists()
@ -300,8 +301,11 @@ class Main extends CI_Controller
if ($check)
{
$data = $this->pastes->getPaste(3, true);
print_r($data);
$data = $this->pastes->getReplies(3);
$data['feed_url'] = '';
$data['page_description'] = '';
$data['page_language'] = '';
$data['creator_email'] = '';
$this->load->view('view/rss', $data);
}
else

View File

@ -8,6 +8,7 @@
* - createPaste()
* - checkPaste()
* - getPaste()
* - getReplies()
* - getLists()
* - cron()
* Classes list:
@ -298,6 +299,40 @@ class Pastes extends CI_Model
return $data;
}
function getReplies($seg = 3)
{
$amount = $this->config->item('per_page');
if ($this->uri->segment($seg) == '')
{
redirect('');
}
else
{
$pid = $this->uri->segment($seg);
}
$this->db->select('title, name, created, pid, paste');
$this->db->where('replyto', $pid);
$this->db->order_by('id', 'desc');
$this->db->limit($amount);
$query = $this->db->get('pastes', $amount);
if ($query->num_rows() > 0)
{
$n = 0;
foreach ($query->result_array() as $row)
{
$data['replies'][$n]['title'] = $row['title'];
$data['replies'][$n]['name'] = $row['name'];
$data['replies'][$n]['created'] = $row['created'];
$data['replies'][$n]['pid'] = $row['pid'];
$data['replies'][$n]['paste'] = $row['paste'];
$n++;
}
}
return $data;
}
function getLists($root = 'lists/', $seg = 2)
{
$this->load->library('pagination');

View File

@ -2,6 +2,7 @@
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Stikked</title>
<link><?php echo $feed_url; ?>
<description><?php echo $page_description; ?></description>
<dc:language><?php echo $page_language; ?></dc:language>
@ -10,14 +11,14 @@
<dc:rights>Copyright <?php echo gmdate("Y", time()); ?></dc:rights>
<admin:generatoragent rdf:resource="http://www.codeigniter.com/">
<?php foreach($posts->result() as $post): ?>
<?php foreach($replies as $paste): ?>
<item>
<link><?php echo site_url('blog/posting/' . $post->id) ?>
<guid><?php echo site_url('blog/posting/' . $post->id) ?></guid>
<link><?php echo site_url('view/' . $paste['pid']) ?>
<guid><?php echo site_url('view/' . $paste['pid']) ?></guid>
<description><[CDATA[ <?php echo character_limiter($post->text, 200); ?> ]]></description>
<pubdate><?php echo $post->date; ?></pubdate>
<description><[CDATA[ <?php echo $paste['paste']; ?> ]]></description>
<pubdate><?php echo $paste['created']; ?></pubdate>
</item>
<?php endforeach; ?>