<?php
/*
+===========================================+
|      ArabPortal V2.1.x Copyright © 2006   |
|   -------------------------------------   |
|            By Rafia AL-Otibi              |
|                    And                    |
|              Arab Portal Team             |
|   -------------------------------------   |
|      Web: http://www.ArabPortal.Net       |
|   -------------------------------------   |
|  Last Updated: 22/10/2006 Time: 10:00 PM  |
+===========================================+
*/
/***************************************************************************
			موديول اخر الاخبار او جالب الاخبار RSS + XML
			   برمجة عبقري العرب (موقع دار الاوائل)
			www.arabiaone.org (arabgenius@hotmail.com)
	=========================== v2.0 ===========================
***************************************************************************/

if (RUN_MODULE !== true)
{
    die ("<center><h3>عفوا هذه العملية غير مشروعة</h3></center>");
}

$mod_theme = $mod->modInfo[themeid];
$mod_name = $mod->modInfo[mod_name];
$modid = $mod->modInfo[id];
$mod_title = $mod->modInfo[mod_title];

echo $apt->table_cat_module("<a href=mod.php?mod=$mod_name>&nbsp;$mod_title</a>");

$result = mysql_query("SELECT * FROM rafia_rss order by feedorder ASC");
while ($row = mysql_fetch_array($result)) {
$id = $row['r_id']; 
$feedurl = $row['url']; 
$feedtime = $row['feedtime']; 
$sitename = $row['sitename']; 
$ltime = $row['ltime']; 
$feed = $row['feed']; 
$count = $row['count']; 

$now = time();
$diff = $now - $ltime;

if($diff >= $feedtime){
include_once("modules/RSS/getfeed.php");

$feed = $apt->get_contents($feedurl);
	if(!$feed){
		$text = "	<img src=modules/RSS/images/zoom-headline.gif>&nbsp;&nbsp; لم يتم الاتصال بالموقع او لا يوجد اخبار جديده <br>\n";
	}else{
		$text = getfeed($feed,$count);
	}
$apt->query("Update rafia_rss set ltime='$now',feed='$text' where r_id='$id'");
}

eval("echo \" " . $apt->getmodtemplate ( 'header_view_feed', $modid,$mod_theme ) . "\";");
if($text){echo $text;}else{echo $feed;}
unset($feed,$text);
eval("echo \" " . $apt->getmodtemplate ( 'footer_view_feed', $modid,$mod_theme ) . "\";");


}

?>