<?PHP
/************************************************************************/
/* NPDS V : Net Portal Dynamic System .                                 */
/* ===========================                                          */
/*                                                                      */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)   */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2004 by Philippe Brunier   */
/*                                                                      */
/* New Links.php Module with SFROM extentions                           */
/*                                                                      */
/* 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.       */
/************************************************************************/
   global $PHP_SELF; if (!eregi("modules.php", $PHP_SELF)) { die(); }

   $x=0;
   while (list($lid, $url, $title, $description, $time, $hits, $topicid_card, $xcid, $xsid)=mysql_fetch_row($result)) {
      //compare the description with "nohtml description"
      if (!empty($query)) {
         $affichT=false; $affichD=false;
         if (strcasecmp($title,check_html($title,"nohtml"))==0) {
            if ($title!=ereg_replace($query, "<b>$query</b>", $title)) {
               $title = ereg_replace($query, "<b>$query</b>", $title);
               $affichT=true;
            }
         } else {
            $affichT=true;
         }
         if (strcasecmp($description,check_html($description,"nohtml"))==0) {
            if ($description!=ereg_replace($query, "<b>$query</b>", $description)) {
               $description = ereg_replace($query, "<b>$query</b>", $description);
               $affichD=true;
            }
         } else {
            $affichD=true;
         }
         if ($affichT or $affichD)
            $affich=true;
         else
            $affich=false;
      } else {
         $affich=true;
      }

      if ($affich) {
         $title = stripslashes($title); $description = stripslashes($description);
         echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"HEADER\"><tr><td>";
         echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr class=\"LIGNB\"><td colspan=\"2\">";
         if ($ibid=theme_image("links/urlgo.gif")) {$imgtmp=$ibid;} else {$imgtmp="images/links/urlgo.gif";}
         if ($url=="") {
            echo "<img src=\"$imgtmp\" border=\"0\" alt=\"\" /> ".aff_langue($title);
         } else {
            echo "<img src=\"$imgtmp\" border=\"0\" alt=\"\" /> <a href=\"modules.php?ModStart=$ModStart&amp;ModPath=$ModPath&amp;op=visit&amp;lid=$lid\" target=\"_blank\" class=\"NOIR\">".aff_langue($title)."</a>";
         }
         newlinkgraphic($datetime, $time);
         echo "</td>";
         $colspanX=2;
         if (!empty($xcid)) {
            $result3 = mysql_query("select title from ".$links_DB."links_categories where cid='$xcid'");
            $result4 = mysql_query("select title from ".$links_DB."links_subcategories where sid='$xsid'");
            list($ctitle) = mysql_fetch_row($result3);
            list($stitle) = mysql_fetch_row($result4);
            if ($stitle=="") {$slash = "";}else{$slash = "/";}
            echo "<td align=\"right\" nowrap=\"nowrap\">".translate("Category: ")."<b>".aff_langue($ctitle)."</b> $slash <b>".aff_langue($stitle)."</b></TD>";
            $colspanX=3;
         }
         echo "<tr class=\"LIGNB\" height=\"4\"><td colspan=\"$colspanX\">&nbsp;</td></tr>";
         echo "<tr class=\"LIGNB\"><td colspan=\"$colspanX\">";
            echo "<table border=\"0\" WIDTH=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
            echo "<tr><td width=\"15%\">".translate("Description: ")."</td><td wrap=\"wrap\">".aff_langue($description)."</td></tr>";
            global $links_topic;
            if ($links_topic and $topicid_card!=0) {
               list($topicLX)=mysql_fetch_row(mysql_query("select topictext from topics where topicid='$topicid_card'"));
               echo "<tr><td>".translate("Topics")." :</td><td><b>$topicLX</b></td></tr>";
            }
            echo "</table>";
         echo "</td></tr>";
         $datetime=formatTimestampShort($time);
         echo "<tr class=\"LIGNB\"><td colspan=\"$colspanX\"><hr noshade class=\"ONGL\">";
            echo "<table border=\"0\" WIDTH=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
            echo "<tr><td>".translate("Added on: ")."$datetime ";
            if ($url!="") {
               echo translate("Hits: ");
               global $popular;
               if ($ibid=theme_image("links/popular.gif")) {$imgtmp=$ibid;} else {$imgtmp="images/links/popular.gif";}
               if ($hits>$popular) {
                  echo "<b>$hits</b> <img src=\"$imgtmp\" border=\"0\" alt=\"\" align=\"middle\" />";
               } else {
                  echo $hits;
               }
               echo "</td>";

               echo "<td align=\"right\" nowrap=\"nowrap\"><a href=\"modules.php?ModStart=$ModStart&amp;ModPath=$ModPath&amp;op=brokenlink&amp;lid=$lid\" class=\"NOIR\"><span style=\"font-size: 10px;\">".translate("Report Broken Link")."</a></td>";
            } else {
               echo "</td>";
            }
            echo "</tr><tr>";
            echo "<td align=\"left\">";
            // Advance infos via the class sform.php
            autorise_mod($lid,true);
            $browse_key=$lid;
            include ("modules/sform/$ModPath/link_detail.php");

            detecteditorial($lid, urlencode($title));
            echo "</td><td align=\"right\">";
            echo "<a href=\"print.php?DB=$links_DB&amp;lid=$lid\"><img src=\"";
            if ($ibid=theme_image("box/print.gif")) {$imgtmp=$ibid;} else {$imgtmp="images/print.gif";}
            echo "$imgtmp\" border=\"0\" align=\"middle\" alt=\"".translate("Printer Friendly Page")."\" /></a>";
            echo "</td></tr></table>";
         echo "</td></tr><tr height=\"1\"><td class=\"LIGNB\" colspan=\"$colspanX\"></td></tr></table>";
         echo "</td></tr></table><br />";
        $x++;
     }
   }
   mysql_free_result;
?>