mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
new module creation
This commit is contained in:
412
e107_plugins/rss_menu/admin_prefs.php
Normal file
412
e107_plugins/rss_menu/admin_prefs.php
Normal file
@@ -0,0 +1,412 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/admin_prefs.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:41 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
/*
|
||||
Notes:
|
||||
|
||||
- array_flip method deprecated for delete item detection.
|
||||
- using form handler is deprecated and present only for backwards compatibility.
|
||||
- using generic terms like EDIT and DELETE in Language file is deprecated, use LAN_EDIT etc. instead.
|
||||
- using terms like created, update, options etc..deprecated should use built in terms.
|
||||
- generic admin icons used. ADMIN_ICON_EDIT etc.
|
||||
- using $caption = "whatever", is unneccessary.
|
||||
|
||||
*/
|
||||
|
||||
require_once("../../class2.php");
|
||||
if(!getperms("P")){ header("location:".e_BASE."index.php"); }
|
||||
$lan_file = e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php";
|
||||
require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."rss_menu/languages/English.php");
|
||||
|
||||
require_once(e_ADMIN."auth.php");
|
||||
|
||||
$imagedir = e_IMAGE."admin_images/";
|
||||
$lan_file = e_PLUGIN.'rss_menu/languages/'.e_LANGUAGE.'.php';
|
||||
include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'rss_menu/languages/English.php');
|
||||
require_once(e_PLUGIN.'rss_menu/rss_shortcodes.php');
|
||||
$rss = new rss;
|
||||
|
||||
global $tp;
|
||||
|
||||
//delete entry
|
||||
if(isset($_POST['delete'])){
|
||||
$d_idt = array_keys($_POST['delete']);
|
||||
$message = ($sql -> db_Delete("rss", "rss_id='".$d_idt[0]."'")) ? LAN_DELETED : LAN_DELETED_FAILED;
|
||||
$e107cache->clear("rss");
|
||||
}
|
||||
|
||||
//create rss feed
|
||||
if(isset($_POST['create_rss'])){
|
||||
$message = $rss -> dbrss("create");
|
||||
}
|
||||
|
||||
//update rss feed
|
||||
if(isset($_POST['update_rss'])){
|
||||
$message = $rss -> dbrss("update");
|
||||
}
|
||||
|
||||
//import rss feed
|
||||
if(isset($_POST['import_rss'])){
|
||||
$message = $rss -> dbrssimport();
|
||||
}
|
||||
|
||||
//update_limit
|
||||
if(isset($_POST['update_limit'])){
|
||||
$message = $rss -> dbrsslimit();
|
||||
}
|
||||
//update options
|
||||
if(isset($_POST['updatesettings'])){
|
||||
$message = $rss->dboptions();
|
||||
}
|
||||
|
||||
//config check
|
||||
if($rss->file_check()){
|
||||
$message = RSS_LAN_ERROR_2; // space found in file.
|
||||
}
|
||||
|
||||
|
||||
//render message
|
||||
if(isset($message)){
|
||||
$rss->show_message('', $message);
|
||||
}
|
||||
|
||||
//get template
|
||||
if (is_readable(THEME."rss_template.php")) {
|
||||
require_once(THEME."rss_template.php");
|
||||
} else {
|
||||
require_once(e_PLUGIN."rss_menu/rss_template.php");
|
||||
}
|
||||
|
||||
//listing
|
||||
if(e_QUERY){
|
||||
$qs = explode(".", e_QUERY);
|
||||
$field = (isset($qs[1])) ? $qs[1] : "";
|
||||
$sort = (isset($qs[2])) ? $qs[2] : "";
|
||||
}
|
||||
|
||||
//create
|
||||
if(isset($qs[0]) && $qs[0] == 'create' && !$_POST){
|
||||
$rss -> rssadmincreate();
|
||||
|
||||
//import
|
||||
}elseif(isset($qs[0]) && $qs[0] == 'import'){
|
||||
$rss -> rssadminimport();
|
||||
|
||||
//options
|
||||
}elseif(isset($qs[0]) && $qs[0] == 'options'){
|
||||
$rss -> rssadminoptions();
|
||||
|
||||
//list
|
||||
}else{
|
||||
|
||||
$rss -> rssadminlist();
|
||||
}
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
||||
// ##### Display options --------------------------------------------------------------------------
|
||||
function admin_prefs_adminmenu(){
|
||||
global $sql, $qs;
|
||||
|
||||
$act = $qs[0];
|
||||
if($act==""){$act="list";}
|
||||
|
||||
$var['list']['text'] = RSS_LAN_ADMINMENU_2;
|
||||
$var['list']['link'] = e_SELF."?list";
|
||||
|
||||
$var['create']['text'] = LAN_CREATE;
|
||||
$var['create']['link'] = e_SELF."?create";
|
||||
|
||||
$var['import']['text'] = RSS_LAN_ADMINMENU_4;
|
||||
$var['import']['link'] = e_SELF."?import";
|
||||
|
||||
$var['options']['text'] = LAN_OPTIONS;
|
||||
$var['options']['link'] = e_SELF."?options";
|
||||
|
||||
show_admin_menu(RSS_LAN_ADMINMENU_1, $act, $var);
|
||||
|
||||
}
|
||||
// ##### End --------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class rss{
|
||||
|
||||
//check for config
|
||||
function file_check(){
|
||||
$arrays = file_get_contents(e_BASE."e107_config.php");
|
||||
$arrays2 = file_get_contents(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php");
|
||||
if($arrays[0] != "<" || $arrays2[0] != "<"){
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//admin : list : existing rss feeds
|
||||
function rssadminlist(){
|
||||
global $qs, $ns, $sql, $rs, $tp, $field, $sort, $rss_shortcodes, $row, $RSS_ADMIN_LIST_HEADER, $RSS_ADMIN_LIST_TABLE, $RSS_ADMIN_LIST_FOOTER;
|
||||
|
||||
$fieldstag = array('id'=>'rss_id','path'=>'rss_path','name'=>'rss_name','url'=>'rss_url','limit'=>'rss_limit');
|
||||
$order = (isset($fieldstag[$field])) ? "ORDER BY ".$fieldstag[$field]." ".$sort : "ORDER BY rss_id";
|
||||
|
||||
$query = "SELECT * FROM #rss ".$order;
|
||||
if(!$sql->db_Select_gen($query))
|
||||
{
|
||||
$this->show_message(LAN_ERROR, RSS_LAN_ERROR_3);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $tp -> parseTemplate($RSS_ADMIN_LIST_HEADER, FALSE, $rss_shortcodes);
|
||||
while($row=$sql->db_Fetch())
|
||||
{
|
||||
$text .= $tp -> parseTemplate($RSS_ADMIN_LIST_TABLE, FALSE, $rss_shortcodes);
|
||||
}
|
||||
$text .= $tp -> parseTemplate($RSS_ADMIN_LIST_FOOTER, FALSE, $rss_shortcodes);
|
||||
$ns->tablerender(RSS_LAN_ADMIN_1, $text);
|
||||
}
|
||||
}
|
||||
|
||||
//create
|
||||
function rssadmincreate(){
|
||||
global $ns, $qs, $rs, $sql, $tp, $rss_shortcodes, $row, $RSS_ADMIN_CREATE_TABLE;
|
||||
|
||||
if( isset($qs[1]) && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
if(!$sql -> db_Select("rss", "*", "rss_id='".intval($qs[2])."' ")){
|
||||
$this->show_message(LAN_ERROR, RSS_LAN_ERROR_5);
|
||||
}else{
|
||||
$row = $sql -> db_Fetch();
|
||||
|
||||
$row['rss_name'] = $tp -> toForm($row['rss_name']);
|
||||
$row['rss_path'] = $tp -> toForm($row['rss_path']);
|
||||
$row['rss_url'] = $tp -> toForm($row['rss_url']);
|
||||
$row['rss_text'] = $tp -> toForm($row['rss_text']);
|
||||
}
|
||||
}
|
||||
$text = $tp -> parseTemplate($RSS_ADMIN_CREATE_TABLE, FALSE, $rss_shortcodes);
|
||||
$ns->tablerender(RSS_LAN_ADMIN_10, $text);
|
||||
}
|
||||
|
||||
//import
|
||||
function rssadminimport(){
|
||||
global $sql, $ns, $i, $qs, $rs, $tp, $rss_shortcodes, $feed, $pref;
|
||||
global $RSS_ADMIN_IMPORT_HEADER, $RSS_ADMIN_IMPORT_TABLE, $RSS_ADMIN_IMPORT_FOOTER;
|
||||
|
||||
$sqli = new db;
|
||||
$feedlist = array();
|
||||
|
||||
//news
|
||||
$feed['name'] = ADLAN_0;
|
||||
$feed['url'] = 'news'; //the identifier for the rss feed url
|
||||
$feed['topic_id'] = ''; //the topic_id, empty on default (to select a certain category)
|
||||
$feed['path'] = 'news'; //this is the plugin path location
|
||||
$feed['text'] = RSS_PLUGIN_LAN_7;
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
|
||||
//news categories
|
||||
if($sqli -> db_Select("news_category", "*","category_id!='' ORDER BY category_name ")){
|
||||
while($rowi = $sqli -> db_Fetch()){
|
||||
$feed['name'] = ADLAN_0.' > '.$rowi['category_name'];
|
||||
$feed['url'] = 'news';
|
||||
$feed['topic_id'] = $rowi['category_id'];
|
||||
$feed['path'] = 'news';
|
||||
$feed['text'] = RSS_PLUGIN_LAN_10.' '.$rowi['category_name'];
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
}
|
||||
}
|
||||
|
||||
//download
|
||||
$feed['name'] = ADLAN_24;
|
||||
$feed['url'] = 'download';
|
||||
$feed['topic_id'] = '';
|
||||
$feed['path'] = 'download';
|
||||
$feed['text'] = RSS_PLUGIN_LAN_8;
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
|
||||
//download categories
|
||||
if($sqli -> db_Select("download_category", "*","download_category_id!='' ORDER BY download_category_order ")){
|
||||
while($rowi = $sqli -> db_Fetch()){
|
||||
$feed['name'] = ADLAN_24.' > '.$rowi['download_category_name'];
|
||||
$feed['url'] = 'download';
|
||||
$feed['topic_id'] = $rowi['download_category_id'];
|
||||
$feed['path'] = 'download';
|
||||
$feed['text'] = RSS_PLUGIN_LAN_11.' '.$rowi['download_category_name'];
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
}
|
||||
}
|
||||
|
||||
//comments
|
||||
$feed['name'] = RSS_PLUGIN_LAN_14;
|
||||
$feed['url'] = 'comments';
|
||||
$feed['topic_id'] = '';
|
||||
$feed['path'] = 'comments';
|
||||
$feed['text'] = RSS_PLUGIN_LAN_9;
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$feedlist[] = $feed;
|
||||
|
||||
//plugin rss feed, using e_rss.php in plugin folder
|
||||
$plugin_feedlist = array();
|
||||
foreach($pref['e_rss_list'] as $val)
|
||||
{
|
||||
if (is_readable(e_PLUGIN.$val."/e_rss.php")) {
|
||||
require_once(e_PLUGIN.$val."/e_rss.php");
|
||||
$plugin_feedlist = $eplug_rss_feed;
|
||||
}
|
||||
}
|
||||
|
||||
/* if($sqli -> db_Select("plugin","plugin_path","plugin_installflag = '1' ORDER BY plugin_path ")){
|
||||
while($rowi = $sqli -> db_Fetch()){
|
||||
if (is_readable(e_PLUGIN.$rowi['plugin_path']."/e_rss.php")) {
|
||||
require_once(e_PLUGIN.$rowi['plugin_path']."/e_rss.php");
|
||||
$plugin_feedlist = $eplug_rss_feed;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$feedlist = array_merge($feedlist, $plugin_feedlist);
|
||||
|
||||
$render=FALSE;
|
||||
$i=0;
|
||||
$text = $RSS_ADMIN_IMPORT_HEADER;
|
||||
foreach($feedlist as $k=>$feed){
|
||||
$feed['topic_id'] = $tp -> toDB($feed['topic_id']);
|
||||
$feed['url'] = $tp -> toDB($feed['url']);
|
||||
|
||||
//check if feed is not yet present
|
||||
if(!$sql -> db_Select("rss", "*", "rss_path='".$feed['path']."' AND rss_url='".$feed['url']."' AND rss_topicid='".$feed['topic_id']."' "))
|
||||
{
|
||||
$render=TRUE;
|
||||
$text .= $tp -> parseTemplate($RSS_ADMIN_IMPORT_TABLE, FALSE, $rss_shortcodes);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$text .= $tp -> parseTemplate($RSS_ADMIN_IMPORT_FOOTER, FALSE, $rss_shortcodes);
|
||||
|
||||
if(!$render){
|
||||
$this->show_message(RSS_LAN_ADMIN_11, RSS_LAN_ERROR_6);
|
||||
}else{
|
||||
$ns->tablerender(RSS_LAN_ADMIN_11, $text);
|
||||
}
|
||||
}
|
||||
|
||||
//options
|
||||
function rssadminoptions(){
|
||||
global $ns, $qs, $rs, $sql, $tp, $rss_shortcodes, $row, $RSS_ADMIN_OPTIONS_TABLE;
|
||||
|
||||
$text = $tp -> parseTemplate($RSS_ADMIN_OPTIONS_TABLE, FALSE, $rss_shortcodes);
|
||||
$ns->tablerender(LAN_OPTIONS, $text);
|
||||
return;
|
||||
}
|
||||
|
||||
//render message
|
||||
function show_message($caption='', $text=''){
|
||||
global $ns;
|
||||
$ns -> tablerender($caption, "<div style='text-align:center'><b>$text</b></div>");
|
||||
}
|
||||
|
||||
//db:create/update
|
||||
function dbrss($mode='create'){
|
||||
global $qs, $sql, $ns, $rs, $tp, $e107cache;
|
||||
|
||||
if($_POST['rss_name'] && $_POST['rss_url'] && $_POST['rss_path']){
|
||||
|
||||
$_POST['rss_name'] = $tp -> toDB(trim($_POST['rss_name']));
|
||||
$_POST['rss_url'] = $tp -> toDB($_POST['rss_url']);
|
||||
$_POST['rss_topicid'] = $tp -> toDB($_POST['rss_topicid']);
|
||||
$_POST['rss_path'] = $tp -> toDB($_POST['rss_path']);
|
||||
$_POST['rss_text'] = $tp -> toDB($_POST['rss_text']);
|
||||
$_POST['rss_class'] = (intval($_POST['rss_class']) ? intval($_POST['rss_class']) : '0');
|
||||
$_POST['rss_limit'] = intval($_POST['rss_limit']);
|
||||
|
||||
if(isset($_POST['rss_datestamp']) && $_POST['rss_datestamp']!=''){
|
||||
$datestamp = intval($_POST['rss_datestamp']);
|
||||
}else{
|
||||
$datestamp = time();
|
||||
}
|
||||
|
||||
if($mode == 'create'){
|
||||
$message = ($sql -> db_Insert("rss", "'0', '".$_POST['rss_name']."', '".$_POST['rss_url']."', '".$_POST['rss_topicid']."', '".$_POST['rss_path']."', '".$_POST['rss_text']."', '".$datestamp."', '".$_POST['rss_class']."', '".$_POST['rss_limit']."' ")) ? LAN_CREATED : LAN_CREATED_FAILED;
|
||||
$e107cache->clear("rss");
|
||||
|
||||
}elseif($mode == 'update'){
|
||||
$message = ($sql -> db_Update("rss", "rss_name = '".$_POST['rss_name']."', rss_url = '".$_POST['rss_url']."', rss_topicid = '".$_POST['rss_topicid']."', rss_path = '".$_POST['rss_path']."', rss_text = '".$_POST['rss_text']."', rss_datestamp = '".$datestamp."', rss_class = '".$_POST['rss_class']."', rss_limit = '".$_POST['rss_limit']."' WHERE rss_id = '".intval($_POST['rss_id'])."' ")) ? LAN_UPDATED : LAN_UPDATED_FAILED;
|
||||
$e107cache->clear("rss");
|
||||
}
|
||||
}else{
|
||||
$message = RSS_LAN_ERROR_7;
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
//import rss feeds
|
||||
function dbrssimport(){
|
||||
global $sql, $tp;
|
||||
|
||||
foreach($_POST['importid'] as $key=>$value)
|
||||
{
|
||||
$rss_topcid = ($_POST['topic_id'][$key] ? $tp -> toDB($_POST['topic_id'][$key]) : '');
|
||||
$rss_url = ($_POST['url'][$key] ? $tp -> toDB($_POST['url'][$key]) : '');
|
||||
$rss_path = ($_POST['path'][$key] ? $tp -> toDB($_POST['path'][$key]) : '');
|
||||
$rss_name = ($_POST['name'][$key] ? $tp -> toDB($_POST['name'][$key]) : '');
|
||||
$rss_text = ($_POST['text'][$key] ? $tp -> toDB($_POST['text'][$key]) : '');
|
||||
$rss_datestamp = time();
|
||||
$rss_class = ($_POST['class'][$key] ? intval($_POST['class'][$key]) : '0');
|
||||
$rss_limit = ($_POST['limit'][$key] ? intval($_POST['limit'][$key]) : '0');
|
||||
|
||||
$sql -> db_Insert("rss", "'0', '".$rss_name."', '".$rss_url."', '".$rss_topcid."', '".$rss_path."', '".$rss_text."', '".$rss_datestamp."', '".$rss_class."', '".$rss_limit."' ");
|
||||
}
|
||||
$message = count($_POST['importid'])." ".RSS_LAN_ADMIN_18;
|
||||
return $message;
|
||||
|
||||
}
|
||||
|
||||
function dbrsslimit(){
|
||||
global $sql, $tp;
|
||||
foreach($_POST['limit'] as $key=>$value)
|
||||
{
|
||||
$sql -> db_Update("rss", "rss_limit = '".intval($value)."' WHERE rss_id = '".intval($key)."' ");
|
||||
}
|
||||
header("location:".e_SELF."?r3");
|
||||
}
|
||||
|
||||
//update options
|
||||
function dboptions(){
|
||||
global $tp, $pref;
|
||||
|
||||
$pref['rss_othernews'] = $_POST['rss_othernews'];
|
||||
|
||||
save_prefs();
|
||||
return LAN_SAVED;
|
||||
}
|
||||
|
||||
|
||||
} //end class
|
||||
|
||||
|
||||
?>
|
36
e107_plugins/rss_menu/e_meta.php
Normal file
36
e107_plugins/rss_menu/e_meta.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/e_meta.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:41 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
global $tp,$PLUGINS_DIRECTORY;
|
||||
|
||||
if(isset($pref['rss_feeds']) && $pref['rss_feeds'])
|
||||
{
|
||||
if($sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 ORDER BY rss_name")){
|
||||
while($row=$sql->db_Fetch()){
|
||||
//wildcard topic_id's should not be listed
|
||||
if(strpos($row['rss_url'], "*")===FALSE){
|
||||
$url = SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".$tp->toHTML($row['rss_url'], TRUE, 'constants, no_hook, emotes_off').".2";
|
||||
$name = $tp->toHTML($row['rss_name'], TRUE, 'no_hook, emotes_off');
|
||||
echo "<link rel='alternate' type='application/rss+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)." ".htmlspecialchars($name, ENT_QUOTES, CHARSET)."' href='".$url."' />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
BIN
e107_plugins/rss_menu/images/rss1.png
Normal file
BIN
e107_plugins/rss_menu/images/rss1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
e107_plugins/rss_menu/images/rss2.png
Normal file
BIN
e107_plugins/rss_menu/images/rss2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
e107_plugins/rss_menu/images/rss3.png
Normal file
BIN
e107_plugins/rss_menu/images/rss3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
e107_plugins/rss_menu/images/rss4.png
Normal file
BIN
e107_plugins/rss_menu/images/rss4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
e107_plugins/rss_menu/images/rss_16.png
Normal file
BIN
e107_plugins/rss_menu/images/rss_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 604 B |
BIN
e107_plugins/rss_menu/images/rss_32.png
Normal file
BIN
e107_plugins/rss_menu/images/rss_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
92
e107_plugins/rss_menu/languages/English.php
Normal file
92
e107_plugins/rss_menu/languages/English.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/languages/English.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:43 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
define("RSS_LAN05","Number of items (0=inactive)");
|
||||
|
||||
define("RSS_MENU_L1", " can be syndicated by using these rss feeds.");
|
||||
define("RSS_MENU_L2", "RSS Feeds");
|
||||
define("RSS_MENU_L3", "Our news");
|
||||
define("RSS_MENU_L4", "Our comments");
|
||||
define("RSS_MENU_L5", "Our forum threads");
|
||||
define("RSS_MENU_L6", "Our forum posts");
|
||||
define("RSS_MENU_L7", "Our chatbox posts");
|
||||
define("RSS_MENU_L8", "Our bugtracker reports");
|
||||
define("RSS_MENU_L9", "Our downloads");
|
||||
|
||||
define("RSS_NEWS", "News");
|
||||
define("RSS_COM", "Comments");
|
||||
define("RSS_ART", "Articles");
|
||||
define("RSS_REV", "Reviews");
|
||||
define("RSS_FT", "Forum Threads");
|
||||
define("RSS_FP", "Forum Posts");
|
||||
define("RSS_FSP", "Forum Specific Post");
|
||||
define("RSS_BUG", "Bugtracker");
|
||||
define("RSS_FOR", "Forum");
|
||||
define("RSS_DL", "Downloads");
|
||||
|
||||
define("RSS_PLUGIN_LAN_1", "RSS");
|
||||
|
||||
define("RSS_PLUGIN_LAN_6", "Feed Links");
|
||||
define("RSS_PLUGIN_LAN_7", "The rss feed of the news");
|
||||
define("RSS_PLUGIN_LAN_8", "The rss feed of the downloads");
|
||||
define("RSS_PLUGIN_LAN_9", "The rss feed of the comments");
|
||||
define("RSS_PLUGIN_LAN_10", "The rss feed of news category:");
|
||||
define("RSS_PLUGIN_LAN_11", "The rss feed of download category:");
|
||||
|
||||
define("RSS_PLUGIN_LAN_14", "Comments");
|
||||
|
||||
define("RSS_LAN_ADMINMENU_1", "RSS Options");
|
||||
define("RSS_LAN_ADMINMENU_2", "Listing");
|
||||
define("RSS_LAN_ADMINMENU_4", "Import");
|
||||
|
||||
define("RSS_LAN_ERROR_1", "This is not a valid rss feed<br /><br /><a href='".e_SELF."'><< return to rss feed list</a>");
|
||||
define("RSS_LAN_ERROR_2", "Your e107_config.php file or your language files contain spaces or  characters before the <? characters. You should remove this with a non-utf8 text-editor if you wish to have a valid RSS feed.");
|
||||
define("RSS_LAN_ERROR_3", "No rss feeds are present yet<br />please use the import feature to import available rss feeds or create a rss feed manually.");
|
||||
define("RSS_LAN_ERROR_4", "No rss feeds are available yet");
|
||||
define("RSS_LAN_ERROR_5", "This rss entry does not exist");
|
||||
define("RSS_LAN_ERROR_6", "There are no rss feeds to import");
|
||||
define("RSS_LAN_ERROR_7", "Some required fields are missing.");
|
||||
|
||||
define("RSS_LAN_ADMIN_1", "Existing RSS feeds");
|
||||
define("RSS_LAN_ADMIN_2", "Id");
|
||||
define("RSS_LAN_ADMIN_3", "Path");
|
||||
define("RSS_LAN_ADMIN_4", "Name");
|
||||
define("RSS_LAN_ADMIN_5", "Url");
|
||||
define("RSS_LAN_ADMIN_6", "Text");
|
||||
define("RSS_LAN_ADMIN_7", "Limit");
|
||||
define("RSS_LAN_ADMIN_8", "Visibility");
|
||||
define("RSS_LAN_ADMIN_9", "Type");
|
||||
define("RSS_LAN_ADMIN_10", "rss feed create entry");
|
||||
define("RSS_LAN_ADMIN_11", "rss feed import feeds");
|
||||
define("RSS_LAN_ADMIN_12", "Topic id");
|
||||
|
||||
define("RSS_LAN_ADMIN_13", "Include Other-news items in News Feed?");
|
||||
define("RSS_LAN_ADMIN_14", "Enable");
|
||||
define("RSS_LAN_ADMIN_15", "Tick links to mark them for import ...");
|
||||
define("RSS_LAN_ADMIN_16", "import?");
|
||||
define("RSS_LAN_ADMIN_17", "import ticked links");
|
||||
define("RSS_LAN_ADMIN_18", "rss feed(s) imported.");
|
||||
|
||||
define("RSS_LAN_ADMIN_21", "active and visible in rss feed list");
|
||||
define("RSS_LAN_ADMIN_22", "active and not visible in rss feed list");
|
||||
define("RSS_LAN_ADMIN_23", "inactive");
|
||||
|
||||
define("RSS_LAN_ADMIN_26", "Check All");
|
||||
define("RSS_LAN_ADMIN_27", "Uncheck All");
|
||||
|
||||
define("RSS_LAN_ADMIN_31", "rss entries limit updated");
|
||||
|
||||
define("RSS_LAN_0", "RSS");
|
||||
define("RSS_LAN_2", "@nospam.com");
|
||||
define("RSS_LAN_3", "noauthor@nospam.com");
|
||||
|
||||
?>
|
111
e107_plugins/rss_menu/plugin.php
Normal file
111
e107_plugins/rss_menu/plugin.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/plugin.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:41 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$lan_file = e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php";
|
||||
require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."rss_menu/languages/English.php");
|
||||
|
||||
// Plugin info ----------------------------------------------------------------
|
||||
$eplug_name = "RSS_PLUGIN_LAN_1";
|
||||
$eplug_version = "1.1";
|
||||
$eplug_author = "e107dev";
|
||||
$eplug_logo = "";
|
||||
$eplug_url = "http://e107.org";
|
||||
$eplug_email = "";
|
||||
$eplug_description = RSS_MENU_L2;
|
||||
$eplug_compatible = "e107v0.7+";
|
||||
$eplug_readme = ""; //leave blank if no readme file
|
||||
$eplug_latest = FALSE; //Show reported threads in admin (use latest.php)
|
||||
$eplug_status = FALSE; //Show post count in admin (use status.php)
|
||||
|
||||
// Name of the plugin's folder ------------------------------------------------
|
||||
$eplug_folder = "rss_menu";
|
||||
|
||||
// Name of menu item for plugin -----------------------------------------------
|
||||
$eplug_menu_name = "rss_menu";
|
||||
|
||||
// Name of the admin configuration file ---------------------------------------
|
||||
$eplug_conffile = "admin_prefs.php";
|
||||
|
||||
// Icon image and caption text ------------------------------------------------
|
||||
$eplug_icon = $eplug_folder."/images/rss_32.png";
|
||||
$eplug_icon_small = $eplug_folder."/images/rss_16.png";
|
||||
$eplug_caption = LAN_CONFIGURE;
|
||||
|
||||
// List of preferences --------------------------------------------------------
|
||||
$eplug_prefs = '';
|
||||
|
||||
// List of table names --------------------------------------------------------
|
||||
$eplug_table_names = array("rss");
|
||||
|
||||
// List of sql requests to create tables --------------------------------------
|
||||
$eplug_tables = array(
|
||||
"CREATE TABLE ".MPREFIX."rss (
|
||||
rss_id int(10) unsigned NOT NULL auto_increment,
|
||||
rss_name varchar(255) NOT NULL default '',
|
||||
rss_url text NOT NULL,
|
||||
rss_topicid varchar(255) NOT NULL default '',
|
||||
rss_path varchar(255) NOT NULL default '',
|
||||
rss_text longtext NOT NULL,
|
||||
rss_datestamp int(10) unsigned NOT NULL default '0',
|
||||
rss_class tinyint(1) unsigned NOT NULL default '0',
|
||||
rss_limit tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (rss_id)
|
||||
) TYPE=MyISAM;",
|
||||
|
||||
"INSERT INTO ".MPREFIX."rss VALUES
|
||||
(0, '".RSS_NEWS."', 'news', '', 'news', '".RSS_PLUGIN_LAN_7."', '".time()."', 0, 9),
|
||||
(0, '".RSS_DL."', 'download', '', 'download', '".RSS_PLUGIN_LAN_8."', '".time()."', 0, 9),
|
||||
(0, '".RSS_COM."', 'comments', '', 'comments', '".RSS_PLUGIN_LAN_9."', '".time()."', 0, 9)
|
||||
"
|
||||
);
|
||||
|
||||
// Create a link in main menu (yes=TRUE, no=FALSE) ----------------------------
|
||||
$eplug_link = FALSE;
|
||||
$eplug_link_name = '';
|
||||
$eplug_link_url = '';
|
||||
|
||||
|
||||
// upgrading ------------------------------------------------------------------
|
||||
$upgrade_add_prefs = "";
|
||||
$upgrade_remove_prefs = "";
|
||||
|
||||
$upgrade_alter_tables = array(
|
||||
"CREATE TABLE ".MPREFIX."rss (
|
||||
rss_id int(10) unsigned NOT NULL auto_increment,
|
||||
rss_name varchar(255) NOT NULL default '',
|
||||
rss_url text NOT NULL,
|
||||
rss_topicid varchar(255) NOT NULL default '',
|
||||
rss_path varchar(255) NOT NULL default '',
|
||||
rss_text longtext NOT NULL,
|
||||
rss_datestamp int(10) unsigned NOT NULL default '0',
|
||||
rss_class tinyint(1) unsigned NOT NULL default '0',
|
||||
rss_limit tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (rss_id)
|
||||
) TYPE=MyISAM;",
|
||||
|
||||
"INSERT INTO ".MPREFIX."rss VALUES
|
||||
(0, '".RSS_NEWS."', 'news', '', 'news', '".RSS_PLUGIN_LAN_7."', '".time()."', 0, 9),
|
||||
(0, '".RSS_DL."', 'download', '', 'download', '".RSS_PLUGIN_LAN_8."', '".time()."', 0, 9),
|
||||
(0, '".RSS_COM."', 'comments', '', 'comments', '".RSS_PLUGIN_LAN_9."', '".time()."', 0, 9)
|
||||
"
|
||||
);
|
||||
|
||||
|
||||
?>
|
669
e107_plugins/rss_menu/rss.php
Normal file
669
e107_plugins/rss_menu/rss.php
Normal file
@@ -0,0 +1,669 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/rss.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:42 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/*
|
||||
Query string: content_type.rss_type.[topic id]
|
||||
1: news
|
||||
5: comments
|
||||
12: downloads (option: specify category)
|
||||
|
||||
Plugins should use an e_rss.php file in their plugin folder
|
||||
----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
require_once("../../class2.php");
|
||||
|
||||
global $tp;
|
||||
|
||||
require_once(e_PLUGIN."rss_menu/rss_shortcodes.php");
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
|
||||
if (!is_object($tp->e_bb)) {
|
||||
require_once(e_HANDLER.'bbcode_handler.php');
|
||||
$tp->e_bb = new e_bbcode;
|
||||
}
|
||||
|
||||
//get language file
|
||||
if (is_readable(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php")) {
|
||||
include_once(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php");
|
||||
} else {
|
||||
include_once(e_PLUGIN."rss_menu/languages/English.php");
|
||||
}
|
||||
|
||||
//get template
|
||||
if (is_readable(THEME."rss_template.php")) {
|
||||
require_once(THEME."rss_template.php");
|
||||
} else {
|
||||
require_once(e_PLUGIN."rss_menu/rss_template.php");
|
||||
}
|
||||
|
||||
//query handler
|
||||
list($content_type, $rss_type, $topic_id) = explode(".", e_QUERY);
|
||||
|
||||
//list available rss feeds
|
||||
if (intval($rss_type) == false) {
|
||||
require_once(HEADERF);
|
||||
require_once(e_PLUGIN."rss_menu/rss_template.php");
|
||||
|
||||
if(!$sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 AND rss_topicid NOT REGEXP ('\\\*') ORDER BY rss_name"))
|
||||
{
|
||||
$ns->tablerender(LAN_ERROR, RSS_LAN_ERROR_4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $RSS_LIST_HEADER;
|
||||
while($row=$sql->db_Fetch())
|
||||
{
|
||||
$text .= $tp -> parseTemplate($RSS_LIST_TABLE, FALSE, $rss_shortcodes);
|
||||
}
|
||||
$text .= $RSS_LIST_FOOTER;
|
||||
$ns->tablerender(RSS_MENU_L2, $text);
|
||||
}
|
||||
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
||||
//conversion table for old urls -------
|
||||
$conversion[1] = "news";
|
||||
$conversion[5] = "comments";
|
||||
$conversion[10] = "bugtracker";
|
||||
$conversion[12] = "download";
|
||||
//-------------------------------------
|
||||
|
||||
//convert certain old urls so we can check the db entries ---------------------
|
||||
if($topic_id){
|
||||
//rss.php?1.2.14 (news, rss-2, cat=14)
|
||||
if(is_numeric($content_type) && isset($conversion[$content_type]) ){
|
||||
$content_type = $conversion[$content_type];
|
||||
}
|
||||
}else{
|
||||
//rss.php?1.2 (news, rss-2) --> check = news (check conversion table)
|
||||
if(is_numeric($content_type) && isset($conversion[$content_type]) ){
|
||||
$content_type = $conversion[$content_type];
|
||||
}
|
||||
}
|
||||
|
||||
$check_topic = ($topic_id ? " AND rss_topicid = '".$topic_id."' " : "");
|
||||
|
||||
if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
|
||||
{
|
||||
//check if wildcard present for topic_id
|
||||
$check_topic = ($topic_id ? " AND rss_topicid = '".str_replace($topic_id, "*", $topic_id)."' " : "");
|
||||
if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
|
||||
{
|
||||
require_once(HEADERF);
|
||||
$ns->tablerender("", RSS_LAN_ERROR_1);
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}else{
|
||||
$row = $sql->db_Fetch();
|
||||
}
|
||||
}else{
|
||||
$row = $sql->db_Fetch();
|
||||
}
|
||||
|
||||
//debugging
|
||||
//echo $check." - ".$content_type." - ".$rss_type." - ".$topic_id."<br />";
|
||||
//exit;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
if($rss = new rssCreate($content_type, $rss_type, $topic_id, $row)){
|
||||
$rss_title = ($rss->contentType ? $rss->contentType : ucfirst($content_type));
|
||||
$rss->buildRss ($rss_title);
|
||||
}else{
|
||||
require_once(HEADERF);
|
||||
$ns->tablerender(RSS_LAN_ERROR_0, RSS_LAN_ERROR_1);
|
||||
require_once(FOOTERF);
|
||||
exit;
|
||||
}
|
||||
|
||||
class rssCreate {
|
||||
|
||||
var $contentType;
|
||||
var $rssType;
|
||||
var $path;
|
||||
var $parm;
|
||||
var $rssItems;
|
||||
var $rssQuery;
|
||||
var $topicid;
|
||||
var $offset;
|
||||
var $rssNamespace;
|
||||
var $rssCustomChannel;
|
||||
|
||||
function rssCreate($content_type, $rss_type, $topic_id, $row) {
|
||||
// constructor
|
||||
$sql_rs = new db;
|
||||
global $tp, $sql, $e107, $PLUGINS_DIRECTORY, $pref, $rssgen;
|
||||
$this -> path = e_PLUGIN."rss_menu/";
|
||||
$this -> rssType = $rss_type;
|
||||
$this -> topicid = $topic_id;
|
||||
$this -> offset = $pref['time_offset'] * 3600;
|
||||
$this -> limit = $row['rss_limit'];
|
||||
$this -> contentType = $row['rss_name'];
|
||||
|
||||
if(!is_numeric($content_type)){
|
||||
$path = e_PLUGIN.$row['rss_path']."/e_rss.php";
|
||||
}
|
||||
if(strpos($row['rss_path'],'|')!==FALSE){
|
||||
$tmp = explode("|", $row['rss_path']);
|
||||
$path = e_PLUGIN.$tmp[0]."/e_rss.php";
|
||||
$this -> parm = $tmp[1]; //parm is used in e_rss.php to define which feed you need to prepare
|
||||
}
|
||||
|
||||
switch ($content_type) {
|
||||
case news:
|
||||
case 1:
|
||||
if($topic_id && is_numeric($topic_id)){
|
||||
$topic = " AND news_category = ".intval($topic_id);
|
||||
}else{
|
||||
$topic = '';
|
||||
}
|
||||
$path='';
|
||||
$render = ($pref['rss_othernews'] != 1) ? "AND n.news_render_type < 2" : "";
|
||||
|
||||
$this -> rssQuery = "
|
||||
SELECT n.*, u.user_id, u.user_name, u.user_email, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") {$render} {$topic} ORDER BY news_datestamp DESC LIMIT 0,".$this -> limit;
|
||||
$sql->db_Select_gen($this -> rssQuery);
|
||||
$tmp = $sql->db_getList();
|
||||
$this -> rssItems = array();
|
||||
$loop=0;
|
||||
foreach($tmp as $value) {
|
||||
$this -> rssItems[$loop]['title'] = $value['news_title'];
|
||||
$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."news.php?item.".$value['news_id'].".".$value['news_category'];
|
||||
if($value['news_summary']){
|
||||
$this -> rssItems[$loop]['description'] = $value['news_summary'];
|
||||
}else{
|
||||
$this -> rssItems[$loop]['description'] = $value['news_body'];
|
||||
}
|
||||
$this -> rssItems[$loop]['author'] = $value['user_name'];
|
||||
$this -> rssItems[$loop]['author_email'] = $value['user_email'];
|
||||
$this -> rssItems[$loop]['category'] = "<category domain='".SITEURL."news.php?cat.".$value['news_category']."'>".$value['category_name']."</category>";
|
||||
|
||||
if($value['news_allow_comments'] && $pref['comments_disabled'] != 1){
|
||||
$this -> rssItems[$loop]['comment'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['news_id'];
|
||||
}
|
||||
$this -> rssItems[$loop]['pubdate'] = $value['news_datestamp'];
|
||||
|
||||
$loop++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$path='';
|
||||
$this -> contentType = "articles";
|
||||
break;
|
||||
case 3:
|
||||
$path='';
|
||||
$this -> contentType = "reviews";
|
||||
break;
|
||||
case 4:
|
||||
$path='';
|
||||
$this -> contentType = "content";
|
||||
break;
|
||||
case comments:
|
||||
case 5:
|
||||
$path='';
|
||||
$this -> rssQuery = "SELECT * FROM #comments ORDER BY comment_datestamp DESC LIMIT 0,".$this -> limit;
|
||||
$sql->db_Select_gen($this -> rssQuery);
|
||||
$tmp = $sql->db_getList();
|
||||
$this -> rssItems = array();
|
||||
$loop=0;
|
||||
foreach($tmp as $value) {
|
||||
$this -> rssItems[$loop]['title'] = $value['comment_subject'];
|
||||
|
||||
switch ($value['comment_type']) {
|
||||
case 0:
|
||||
$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['comment_item_id'];
|
||||
break;
|
||||
case 4:
|
||||
$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.poll.".$value['comment_item_id'];
|
||||
break;
|
||||
}
|
||||
|
||||
$this -> rssItems[$loop]['description'] = $value['comment_comment'];
|
||||
$this -> rssItems[$loop]['author'] = substr($value['comment_author'], (strpos($value['comment_author'], ".")+1));
|
||||
$loop++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
$path = e_PLUGIN."forum/e_rss.php";
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if(!$this -> topicid) {
|
||||
return FALSE;
|
||||
}
|
||||
$path = e_PLUGIN."forum/e_rss.php";
|
||||
break;
|
||||
|
||||
/*
|
||||
case 10:
|
||||
$this -> limit = '9';
|
||||
$path='';
|
||||
$this -> contentType = "bugtracker reports";
|
||||
$sql->db_Select("bugtrack2_bugs", "*", "bugtrack2_bugs_status=0 ORDER BY bugtrack2_bugs_datestamp LIMIT 0,".$this -> limit);
|
||||
$tmp = $sql->db_getList();
|
||||
$this -> rssItems = array();
|
||||
$loop=0;
|
||||
foreach($tmp as $value) {
|
||||
$nick = preg_replace("/[0-9]+\./", "", $value['bugtrack2_bugs_poster']);
|
||||
$this -> rssItems[$loop]['author'] = $nick;
|
||||
$this -> rssItems[$loop]['title'] = $value['bugtrack2_bugs_summary'];
|
||||
$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."bugtracker2/bugtracker2.php?0.bug.".$value['bugtrack2_bugs_id'];
|
||||
$this -> rssItems[$loop]['description'] = $value['bugtrack2_bugs_description'];
|
||||
$loop++;
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
case 11:
|
||||
if(!$this -> topicid) {
|
||||
return FALSE;
|
||||
}
|
||||
$path = e_PLUGIN."forum/e_rss.php";
|
||||
break;
|
||||
|
||||
case download:
|
||||
case 12:
|
||||
if($topic_id && is_numeric($topic_id)){
|
||||
$topic = "d.download_category='".intval($topic_id)."' AND ";
|
||||
}else{
|
||||
$topic = "";
|
||||
}
|
||||
$path='';
|
||||
$class_list = "0,251,252,253";
|
||||
$query = "SELECT d.*, dc.* FROM #download AS d LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id WHERE {$topic} d.download_active > 0 AND d.download_class IN (".$class_list.") ORDER BY d.download_datestamp DESC LIMIT 0,".$this -> limit;
|
||||
$sql -> db_Select_gen($query);
|
||||
|
||||
// $sql->db_Select("download", "*", "{$topic} download_active > 0 AND download_class IN (".$class_list.") ORDER BY download_datestamp DESC LIMIT 0,".$this -> limit);
|
||||
$tmp = $sql->db_getList();
|
||||
$this -> rssItems = array();
|
||||
$loop=0;
|
||||
foreach($tmp as $value) {
|
||||
if($value['download_author']){
|
||||
$nick = preg_replace("/[0-9]+\./", "", $value['download_author']);
|
||||
$this -> rssItems[$loop]['author'] = $nick;
|
||||
}
|
||||
$this -> rssItems[$loop]['author_email'] = $value['download_author_email'];
|
||||
$this -> rssItems[$loop]['title'] = $value['download_name'];
|
||||
$this -> rssItems[$loop]['link'] = $e107->base_path."download.php?view.".$value['download_id'];
|
||||
$this -> rssItems[$loop]['description'] = ($rss_type == 3 ? $value['download_description'] : $value['download_description']);
|
||||
$this -> rssItems[$loop]['category_name'] = $value['download_category_name'];
|
||||
$this -> rssItems[$loop]['category_link'] = $e107->base_path."download.php?list.".$value['download_category_id'];
|
||||
$this -> rssItems[$loop]['enc_url'] = $e107->base_path."request.php?".$value['download_id'];
|
||||
$this -> rssItems[$loop]['enc_leng'] = $value['download_filesize'];
|
||||
$this -> rssItems[$loop]['enc_type'] = $this->getmime($value['download_url']);
|
||||
$this -> rssItems[$loop]['pubdate'] = $value['download_datestamp'];
|
||||
$loop++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(isset($path) && $path!=''){
|
||||
|
||||
//new rss reader from e_rss.php in plugin folder
|
||||
if (is_readable($path)) {
|
||||
require_once($path);
|
||||
foreach($eplug_rss_data as $key=>$rs){
|
||||
foreach($rs as $k=>$row){
|
||||
$this -> rssItems[$k]['author'] = $row['author'];
|
||||
$this -> rssItems[$k]['author_email'] = $row['author_email'];
|
||||
$this -> rssItems[$k]['title'] = $row['title'];
|
||||
if($row['link']){
|
||||
if(eregi("http",$row['link'])){
|
||||
$this -> rssItems[$k]['link'] = $row['link'];
|
||||
}else{
|
||||
$this -> rssItems[$k]['link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['link'];
|
||||
}
|
||||
}
|
||||
$this -> rssItems[$k]['description'] = $row['description'];
|
||||
if($row['enc_url']){
|
||||
$this -> rssItems[$k]['enc_url'] = $e107->base_path.$PLUGINS_DIRECTORY.$enc_url.$row['item_id'];
|
||||
}
|
||||
if($row['enc_leng']){
|
||||
$this -> rssItems[$k]['enc_leng'] = $row['enc_leng'];
|
||||
}
|
||||
|
||||
if($eplug_rss['enc_type']){
|
||||
$this -> rssItems[$k]['enc_type'] = $this->getmime($eplug_rss['enc_type']);
|
||||
}elseif($row['enc_type']){
|
||||
$this -> rssItems[$k]['enc_type'] = $row['enc_type'];
|
||||
}
|
||||
|
||||
$this -> rssItems[$k]['category_name'] = $row['category_name'];
|
||||
if($row['category_link']){
|
||||
if(eregi("http",$row['category_link'])){
|
||||
$this -> rssItems[$k]['category_link'] = $row['category_link'];
|
||||
}else{
|
||||
$this -> rssItems[$k]['category_link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['category_link'];
|
||||
}
|
||||
}
|
||||
if($row['datestamp']){
|
||||
$this -> rssItems[$k]['pubdate'] = $row['datestamp'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function buildRss($rss_title) {
|
||||
global $sql, $pref, $tp, $e107, $PLUGINS_DIRECTORY;
|
||||
header('Content-type: application/xml', TRUE);
|
||||
|
||||
$rss_title = $tp->toRss($pref['sitename']." : ".$rss_title);
|
||||
$rss_namespace = ($this->rssNamespace) ? "xmlns:".$this->rssNamespace : "";
|
||||
$rss_custom_channel = ($this->rssCustomChannel) ? $this->rssCustomChannel : "";
|
||||
$time = time();
|
||||
switch ($this -> rssType) {
|
||||
case 1: // Rss 1.0
|
||||
echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
|
||||
<!-- generator=\"e107\" -->
|
||||
<!-- content type=\"".$this -> contentType."\" -->
|
||||
<rss version=\"0.92\">
|
||||
<channel>
|
||||
<title>".$tp->toRss($rss_title)."</title>
|
||||
<link>".$pref['siteurl']."</link>
|
||||
<description>".$tp->toRss($pref['sitedescription'])."</description>
|
||||
<lastBuildDate>".$itemdate = date("r", ($time + $this -> offset))."</lastBuildDate>
|
||||
<docs>http://backend.userland.com/rss092</docs>\n";
|
||||
|
||||
foreach($this -> rssItems as $value)
|
||||
{
|
||||
|
||||
// Multi-language rss links.
|
||||
$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
|
||||
|
||||
echo "
|
||||
<item>
|
||||
<title>".$tp->toRss($value['title'])."</title>
|
||||
<description>".$tp->toRss(substr($value['description'],0,150))."</description>
|
||||
<author>".$value['author']."<".$this->nospam($value['author_email'])."></author>
|
||||
<link>".$link."</link>
|
||||
</item>";
|
||||
}
|
||||
echo "
|
||||
</channel>
|
||||
</rss>";
|
||||
break;
|
||||
|
||||
case 2: // rss 2.0
|
||||
$sitebutton = (strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON);
|
||||
echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>
|
||||
<!-- generator=\"e107\" -->
|
||||
<!-- content type=\"".$this -> contentType."\" -->
|
||||
<!-- test=\"".SITEDISCLAIMER."\" -->
|
||||
<rss {$rss_namespace} version=\"2.0\">
|
||||
<channel>
|
||||
<title>".$tp->toRss($rss_title)."</title>
|
||||
<link>".$pref['siteurl']."</link>
|
||||
<description>".$tp->toRss($pref['sitedescription'])."</description>\n";
|
||||
|
||||
echo $tp->toRss($rss_custom_channel,TRUE)."\n";
|
||||
|
||||
echo "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
|
||||
<copyright>".preg_replace("#\<br \/\>|\n|\r#si", "", SITEDISCLAIMER)."</copyright>
|
||||
<managingEditor>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</managingEditor>
|
||||
<webMaster>".$this->nospam($pref['siteadminemail'])."</webMaster>
|
||||
<pubDate>".date("r",($time + $this -> offset))."</pubDate>
|
||||
<lastBuildDate>".date("r",($time + $this -> offset))."</lastBuildDate>
|
||||
<docs>http://backend.userland.com/rss</docs>
|
||||
<generator>e107 (http://e107.org)</generator>
|
||||
<ttl>60</ttl>
|
||||
<image>
|
||||
<title>".$tp->toRss($rss_title)."</title>
|
||||
<url>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</url>
|
||||
<link>".$pref['siteurl']."</link>
|
||||
<width>88</width>
|
||||
<height>31</height>
|
||||
<description>".$tp->toRss($pref['sitedescription'])."</description>
|
||||
</image>
|
||||
<textInput>
|
||||
<title>Search</title>
|
||||
<description>Search ".$tp->toRss($pref['sitename'])."</description>
|
||||
<name>query</name>
|
||||
<link>".SITEURL.(substr(SITEURL, -1) == "/" ? "" : "/")."search.php</link>
|
||||
</textInput>";
|
||||
foreach($this -> rssItems as $value)
|
||||
{
|
||||
// Multi-language rss links.
|
||||
$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
|
||||
$catlink = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['category_link']) : $value['category_link'];
|
||||
|
||||
echo "
|
||||
<item>
|
||||
<title>".$tp->toRss($value['title'])."</title>\n";
|
||||
|
||||
if($link){
|
||||
echo "<link>".$link."</link>\n";
|
||||
}
|
||||
|
||||
echo "<description>".$tp->toRss($value['description'],TRUE)."</description>\n";
|
||||
|
||||
if($value['category_name'] && $catlink){
|
||||
echo "<category domain='".$catlink."'>".$tp -> toRss($value['category_name'])."</category>\n";
|
||||
}
|
||||
|
||||
if($value['comment']){
|
||||
//echo "<comments>".$tp->toRss($value['comment'])."</comments>\n";
|
||||
echo "<comments>".$value['comment']."</comments>\n";
|
||||
}
|
||||
|
||||
if($value['author']){
|
||||
echo "<author>".$value['author']."<".$this->nospam($value['author_email'])."></author>\n";
|
||||
}
|
||||
|
||||
// enclosure support for podcasting etc.
|
||||
if($value['enc_url'] && $value['enc_leng'] && $value['enc_type']){
|
||||
echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\" />\n";
|
||||
}
|
||||
|
||||
echo "<pubDate>".date("r", ($value['pubdate'] + $this -> offset))."</pubDate>\n";
|
||||
|
||||
if($link){
|
||||
echo "<guid isPermaLink=\"true\">".$link."</guid>\n";
|
||||
}
|
||||
|
||||
echo "</item>";
|
||||
}
|
||||
echo "
|
||||
</channel>
|
||||
</rss>";
|
||||
break;
|
||||
|
||||
case 3: // rdf
|
||||
echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
|
||||
<!-- generator=\"e107\" -->
|
||||
<!-- content type=\"".$this -> contentType."\" -->
|
||||
<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" 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:content=\"http://purl.org/rss/1.0/modules/content/\">
|
||||
<channel rdf:about=\"".$pref['siteurl']."\">
|
||||
<title>".$tp->toRss($rss_title)."</title>
|
||||
<link>".$pref['siteurl']."</link>
|
||||
<description>".$tp->toRss($pref['sitedescription'])."</description>
|
||||
<dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language>
|
||||
<dc:date>".$this->get_iso_8601_date($time + $this -> offset). "</dc:date>
|
||||
<dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator>
|
||||
<admin:generatorAgent rdf:resource=\"http://e107.org\" />
|
||||
<admin:errorReportsTo rdf:resource=\"mailto:".$this->nospam($pref['siteadminemail'])."\" />
|
||||
<sy:updatePeriod>hourly</sy:updatePeriod>
|
||||
<sy:updateFrequency>1</sy:updateFrequency>
|
||||
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
|
||||
<items>
|
||||
<rdf:Seq>";
|
||||
|
||||
foreach($this -> rssItems as $value)
|
||||
{
|
||||
|
||||
// Multi-language rss links.
|
||||
$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
|
||||
|
||||
echo "
|
||||
<rdf:li rdf:resource=\"".$link."\" />";
|
||||
}
|
||||
|
||||
echo "
|
||||
</rdf:Seq>
|
||||
</items>
|
||||
</channel>";
|
||||
|
||||
reset($this -> rssItems);
|
||||
unset($link);
|
||||
foreach($this -> rssItems as $value)
|
||||
{
|
||||
|
||||
// Multi-language rss links.
|
||||
$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
|
||||
|
||||
echo "
|
||||
<item rdf:about=\"".$link."\">
|
||||
<title>".$tp->toRss($value['title'])."</title>
|
||||
<link>".$link."</link>
|
||||
<dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date>
|
||||
<dc:creator>".$value['author']."</dc:creator>
|
||||
<dc:subject>".$tp->toRss($value['category_name'])."</dc:subject>
|
||||
<description>".$tp->toRss($value['description'])."</description>
|
||||
</item>";
|
||||
}
|
||||
echo "
|
||||
</rdf:RDF>";
|
||||
break;
|
||||
|
||||
//new feed for atom - still in development, and not yet tested
|
||||
case 4:
|
||||
echo "<?xml version='1.0' encoding='".CHARSET."'?>\n
|
||||
<feed xmlns='http://www.w3.org/2005/Atom'>\n";
|
||||
/*
|
||||
<feed version='0.3'
|
||||
xmlns='http://purl.org/atom/ns#'
|
||||
xmlns:dc='http://purl.org/dc/elements/1.1/'
|
||||
xml:lang='".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."'>\n";
|
||||
*/
|
||||
|
||||
//required
|
||||
echo "
|
||||
<id>".$pref['siteurl']."</id>\n
|
||||
<title type='text'>".$tp->toRss($rss_title)."</title>\n
|
||||
<updated>".$this->get_iso_8601_date($time + $this -> offset)."</updated>\n";
|
||||
|
||||
//recommended
|
||||
echo "
|
||||
<author>\n
|
||||
<name>e107</name>\n";
|
||||
//<email></email>\n
|
||||
echo "
|
||||
<uri>http://e107.org/</uri>\n
|
||||
</author>\n
|
||||
<link rel='self' href='".$e107->base_path.$PLUGINS_DIRECTORY."rss_menu/".e_PAGE."?".e_QUERY."' />\n";
|
||||
|
||||
//optional
|
||||
include(e_ADMIN."ver.php");
|
||||
echo "
|
||||
<category term='e107'/>\n
|
||||
<contributor>\n
|
||||
<name>e107</name>\n
|
||||
</contributor>\n
|
||||
<generator uri='http://e107.org/' version='".$e107info['e107_version']."'>e107</generator>\n";
|
||||
//<icon>/icon.jpg</icon>\n
|
||||
echo "
|
||||
<logo>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</logo>\n
|
||||
<rights type='html'>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</rights>\n";
|
||||
if($pref['sitedescription']){
|
||||
echo "
|
||||
<subtitle type='text'>".$pref['sitedescription']."</subtitle>\n";
|
||||
}
|
||||
foreach($this -> rssItems as $value) {
|
||||
echo "
|
||||
<entry>\n";
|
||||
|
||||
//required
|
||||
echo "
|
||||
<id>".$value['link']."</id>\n
|
||||
<title type='text'>".$tp->toRss($value['title'])."</title>\n
|
||||
<updated>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</updated>\n";
|
||||
|
||||
//recommended
|
||||
$author = ($value['author']) ? $value['author'] : "unknown";
|
||||
|
||||
echo "
|
||||
<author>\n";
|
||||
echo "
|
||||
<name>".$author."</name>\n";
|
||||
echo ($value['author_email']) ? "\t\t\t\t\t\t<email>".$this->nospam($value['author_email'])."</email>\n" : "";
|
||||
echo "</author>\n";
|
||||
//<content>complete story here</content>\n
|
||||
echo "
|
||||
<link rel='alternate' type='text/html' href='".$value['link']."' />\n
|
||||
<summary type='text'>".$tp->toRss($value['description'])."</summary>\n";
|
||||
|
||||
//optional
|
||||
if($value['category_name']){
|
||||
echo "<category term='".$tp -> toRss($value['category_name'])."'/>\n";
|
||||
}
|
||||
//<contributor>
|
||||
// <name>Jane Doe</name>
|
||||
//</contributor>
|
||||
echo "<published>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</published>\n";
|
||||
//<source>
|
||||
// <id>http://example.org/</id>
|
||||
// <title>Fourty-Two</title>
|
||||
// <updated>2003-12-13T18:30:02Z</updated>
|
||||
// <rights><3E> 2005 Example, Inc.</rights>
|
||||
//</source>
|
||||
//<rights type='html'>&copy; 2005 John Doe</rights>
|
||||
echo "
|
||||
</entry>\n";
|
||||
}
|
||||
echo "
|
||||
</feed>\n";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getmime($file){
|
||||
$ext = strtolower(str_replace(".","",strrchr(basename($file), ".")));
|
||||
$mime["mp3"] = "audio/mpeg";
|
||||
return $mime[$ext];
|
||||
}
|
||||
|
||||
function get_iso_8601_date($int_date) {
|
||||
//$int_date: current date in UNIX timestamp
|
||||
$date_mod = date('Y-m-d\TH:i:s', $int_date);
|
||||
$pre_timezone = date('O', $int_date);
|
||||
$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
|
||||
$date_mod .= $time_zone;
|
||||
return $date_mod;
|
||||
}
|
||||
|
||||
function nospam($text){
|
||||
$tmp = explode("@",$text);
|
||||
return ($tmp[0] != "") ? $tmp[0].RSS_LAN_2 : RSS_LAN_3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
81
e107_plugins/rss_menu/rss_menu.php
Normal file
81
e107_plugins/rss_menu/rss_menu.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/rss_menu.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:42 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
global $FILES_DIRECTORY,$pref,$sql;
|
||||
$path = e_PLUGIN."rss_menu/";
|
||||
|
||||
$des = "";
|
||||
$topic = "";
|
||||
|
||||
if(strstr(e_SELF, "comment.php") && $sql -> db_Select("rss", "rss_path", " rss_path = 'comments' LIMIT 1")) {
|
||||
$type = 5;
|
||||
$des = RSS_MENU_L4;
|
||||
}
|
||||
if(strstr(e_SELF, "/forum")&& $sql -> db_Select("rss", "rss_path", " rss_path = 'forum|name' LIMIT 1") ) {
|
||||
$type = 6;
|
||||
$des = RSS_MENU_L5;
|
||||
}
|
||||
if(strstr(e_SELF, "forum_viewtopic") && $sql -> db_Select("rss", "rss_path", " rss_path = 'forum|topic' LIMIT 1")) {
|
||||
$type = 7;
|
||||
$des = RSS_MENU_L6;
|
||||
}
|
||||
if(strstr(e_SELF, "chat.php")&& $sql -> db_Select("rss", "rss_path", " rss_path = 'chatbox_menu' LIMIT 1")) {
|
||||
$type = 9;
|
||||
$des = RSS_MENU_L7;
|
||||
}
|
||||
|
||||
if(strstr(e_SELF, "/bugtracker")) {
|
||||
$type = 10;
|
||||
$des = RSS_MENU_L8;
|
||||
}
|
||||
|
||||
if(strstr(e_SELF, "download.php") && $sql -> db_Select("rss", "rss_path", " rss_path = 'download' LIMIT 1")) {
|
||||
$type = 12;
|
||||
$des = RSS_MENU_L9;
|
||||
}
|
||||
|
||||
if(!$des) {
|
||||
$type = 1;
|
||||
$des = RSS_MENU_L3;
|
||||
}
|
||||
|
||||
if(e_PAGE == "news.php" && $pref['rss_newscats'])
|
||||
{
|
||||
|
||||
$qry = explode(".",e_QUERY);
|
||||
if($qry[0] == "cat" || $qry[0] == "list")
|
||||
{
|
||||
$topic = intval($qry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$text = "
|
||||
<div style='text-align:center' class='smalltext'>
|
||||
".$des.RSS_MENU_L1."<br />
|
||||
<div class='spacer'><a href='".$path."rss.php?$type.1".($topic ? ".".$topic : "")."'><img src='".$path."images/rss1.png' alt='rss1.0' style='border:0' /></a></div>
|
||||
<div class='spacer'><a href='".$path."rss.php?$type.2".($topic ? ".".$topic : "")."'><img src='".$path."images/rss2.png' alt='rss2.0' style='border:0' /></a></div>
|
||||
<div class='spacer'><a href='".$path."rss.php?$type.3".($topic ? ".".$topic : "")."'><img src='".$path."images/rss3.png' alt='rdf' style='border:0' /></a><br /></div>
|
||||
</div>";
|
||||
|
||||
$caption = (file_exists(THEME."images/RSS_menu.png") ? "<img src='".THEME_ABS."images/RSS_menu.png' alt='' style='vertical-align:middle' /> ".RSS_MENU_L2 : RSS_MENU_L2);
|
||||
|
||||
$ns->tablerender($caption, $text, 'backend');
|
||||
|
||||
?>
|
192
e107_plugins/rss_menu/rss_shortcodes.php
Normal file
192
e107_plugins/rss_menu/rss_shortcodes.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
include_once(e_HANDLER.'shortcode_handler.php');
|
||||
$rss_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
|
||||
/*
|
||||
|
||||
SC_BEGIN RSS_FEED
|
||||
global $row, $tp;
|
||||
$url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
return "<a href='".$url2."'>".$tp->toHTML($row['rss_name'], TRUE)."</a>";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ICON
|
||||
global $row, $tp;
|
||||
$url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
return "<a href='".$url2."'>".RSS_ICON."</a>";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_TEXT
|
||||
global $row, $tp;
|
||||
return $tp->toHTML($row['rss_text'], TRUE, "defs");
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_TYPES
|
||||
global $row, $tp;
|
||||
$url1 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
$url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
$url3 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
$url4 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
|
||||
|
||||
$text = "
|
||||
<a href='".$url1."'><img src='".e_PLUGIN."rss_menu/images/rss1.png' alt='rss1' /></a>
|
||||
<a href='".$url2."'><img src='".e_PLUGIN."rss_menu/images/rss2.png' alt='rss1' /></a>
|
||||
<a href='".$url3."'><img src='".e_PLUGIN."rss_menu/images/rss3.png' alt='rss1' /></a>
|
||||
<a href='".$url4."'><img src='".e_PLUGIN."rss_menu/images/rss4.png' alt='rss1' /></a>
|
||||
";
|
||||
return $text;
|
||||
SC_END
|
||||
|
||||
|
||||
//##### ADMIN --------------------------------------------------
|
||||
|
||||
SC_BEGIN RSS_ADMIN_CAPTION
|
||||
global $sort;
|
||||
list($field,$txt) = explode(",",$parm);
|
||||
$txt = constant($txt);
|
||||
return "<a href='".e_SELF."?list.{$field}.".($sort == "desc" ? "asc" : "desc")."'>".$txt."</a>\n";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_ID
|
||||
global $row;
|
||||
return $row['rss_id'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_NAME
|
||||
global $row;
|
||||
return $row['rss_name'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_PATH
|
||||
global $row;
|
||||
return $row['rss_path'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_URL
|
||||
global $row;
|
||||
return "<a href='".e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$row['rss_url']."'>".$row['rss_url']."</a>";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_TOPICID
|
||||
global $row;
|
||||
return $row['rss_topicid'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_LIMIT
|
||||
global $row, $rs;
|
||||
$id = $row['rss_id'];
|
||||
return "<input class='tbox' type='text' name=\"limit[$id]\" title=\"".RSS_LAN05."\" value='".intval($row['rss_limit'])."' size='3' maxlength='3' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_LIMITBUTTON
|
||||
global $row;
|
||||
return "<input class='button' type='submit' name='update_limit' value=\"".LAN_UPDATE."\" />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_OPTIONS
|
||||
global $row, $tp;
|
||||
$delname = $row['rss_name'];
|
||||
$delid = $row['rss_id'];
|
||||
$options = "
|
||||
<a href='".e_SELF."?create.edit.".$row['rss_id']."' >".ADMIN_EDIT_ICON."</a>
|
||||
<input type='image' title=\"".LAN_DELETE."\" name='delete[{$delid}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL ." [".RSS_LAN_ADMIN_2.": ".$delid." : ".$delname."]\\n\\n")."')\"/>";
|
||||
return $options;
|
||||
SC_END
|
||||
|
||||
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_NAME
|
||||
global $row;
|
||||
return "<input class='tbox' type='text' name='rss_name' size='74' value=\"".$row['rss_name']."\" />\n";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_URL
|
||||
global $row,$PLUGINS_DIRECTORY;
|
||||
return SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".e_LANQRY." <input class='tbox' type='text' name='rss_url' size='10' value=\"".$row['rss_url']."\" maxlength='50' /> .{".RSS_LAN_ADMIN_9."}.{".RSS_LAN_ADMIN_12."}";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_TOPICID
|
||||
global $row;
|
||||
return "<input class='tbox' type='text' name='rss_topicid' size='74' value=\"".$row['rss_topicid']."\" maxlength='250' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_PATH
|
||||
global $row;
|
||||
return "<input class='tbox' type='text' name='rss_path' size='74' value=\"".$row['rss_path']."\" maxlength='250' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_TEXT
|
||||
global $row;
|
||||
return "<textarea class='tbox' name='rss_text' cols='74' rows='5' >".$row['rss_text']."</textarea>\n";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_CLASS
|
||||
global $row;
|
||||
$vals = array(RSS_LAN_ADMIN_21,RSS_LAN_ADMIN_22,RSS_LAN_ADMIN_23);
|
||||
$text = "<select class='tbox' name='rss_class'>";
|
||||
foreach($vals as $key=>$val){
|
||||
$sel = ($row['rss_class'] == $key) ? "selected='selected'" : "";
|
||||
$text .= "<option value='$key'>$val</option>\n";
|
||||
}
|
||||
$text .= "</select>";
|
||||
return $text;
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_LIMIT
|
||||
global $row;
|
||||
return "<input class='tbox' name='rss_limit' size='3' title=\"".RSS_LAN05."\" value='".intval($row['rss_limit'])."' maxlength='3' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_FORM_CREATEBUTTON
|
||||
global $row, $qs;
|
||||
if(isset($qs[1]) && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) ){
|
||||
$text = "<input type='hidden' name='rss_datestamp' value='".$row['rss_datestamp']."' />
|
||||
<input type='hidden' name='rss_id' value='".$row['rss_id']."' />
|
||||
<input class='button' type='submit' name='update_rss' value=\"".LAN_UPDATE."\" />";
|
||||
}else{
|
||||
$text = "<input class='button' type='submit' name='create_rss' value=\"".LAN_CREATE."\" />";
|
||||
}
|
||||
return $text;
|
||||
SC_END
|
||||
|
||||
|
||||
|
||||
SC_BEGIN RSS_ADMIN_IMPORT_CHECK
|
||||
global $feed, $rs, $tp, $i;
|
||||
$text = "<input type='checkbox' name='importid[$i]' value='1' />";
|
||||
$text .= "<input type='hidden' name='name[$i]' value='".$tp->toForm($feed['name'])."' />";
|
||||
$text .= "<input type='hidden' name='url[$i]' value='".$tp->toForm($feed['url'])."' />";
|
||||
$text .= "<input type='hidden' name='topic_id[$i]' value='".$tp->toForm($feed['topic_id'])."' />";
|
||||
$text .= "<input type='hidden' name='path[$i]' value='".$tp->toForm($feed['path'])."' />";
|
||||
$text .= "<input type='hidden' name='text[$i]' value='".$tp->toForm($feed['text'])."' />";
|
||||
$text .= "<input type='hidden' name='class[$i]' value='".$tp->toForm($feed['class'])."' />";
|
||||
$text .= "<input type='hidden' name='limit[$i]' value='".intval($feed['limit'])."' />";
|
||||
return $text;
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_IMPORT_PATH
|
||||
global $feed;
|
||||
return $feed['path'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_IMPORT_NAME
|
||||
global $feed;
|
||||
return $feed['name'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_IMPORT_TEXT
|
||||
global $feed;
|
||||
return $feed['text'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_IMPORT_URL
|
||||
global $feed;
|
||||
return $feed['url'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RSS_ADMIN_IMPORT_TOPICID
|
||||
global $feed;
|
||||
return $feed['topic_id'];
|
||||
SC_END
|
||||
|
||||
*/
|
||||
?>
|
12
e107_plugins/rss_menu/rss_sql.php
Normal file
12
e107_plugins/rss_menu/rss_sql.php
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE rss (
|
||||
rss_id int(10) unsigned NOT NULL auto_increment,
|
||||
rss_name varchar(255) NOT NULL default '',
|
||||
rss_url text NOT NULL,
|
||||
rss_topicid varchar(255) NOT NULL default '',
|
||||
rss_path varchar(255) NOT NULL default '',
|
||||
rss_text longtext NOT NULL,
|
||||
rss_datestamp int(10) unsigned NOT NULL default '0',
|
||||
rss_class tinyint(1) unsigned NOT NULL default '0',
|
||||
rss_limit tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (rss_id)
|
||||
) TYPE=MyISAM;
|
175
e107_plugins/rss_menu/rss_template.php
Normal file
175
e107_plugins/rss_menu/rss_template.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
if (!defined('ADMIN_WIDTH')) { define("ADMIN_WIDTH", "width:98%;"); }
|
||||
if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:100%"); }
|
||||
|
||||
//rss listing
|
||||
if(!isset($RSS_LIST_HEADER)){
|
||||
$RSS_LIST_HEADER = "<table class='fborder' style='".USER_WIDTH."'>
|
||||
<tr>
|
||||
<td class='fcaption' style='width:55%'>".RSS_LAN_ADMIN_4."</td>
|
||||
<td class='fcaption' style='text-align:right'>".RSS_PLUGIN_LAN_6."</td>
|
||||
</tr>";
|
||||
}
|
||||
if(!isset($RSS_LIST_TABLE)){
|
||||
$RSS_LIST_TABLE = "
|
||||
<tr>
|
||||
<td class='forumheader3'>{RSS_FEED}<br />
|
||||
<span class='smalltext' >{RSS_TEXT}</span>
|
||||
</td>
|
||||
<td class='forumheader3' style='text-align:right'>
|
||||
{RSS_TYPES}
|
||||
</td>
|
||||
</tr>";
|
||||
}
|
||||
if(!isset($RSS_LIST_FOOTER)){
|
||||
$RSS_LIST_FOOTER = "</table>";
|
||||
}
|
||||
|
||||
//admin : rss listing
|
||||
if(!isset($RSS_ADMIN_LIST_HEADER)){
|
||||
$RSS_ADMIN_LIST_HEADER = "
|
||||
<div style='text-align:center;'>
|
||||
<form action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."' id='dataform' method='post' >
|
||||
<table class='fborder' style='".ADMIN_WIDTH."'>
|
||||
<tr>
|
||||
<td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=id,RSS_LAN_ADMIN_2}</td>
|
||||
<td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=name,RSS_LAN_ADMIN_4}</td>
|
||||
<td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=path,RSS_LAN_ADMIN_3}</td>
|
||||
<td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=url,RSS_LAN_ADMIN_5}</td>
|
||||
<td class='fcaption' style='white-space:nowrap;'>".RSS_LAN_ADMIN_12."</td>
|
||||
<td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=limit,RSS_LAN_ADMIN_7}</td>
|
||||
<td class='fcaption' style='white-space:nowrap;'>".LAN_OPTIONS."</td>
|
||||
</tr>";
|
||||
}
|
||||
if(!isset($RSS_ADMIN_LIST_TABLE)){
|
||||
$RSS_ADMIN_LIST_TABLE = "
|
||||
<tr>
|
||||
<td class='forumheader3'>{RSS_ADMIN_ID}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_NAME}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_PATH}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_URL}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_TOPICID}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_LIMIT}</td>
|
||||
<td class='forumheader3' style='text-align:center'>{RSS_ADMIN_OPTIONS}</td>
|
||||
</tr>";
|
||||
}
|
||||
if(!isset($RSS_ADMIN_LIST_FOOTER)){
|
||||
$RSS_ADMIN_LIST_FOOTER = "
|
||||
<tr>
|
||||
<td class='forumheader' colspan='7' style='text-align:center'>
|
||||
{RSS_ADMIN_LIMITBUTTON}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>";
|
||||
}
|
||||
|
||||
//admin : rss create/edit
|
||||
if(!isset($RSS_ADMIN_CREATE_TABLE)){
|
||||
$RSS_ADMIN_CREATE_TABLE = "
|
||||
<div style='text-align:center;'>
|
||||
<form action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."' id='dataform' method='post' >
|
||||
<table class='fborder' style='".ADMIN_WIDTH."'>
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:12%'>".RSS_LAN_ADMIN_4."</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_FORM_NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".RSS_LAN_ADMIN_5."</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_FORM_URL}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".RSS_LAN_ADMIN_12."</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_FORM_TOPICID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".RSS_LAN_ADMIN_3."</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_FORM_PATH}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".RSS_LAN_ADMIN_6."</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_FORM_TEXT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".RSS_LAN_ADMIN_7."</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_FORM_LIMIT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".RSS_LAN_ADMIN_8."</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_FORM_CLASS}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader' colspan='2' style='text-align:center;'>{RSS_ADMIN_FORM_CREATEBUTTON}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>";
|
||||
}
|
||||
|
||||
//admin : rss options
|
||||
if(!isset($RSS_ADMIN_OPTIONS_TABLE)){
|
||||
$RSS_ADMIN_OPTIONS_TABLE = "
|
||||
<div style='text-align:center;'>
|
||||
<form action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."' id='dataform' method='post' >
|
||||
<table class='fborder' style='".ADMIN_WIDTH."'>
|
||||
<tr>
|
||||
<td class='fcaption'>".LAN_OPTIONS."</td>
|
||||
<td class='fcaption'>".RSS_LAN_ADMIN_14."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".RSS_LAN_ADMIN_13."</td>
|
||||
<td class='forumheader3'>
|
||||
<input type='checkbox' name='rss_othernews' value='1' ".($pref['rss_othernews'] == 1 ? " checked='checked' " : "")." />
|
||||
</td>
|
||||
</tr>
|
||||
<tr style='vertical-align:top'>
|
||||
<td colspan='2' style='text-align:center' class='forumheader'>
|
||||
<input class='button' type='submit' name='updatesettings' value='".LAN_SAVE."' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>";
|
||||
}
|
||||
|
||||
//admin : rss import
|
||||
if(!isset($RSS_ADMIN_IMPORT_HEADER)){
|
||||
$RSS_ADMIN_IMPORT_HEADER = "
|
||||
<div style='text-align:center;'>
|
||||
<form action='".e_SELF."' id='imlistform' method='post' >
|
||||
<table class='fborder' style='".ADMIN_WIDTH."'>
|
||||
<tr><td class='fcaption' colspan='5'>".RSS_LAN_ADMIN_15."</td></tr>
|
||||
<tr>
|
||||
<td class='fcaption'>".RSS_LAN_ADMIN_16."</td>
|
||||
<td class='fcaption'>".RSS_LAN_ADMIN_3."</td>
|
||||
<td class='fcaption'>".RSS_LAN_ADMIN_4."</td>
|
||||
<td class='fcaption'>".RSS_LAN_ADMIN_5."</td>
|
||||
<td class='fcaption'>".RSS_LAN_ADMIN_12."</td>
|
||||
</tr>";
|
||||
}
|
||||
if(!isset($RSS_ADMIN_IMPORT_TABLE)){
|
||||
$RSS_ADMIN_IMPORT_TABLE = "
|
||||
<tr>
|
||||
<td class='forumheader3'>{RSS_ADMIN_IMPORT_CHECK}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_IMPORT_PATH}</td>
|
||||
<td class='forumheader3'><b>{RSS_ADMIN_IMPORT_NAME}</b><br />{RSS_ADMIN_IMPORT_TEXT}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_IMPORT_URL}</td>
|
||||
<td class='forumheader3'>{RSS_ADMIN_IMPORT_TOPICID}</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
if(!isset($RSS_ADMIN_IMPORT_FOOTER)){
|
||||
$RSS_ADMIN_IMPORT_FOOTER = "
|
||||
<tr style='vertical-align:top'>
|
||||
<td colspan='5' style='text-align:center' class='forumheader'>
|
||||
<input class='button' type='submit' name='import_rss' value='".RSS_LAN_ADMIN_17."' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>";
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user