<?PHP
/************************************************************************/
/* NPDS V : Net Portal Dynamic System .                                 */
/* ===========================                                          */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2004 by Philippe Brunier   */
/* ===========================                                          */
/* From ALL STORIES Add-On ... ver. 1.4.1a                              */
/*                                                                      */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)   */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program 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.       */
/************************************************************************/
if (strstr($ModPath,"..") || strstr($ModStart,"..") || stristr($ModPath, "script") || stristr($ModPath, "cookie") || stristr($ModPath, "iframe") || stristr($ModPath, "applet") || stristr($ModPath, "object") || stristr($ModPath, "meta") || stristr($ModStart, "script") || stristr($ModStart, "cookie") || stristr($ModStart, "iframe") || stristr($ModStart, "applet") || stristr($ModStart, "object") || stristr($ModStart, "meta")) {
   die();
}
if (!function_exists("Mysql_Connexion")) {include ("mainfile.php");}
global $pdst; $pdst="1";

   include ("modules/$ModPath/archive-stories.conf.php");
   include ("modules/$ModPath/cache.timings.php");
   if (!$start) {$start=0;}
   include("header.php");
   // Include cache manager
   if ($SuperCache) {
      $cache_obj = new cacheManager();
      $cache_obj->startCachingPage();
   }
   if (($cache_obj->genereting_output==1) or ($cache_obj->genereting_output==-1) or (!$SuperCache)) {
      opentable();
      echo "<TABLE WIDTH=\"100%\" CELLSPACING=\"2\" CELLPADDING=\"2\" BORDER=\"0\">\n";
      echo "<tr CLASS=\"HEADER\" align=\"center\"><td>".translate("Articles")."&nbsp;</td><td>".translate("reads")."</td><td>".translate("Posted on")."</td><td>".translate("Author")."</td><td>&nbsp;</td></tr>";

      if (!$count) {
         $result0 = mysql_query("SELECT sid FROM stories where archive='0'");
         $count=mysql_num_rows($result0);
      }
      $xtab=news_aff("libre", "where archive='0' ORDER BY sid DESC limit $start,$maxcount", $start, $maxcount);
      $ibid=0;
      $story_limit=0;
      if ($ibid=theme_image("box/print.gif")) {$imgtmpP=$ibid;} else {$imgtmpP="images/print.gif";}
      if ($ibid=theme_image("box/friend.gif")) {$imgtmpF=$ibid;} else {$imgtmpF="images/friend.gif";}
      while (($story_limit<$maxcount) and ($story_limit<sizeof($xtab))) {
        $rowcolor=tablos();
        list($s_sid, $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant) = $xtab[$story_limit];
        $story_limit++;

        if ($catid!=0) {
            list($cattitle) = mysql_fetch_row(mysql_query("select title from stories_cat where catid='$catid'"));
        }
        $printP = "<a href=\"print.php?sid=$s_sid\"><img src=\"".$imgtmpP."\" border=\"0\" Alt=\"".translate("Printer Friendly Page")."\"></a>&nbsp;";
        $sendF = "<a href=\"friend.php?op=FriendSend&amp;sid=$s_sid\"><img src=\"".$imgtmpF."\" border=\"0\" Alt=\"".translate("Send this Story to a Friend")."\"></a>";
        $sid = $s_sid;
        if ($catid != 0) {
            $resultm = mysql_query("select title from stories_cat where catid='$catid'");
            list($title1) = mysql_fetch_row($resultm);
            $title = "<a href=\"article.php?sid=$sid&amp;mode=&amp;order=0\" CLASS=\"NOIR\">$title</a> [ <a href=\"index.php?op=newindex&amp;catid=$catid\" CLASS=\"ONGL\">$title1</a> ]";
        }
        setlocale (LC_TIME, aff_langue($locale));
        ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
        $datetime = strftime("%d-%m-%Y %T", mktime($datetime[4]+$gmt,$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
        if (cur_charset!="utf-8") {
           $datetime = ucfirst($datetime);
        }
        echo "<tr align=\"center\" $rowcolor>
        <td align=\"left\" width=\"50%\"><a href=\"article.php?sid=$sid&amp;mode=&amp;order=0\" CLASS=\"NOIR\">".aff_langue($title)."</td>
        <td align=\"center\"><font size=\"1\">$counter</td>
        <td align=\"center\" align=\"25%\"><font size=\"1\">$datetime</font></td>
        <td align=\"left\"><a href=\"user.php?op=userinfo&amp;uname=$informant\" CLASS=\"NOIR\"><font size=\"1\">$informant</font></a></td>
        <td align=\"center\">$printP&nbsp;$sendF</td>
        </tr>";
      }
      echo "</table><br />";
      $start=$start+$maxcount-1;
      if (($count-$start)>0) {
         if ($ibid=theme_image("box/right.gif")) {$imgtmp=$ibid;} else {$imgtmp="images/download/right.gif";}
         echo "<a href=\"modules.php?ModPath=archive-stories&amp;ModStart=archive-stories&amp;start=$start&amp;count=$count\" CLASS=\"NOIR\">".translate("next matches")." <img src=\"".$imgtmp."\" border=\"0\" align=\"middle\"></a>";
      }
      echo "<center><br />".translate("Nb of articles")." : $count :: [ <a href=\"modules.php?ModPath=archive-stories&amp;ModStart=archive-stories\" CLASS=\"NOIR\">".translate("Go Back")."</a> ]</center>";
      closetable();
   }
   if ($SuperCache) {
      $cache_obj->endCachingPage();
   }
   include("footer.php");
?>