GroupAllow('view_site');
$menu = new menu;
$menu->menuid = $apt->getsettings("index_menuid");
$right_menu = $menu->_menu(1);
$middle_menu = $menu->middle_menu();
$action = $apt->get[action];
//---------------------------------------------------
if (($action=="") || ($action=="idx"))
{
$left_menu = $menu->_menu(2);
$perpage_comment = $apt->getsettings("newsperpagecomment");
$showmax = $apt->getsettings("showmax");
$indexColcount = intval($apt->getsettings("indexColcount"));
if($indexColcount < 1 ) $indexColcount = 1;
if( $indexColcount == 1)
{
$wordwrap = 600;
}
elseif( $indexColcount == 2)
{
$wordwrap = 400;
}
elseif( $indexColcount == 3)
{
$wordwrap = 300;
}
$apt->head($head_home);
eval("\$index_middle = \" " . $apt->gettemplate ( 'announcement' ) . "\";");
$getImageCat = array();
$getImageCat = $apt->getImageCat();
if($apt->dbnumquery("rafia_news","main='1' and allow='yes'",'id')){
$results = $apt->query ("SELECT id,title,date_time,userid,name,news_head,catmig,reader,c_comment,timestamp,uploadfile FROM rafia_news
WHERE allow = 'yes'
AND main = '1'
ORDER BY `id` DESC
LIMIT 1");
$rows = $apt->dbarray($results);
@extract($rows);
$postid = $id;
$numrows = $c_comment;
$newsimage = '';
if($catmig == 0)
{
if($uploadfile >0)
{
if($apt->getsettings("use_gd_thumb") == 'yes'){$usegd=true;}else{$usegd=false;}
$newsimage = $apt->getnewsimage($postid,$uploadfile,$usegd);
}
elseif($apt->conf['isupgrade'] == 1)
{
$newsimage = getimagefile($postid);
}
}
else
{
$newsimage = $getImageCat[$cat_id];
}
$news_head = $apt->rafia_code($news_head,$wordwrap);
$date = $apt->Hijri($date_time)." ".$apt->gettime($date_time);
$title = $apt->format_data_out($title);
$name = $apt->format_data_out($name);
if($apt->getsettings('html_links')=='yes'){
$news_link = "news_view_".$id.".html";
}else{
$news_link = "news.php?action=view&id=".$id;
}
eval("\$index_middle .= \" " . $apt->gettemplate ( 'index_main_table' ) . "\";");
}
$form = $apt->getsettings('main_form');
if($form == 'formB'){
$result = $apt->query ("SELECT id,title,date_time,userid,name,news_head,catmig,reader,c_comment,timestamp,uploadfile FROM rafia_news
WHERE allow = 'yes'
AND inindex = '1'
AND main = '0'
ORDER BY id DESC
LIMIT $start,$showmax");
$getImageCat = $apt->getImageCat();
$index_middle .= "
";
while ( $row = $apt->dbarray($result) )
{
@extract($row);
$postid = $id;
$numrows = $c_comment;
$newsimage = '';
if($catmig == 0)
{
if($uploadfile >0)
{
if($apt->getsettings("use_gd_thumb") == 'yes'){$usegd=true;}else{$usegd=false;}
$newsimage = $apt->getnewsimage($postid,$uploadfile,$usegd);
}
elseif($apt->conf['isupgrade'] == 1)
{
$newsimage = getimagefile($postid);
}
}
else
{
$newsimage = $getImageCat[$cat_id];
}
$apt->numrows = $numrows;
$pagenum = $apt->pagenumlist($perpage_comment,$postid,"news.php");
$news_head = $apt->rafia_code($news_head,$wordwrap);
$date = $apt->Hijri($date_time)." ".$apt->gettime($date_time);
$title = $apt->format_data_out($title);
$name = $apt->format_data_out($name);
if ($news_head <>"")
{
$tdwidth = 100/$indexColcount;
$index_middle .= "| ";
if($apt->getsettings('html_links')=='yes'){
$news_link = "news_view_".$id.".html";
}else{
$news_link = "news.php?action=view&id=".$id;
}
eval("\$index_middle .= \" " . $apt->gettemplate ( 'index_table' ) . "\";");
$index_middle .= " | ";
$count++;
if ($count == $indexColcount)
{
$index_middle .= "
";
$count = 0;
}
}
}
$index_middle .= "
";
$apt->numrows = $apt->dbnumquery("rafia_news","allow='yes' AND inindex ='1'",'id');
$index_middle .= $apt->pagenum($showmax,"idx");
}else{
////----------
$showcat = trim($apt->getsettings('showcat'));
$showcat = explode(",",$apt->getsettings('showcat'));
foreach($showcat as $showc){$shc = intval($showc); if(!$shc == 0)$sc[] = $shc;}
$showcat = $apt->myimplode($sc);
if(!$showcat)$showcat = 0;
$result = $apt->query("SELECT title,id,homeshow FROM rafia_cat WHERE catType='1' and ismine='1' ORDER BY ordercat ASC");
while($row = $apt->dbarray($result)){
@extract($row);
if($homeshow == 0)$homeshow = 1;
$count = 0;
$cid = intval($id);
$ctitle = $apt->format_data_out($title);
eval("\$index_middle .= \" " . $apt->gettemplate ( 'index_table_cat_title' ) . "\";");
$results = $apt->query ("SELECT id,title,date_time,userid,name,news_head,catmig,reader,c_comment,timestamp,uploadfile FROM rafia_news
WHERE allow = 'yes'
AND cat_id = '$cid'
AND inindex = '1'
AND main = '0'
ORDER BY `id` DESC
LIMIT $homeshow");
$index_middle .= "";
while ( $rows = $apt->dbarray($results) )
{
@extract($rows);
$postid = $id;
$numrows = $c_comment;
$newsimage = '';
if($catmig == 0)
{
if($uploadfile >0)
{
if($apt->getsettings("use_gd_thumb") == 'yes'){$usegd=true;}else{$usegd=false;}
$newsimage = $apt->getnewsimage($postid,$uploadfile,$usegd);
}
elseif($apt->conf['isupgrade'] == 1)
{
$newsimage = getimagefile($postid);
}
}
else
{
$newsimage = $getImageCat[$cat_id];
}
$apt->numrows = $numrows;
$pagenum = $apt->pagenumlist($perpage_comment,$postid,"news.php");
$news_head = $apt->rafia_code($news_head,$wordwrap);
$date = $apt->Hijri($date_time)." ".$apt->gettime($date_time);
$title = $apt->format_data_out($title);
$name = $apt->format_data_out($name);
$tdwidth = 100/$indexColcount;
$index_middle .= "| ";
if($apt->getsettings('html_links')=='yes'){
$news_link = "news_view_".$id.".html";
}else{
$news_link = "news.php?action=view&id=".$id;
}
eval("\$index_middle .= \" " . $apt->gettemplate ( 'index_table' ) . "\";");
$index_middle .= " | ";
$count++;
if ($count == $indexColcount)
{
$index_middle .= "
";
$count = 0;
}
}
$index_middle .= "
";
}
}
////----------
eval("\$index_middle .= \" " . $apt->gettemplate ( 'index_block' ) . "\";");
$apt->html_Output($left_menu);
}
else if ($apt->get['action']=="pages")
{
$id = $apt->setid('id');
$page_res = $apt->query("SELECT * FROM rafia_pages WHERE active='1' and id='$id'");
$row = $apt->dbarray($page_res);
@extract($row);
if ($checkuser == 1)
{
checkcookie();
}
$apt->head($name);
$pagetext = @explode('[--NEW_PAGE--]',$pagetext);
$pcount = count($pagetext);
$part = intval($_GET[part]);
if($part == 0)$part = 1;
$pagetext = $pagetext[$part-1];
$pagetext = $apt->replace_callback($pagetext);
$member_un = $apt->format_data($apt->cookie['cname']);
$pagetext = str_replace('[--USER_NAME--]',$member_un,$pagetext);
$date = $apt->Hijri(time());
$pagetext = str_replace('[--TIME_NOW--]',$date,$pagetext);
if($ishtml==0)$pagetext = nl2br($pagetext);
$index_middle = '
'.$pagetext;
$count=$count+1;
$end= 1;
$show=3;
$start=$page*$end-$end;
$links=$pcount/$end;
$lastlink=ceil($links);
if ($lastlink!=1 ) {
if (($lastlink<=$part+$show and $part-$show>1) or ($part-$show>1) ) { $part_code = "« ..";}
if ($part-$show<1) { for ($i=1 ;$i<=$part-1 ;$i++) $part_code .= "[$i]"; }
if ($part-$show>=1) { for ($i=$part-$show ;$i<=$part-1 ;$i++) $part_code .= "[$i]"; }
if ($lastlink>$part+$show) { $part_code .= "[$part]"; for ($i=$part+1 ;$i<=$part+$show ;$i++) { $part_code .= "[$i]";} $part_code .= " .. »"; }
if ($lastlink<=$part+$show) { $part_code .= "[$part]"; for ($i=$part+1 ;$i<=$lastlink ;$i++) $part_code .= "[$i]"; }
}
if ($lastlink>2 )
$part_code .= "
عرض الصفحة : $part من $lastlink" ;
$part_code = '
'.$part_code;
$index_middle .= $part_code;
if ($showcount == 1){
$index_middle .= '
تم عرض هذه الصفحة '.$count . ' مره/ مرات ';
}
$apt->query("update rafia_pages set count=count+1 where id='$id'");
$index_middle .= '';
if($lmenu_show)$left_menu = $menu->_menu(2);
$apt->html_Output($left_menu);
}
else if (($apt->get['action']=="ads") or ($apt->get['action']=="e3lan"))
{
$adsid = $apt->setid('adsid');
$result= $apt->query("SELECT * FROM rafia_ads WHERE adsid='$adsid'");
if($apt->dbnumrows($result)==0){$apt->errmsg ('عفوا ... يبدو انك اخطأت في العنوان');}
$row= $apt->dbarray($result);
@extract($row);
if($clicks==""){$clicks=0;}
$clicks=$clicks + 1;
$result=$apt->query("update rafia_ads set clicks='$clicks' where adsid='$adsid'");
if($result){
$adsurl=$apt->addToURL($adsurl);
$redirect="Location:$adsurl";
header($redirect);
}
}else if ($apt->get['action']=="rss"){
$url = $apt->getsettings("siteURL");
$site= $apt->getsettings("sitetitle");
if(substr($url,-1) != '/'){
$url = $url . '/';
}
function xmlentities($string){
return str_replace ( array ('&', '"', "'", '<', '>', '\x92' ), array ('&' , '\"', "\'" , '<' , '>', ''' ), $string );
}
header('Content-Type: text/xml');
echo ''. "\r\n";
echo ''."\r\n";
echo "\r\n";
echo "\t\t".xmlentities($site)."\r\n";
echo "\t\t$url\r\n";
echo "\t\t".xmlentities("بإعتماد مجلة البوابة العربية")."\r\n";
$result = mysql_query ("SELECT id,title,news_head FROM rafia_news
WHERE allow='yes'
ORDER BY id DESC limit 10");
while ($row = mysql_fetch_array($result))
{
$id = $row['id'];
$title = xmlentities($row['title']);
$news_head = xmlentities($row['news_head']);
$thelink = xmlentities($url."news.php?action=view&id=$id");
echo "\t- \r\n";
echo "\t\t$title\r\n";
echo "\t\t".$thelink."\r\n";
echo "\t\t$news_head\r\n";
echo "\t
\r\n";
}
echo "\r\n";
echo "";
exit();
}
else if ($apt->get['action']=="Login")
{
Login();
}
$apt->foot($pageft);
?>