diff --git a/e107_plugins/download/e_rss.php b/e107_plugins/download/e_rss.php index adb38a538..338223a5a 100644 --- a/e107_plugins/download/e_rss.php +++ b/e107_plugins/download/e_rss.php @@ -20,7 +20,7 @@ if (!defined('e107_INIT')) { exit; } //##### create feed for admin, return array $eplug_rss_feed -------------------------------- // Download - $feed['name'] = ADLAN_24; + $feed['name'] = LAN_PLUGIN_DOWNLOAD_NAME; $feed['url'] = 'download'; $feed['topic_id'] = ''; $feed['path'] = 'download'; @@ -36,9 +36,9 @@ if (!defined('e107_INIT')) { exit; } if($sqli -> db_Select("download_category", "*","download_category_id!='' ORDER BY download_category_order ")) { - while($rowi = $sqli -> db_Fetch()) + while($rowi = $sqli ->fetch()) { - $feed['name'] = ADLAN_24.' > '.$rowi['download_category_name']; + $feed['name'] = LAN_PLUGIN_DOWNLOAD_NAME.' > '.$rowi['download_category_name']; $feed['url'] = 'download'; $feed['topic_id'] = $rowi['download_category_id']; $feed['path'] = 'download'; diff --git a/e107_plugins/rss_menu/admin_prefs.php b/e107_plugins/rss_menu/admin_prefs.php index aead5acfa..d5689a591 100644 --- a/e107_plugins/rss_menu/admin_prefs.php +++ b/e107_plugins/rss_menu/admin_prefs.php @@ -55,10 +55,10 @@ class rss_admin extends e_admin_dispatcher protected $adminMenu = array( 'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'), - 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'), - - /* + 'main/import' => array('caption'=> "Add New Feed", 'perm' => 'P'), + 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'), + /* 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P') */ @@ -69,6 +69,15 @@ class rss_admin extends e_admin_dispatcher ); protected $menuTitle = 'RSS'; + + + function init() + { + if(E107_DEBUG_LEVEL > 0) + { + $this->adminMenu['main/create'] = array('caption'=> "Add Custom Feed", 'perm' => 'P'); + } + } } @@ -79,51 +88,255 @@ class rss_ui extends e_admin_ui { protected $pluginTitle = 'RSS'; - protected $pluginName = 'myplugin'; + protected $pluginName = 'core'; protected $table = 'rss'; protected $pid = 'rss_id'; protected $perPage = 10; protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => '', 'data' => '', 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), - 'rss_id' => array ( 'title' => 'LAN_ID', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'rss_name' => array ( 'title' => 'LAN_TITLE', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'rss_url' => array ( 'title' => 'LAN_URL', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '.{Type}.{Topic id}', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'rss_topicid' => array ( 'title' => 'Topic id', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), - 'rss_path' => array ( 'title' => 'Path', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'rss_text' => array ( 'title' => 'Text', 'type' => 'textarea', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), - 'rss_datestamp' => array ( 'title' => 'LAN_DATESTAMP', 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'rss_class' => array ( 'title' => 'LAN_VISIBILITY', 'type' => 'method', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'rss_limit' => array ( 'title' => 'Limit', 'type' => 'number', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'options' => array ( 'title' => 'LAN_OPTIONS', 'type' => null, 'data' => '', 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), + 'rss_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'rss_name' => array ( 'title' => LAN_TITLE, 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'rss_path' => array ( 'title' => 'Plugin-Dir', 'type' => 'text', 'data' => 'int', 'readonly'=>1, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'rss_url' => array ( 'title' => LAN_URL, 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'rss_topicid' => array ( 'title' => 'Topic id', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + + 'rss_text' => array ( 'title' => 'Text', 'type' => 'textarea', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'rss_datestamp' => array ( 'title' => LAN_DATESTAMP, 'type' => 'datestamp', 'data' => 'int', 'readonly'=>true, 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'rss_class' => array ( 'title' => LAN_VISIBILITY, 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => array('optArray'=> array(RSS_LAN_ADMIN_21,RSS_LAN_ADMIN_22,RSS_LAN_ADMIN_23),'size'=>'xlarge'), 'class' => 'left', 'thclass' => 'left', ), + 'rss_limit' => array ( 'title' => 'Limit', 'type' => 'number', 'data' => 'int', 'inline'=>true, 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => '', 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), ); - protected $fieldpref = array('checkboxes', 'rss_name','rss_url', 'rss_topicid', 'rss_path', 'rss_class', 'options'); - - - - /* - protected = array( - 'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true), - 'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'), - 'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore') + protected $fieldpref = array('checkboxes', 'rss_name','rss_url', 'rss_topicid', 'rss_limit', 'rss_class', 'options'); + + + protected $prefs = array( + 'rss_othernews' => array('title'=> RSS_LAN_ADMIN_13, 'type' => 'boolean', 'data' => 'int'), + 'rss_summarydiz' => array('title'=> RSS_LAN_ADMIN_19, 'type' => 'boolean', 'data' => 'integer'), + 'rss_shownewsimage' => array('title'=> RSS_LAN_ADMIN_33, 'type' => 'boolean', 'data' => 'int') ); - - // optional - public function init() + + // optional + public function init() + { + + if(!empty($_POST['importid'])) { - + $this->dbrssImport(); } - - - public function customPage() + } + + + function dbrssImport() + { + $sql = e107::getDb(); + $tp = e107::getParser(); + + + + foreach($_POST['importid'] as $key=>$value) { + $rssVals = array(); + $rssVals['rss_topicid'] = $tp -> toDB(varset($_POST['topic_id'][$key], '')); + $rssVals['rss_url'] = $tp -> toDB(varset($_POST['url'][$key], '')); + $rssVals['rss_path'] = $tp -> toDB(varset($_POST['path'][$key], '')); + $rssVals['rss_name'] = $tp -> toDB(varset($_POST['name'][$key], '')); + $rssVals['rss_text'] = $tp -> toDB(varset($_POST['text'][$key], '')); + $rssVals['rss_datestamp'] = time(); + $rssVals['rss_class'] = intval(varset($_POST['class'][$key], '0')); + $rssVals['rss_limit'] = intval(varset($_POST['limit'][$key], '0')); + + $sql->insert("rss", $rssVals); + e107::getLog()->logArrayAll('RSS_04',$rssVals); + } + $message = count($_POST['importid'])." ".RSS_LAN_ADMIN_18; + return $message; + } + + + public function importPage() + { + // Import - put up the list of possible feeds to import + + + $sql = e107::getDb(); $ns = e107::getRender(); - $text = 'Hello World!'; - $ns->tablerender('Hello',$text); - + $mes = e107::getMessage(); + $tp = e107::getParser(); + $frm = e107::getForm(); + + global $i,$rss_shortcodes, $feed, $pref; + + require_once(e_PLUGIN.'rss_menu/rss_shortcodes.php'); + + if(!isset($RSS_ADMIN_IMPORT_HEADER)) + { + $RSS_ADMIN_IMPORT_HEADER = " +
+ + + "; + } + if(!isset($RSS_ADMIN_IMPORT_TABLE)) + { + $RSS_ADMIN_IMPORT_TABLE = " + + + + + + + "; + } + + if(!isset($RSS_ADMIN_IMPORT_FOOTER)) + { + $RSS_ADMIN_IMPORT_FOOTER = " +
".RSS_LAN_ADMIN_16." + ".RSS_LAN_ADMIN_3." + ".LAN_NAME." + ".RSS_LAN_ADMIN_5." + ".RSS_LAN_ADMIN_12." +
{RSS_ADMIN_IMPORT_CHECK}{RSS_ADMIN_IMPORT_PATH}{RSS_ADMIN_IMPORT_NAME}
{RSS_ADMIN_IMPORT_TEXT}
{RSS_ADMIN_IMPORT_URL}{RSS_ADMIN_IMPORT_TOPICID}
+
+ ".$frm->admin_button('import_rss',RSS_LAN_ADMIN_17,'submit')." +
+
+ "; } - */ + + + + + // 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'; + // $feed['exclude_class'] = ''; + $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) + { + $eplug_rss_feed = array(); + if (is_readable(e_PLUGIN.$val."/e_rss.php")) + { + require_once(e_PLUGIN.$val."/e_rss.php"); + + $className = $val."_rss"; + $data = false; + + if(!$data = e107::callMethod($className,'config')) + { + $data = $eplug_rss_feed; + } + + foreach($data as $v) + { + $v['path'] = $val; + array_push($plugin_feedlist,$v); + } + + } + } + + $feedlist = array_merge($feedlist, $plugin_feedlist); + +// print_a($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->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, $mes->render(). $text); + + return $text; + } + } + } @@ -134,41 +347,44 @@ class rss_form_ui extends e_admin_form_ui // Custom Method/Function - function rss_class($curVal,$mode) + function rss_url($curVal,$mode) { - $frm = e107::getForm(); - $array = array(RSS_LAN_ADMIN_21,RSS_LAN_ADMIN_22,RSS_LAN_ADMIN_23); - + + + switch($mode) { case 'read': // List Page - return vartrue($array[$curVal]); + + $type = $this->getController()->getListModel()->get('rss_type'); + $topic = $this->getController()->getListModel()->get('rss_topicid'); + + $link = e107::url('rss_menu', 'rss', array('rss_type'=>$type, 'rss_url'=>$curVal, 'rss_topicid'=>$topic)); + return "".$curVal.""; break; case 'write': // Edit Page - return $frm->select('rss_class',$array, $curVal); + $link = SITEURL."feed/"; // e107::url('rss_menu','index').'/'; + return "
".$link.e107::getForm()->text('rss_url', $curVal,255, 'size=small')."/rss/{Topic id}
"; break; case 'filter': case 'batch': - return $array; + return null; break; } } } -/* -new rss_admin(); -require_once(e_ADMIN."auth.php"); -e107::getAdminUI()->runPage(); + new rss_admin(); -require_once(e_ADMIN."footer.php"); -exit; + require_once(e_ADMIN."auth.php"); + e107::getAdminUI()->runPage(); - -*/ + require_once(e_ADMIN."footer.php"); + exit; @@ -179,6 +395,9 @@ exit; +/// ------------------------------- Legacy Code ------------------------------- + + @@ -801,7 +1020,9 @@ class rss // Update options function dboptions() { - global $tp, $pref, $admin_log; + global $tp, $pref; + + $admin_log = e107::getLog(); $temp = array(); $temp['rss_othernews'] = $_POST['rss_othernews']; diff --git a/e107_plugins/rss_menu/e_meta.php b/e107_plugins/rss_menu/e_meta.php index fe4346b78..295a7dc57 100644 --- a/e107_plugins/rss_menu/e_meta.php +++ b/e107_plugins/rss_menu/e_meta.php @@ -23,16 +23,24 @@ global $PLUGINS_DIRECTORY; $tp = e107::getParser(); $sql = e107::getDb(); -if(USER_AREA && $sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 ORDER BY rss_name")) +if(USER_AREA && $sql->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) + while($row = $sql->fetch()) + { + if(strpos($row['rss_url'], "*") === false) // Wildcard topic_id's should not be listed { - $url = SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".$tp->toHTML($row['rss_url'], TRUE, 'constants, no_hook, emotes_off').".2"; - $url .= ($row['rss_topicid']) ? ".".$row['rss_topicid'] : ""; + // $url = SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".$tp->toHTML($row['rss_url'], TRUE, 'constants, no_hook, emotes_off').".2"; + // $url .= ($row['rss_topicid']) ? ".".$row['rss_topicid'] : ""; + + $url2 = e107::url('rss_menu','rss', $row); + $url4 = e107::url('rss_menu','atom', $row); + $name = $tp->toHTML($row['rss_name'], TRUE, 'no_hook, emotes_off'); - echo "\n"; + + echo "\n"; + echo "\n"; + + } } } diff --git a/e107_plugins/rss_menu/e_url.php b/e107_plugins/rss_menu/e_url.php new file mode 100644 index 000000000..751185b9a --- /dev/null +++ b/e107_plugins/rss_menu/e_url.php @@ -0,0 +1,42 @@ + '^feed/(.*)/rss/?([\d]*)?$', + 'sef' => 'feed/{rss_url}/rss/{rss_topicid}', + 'redirect' => '{e_PLUGIN}rss_menu/rss.php?cat=$1&type=2&topic=$2' + ); + + $config['atom'] = array( + 'regex' => '^feed/(.*)/atom/?([\d]*)?$', + 'sef' => 'feed/{rss_url}/atom/{rss_topicid}', + 'redirect' => '{e_PLUGIN}rss_menu/rss.php?cat=$1&type=4&topic=$2' + ); + + $config['index'] = array( + 'regex' => '^feed/?$', + 'sef' => 'feed', + 'redirect' => '{e_PLUGIN}rss_menu/rss.php', + ); + + return $config; + } + +} \ No newline at end of file diff --git a/e107_plugins/rss_menu/languages/English_global.php b/e107_plugins/rss_menu/languages/English_global.php index 136f06cc9..aeb258252 100644 --- a/e107_plugins/rss_menu/languages/English_global.php +++ b/e107_plugins/rss_menu/languages/English_global.php @@ -2,5 +2,6 @@ define("LAN_PLUGIN_RSS_NAME", "RSS"); define("LAN_PLUGIN_RSS_DESCRIPTION", "RSS Feeds from your site."); - +define("LAN_PLUGIN_RSS_SUBSCRIBE", "Subscribe"); +define("LAN_PLUGIN_RSS_SUBSCRIBE_TO", "Subscribe to [x]"); ?> \ No newline at end of file diff --git a/e107_plugins/rss_menu/rss.php b/e107_plugins/rss_menu/rss.php index 34e031cca..ad3175e8e 100644 --- a/e107_plugins/rss_menu/rss.php +++ b/e107_plugins/rss_menu/rss.php @@ -19,9 +19,13 @@ Query string: content_type.rss_type.[topic id] Plugins should use an e_rss.php file in their plugin folder ---------------------------------------------------------------- */ +if (!defined('e107_INIT')) +{ + require_once('../../class2.php'); +} -require_once('../../class2.php'); $e107 = e107::getInstance(); + if (!$e107->isInstalled('rss_menu')) { header('Location: '.e_BASE.'index.php'); @@ -56,7 +60,14 @@ else } // Query handler -if (e_QUERY) +if(!empty($_GET)) +{ + $content_type = $tp->toDB($_GET['cat']); + $rss_type = intval(varset($_GET['type'],0)); + $topic_id = $tp->toDB($_GET['topic'],''); + +} +elseif (e_QUERY) { $tmp = explode('.', e_QUERY); $content_type = $tp->toDB($tmp[0]); @@ -64,6 +75,7 @@ if (e_QUERY) $topic_id = $tp->toDB($tmp[2],''); } + // List available rss feeds if (!$rss_type) { // Display list of all feeds diff --git a/e107_plugins/rss_menu/rss_menu.php b/e107_plugins/rss_menu/rss_menu.php index e16bfeb1e..7618541d5 100644 --- a/e107_plugins/rss_menu/rss_menu.php +++ b/e107_plugins/rss_menu/rss_menu.php @@ -2,87 +2,102 @@ /* * e107 website system * - * Copyright (C) 2008-2009 e107 Inc (e107.org) + * Copyright (C) 2008-2015 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) - * - * - * - * $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/rss_menu.php,v $ - * $Revision$ - * $Date$ - * $Author$ + */ -if (!defined('e107_INIT')) { exit; } -if (!e107::isInstalled('rss_menu')) -{ - return ''; -} + if (!defined('e107_INIT')) { exit; } -$FILES_DIRECTORY = e107::getInstance()->getFolder('files'); -$sql = e107::getDb(); -$path = e_PLUGIN_ABS."rss_menu/"; -include_lan(e_PLUGIN."rss_menu/languages/".e_LANGUAGE."_admin_rss_menu.php"); - -$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" && e107::getPref('rss_newscats')) -{ - - $qry = explode(".",e_QUERY); - if($qry[0] == "cat" || $qry[0] == "list") + if (!e107::isInstalled('rss_menu')) { - $topic = intval($qry[1]); + return ''; } -} -$text = " -
- ".$des.RSS_MENU_L1."
-
rss1.0
-
rss2.0
-
rdf
-
atom
-
"; + $sql = e107::getDb(); -// Deprecated - can be controlled within tablestyle (theme) - case mod == 'rss_menu' -//$caption = (file_exists(THEME."images/RSS_menu.png") ? " ".RSS_MENU_L2 : RSS_MENU_L2); -e107::getRender()->tablerender(RSS_MENU_L2, $text, 'rss_menu'); + e107::includeLan(e_PLUGIN."rss_menu/languages/".e_LANGUAGE."_admin_rss_menu.php"); + + $topic = ""; + $caption = ""; + + + if(e_PAGE == "news.php" && e107::getPref('rss_newscats')) + { + + $qry = explode(".",e_QUERY); + if($qry[0] == "cat" || $qry[0] == "list") + { + $topic = intval($qry[1]); + } + } + + + if(deftrue('e_CURRENT_PLUGIN') && $res = $sql->retrieve("rss", "rss_path,rss_url", " rss_path = '".e_CURRENT_PLUGIN."' LIMIT 1")) + { + $caption = e107::getParser()->lanVars(LAN_PLUGIN_RSS_SUBSCRIBE_TO, deftrue('LAN_PLUGIN_'.strtoupper(e_CURRENT_PLUGIN).'_NAME')); + $type = $res['rss_url']; + $plug = $res['rss_path']; + } + elseif($sql->select("rss", "rss_path", " rss_path = 'news' LIMIT 1")) // Fall back to news, if available. + { + $caption = LAN_PLUGIN_RSS_SUBSCRIBE; + $type = 'news'; + $plug = 'news'; + } + + + + if(!empty($type)) + { + $arr = array('rss_topicid'=> $topic, 'rss_url'=>$type); + + + if(deftrue('BOOTSTRAP') === 3) // v2.x + { + $text = " +
+ ".$tp->toGlyph('fa-rss')." RSS + ".$tp->toGlyph('fa-rss')." Atom +
"; + + } + else // v1.x + { + $path = e_PLUGIN_ABS."rss_menu/"; + + $description = array( + + 'chatbox' => RSS_MENU_L7, + 'download' => RSS_MENU_L9, + 'bugtracker' => RSS_MENU_L8, + 'forumtopic' => RSS_MENU_L6, + 'forumname' => RSS_MENU_L5, + 'forumposts' => '', + 'comments' => RSS_MENU_L4, + 5 => RSS_MENU_L4, + 6 => RSS_MENU_L5, + 7 => RSS_MENU_L6, + 9 => RSS_MENU_L7, + 10 => RSS_MENU_L8, + 12 => RSS_MENU_L9, + + ); + + + $text = " +
+ ".varset($description[$type]).RSS_MENU_L1."
+ +
rss2.0
+
atom
+
"; + + $caption = RSS_MENU_L2; + + } + + e107::getRender()->tablerender($caption, $text, 'rss_menu'); + } ?> \ No newline at end of file diff --git a/e107_plugins/rss_menu/rss_shortcodes.php b/e107_plugins/rss_menu/rss_shortcodes.php index e68d10737..00c5573fb 100644 --- a/e107_plugins/rss_menu/rss_shortcodes.php +++ b/e107_plugins/rss_menu/rss_shortcodes.php @@ -2,207 +2,269 @@ // $Id$ if (!defined('e107_INIT')) { exit; } -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 "".$tp->toHTML($row['rss_name'], TRUE).""; -SC_END + include_once(e_HANDLER.'shortcode_handler.php'); +// $rss_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__); -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 "".RSS_ICON.""; -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_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); -$url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); -$url3 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); -$url4 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); - -$text = " -RSS 0.92 -RSS 2.0 -RDF -ATOM -"; -return $text; -SC_END - -//##### ADMIN -------------------------------------------------- -SC_BEGIN RSS_ADMIN_CAPTION -global $sort; -list($field,$txt) = explode(",",$parm); -$txt = constant($txt); -return "".$txt."\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 "".$row['rss_url'].""; -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']; -$frm = e107::getForm(); - return $frm->number("limit[$id]",$row['rss_limit']); -return ""; -SC_END - -SC_BEGIN RSS_ADMIN_LIMITBUTTON - $frm = e107::getForm(); - return $frm->admin_button('update_limit',LAN_UPDATE,'update'); -SC_END - -SC_BEGIN RSS_ADMIN_OPTIONS -global $row, $tp; -$delname = $row['rss_name']; -$delid = $row['rss_id']; -$options = " -".ADMIN_EDIT_ICON." -toJS(LAN_CONFIRMDEL ." [".RSS_LAN_ADMIN_2.": ".$delid." : ".$delname."]\\n\\n")."')\"/>"; -return $options; -SC_END - -SC_BEGIN RSS_ADMIN_FORM_NAME -global $row; -return "\n"; -SC_END - -SC_BEGIN RSS_ADMIN_FORM_URL -global $row,$PLUGINS_DIRECTORY; -return SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".e_LANQRY." .{".LAN_TYPE."}.{".RSS_LAN_ADMIN_12."}"; -SC_END - -SC_BEGIN RSS_ADMIN_FORM_TOPICID -global $row; -return ""; -SC_END - -SC_BEGIN RSS_ADMIN_FORM_PATH -global $row; -return ""; -SC_END - -SC_BEGIN RSS_ADMIN_FORM_TEXT -global $row; -return "\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 = ""; -return $text; -SC_END - -SC_BEGIN RSS_ADMIN_FORM_LIMIT -global $row; -$frm = e107::getForm(); - -return $frm->number('rss_limit',$row['rss_limit'],3); -return ""; -SC_END -SC_BEGIN RSS_ADMIN_FORM_CREATEBUTTON -global $row; -$qs = explode(".", e_QUERY); -$frm = e107::getForm(); - -if(isset($qs[1]) && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) ) -{ - $text = " - "; - - $text .= $frm->admin_button('update_rss',LAN_UPDATE,'update'); - -} -else -{ - $text = $frm->admin_button('create_rss',LAN_CREATE,'submit'); + + + function sc_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'] : ''); + $url2 = e107::url('rss_menu','rss', $row); + return "".$tp->toHTML($row['rss_name'], TRUE).""; + } + + function sc_rss_icon() + { + global $row, $tp; + // $url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); + $url2 = e107::url('rss_menu','rss', $row); + return "".RSS_ICON.""; + } + + function sc_rss_text() + { + global $row, $tp; + return $tp->toHTML($row['rss_text'], TRUE, "defs"); + } + + function sc_rss_types() + { + global $row, $tp; + // $url1 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); + // $url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); + // $url3 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); + // $url4 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); + + $url2 = e107::url('rss_menu','rss', $row); + $url4 = e107::url('rss_menu','atom', $row); + + + $text = ""; + // $text .= "RSS 0.92"; + $text .= "RSS 2.0"; + // $text .= "RDF"; + $text .= "ATOM"; + return $text; + } + + + + + + + + + + + + + + + + //##### ADMIN -------------------------------------------------- + + + + + + function sc_rss_admin_caption($parm='') + { + global $sort; + list($field,$txt) = explode(",",$parm); + $txt = constant($txt); + return "".$txt."\n"; + } + + function sc_rss_admin_id() + { + global $row; + return $row['rss_id']; + } + + function sc_rss_admin_name() + { + global $row; + return $row['rss_name']; + } + + function sc_rss_admin_path() + { + global $row; + return $row['rss_path']; + } + + function sc_rss_admin_url() + { + global $row; + return "".$row['rss_url'].""; + } + + function sc_rss_admin_topicid() + { + global $row; + return $row['rss_topicid']; + } + + function sc_rss_admin_limit() + { + global $row, $rs; + $id = $row['rss_id']; + $frm = e107::getForm(); + return $frm->number("limit[$id]",$row['rss_limit']); + return ""; + } + + function sc_rss_admin_limitbutton() + { + $frm = e107::getForm(); + return $frm->admin_button('update_limit',LAN_UPDATE,'update'); + } + + function sc_rss_admin_options() + { + global $row, $tp; + $delname = $row['rss_name']; + $delid = $row['rss_id']; + $options = " + ".ADMIN_EDIT_ICON." + toJS(LAN_CONFIRMDEL ." [".RSS_LAN_ADMIN_2.": ".$delid." : ".$delname."]\\n\\n")."')\"/>"; + return $options; + } + + function sc_rss_admin_form_name() + { + global $row; + return "\n"; + } + + function sc_rss_admin_form_url() + { + global $row,$PLUGINS_DIRECTORY; + return SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".e_LANQRY." .{".LAN_TYPE."}.{".RSS_LAN_ADMIN_12."}"; + } + + function sc_rss_admin_form_topicid() + { + global $row; + return ""; + } + + function sc_rss_admin_form_path() + { + global $row; + return ""; + } + + function sc_rss_admin_form_text() + { + global $row; + return "\n"; + } + + function sc_rss_admin_form_class() + { + global $row; + $vals = array(RSS_LAN_ADMIN_21,RSS_LAN_ADMIN_22,RSS_LAN_ADMIN_23); + $text = ""; + return $text; + } + + function sc_rss_admin_form_limit() + { + global $row; + $frm = e107::getForm(); + + return $frm->number('rss_limit',$row['rss_limit'],3); + return ""; + } + + + function sc_rss_admin_form_createbutton() + { + global $row; + $qs = explode(".", e_QUERY); + $frm = e107::getForm(); + + if(isset($qs[1]) && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) ) + { + $text = " + "; + + $text .= $frm->admin_button('update_rss',LAN_UPDATE,'update'); + + } + else + { + $text = $frm->admin_button('create_rss',LAN_CREATE,'submit'); + + } + return $text; + } + + function sc_rss_admin_import_check() + { + global $feed, $rs, $tp, $i; + if($feed['description']) + { + $feed['text'] = $feed['description']; + } + + $text = ""; + $text .= ""; + $text .= ""; + $text .= ""; + $text .= ""; + $text .= ""; + $text .= ""; + $text .= ""; + return $text; + } + + function sc_rss_admin_import_path() + { + global $feed; + return $feed['path']; + } + + function sc_rss_admin_import_name() + { + global $feed; + return $feed['name']; + } + + function sc_rss_admin_import_text() + { + global $feed; + return ($feed['description']) ? $feed['description'] : $feed['text']; + } + + function sc_rss_admin_import_url() + { + global $feed; + return $feed['url']; + } + + function sc_rss_admin_import_topicid() + { + global $feed; + return $feed['topic_id']; + } } -return $text; -SC_END -SC_BEGIN RSS_ADMIN_IMPORT_CHECK -global $feed, $rs, $tp, $i; -if($feed['description']) -{ - $feed['text'] = $feed['description']; -} - -$text = ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -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['description']) ? $feed['description'] : $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 -*/ + $rss_shortcodes = new rss_menu_shortcodes; ?> \ No newline at end of file diff --git a/e107_plugins/rss_menu/rss_template.php b/e107_plugins/rss_menu/rss_template.php index 5358247af..76d30e1a0 100644 --- a/e107_plugins/rss_menu/rss_template.php +++ b/e107_plugins/rss_menu/rss_template.php @@ -7,8 +7,8 @@ if(!isset($RSS_LIST_HEADER)) { $RSS_LIST_HEADER = " - - + + "; } if(!isset($RSS_LIST_TABLE))
".RSS_PLUGIN_LAN_6." ".RSS_PLUGIN_LAN_6."