Location: PHPKode > projects > Slashster > slashster/html/news.php
<?

# Slashster: Open Source Friend of a Friend Software
# Copyright 2004 Mark El-Wakil
# Contact: hide@address.com
# http://seventhcycle.net
#
# This file is part of Slashster.
#
# Slashster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Slashster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Slashster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

   import_request_variables("gPc");

   require("PageClass.php");

   $mpage = new PageClass("authonly");  
   $mpage->TitleTag = $mpage->sys[sitename] . " News";
   $mpage->Initialize("authremainder");

?>


<table width=100% height=500 border=1 cellspacing=0 cellpadding=0>
<tr>
<td width=560 valign=top class="stdfilling">
<? $cnt = Body($pge, $id); ?>
</td>
<td width=200 valign=top class="stdfilling">
<?= $mpage->SideBar($cnt) ?>
</td>


</table>

<?




   $mpage->ClosePage();

function Body($pge, $id)
{
   global $mpage;

   $numperpage = $mpage->newsnumperpage;
   $pge = ($pge >=1) ? floor($pge) : 1;

   $limit = "";
   $limit = "limit " . ($pge - 1) * $numperpage . ", $numperpage";

   $whr = ($id) ? "where UpdateTable.Id = '$id'" : "";

   $sql = "select SQL_CALC_FOUND_ROWS UserTable.Fname, UserTable.Lname, 
              UpdateTable.*, UNIX_TIMESTAMP(UpdateTable.Date) as dt from UpdateTable
              left join UserTable on UpdateTable.Submittee = UserTable.Id
              $whr order by UpdateTable.Id desc $limit";

   $r = $mpage->DoQuery($sql,1);

   $sql = "select FOUND_ROWS()";
   $cnt = $mpage->DoQuery($sql);
   $cnt = $cnt[0][0];


   if (!sizeof($r)) return;

   foreach ($r as $s) 
   { 
?>

  
<BR>
<center>

<table width=95% border=1 bordercolor=black cellspacing=>
<tr>
<td colspan=2 class="stdtable">
&nbsp; <a class="stdtxt" href="news.php?id=<?= $s[Id] ?>"><B><?= $s[Title] ?></b></a>
</td>
</tr>

<tr>
       <td width=100 valign=top class="stdtable">
                
<img src = "images/admin-<?= $s[Submittee] ?>.jpg" width=80 height=60>
<?= $s[Fname] ?> <?= substr($s[Lname],0,1) ?>
<BR>User #<?= $s[Submittee] ?>
                    
       </td>
       <td width=* valign=top class="stdfilling">

<?= $s[Txt] ?>


</td>  
</td></tr>

<tr>
<td colspan=2 align=right class="stdtable">
&nbsp; <B><?= date("F d Y, h:i:a",$s[dt]) ?></b>
</td>
</tr>

</table>
</center>

<?


   } 


   return $cnt;
}


?>
Return current item: Slashster