<?php
@version @since @author @copyright @package
require_once '../config/ApplicationCfg.php';
require_once PD_WEB_INCLUDES_ROOT. 'common.inc.php';
define('PAGE_ID' , 'news'. PD_WEB_FILE_EXT);
define('PAGE_TR_ID' , 'news');
define('_FILE_', basename(__FILE__));
define('DEFAULT_ACTION', 'GETNEWS');
$Dbg->setAction(DEFAULT_ACTION);
require_once('XML/RSS.php');
require_once('Cache/Lite.php');
$options = array(
'cacheDir' => PD_WEB_TEMP,
'lifeTime' => 36000
);
$Cache_Lite = new Cache_Lite($options);
$today = getdate();
$cachedFileName = $today['year'] .$today['mon'] .$today['mday'] .".txt";
$cachedFileNameFull = PD_WEB_TEMP. $cachedFileName;
$rssNewsUrl = 'http://sourceforge.net/export/rss2_projnews.php?group_id=95715&rss_fulltext=1';
if ($data = $Cache_Lite->get('news')) {
$Dbg->add('Getting $news from cache');
$news = unserialize($data);
} else {
$rssNews =& new XML_RSS($rssNewsUrl);
$rssNews->parse();
foreach ($rssNews->getItems() as $lkey => $lvalue) {
$news[] = $lvalue;
}
$Dbg->add('Saving $news to the cache');
$Cache_Lite->save(serialize($news));
}
$smarty->assign('news', $news);
$smarty->assign('file', PD_WEB_PHP_DEBUG_ROOT. DIRECTORY_SEPARATOR. PAGE_ID);
$smarty->assign('bodyTpl', PAGE_TR_ID);
$smarty->assign('debugBuffer', $Dbg->getOutput());
$smarty->display('index.tpl');
?> |