Location: PHPKode > projects > L-Forum > l-forum/read.php
<?

include "config.php";
include "lib/init.inc";
include "lib/date_trans.inc";

if(empty($cookie_read))
   $ca=Array();
else
   $ca=unserialize($cookie_read);
$ca[$i]=1;
setcookie("cookie_read", serialize($ca), time()+99999999);

if(empty($i)){
   error_f($lang['no_mess_id']);
}
else{
   echo ereg_replace("__TITLE__", $lang['read_message'], $design['head']);
   include "themes/".$theme."/header.inc";
   if($db_type=='mysql'){
      $timestamp = "UNIX_TIMESTAMP(time) as time";
      $limit = "$o, ".$forum_array[$f]['mpp'];
   }
   else if($db_type=='postgres'){
      $timestamp = "date_part('epoch', time) as time";
      $limit = $forum_array[$f]['mpp'].", $o";
   }
   $q=new Query("select id, author, email, subject, body, root, views, attach, moderation_state, $timestamp from articles where id=$i");
   if($q->nr()!=1)
      error($lang['bad_res']);
   $r=$q->row();
   $newrows = $r['views']+1;
   if($count_view)
      $q=new Query("update articles set views=".$newrows." where id=$i");
   $date_arr = getdate($r['time']);
   $date = $lang[$dow[$date_arr['wday']]."_l"];
   $date .= ", ".$date_arr['mday']." ".$lang[$mth[$date_arr['mon']]."_l"]." ";
   $date .= $date_arr['year']." ";
   $date .= ($date_arr['hours']<10?"0".$date_arr['hours']:$date_arr['hours']).":";
   $date .= ($date_arr['minutes']<10?"0".$date_arr['minutes']:$date_arr['minutes']).":";
   $date .= ($date_arr['seconds']<10?"0".$date_arr['seconds']:$date_arr['seconds']);
 
?>

<table border=0 width="<?echo $design['readwidth']?>"><tr><td align=left>
<?
if($r['moderation_state']==2||$r['moderation_state']==3)
   echo "<div class=header>".$lang['msg_locked']."</div>";
else{
?>
<a href="new.php?f=<?echo $f?>&r=<?echo $i?>" class=list><?echo $lang['reply']?></a>&nbsp;
<?
}
?>
<a href="read_thr.php?f=<?echo $f?>&r=<?echo $r['root']?>" class=list><?echo $lang['show_thread']?></a>

<? echo $design['readhead'] ?>

<tr><td bgcolor="<? echo $design['oddcolor'] ?>" class=readhead width=25%>
<? echo $lang['from'] ?>:</td><td  bgcolor="<? echo $design['oddcolor'] ?>">
<? echo $r['author'] ?></td></tr>
<tr><td bgcolor="<? echo $design['evencolor'] ?>" class=readhead>
<? echo $lang['email'] ?>:</td><td bgcolor="<? echo $design['evencolor'] ?>">
<? 
if(!empty($r['email']))
   echo "<a href=\"mailto:".hide_addr($r['email'])."\">".$r['email']."</a>";
else
   echo "&nbsp;";
?></td></tr>
<tr><td bgcolor="<? echo $design['oddcolor'] ?>" class=readhead>
<? echo $lang['date'] ?>:</td><td bgcolor="<? echo $design['oddcolor'] ?>">
<? echo $date ?></td></tr>
<tr><td bgcolor="<? echo $design['evencolor'] ?>" class=readhead>
<? echo $lang['subject'] ?>:</td><td bgcolor="<? echo $design['evencolor'] ?>">
<? echo $r['subject'] ?></td></tr>
<? if(!empty($r['attach'])){ ?>
<tr>
<td bgcolor="<? echo $design['oddcolor']?>" class=readhead>
<?echo $lang['att']?>:</td>
<td bgcolor="<? echo $design['oddcolor']?>">
<a href="attachment.php?i=<?echo $i?>" target="_blank"><?echo $r['attach']?></a>
 (<?echo filesize("upload/".$i)." ".$lang['bytes']?>)
</td>
</tr>
<? } ?>
<tr><td bgcolor="<? echo $design['evencolor'] ?>" colspan=2>
<table border=0 width="100%"><tr><td bgcolor="<? echo $design['oddcolor'] ?>">
<? echo nl2br($r['body']);?>
</td></tr></table></td></tr>
<tr><td bgcolor="<? echo $design['evencolor'] ?>" colspan=2>
<? 

if($thrinmess){
   $type=1;
   $mess_id = $r['root'];
   $href=false;
   include "inc/list_thr.inc";
}

?></td></tr>

<? echo $design['readfoot'] ?>

</td></tr></table><br>
<div align=center><a class="list" href="<?
if(ereg("last.php", $HTTP_REFERER))
   $ref = "last.php";
else if(ereg("moderate.php", $HTTP_REFERER))
   $ref = "admin/moderate.php";
else
   $ref = "list.php";
echo "$ref?f=$f\">".$lang['back']."</a></div>";
include "themes/".$theme."/footer.inc";
echo $design['footer'];
}
?>
Return current item: L-Forum