| 1 | <?php |
|---|
| 2 | ############################################################################### |
|---|
| 3 | ## RSSFit - Extendable XML news feed generator ## |
|---|
| 4 | ## Copyright (c) 2004 NS Tai (aka tuff) ## |
|---|
| 5 | ## <http://www.brandycoke.com/> ## |
|---|
| 6 | ## Modified By 2005 CACHE RSSfitJ ## |
|---|
| 7 | ## <http://gyakubiki.kir.jp/> ## |
|---|
| 8 | ############################################################################### |
|---|
| 9 | ## XOOPS - PHP Content Management System ## |
|---|
| 10 | ## Copyright (c) 2000 XOOPS.org ## |
|---|
| 11 | ## <http://www.xoops.org/> ## |
|---|
| 12 | ############################################################################### |
|---|
| 13 | ## This program is free software; you can redistribute it and/or modify ## |
|---|
| 14 | ## it under the terms of the GNU General Public License as published by ## |
|---|
| 15 | ## the Free Software Foundation; either version 2 of the License, or ## |
|---|
| 16 | ## (at your option) any later version. ## |
|---|
| 17 | ## ## |
|---|
| 18 | ## You may not change or alter any portion of this comment or credits ## |
|---|
| 19 | ## of supporting developers from this source code or any supporting ## |
|---|
| 20 | ## source code which is considered copyrighted (c) material of the ## |
|---|
| 21 | ## original comment or credit authors. ## |
|---|
| 22 | ## ## |
|---|
| 23 | ## This program is distributed in the hope that it will be useful, ## |
|---|
| 24 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## |
|---|
| 25 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## |
|---|
| 26 | ## GNU General Public License for more details. ## |
|---|
| 27 | ## ## |
|---|
| 28 | ## You should have received a copy of the GNU General Public License ## |
|---|
| 29 | ## along with this program; if not, write to the Free Software ## |
|---|
| 30 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## |
|---|
| 31 | ############################################################################### |
|---|
| 32 | ## Author of this file: CACHE ## |
|---|
| 33 | ## URL: http://gyakubiki.kir.jp/ ## |
|---|
| 34 | ## Project: RSSFitJ ## |
|---|
| 35 | ############################################################################### |
|---|
| 36 | $module_array=array(); |
|---|
| 37 | for ($i=0;$i<100;$i++) { |
|---|
| 38 | if (isset($_GET['module'.$i])) { |
|---|
| 39 | $module_array[]=$_GET['module'.$i]; |
|---|
| 40 | } else { |
|---|
| 41 | if (isset($_POST['module'.$i])) |
|---|
| 42 | $module_array[]=$_POST['module'.$i]; |
|---|
| 43 | } |
|---|
| 44 | } |
|---|
| 45 | if( function_exists('mb_http_output') ){ |
|---|
| 46 | mb_http_output('pass'); |
|---|
| 47 | } |
|---|
| 48 | include 'header.php'; |
|---|
| 49 | require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|---|
| 50 | $xoopsTpl = new XoopsTpl(); |
|---|
| 51 | $nocache = !empty($_GET['nocache']) || !$xoopsModuleConfig['cache'] || !empty($_GET['debug']) ? true : false; |
|---|
| 52 | if( $nocache ){ |
|---|
| 53 | $xoopsTpl->xoops_setCaching(0); |
|---|
| 54 | }else{ |
|---|
| 55 | $xoopsTpl->xoops_setCaching(2); |
|---|
| 56 | $xoopsTpl->xoops_setCacheTime($xoopsModuleConfig['cache']*60); |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | if( !$xoopsTpl->is_cached('db:rssfitJ_rss.html') || $nocache ){ |
|---|
| 60 | $criteria = new Criteria('rssfj_activated', 1); |
|---|
| 61 | $criteria->setSort('rssfj_order'); |
|---|
| 62 | if( $plugins =& $rssfj_mgr->getObjects($criteria) ){ |
|---|
| 63 | $entries = array(); |
|---|
| 64 | foreach( $plugins as $p ){ |
|---|
| 65 | if( $handler =& $rssfj_mgr->checkPlugin($p) ){ |
|---|
| 66 | $modDir = $handler->getDirName(); |
|---|
| 67 | if (in_array($modDir,$module_array) || |
|---|
| 68 | count($module_array)==0) { |
|---|
| 69 | $grab = $handler->grabEntries($p); |
|---|
| 70 | if( count($grab) > 0 ){ |
|---|
| 71 | foreach( $grab as $g ){ |
|---|
| 72 | array_push($entries, $g); |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | } |
|---|
| 76 | } |
|---|
| 77 | } |
|---|
| 78 | if( count($entries) > 0 ){ |
|---|
| 79 | if( $xoopsModuleConfig['sort'] == 'd' ){ |
|---|
| 80 | uasort($entries, 'sortTimestamp'); |
|---|
| 81 | } |
|---|
| 82 | if( count($entries) > $xoopsModuleConfig['overall_entries'] ){ |
|---|
| 83 | $entries = array_slice($entries, 0, $xoopsModuleConfig['overall_entries']); |
|---|
| 84 | } |
|---|
| 85 | foreach( $entries as $e ){ |
|---|
| 86 | $e['title'] = utf8Encode(htmlspecialchars($e['title'], ENT_QUOTES)); |
|---|
| 87 | $e['pubdate'] = rssTimeStamp($e['timestamp']); |
|---|
| 88 | if( $xoopsModuleConfig['strip_html'] ){ |
|---|
| 89 | $e['description'] = preg_replace('/<([^>]|\n)*>/', ' ', $e['description']); |
|---|
| 90 | $e['description'] = preg_replace('/\[([^>]|\n)*\]/', ' ', $e['description']); |
|---|
| 91 | } |
|---|
| 92 | $e['description'] = utf8Encode(htmlspecialchars(doSubstr($e['description']), ENT_QUOTES)); |
|---|
| 93 | $e['category'] = utf8Encode(htmlspecialchars($e['category'], ENT_QUOTES)); |
|---|
| 94 | $xoopsTpl->append('items', $e); |
|---|
| 95 | } |
|---|
| 96 | } |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | $xoopsTpl->assign('channel_title', utf8Encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))); |
|---|
| 100 | $xoopsTpl->assign('channel_desc', utf8Encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); |
|---|
| 101 | $sql = "SELECT conf_value FROM ".$xoopsDB->prefix('config')." WHERE conf_name = 'meta_copyright' AND conf_modid = 0 AND conf_catid = ".XOOPS_CONF_METAFOOTER; |
|---|
| 102 | list($copyright) = $xoopsDB->fetchRow($xoopsDB->query($sql)); |
|---|
| 103 | $xoopsTpl->assign('channel_copyright', utf8Encode(htmlspecialchars($copyright, ENT_QUOTES))); |
|---|
| 104 | $xoopsTpl->assign('channel_lastbuild', rssTimeStamp(time())); |
|---|
| 105 | $gen = XOOPS_VERSION.' / '.RSSFITJ_VERSION; |
|---|
| 106 | $xoopsTpl->assign('channel_generator', utf8Encode($gen)); |
|---|
| 107 | $xoopsTpl->assign('channel_editor', $xoopsConfig['adminmail']); |
|---|
| 108 | $xoopsTpl->assign('channel_webmaster', $xoopsConfig['adminmail']); |
|---|
| 109 | if( $xoopsModuleConfig['cache'] > 0 ){ |
|---|
| 110 | $xoopsTpl->assign('channel_ttl', $xoopsModuleConfig['cache']); |
|---|
| 111 | } |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | if( empty($_GET['debug']) ){ |
|---|
| 115 | if( !$xoopsModuleConfig['utf8'] ){ |
|---|
| 116 | $xoopsTpl->assign('rssj_encoding', _CHARSET); |
|---|
| 117 | header('Content-Type:text/xml; charset='._CHARSET); |
|---|
| 118 | }else{ |
|---|
| 119 | $xoopsTpl->assign('rssj_encoding', 'UTF-8'); |
|---|
| 120 | header('Content-Type:text/xml; charset=UTF-8'); |
|---|
| 121 | } |
|---|
| 122 | }else{ |
|---|
| 123 | header('Content-Type:text/html; charset='._CHARSET); |
|---|
| 124 | } |
|---|
| 125 | $xoopsTpl->display('db:rssfitJ_rss.html'); |
|---|
| 126 | ?> |
|---|