Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/view_fodarticle.php
<?php
	/*******************************************************************************
     **  File          :  view_fodarticle.php                                     **
     **  Author        :  G.Ramkumar                                              **
     **  Description   :  Fodkem article page 									  **
  	 **  Date          :  14/07/2005                                              **
     **  Last Modified :  02/08/2005                                              **
     **  PHP Version   :  5.0.3                                                   **
     **                                                                           **
     *******************************************************************************/
$id_ar=$_REQUEST['id'];
if($id_ar!="")
{
   session_start();
   include('header.php');

	$article="Select * from new_newsitem where newsitem_id=$id_ar";
	$article_res=$pg_sql->query_pass($article,"4");
	$hour=str_replace(":","h",$article_res[0]['hour']);
	$source=$article_res[0]['channel_short_name'];

	$view_dir="login/tmp/attachments/".$id_ar;
	if(file_exists($view_dir.".gif"))
	   $image_dis="<a href='".$view_dir.".gif' target='_new'><img src='".$view_dir.".gif' alt='".trim($article_res[0]['alt_tag'])."' border='0' height='60' width='80'></a>";
	elseif(file_exists($view_dir.".jpg"))
	  $image_dis="<a href='".$view_dir.".jpg' target='_new'><img src='".$view_dir.".jpg' alt='".trim($article_res[0]['alt_tag'])."' border='0' height='60' width='80'></a>";
	elseif(file_exists($view_dir.".bmp"))
	  $image_dis="<a href='".$view_dir.".bmp' target='_new'><img src='".$view_dir.".bmp' alt='".trim($article_res[0]['alt_tag'])."' border='0' height='60' width='80'></a>";
	else
	  $image_dis="";

	if(file_exists($view_dir.".doc"))
	{
	   //trim($article_res[0]['alt_tag'])
	 	$att_icon='<img src="images/doc.gif" border="0">';
	    $att_name='<ul><li>'.$att_icon.'&nbsp;<a href="login/tmp/attachments/'.$id_ar.'.doc" class="contblack" target="new">'.Document.'</a></li></ul>';
	}elseif(file_exists($view_dir.".rtf")){
	   	$att_icon='<img src="images/doc.gif" border="0">';
	    $att_name='<ul><li>'.$att_icon.'&nbsp;<a href="login/tmp/attachments/'.$id_ar.'.rtf" class="contblack" target="new">'.Document.'</a></li></ul>';
	}elseif(file_exists($view_dir.".xls")){
	   	$att_icon='<img src="images/xls.gif" border="0">';
	    $att_name='<ul><li>'.$att_icon.'&nbsp;<a href="login/tmp/attachments/'.$id_ar.'.xls" class="contblack" target="new">'.Document.'</a></li></ul>';
	}elseif(file_exists($view_dir.".ppt")){
	   	$att_icon='<img src="images/ppt.gif" border="0">';
	    $att_name='<ul><li>'.$att_icon.'&nbsp;<a href="login/tmp/attachments/'.$id_ar.'.ppt" class="contblack" target="new">'.Document.'</a></li></ul>';
	}else{
	   $att_icon='';
	   $att_name='';
	}


 //include('fod_att.php');

			$date=explode("-",$article_res[0]['pubdate']);
			$date=$date[2]."/".$date[1]."/".$date[0];

			$ext_url=$article_res[0]['url_external'];
			if($ext_url!="")
			{
			   if(strstr($ext_url,"http://"))
			     $ext_url=$ext_url;
			   else
			     $ext_url="http://".$ext_url;

			  $ext_link='<a href="'.$ext_url.'" class="contblue" target="_new">'.$article_res[0]['title'].'</a>';
			}
			else
			  $ext_link=$article_res[0]['title'];

			$yesterday = strftime ("%e/%m/%Y", strtotime("-1 day"));


			$yday=explode("/",$yesterday);
			if(substr($yday[1],0,1)==0)
			  $yday[1]=str_replace("0","",$yday[1]);
			else
			  $yday[1]=$yday[1];

			if(strlen(trim($yday[0]))==1)
			   $yday[0] ="0".trim($yday[0]);

			$yesterday=trim($yday[0])."/".$yday[1]."/".$yday[2];
			$today=date('d/n/Y');

			if($date==$today)
			  $pubdate=$today_;
			elseif($date == $yesterday)
			  $pubdate=$yesterday_;
			else
			 $pubdate=$date;

             $introcontent=html_entity_decode(str_replace("||","'",$article_res[0]['introtext']));
			 $introcontent=htmlentities(stripslashes($introcontent));
			 $intro__res=html_entity_decode(str_replace("images/","login/images/",$introcontent));

			 $content=html_entity_decode(str_replace("||","'",$article_res[0]['body']));
			 $content=htmlentities(stripslashes($content));

			 if(strstr($content,"login/")){
	 		 	$body__=html_entity_decode($content);
	 		 }else{
	 		   	$body__=html_entity_decode(str_replace("images/","login/images/",$content));
	 		 }
			// preg_match_all('/(src=&quot;)(.*?)(&quot;)/i',$content,$matches);

?>
<tr>
  <td width="180" align="left" valign="top">
		<?
		  include("list_categories.php");
		?>

  </td>
  <td width="600"  align="left" valign="top">
      <table width="100%" border="0" align="center" cellspacing="0" cellpadding="0">
		  <tr>
			<td align="left" valign="top" class="bgybluewolineCopy" height="17">&nbsp;&nbsp;<span class="cont"><?=$your_?> :</span><a class="contlink" href="http://www.belgium.be/eportal/application?languageParameter=<?=$lang?>"><?=$home_?></a>&nbsp;<img src="images/arrow.gif"><span class="cont">Article</span></td>
		  </tr>
        </table>
	    <table cellpadding="0" width="100%" align="center" cellspacing="3" border="0">
			<tr>
   			   <td valign="top" colspan="3" class="contblack"><?=$ext_link?></td>
   			     <title>news.belgium-<?=$article_res[0]['title']?></title>
  			</tr>
  			<tr>
  			<td colspan="3" class="cont1"><font class="contgrey"><?=$pubdate."&nbsp;&nbsp;&nbsp;".$hour?></font></td>
   			</tr>
   			<tr>
			  	<td colspan="3" class="cont1" height="2"></td>
   			</tr>
   			<tr>
       		  <td valign="top" colspan="2" class="cont1"><i><?=$intro__res?></i></td>
       		   <?if($image_dis!=""){?>
   				 <td valign="top" align="center" colspan="1"><?=$image_dis?> </td>
   			   <?}?>
   	   		</tr>
   	   		<tr>
			  <td height="5" colspan="3"></td>
       		</tr>
   	   		<tr>
       		  <td valign="top" colspan="3" class="cont1"><?=$body__?></td>
       		</tr>
   	   		<? if($ext_url!=""){
   	   		     if(strstr($ext_url,"http://"))
   	   		       $ext_url=$ext_url;
   	   		     else
   	   		       $ext_url="http://".$ext_url;

   	   		 ?>

   	   		<tr>
   	   		  <td class="cont" colspan="3" height="5">&nbsp;</td>
   	   		</tr>
   	   		<tr>
   	   		  <td class="cont" colspan="3">
   	   		    <a href="<?=$ext_url?>" target="new" class="linkarticle"><?=$ext_url?></a>
   	   		  </td>
   	   		</tr>

       		<?}if($att_name!=""){?>
			<tr>
			   <td align="left" colspan="3">&nbsp;<?=$att_name?></td>
       		</tr>
       		<?}?>
			<tr><td colspan="3">&nbsp;</TD></tr>
			</table>
		</td>
		<td width="187" height="100%"  align="right" valign="top">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
		     <td align="left"  valign="top" class="bgybluewolineCopy" height="19"></td>
		   </tr>
		 </table>
		 <table border="0"  height="100%" cellspacing="0" cellpadding="3">
		   <tr>
		      <td align="left" valign="middle"> <?include('readalso.php')?></td>
		    </tr>
		 </table>
		 </td>
	</tr>


<?
include('footer.php');
}else{
  header("location:index.php?lang=".$_REQUEST['lang']);
  exit;
}

?>

Return current item: News Manager - RSS aggregator