1<?php 2/** 3 * @package tikiwiki 4 */ 5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 6// 7// All Rights Reserved. See copyright.txt for details and a complete list of authors. 8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 9// $Id$ 10 11require_once('tiki-setup.php'); 12$rsslib = TikiLib::lib('rss'); 13//get_strings tra('External Feeds') 14$auto_query_args = [ 15 'rssId', 16 'offset', 17 'maxRecords', 18 'sort_mode', 19 'find' 20]; 21 22$access->check_permission('tiki_p_admin_rssmodules'); 23 24if (isset($_REQUEST["rssId"])) { 25 $smarty->assign('rssId', $_REQUEST["rssId"]); 26 $cookietab = 2; 27} 28$smarty->assign('preview', 'n'); 29if (isset($_REQUEST["view"])) { 30 $smarty->assign('preview', 'y'); 31 $data = $rsslib->get_rss_module($_REQUEST["view"]); 32 33 if ($data['sitetitle']) { 34 $smarty->assign( 35 'feedtitle', 36 [ 37 'title' => $data['sitetitle'], 38 'link' => $data['siteurl'] 39 ] 40 ); 41 } 42 43 $smarty->assign('items', $rsslib->get_feed_items($_REQUEST['view'])); 44} 45if (isset($_REQUEST["rssId"])) { 46 $info = $rsslib->get_rss_module($_REQUEST["rssId"]); 47} else { 48 $info = []; 49 // default for new rss feed: 50 $info["name"] = ''; 51 $info["description"] = ''; 52 $info["url"] = ''; 53 $info["refresh"] = 1800; 54 $info["showTitle"] = 'n'; 55 $info["showPubDate"] = 'n'; 56} 57$smarty->assign('name', $info["name"]); 58$smarty->assign('description', $info["description"]); 59$smarty->assign('url', $info["url"]); 60$smarty->assign('refresh', $info["refresh"]); 61$smarty->assign('showTitle', $info["showTitle"]); 62$smarty->assign('showPubDate', $info["showPubDate"]); 63if (isset($_REQUEST["refresh"])) { 64 $rsslib->refresh_rss_module($_REQUEST["refresh"]); 65} 66if (isset($_REQUEST['clear'])) { 67 $rsslib->clear_rss_cache($_REQUEST['clear']); 68} 69if (isset($_REQUEST["remove"])) { 70 $access->check_authenticity(); 71 $rsslib->remove_rss_module($_REQUEST["remove"]); 72} 73 74if (isset($_REQUEST['article']) && $prefs['feature_articles'] == 'y') { 75 if ($_SERVER['REQUEST_METHOD'] == 'POST') { 76 $rsslib->set_article_generator( 77 $_REQUEST['article'], 78 [ 79 'active' => isset($_POST['enable']), 80 'expiry' => $jitPost->expiry->int(), 81 'atype' => $jitPost->type->text(), 82 'custom_atype' => $jitPost->asArray('custom_atype'), 83 'topic' => $jitPost->topic->int(), 84 'custom_topic' => $jitPost->asArray('custom_topic'), 85 'future_publish' => $jitPost->future_publish->int(), 86 'categories' => (array) $jitPost->cat_categories->int(), 87 'rating' => $jitPost->rating->int(), 88 'custom_rating' => $jitPost->asArray('custom_rating'), 89 'submission' => isset($_POST['submission']), 90 'custom_priority' => $jitPost->asArray('custom_priority'), 91 'a_lang' => $jitPost->a_lang->word(), 92 ] 93 ); 94 $cookietab = 1; 95 } else { 96 $cookietab = 3; 97 } 98 99 $config = $rsslib->get_article_generator($_REQUEST['article']); 100 $smarty->assign('articleConfig', $config); 101 $smarty->assign('ratingOptions', array_map('strval', range(0, 10))); 102 103 $sourcecats = $rsslib->get_feed_source_categories($_REQUEST["article"]); 104 $smarty->assign('sourcecats', $sourcecats); 105 $article_custom_info = $rsslib->get_article_custom_info($_REQUEST["article"]); 106 $smarty->assign('article_custom_info', $article_custom_info); 107 108 $artlib = TikiLib::lib('art'); 109 $smarty->assign('topics', $artlib->list_topics()); 110 $smarty->assign('types', $artlib->list_types()); 111 112 $cat_type = 'null'; 113 $cat_objid = 'null'; 114 $_REQUEST['cat_categorize'] = 'on'; 115 $_REQUEST['cat_categories'] = $config['categories']; 116 include 'categorize_list.php'; 117} 118 119if (isset($_REQUEST["save"])) { 120 check_ticket('admin-rssmodules'); 121 if (isset($_REQUEST['showTitle']) == 'on') { 122 $smarty->assign('showTitle', 'y'); 123 $info["showTitle"] = 'y'; 124 } else { 125 $smarty->assign('showTitle', 'n'); 126 $info["showTitle"] = 'n'; 127 } 128 if (isset($_REQUEST['showPubDate']) == 'on') { 129 $smarty->assign('showPubDate', 'y'); 130 $info["showPubDate"] = 'y'; 131 } else { 132 $smarty->assign('showPubDate', 'n'); 133 $info["showPubDate"] = 'n'; 134 } 135 $rsslib->replace_rss_module($_REQUEST["rssId"], $_REQUEST["name"], $_REQUEST["description"], $_REQUEST["url"], $_REQUEST["refresh"], $info["showTitle"], $info["showPubDate"]); 136 $smarty->assign('rssId', 0); 137 $smarty->assign('name', ''); 138 $smarty->assign('description', ''); 139 $smarty->assign('url', ''); 140 $smarty->assign('refresh', 900); 141 $smarty->assign('showTitle', 'n'); 142 $smarty->assign('showPubDate', 'n'); 143 $cookietab = 1; 144} 145if (! isset($_REQUEST["sort_mode"])) { 146 $sort_mode = 'name_desc'; 147} else { 148 $sort_mode = $_REQUEST["sort_mode"]; 149} 150if (! isset($_REQUEST["offset"])) { 151 $offset = 0; 152} else { 153 $offset = $_REQUEST["offset"]; 154} 155$smarty->assign_by_ref('offset', $offset); 156if (isset($_REQUEST["find"])) { 157 $find = $_REQUEST["find"]; 158} else { 159 $find = ''; 160} 161if ($prefs['feature_multilingual'] == 'y') { 162 $languages = []; 163 $langLib = TikiLib::lib('language'); 164 $languages = $langLib->list_languages(); 165 $smarty->assign_by_ref('languages', $languages); 166} 167$smarty->assign('find', $find); 168$smarty->assign_by_ref('sort_mode', $sort_mode); 169$channels = $rsslib->list_rss_modules($offset, $maxRecords, $sort_mode, $find); 170$cant = $channels['cant']; 171$smarty->assign_by_ref('cant', $cant); 172$temp_max = count($channels["data"]); 173$smarty->assign_by_ref('channels', $channels["data"]); 174ask_ticket('admin-rssmodules'); 175// disallow robots to index page: 176$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW'); 177// Display the template 178$smarty->assign('mid', 'tiki-admin_rssmodules.tpl'); 179$smarty->display("tiki.tpl"); 180