2010-03-17 16:46:28 +00:00

43 lines
1.4 KiB
PHP

<?php
// News
if ( hasPref('news') ){
/* Information presse 15 Aug 2007 09:21:49 GMT - */
$err_rep = error_reporting();
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
require_once ('XML/RSS.php');
$url = 'http://news.google.fr/news?hl=fr&ned=fr&q='.
urlencode('"'.$etab['Nom'].'"').'&output=rss';
$firephp->log($url, 'url');
$rss = new XML_RSS($url);
$rss->parse();
$tabMonth = array('Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4,
'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8,
'Sep' => 9, 'Oct' => 10,'Nov' => 11,'Dec' => 12);
foreach ($rss->getItems() as $i=>$item) {
if ($i == 0) {
?>
<tr>
<td width="30">&nbsp;</td>
<td width="550" class="StyleInfoLib" colspan="2">Information presse (Source Google News &copy;)<br/>
<ul>
<?php
}
$tmp=explode(', ', $item['pubdate']);
$tabDate = explode(' ', $tmp[1]);
$tabTime = explode(':', $tabDate[3]);
$pubDate = date('d/m/Y à H:i', gmmktime($tabTime[0]-1, $tabTime[1], $tabTime[2], $tabMonth[$tabDate[1]], $tabDate[0], $tabDate[2]));
$titre = $item['title'];
echo '<li><a href="' . $item['link'] . '" target="_blank">Le '. $pubDate ." - $titre</a></li>";
$i++; if ($i==15) break;
}
if ($i>0)
{
?>
</ul>
</td>
</tr>
<?php
}
error_reporting($err_rep);
}