Location: PHPKode > projects > L-Forum > l-forum/inc/list_msgs.inc
<?echo $design['listhead']?>
<tr>
<td class=head>&nbsp;<?echo $lang['subject']?></td>
<td class=head><?echo $lang['from']?></td>
<td class=head><?echo $lang['date']?></td></tr>
<?

include $pre."lib/date_trans.inc";

// Setting image dir from relative path and theme dir

$imgdir=$relpath."themes/".$theme."/img";

// Query: select all needed data about articles from 'articles' table
// If list is called from search page script don't need to execute query, 
// because it's performed in search.php

if(!isset($search)){

   $sort = $s=='d'?'desc':'';
   
   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, $timestamp, author, subject, email, parent, is_parent, subs, level, views, attach from articles where forum = $f and moderation_state != 1 order by time $sort limit $limit");
   
// How many articles we have?
   $count_query = new Query("select count(*) as c from articles where forum = $f");
   $count = $count_query->get(0, 'c');

}
   
// Preparation of array containing read articles
   
if(!empty($cookie_read))
   $ca=unserialize($cookie_read);

// Loop which prints table
   
for($x=0; $x<$q->nr(); $x++){
   $row = $q->row();
   $curr_id = $row['id'];
   $date_arr = getdate($row['time']);
   $date = $lang[$dow[$date_arr['wday']].($long_names?"_l":"_s")];
   $date .= ", ".$date_arr['mday']." ".$lang[$mth[$date_arr['mon']].($long_names?"_l":"_s")]." ";
   $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']);
   $bgcolor=( ($x+1)%2==0 ? $design['evencolor'] : $design['oddcolor'] );
   echo "<tr><td class=list bgcolor=\"$bgcolor\">";
   echo "<img src=\"$imgdir/tree0.png\" border=0 vspace=0 hspace=0 align=absmiddle>";
   echo "<a class=list href=\"read.php?f=$f&i=$curr_id\">";
   echo $row['subject'];
   echo "</a> ";
   if($row['attach'])
      echo "<img src=\"$imgdir/clip.png\" hspace=0 vspace=0 align=absmiddle>";
   if($count_view)
      echo "&nbsp(".$row['views']." ".$lang['views'].")";
   if($ca[$curr_id]!=1)
      echo "&nbsp;<img src=\"$imgdir/unread.png\">";
   echo "</td><td width=20% class=list bgcolor=\"$bgcolor\">";
   if(!empty($row['email']))
      echo "<a class=list href=\"mailto:".hide_addr($row['email'])."\">";
   echo $row['author'];
   if(!empty($row['email']))
      echo "</a>";
   echo "</td><td width=250 class=date bgcolor=\"$bgcolor\">";
   echo $date;
   echo "</td>";
   echo "</tr>\n";
}
echo $design['listfoot'];
?>
Return current item: L-Forum