1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-16 11:36:08 +02:00

Updated e_rss.php to v2.x spec.

This commit is contained in:
Cameron
2013-06-18 20:21:39 -07:00
parent dbf987298d
commit 34f0eeb409
5 changed files with 128 additions and 21 deletions

View File

@@ -1,8 +1,88 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* RSS chatbox feed addon
*/
if (!defined('e107_INIT')) { exit; }
// v2.x Standard
class chatbox_menu_rss // plugin-folder + '_rss'
{
/**
* Admin RSS Configuration
*/
function config() // XXX TODO // Have admin read this.
{
$config = array();
$config[] = array(
'name' => 'Chatbox Posts',
'url' => 'chatbox',
'topic_id' => '',
'path' => 'chatbox_menu', // known
'description' => 'this is the rss feed for the chatbox entries', // that's 'description' not 'text'
'class' => '0',
'limit' => '9'
);
return $config;
}
/**
* Compile RSS Data
* @param $parms array url, limit, id
* @return array
*/
function data($parms='')
{
$sql = e107::getDb();
$rss = array();
$i=0;
if($items = $sql->select('chatbox', "*", "cb_blocked=0 ORDER BY cb_datestamp DESC LIMIT 0,".$parms['limit']))
{
while($row = $sql->fetch())
{
$tmp = explode(".", $row['cb_nick']);
$rss[$i]['author'] = $tmp[1];
$rss[$i]['author_email'] = '';
$rss[$i]['link'] = "chatbox_menu/chat.php?".$row['cb_id'];
$rss[$i]['linkid'] = $row['cb_id'];
$rss[$i]['title'] = '';
$rss[$i]['description'] = $row['cb_message'];
$rss[$i]['category_name'] = '';
$rss[$i]['category_link'] = '';
$rss[$i]['datestamp'] = $row['cb_datestamp'];
$rss[$i]['enc_url'] = "";
$rss[$i]['enc_leng'] = "";
$rss[$i]['enc_type'] = "";
$i++;
}
}
return $rss;
}
}
/*
* XXX Left here as an example of how to convert from v1.x to v2.x
*
//##### create feed for admin, return array $eplug_rss_feed --------------------------------
$feed['name'] = 'Chatbox';
$feed['url'] = 'chatbox'; //the identifier for the rss feed url
$feed['topic_id'] = ''; //the topic_id, empty on default (to select a certain category)
@@ -41,3 +121,5 @@ if($items = $sql -> db_Select('chatbox', "*", "cb_blocked=0 ORDER BY cb_datestam
$eplug_rss_data[] = $rss;
$eplug_rss_feed[] = $feed;
*/