<?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.       */
/************************************************************************/
if (!eregi("modules.php", $PHP_SELF)) { die(); }

function modifylinkrequest($lid, $modifylinkrequest_adv_infos, $author) {
   global $ModPath, $ModStart, $links_DB;
   if (autorise_mod($lid,false)) {
      if ($author=="-9") {
         Header("Location: modules.php?ModStart=$ModStart&ModPath=$ModPath/admin&op=LinksModLink&lid=$lid");
      }
      include("header.php");
      OpenTable();
      mainheader();
      $result = mysql_query("select cid, sid, title, url, description, topicid_card from ".$links_DB."links_links where lid='$lid'");
      list($cid, $sid, $title, $url, $description, $topicid_card) = mysql_fetch_row($result);
      $title = stripslashes($title);
      echo "<br /><table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
      echo translate("Request Link Modification")." : ".$title;
      echo "</td></tr></table>\n";
      echo "<br />\n";
      $description = stripslashes($description);
      echo "<form action=\"modules.php\" method=\"post\" name=\"adminForm\">
      <input type=\"hidden\" name=\"ModPath\" value=\"$ModPath\">
      <input type=\"hidden\" name=\"ModStart\" value=\"$ModStart\">";
      echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\">";
      echo "<tr><td width=\"15%\">".translate("Title:")."</td><td><input class=\"textbox\" type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"></td></tr>";
      global $links_url;
      if ($links_url)
         echo "<tr><td width=\"15%\">URL :</td><td><input class=\"textbox\" type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"></td></tr>";

      echo "<tr><td width=\"15%\">".translate("Category: ")."</td><td><select class=\"TEXTBOX_STANDARD\" name=\"cat\">";
      $result2=mysql_query("select cid, title from ".$links_DB."links_categories order by title");
      while (list($ccid, $ctitle) = mysql_fetch_row($result2)) {
         $sel = "";
         if ($cid==$ccid AND $sid==0) {
            $sel = "selected";
         }
         echo "<option value=\"$ccid\" $sel>".aff_langue($ctitle)."</option>";
         $result3=mysql_query("select sid, title from ".$links_DB."links_subcategories where cid='$ccid' order by title");
         while (list($ssid, $stitle) = mysql_fetch_row($result3)) {
            $sel = "";
            if ($sid==$ssid) {
               $sel = "selected";
            }
            echo "<option value=\"$ccid-$ssid\" $sel>".aff_langue("$ctitle / $stitle")."</option>";
         }
      }
      echo "</select></td></tr>";
      global $links_topic;
      if ($links_topic) {
         echo "<tr><td width=\"15%\">".translate("Topics")." : </td><td><select class=\"TEXTBOX_STANDARD\" name=\"topicL\">";
         $toplist = mysql_query("select topicid, topictext from topics order by topictext");
         echo "<option value=\"\">".translate("All Topics")."</option>\n";
         while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
           if ($topicid==$topicid_card) { $sel = "selected "; }
           echo "<option $sel value=\"$topicid\">$topics</option>\n";
           $sel = "";
         }
         echo "</select></td></tr>";
      }
      echo "</table>";
      echo "<br />".translate("Description: (255 characters max)")."<br /><textarea class=\"textbox\" wrap=\"virtual\" name=\"xtext\" cols=\"50\" rows=\"10\" style=\"width: 100%;\">$description</textarea>";
      aff_editeur("xtext","false");
      echo "<br />";
      echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
      echo "<input type=\"hidden\" name=\"modifysubmitter\" value=\"$author\">";
      echo "<input type=\"hidden\" name=\"op\" value=\"modifylinkrequestS\"><input type=\"submit\" class=\"BOUTON_STANDARD\" value=\"".translate("Send Request")."\"></form>";
      echo "</td></tr></table>";
      $browse_key=$lid;
      include ("modules/sform/$ModPath/link_maj.php");
      CloseTable();
      include("footer.php");
   } else {
      header("Location: modules.php?ModStart=$ModStart&ModPath=$ModPath");
   }
}

function modifylinkrequestS($lid, $cat, $title, $url, $description, $modifysubmitter, $topicL) {
   global $links_DB;
   if (autorise_mod($lid,false)) {
      $cat = explode("-", $cat);
      if ($cat[1]=="") {
         $cat[1] = 0;
      }
      $title = stripslashes(FixQuotes($title));
      $url = stripslashes(FixQuotes($url));
      $description = stripslashes(FixQuotes($description));
      if ($modifysubmitter==-9) {$modifysubmitter="";}
      $result=mysql_query("insert into ".$links_DB."links_modrequest values (NULL, $lid, $cat[0], $cat[1], '$title', '$url', '$description', '$modifysubmitter', '0', '$topicL')");
      echo $result;
      global $pdst; $pdst="1";
      include("header.php");
      opentable();
      echo "<br /><p align=\"center\">".translate("Thanks for this information. We'll look into your request shortly.")."</p><br>";
      closetable();
      include("footer.php");
   }
}

function brokenlink($lid) {
    global $ModPath, $ModStart, $links_DB, $anonymous;
    global $pdst; $pdst="1";
    include("header.php");
    OpenTable();
    global $user;
    if (isset($user)) {
       global $cookie;
       $ratinguser=$cookie[1];
    } else {
       $ratinguser=$anonymous;
    }
    mainheader();
    echo "<br /><table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
    echo translate("Report Broken Link");
    echo "</td></tr></table>\n";
    echo "<br />\n";
    echo "<form method=\"post\" action=\"modules.php\">
          <input type=\"hidden\" name=\"ModPath\" value=\"$ModPath\">
          <input type=\"hidden\" name=\"ModStart\" value=\"$ModStart\">";
    echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
    echo "<input type=\"hidden\" name=\"modifysubmitter\" value=\"$ratinguser\">";
    echo "<p align=\"center\">
          ".translate("Thank you for helping to maintain this directory's integrity.")."
          <br /><br />
          ".translate("For security reasons your user name and IP address will also be temporarily recorded.")."
          <br /><br />";
    echo "<input type=\"hidden\" name=\"op\" value=\"brokenlinkS\"><input type=\"submit\" class=\"BOUTON_STANDARD\" value=\"".translate("Report Broken Link")."\"></p></form>";
    CloseTable();
    include("footer.php");
}

function brokenlinkS($lid, $modifysubmitter) {
    global $user, $links_DB;
    global $pdst; $pdst="1";
    if (isset($user)) {
       global $cookie;
       $ratinguser = $cookie[1];
    } else {
       $ratinguser = "$anonymous";
    }
    mysql_query("insert into ".$links_DB."links_modrequest values (NULL, $lid, 0, 0, '', '', '', '$ratinguser', 1,'')");
    include("header.php");
    opentable();
    echo "<br /><p align=\"center\">".translate("Thanks for this information. We'll look into your request shortly.")."</p><br />";
    closetable();
    include("footer.php");
}
?>