From ecf8281a4e976033676f7ee6679b7eb4948beab3 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Fri, 18 Sep 2009 19:07:09 +0000 Subject: [PATCH] Rss added to download plugin --- e107_plugins/download/download.php | 10 +- e107_plugins/download/e_rss.php | 96 +++++++++++++++++++ .../download/handlers/adminDownload_class.php | 30 +++--- .../download/handlers/category_class.php | 30 +++--- .../download/handlers/download_class.php | 30 +++--- 5 files changed, 144 insertions(+), 52 deletions(-) create mode 100644 e107_plugins/download/e_rss.php diff --git a/e107_plugins/download/download.php b/e107_plugins/download/download.php index 67530fb1c..504377199 100644 --- a/e107_plugins/download/download.php +++ b/e107_plugins/download/download.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/download/download.php,v $ -| $Revision: 1.9 $ -| $Date: 2009-09-17 20:38:18 $ +| $Revision: 1.10 $ +| $Date: 2009-09-18 19:07:09 $ | $Author: e107coders $ | +----------------------------------------------------------------------------+ @@ -22,8 +22,10 @@ if (!defined('e107_INIT')) require_once("../../class2.php"); } - -if (!e107::isInstalled('download')) { exit(); } +if (!e107::isInstalled('download')) +{ + header("location:".e_BASE."index.php"); +} include_lan(e_PLUGIN.'download/languages/'.e_LANGUAGE.'/download.php'); require_once(e_PLUGIN.'download/handlers/download_class.php'); diff --git a/e107_plugins/download/e_rss.php b/e107_plugins/download/e_rss.php new file mode 100644 index 000000000..d92b41354 --- /dev/null +++ b/e107_plugins/download/e_rss.php @@ -0,0 +1,96 @@ + 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'; + $eplug_rss_feed[] = $feed; + } + } + +//##### create rss data, return as array $eplug_rss_data ----------------------------------- + + + 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(); + $rss = array(); + $loop=0; + foreach($tmp as $value) + { + if($value['download_author']) + { + $nick = preg_replace("/[0-9]+\./", "", $value['download_author']); + $rss[$loop]['author'] = $nick; + } + $rss[$loop]['author_email'] = $value['download_author_email']; + $rss[$loop]['title'] = $value['download_name']; + $rss[$loop]['link'] = $e107->base_path."download.php?view.".$value['download_id']; + $rss['description'] = ($rss_type == 3 ? $value['download_description'] : $value['download_description']); + $rss['category_name'] = $value['download_category_name']; + $rss['category_link'] = $e107->base_path."download.php?list.".$value['download_category_id']; + $rss['enc_url'] = $e107->base_path."request.php?".$value['download_id']; + $rss['enc_leng'] = $value['download_filesize']; + $rss['enc_type'] = $this->getmime($value['download_url']); + $rss['pubdate'] = $value['download_datestamp']; + $loop++; + } + + +//##### ------------------------------------------------------------------------------------ + +$eplug_rss_data[] = $rss; + +?> \ No newline at end of file diff --git a/e107_plugins/download/handlers/adminDownload_class.php b/e107_plugins/download/handlers/adminDownload_class.php index 37ccfa970..77d5abb39 100644 --- a/e107_plugins/download/handlers/adminDownload_class.php +++ b/e107_plugins/download/handlers/adminDownload_class.php @@ -1,21 +1,19 @@