Example #1
0
	function getRSSItems( &$items )
	{
		// check module_read permission
		$module_handler =& xoops_gethandler( 'module' ) ;
		$module =& $module_handler->getByDirname( $this->mydirname ) ;
		$gperm_handler =& xoops_gethandler( 'groupperm' ) ;
		$can_read = $gperm_handler->checkRight( 'module_read' , $module->getVar('mid') , XOOPS_GROUP_ANONYMOUS ) ;
		if( ! $can_read ) return ;

		// check config (feed_as_backend)
		$config_handler =& xoops_gethandler( 'config' ) ;
		$mod_config =& $config_handler->getConfigsByCat( 0 , $module->getVar( 'mid' ) ) ;
		if( empty( $mod_config['feed_as_backend'] ) ) {
			return ;
		}

		$myts =& MyTextSanitizer::getInstance();
		$articles = Bulletin::getAllPublished( $this->mydirname , 10 , 0 , 0 , 1 , true, true, true) ;//ver3.0 changed
		foreach( $articles as $article ) {
			$hometext = $article->getVar('hometext','n') ;
			if( function_exists( 'easiestml' ) ) {
				$hometext = easiestml( $hometext ) ;
			}
			$items[] = array(
				'pubdate' => $article->getVar('published') ,
				'title' => htmlspecialchars(bulletin_utf8_encode($article->getVar('title', 'n')), ENT_QUOTES),
				'category' => htmlspecialchars(bulletin_utf8_encode($article->newstopic->topic_title), ENT_QUOTES),
				'link' => XOOPS_URL.'/modules/'.$this->mydirname.'/index.php?page=article&storyid='.$article->getVar('storyid') ,
				'guid' => XOOPS_URL.'/modules/'.$this->mydirname.'/index.php?page=article&storyid='.$article->getVar('storyid') ,
				'description' => bulletin_utf8_encode(htmlspecialchars(strip_tags($myts->xoopsCodeDecode($hometext)), ENT_QUOTES)),
			) ;
		}
	}
Example #2
0
			$height = ($dimention[1] > 400) ? 400 : $dimention[1];
		}
		$tpl->assign('image_width', $width);
		$tpl->assign('image_height', $height);
		$count = $articles;
		foreach ($articles as $article) {
			$content4html = $article->getVar('hometext') . $article->getDividedBodytext() ;
			$hometext = $article->getVar('hometext','n') ;
			if( function_exists( 'easiestml' ) ) {
				$content4html = easiestml( $content4html ) ;
				$hometext = easiestml( $hometext ) ;
			}
			$tpl->append('items', array(
				'title' => htmlspecialchars(bulletin_utf8_encode($article->getVar('title', 'n')), ENT_QUOTES),
				'category' => htmlspecialchars(bulletin_utf8_encode($article->newstopic->topic_title), ENT_QUOTES),
				'link' => $mydirurl.'/index.php?page=article&storyid='.$article->getVar('storyid'),
				'guid' => $mydirurl.'/index.php?page=article&storyid='.$article->getVar('storyid'),
//				'pubdate' => formatTimestamp($article->getVar('published'), 'rss'),
				'pubdate' => date( 'r' , $article->getVar('published') ) , // GIJ
				'description' => bulletin_utf8_encode(htmlspecialchars(strip_tags($myts->xoopsCodeDecode($hometext)), ENT_QUOTES)),
				'content' => bulletin_utf8_encode($content4html),
			) ) ;
		}
	}
}

header ('Content-Type:text/xml; charset=utf-8');
$tpl->display("db:{$mydirname}_rss.html");


?>
Example #3
0
        $tpl->assign('channel_category', 'News');
        $tpl->assign('channel_generator', 'XOOPS');
        $tpl->assign('channel_language', _LANGCODE);
        $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
        $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif');
        if (empty($dimention[0])) {
            $width = 88;
        } else {
            $width = $dimention[0] > 144 ? 144 : $dimention[0];
        }
        if (empty($dimention[1])) {
            $height = 31;
        } else {
            $height = $dimention[1] > 400 ? 400 : $dimention[1];
        }
        $tpl->assign('image_width', $width);
        $tpl->assign('image_height', $height);
        $count = $articles;
        foreach ($articles as $article) {
            $content4html = $article->getVar('hometext') . $article->getDividedBodytext();
            $hometext = $article->getVar('hometext', 'n');
            if (function_exists('easiestml')) {
                $content4html = easiestml($content4html);
                $hometext = easiestml($hometext);
            }
            $tpl->append('items', array('title' => htmlspecialchars(bulletin_utf8_encode($article->getVar('title', 'n')), ENT_QUOTES), 'category' => htmlspecialchars(bulletin_utf8_encode($article->newstopic->topic_title), ENT_QUOTES), 'link' => $mydirurl . '/index.php?page=article&storyid=' . $article->getVar('storyid'), 'guid' => $mydirurl . '/index.php?page=article&storyid=' . $article->getVar('storyid'), 'pubdate' => date('r', $article->getVar('published')), 'description' => bulletin_utf8_encode(htmlspecialchars(strip_tags($myts->xoopsCodeDecode($hometext)), ENT_QUOTES)), 'content' => bulletin_utf8_encode($content4html)));
        }
    }
}
header('Content-Type:text/xml; charset=utf-8');
$tpl->display("db:{$mydirname}_rss.html");