[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Web_Links/admin/ -> index.php (source)

   1  <?php
   2  
   3  /************************************************************************/

   4  /* PHP-NUKE: Web Portal System                                          */

   5  /* ===========================                                          */

   6  /*                                                                      */

   7  /* Copyright (c) 2005 by Francisco Burzi                                */

   8  /* http://phpnuke.org                                                   */

   9  /*                                                                      */

  10  /* Based on Journey Links Hack                                          */

  11  /* Copyright (c) 2000 by James Knickelbein                              */

  12  /* Journey Milwaukee (http://www.journeymilwaukee.com)                  */

  13  /*                                                                      */

  14  /* This program is free software. You can redistribute it and/or modify */

  15  /* it under the terms of the GNU General Public License as published by */

  16  /* the Free Software Foundation; either version 2 of the License.       */

  17  /************************************************************************/

  18  
  19  if (!defined('ADMIN_FILE')) {
  20      die ("Access Denied");
  21  }
  22  
  23  global $prefix, $db, $admin_file;
  24  $aid = substr("$aid", 0,25);
  25  $row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='Web_Links'"));
  26  $row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
  27  $admins = explode(",", $row['admins']);
  28  $auth_user = 0;
  29  for ($i=0; $i < sizeof($admins); $i++) {
  30      if ($row2['name'] == "$admins[$i]" AND !empty($row['admins'])) {
  31          $auth_user = 1;
  32      }
  33  }
  34  
  35  if ($row2['radminsuper'] == 1 || $auth_user == 1) {
  36  
  37      /*********************************************************/

  38      /* Links Modified Web Links                              */

  39      /*********************************************************/

  40  
  41  	function getparent($parentid, $title) {
  42          global $prefix,$db;
  43          $title = filter($title, "nohtml");
  44          $parentid = intval($parentid);
  45          $row = $db->sql_fetchrow($db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories where cid='$parentid'"));
  46          $cid = intval($row['cid']);
  47          $ptitle = filter($row['title'], "nohtml");
  48          $pparentid = intval($row['parentid']);
  49          $db->sql_freeresult($result);
  50          if (!empty($ptitle)) $title=$ptitle."/".$title;
  51          if ($pparentid!=0) {
  52              $title=getparent($pparentid,$title);
  53          }
  54          return $title;
  55      }
  56  
  57  	function links() {
  58          global $prefix, $db, $admin_file;
  59          include  ("header.php");
  60          GraphicAdmin();
  61          OpenTable();
  62          $ThemeSel = get_theme();
  63          if (file_exists("themes/$ThemeSel/images/link-logo.gif")) {
  64              echo "<center><a href=\"modules.php?name=Web_Links\"><img src=\"themes/$ThemeSel/images/link-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
  65          } else {
  66              echo "<center><a href=\"modules.php?name=Web_Links\"><img src=\"modules/Web_Links/images/link-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
  67          }
  68          $result = $db->sql_query("SELECT * from " . $prefix . "_links_links");
  69          $numrows = $db->sql_numrows($result);
  70          echo "<font class=\"content\">" . _THEREARE . " <b>$numrows</b> " . _LINKSINDB . "</font></center>";
  71          CloseTable();
  72          echo "<br>";
  73  
  74          /* Temporarily 'homeless' links functions (to be revised in ".$admin_file.".php breakup) */

  75          $result2 = $db->sql_query("SELECT requestid,lid,cid,title,url,description,modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='1'");
  76          $totalbrokenlinks = $db->sql_numrows($result2);
  77          $result3 = $db->sql_query("SELECT requestid,lid,cid,title,url,description,modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='0'");
  78          $totalmodrequests = $db->sql_numrows($result3);
  79          OpenTable();
  80          echo "<center><font class=\"content\">[ <a href=\"".$admin_file.".php?op=LinksCleanVotes\">" . _CLEANLINKSDB . "</a> | "
  81          ."<a href=\"".$admin_file.".php?op=LinksListBrokenLinks\">" . _BROKENLINKSREP . " ($totalbrokenlinks)</a> | "
  82          ."<a href=\"".$admin_file.".php?op=LinksListModRequests\">" . _LINKMODREQUEST . " ($totalmodrequests)</a> | "
  83          ."<a href=\"".$admin_file.".php?op=LinksLinkCheck\">" . _VALIDATELINKS . "</a> ]</font></center>";
  84          CloseTable();
  85          echo "<br>";
  86  
  87          /* List Links waiting for validation */

  88          $result4 = $db->sql_query("SELECT lid, cid, sid, title, url, description, name, email, submitter from " . $prefix . "_links_newlink order by lid");
  89          $numrows = $db->sql_numrows($result4);
  90          if ($numrows>0) {
  91              OpenTable();
  92              echo "<center><font class=\"option\"><b>" . _LINKSWAITINGVAL . "</b></font></center><br><br>";
  93              while($row4 = $db->sql_fetchrow($result4)) {
  94                  $lid = intval($row4['lid']);
  95                  $cid = intval($row4['cid']);
  96                  $sid = intval($row4['sid']);
  97                  $title = filter($row4['title'], "nohtml");
  98                  $url = filter($row4['url'], "nohtml");
  99                  $description = filter($row4['description']);
 100                  $name = filter($row4['name'], "nohtml");
 101                  $email = filter($row4['email'], "nohtml");
 102                  $submitter = filter($row4['submitter'], "nohtml");
 103                  $url2 = urlencode($url);
 104                  if (empty($submitter)) {
 105                      $submitter = _NONE;
 106                  }
 107                  echo "<form action=\"".$admin_file.".php\" method=\"post\">"
 108                  ."<b>" . _LINKID . ": $lid</b><br><br>"
 109                  ."" . _SUBMITTER . ":  $submitter<br>"
 110                  ."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
 111                  ."" . _PAGEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\">&nbsp;[ <a href=\"index.php?url=$url2\" target=\"_blank\">" . _VISIT . "</a> ]<br>"
 112                  ."" . _DESCRIPTION . ": <br><textarea name=\"description\" cols=\"70\" rows=\"15\">$description</textarea><br>"
 113                  ."" . _NAME . ": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\">&nbsp;&nbsp;"
 114                  ."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\"><br>";
 115                  echo "<input type=\"hidden\" name=\"new\" value=\"1\">";
 116                  echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
 117                  echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
 118                  echo "" . _CATEGORY . ": <select name=\"cat\">";
 119                  $result5 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by title");
 120                  while ($row5 = $db->sql_fetchrow($result5)) {
 121                      $cid2 = intval($row5['cid']);
 122                      $ctitle2 = filter($row5['title'], "nohtml");
 123                      $parentid2 = intval($row5['parentid']);
 124                      if ($cid2==$cid) {
 125                          $sel = "selected";
 126                      } else {
 127                          $sel = "";
 128                      }
 129                      if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 130                      echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
 131                  }
 132  
 133                  echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
 134                  echo "</select><input type=\"hidden\" name=\"op\" value=\"LinksAddLink\"><input type=\"submit\" value=" . _ADD . "> [ <a href=\"".$admin_file.".php?op=LinksDelNew&amp;lid=$lid\">" . _DELETE . "</a> ]</form><br><hr noshade><br>";
 135              }
 136              CloseTable();
 137              echo "<br>";
 138          } else {
 139          }
 140  
 141          /* Add a New Main Category */

 142  
 143          OpenTable();
 144          echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 145          ."<font class=\"option\"><b>" . _ADDMAINCATEGORY . "</b></font><br><br>"
 146          ."" . _NAME . ": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"><br>"
 147          ."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"70\" rows=\"15\"></textarea><br>"
 148          ."<input type=\"hidden\" name=\"op\" value=\"LinksAddCat\">"
 149          ."<input type=\"submit\" value=\"" . _ADD . "\"><br>"
 150          ."</form>";
 151          CloseTable();
 152          echo "<br>";
 153  
 154          // Add a New Sub-Category

 155          $result6 = $db->sql_query("SELECT * from " . $prefix . "_links_categories");
 156          $numrows = $db->sql_numrows($result6);
 157          if ($numrows>0) {
 158              OpenTable();
 159              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 160              ."<font class=\"option\"><b>" . _ADDSUBCATEGORY . "</b></font><br><br>"
 161              ."" . _NAME . ": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\">&nbsp;" . _IN . "&nbsp;";
 162              $result7 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by parentid,title");
 163              echo "<select name=\"cid\">";
 164              while($row7 = $db->sql_fetchrow($result7)) {
 165                  $cid2 = intval($row7['cid']);
 166                  $ctitle2 = filter($row7['title'], "nohtml");
 167                  $parentid2 = intval($row7['parentid']);
 168                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 169                  echo "<option value=\"$cid2\">$ctitle2</option>";
 170              }
 171              echo "</select><br>"
 172              ."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"70\" rows=\"15\"></textarea><br>"
 173              ."<input type=\"hidden\" name=\"op\" value=\"LinksAddSubCat\">"
 174              ."<input type=\"submit\" value=\"" . _ADD . "\"><br>"
 175              ."</form>";
 176              CloseTable();
 177              echo "<br>";
 178          } else {
 179          }
 180  
 181          // Add a New Link to Database

 182          $result8 = $db->sql_query("SELECT cid, title from " . $prefix . "_links_categories");
 183          $numrows = $db->sql_numrows($result8);
 184          if ($numrows>0) {
 185              OpenTable();
 186              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 187              ."<font class=\"option\"><b>" . _ADDNEWLINK . "</b></font><br><br>"
 188              ."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"><br>"
 189              ."" . _PAGEURL . ": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\"><br>";
 190              $result9 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by title");
 191              echo "" . _CATEGORY . ": <select name=\"cat\">";
 192              while($row9 = $db->sql_fetchrow($result9)) {
 193                  $cid2 = intval($row9['cid']);
 194                  $ctitle2 = filter($row9['title'], "nohtml");
 195                  $parentid2 = intval($row9['parentid']);
 196                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 197                  echo "<option value=\"$cid2\">$ctitle2</option>";
 198              }
 199              echo "</select><br><br><br>"
 200              ."" . _DESCRIPTION255 . "<br><textarea name=\"description\" cols=\"70\" rows=\"15\"></textarea><br><br><br>"
 201              ."" . _NAME . ": <input type=\"text\" name=\"name\" size=\"30\" maxlength=\"60\"><br>"
 202              ."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"><br><br>"
 203              ."<input type=\"hidden\" name=\"op\" value=\"LinksAddLink\">"
 204              ."<input type=\"hidden\" name=\"new\" value=\"0\">"
 205              ."<input type=\"hidden\" name=\"lid\" value=\"0\">"
 206              ."<center><input type=\"submit\" value=\"" . _ADDURL . "\"><br>"
 207              ."</form>";
 208              CloseTable();
 209              echo "<br>";
 210          } else {
 211          }
 212  
 213          // Modify Category

 214          $result10 = $db->sql_query("SELECT * from " . $prefix . "_links_categories");
 215          $numrows = $db->sql_numrows($result10);
 216          if ($numrows>0) {
 217              OpenTable();
 218              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 219              ."<font class=\"option\"><b>" . _MODCATEGORY . "</b></font><br><br>";
 220              $result11 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by title");
 221              echo "" . _CATEGORY . ": <select name=\"cat\">";
 222              while($row11 = $db->sql_fetchrow($result11)) {
 223                  $cid2 = intval($row11['cid']);
 224                  $ctitle2 = filter($row11['title'], "nohtml");
 225                  $parentid2 = intval($row11['parentid']);
 226                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 227                  echo "<option value=\"$cid2\">$ctitle2</option>";
 228              }
 229              echo "</select>"
 230              ."<input type=\"hidden\" name=\"op\" value=\"LinksModCat\">"
 231              ."<input type=\"submit\" value=\"" . _MODIFY . "\">"
 232              ."</form>";
 233              CloseTable();
 234              echo "<br>";
 235          } else {
 236          }
 237  
 238          // Modify Links

 239          $result12 = $db->sql_query("SELECT * from " . $prefix . "_links_links");
 240          $numrows = $db->sql_numrows($result12);
 241          if ($numrows>0) {
 242              OpenTable();
 243              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 244              ."<font class=\"option\"><b>" . _MODLINK . "</b><br><br>"
 245              ."" . _LINKID . ": <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\">&nbsp;&nbsp;"
 246              ."<input type=\"hidden\" name=\"op\" value=\"LinksModLink\">"
 247              ."<input type=\"submit\" value=\"" . _MODIFY . "\">"
 248              ."</form>";
 249              CloseTable();
 250              echo "<br>";
 251          } else {
 252          }
 253  
 254          // Transfer Categories

 255          $result13 = $db->sql_query("SELECT * from " . $prefix . "_links_links");
 256          $numrows = $db->sql_numrows($result13);
 257          if ($numrows>0) {
 258              OpenTable();
 259              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 260              ."<font class=\"option\"><b>" . _EZTRANSFERLINKS . "</b></font><br><br>"
 261              ."" . _CATEGORY . ": "
 262              ."<select name=\"cidfrom\">";
 263              $result14 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by parentid,title");
 264              while($row14 = $db->sql_fetchrow($result14)) {
 265                  $cid2 = intval($row14['cid']);
 266                  $ctitle2 = filter($row14['title'], "nohtml");
 267                  $parentid2 = intval($row14['parentid']);
 268                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 269                  echo "<option value=\"$cid2\">$ctitle2</option>";
 270              }
 271              echo "</select><br>"
 272              ."" . _IN . "&nbsp;" . _CATEGORY . ": ";
 273              $result15 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by parentid,title");
 274              echo "<select name=\"cidto\">";
 275              while($row15 = $db->sql_fetchrow($result15)) {
 276                  $cid2 = intval($row15['cid']);
 277                  $ctitle2 = filter($row15['title'], "nohtml");
 278                  $parentid2 = $row15['parentid'];
 279                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 280                  echo "<option value=\"$cid2\">$ctitle2</option>";
 281              }
 282              echo "</select><br>"
 283              ."<input type=\"hidden\" name=\"op\" value=\"LinksTransfer\">"
 284              ."<input type=\"submit\" value=\"" . _EZTRANSFER . "\"><br>"
 285              ."</form>";
 286              CloseTable();
 287              echo "<br>";
 288          } else {
 289          }
 290  
 291          include  ("footer.php");
 292      }
 293  
 294  	function LinksTransfer($cidfrom, $cidto) {
 295          global $prefix, $db, $admin_file;
 296  
 297          // begin old categories

 298          // (uncomment lines to transfer existing datas)

 299          /*

 300          $cat = explode("-", $cidfrom);

 301          if (empty($cat[1])) {

 302          $cat[1] = 0;

 303          }

 304          $db->sql_query("update " . $prefix . "_links_links set cid='$cidto', sid='0' where cid='$cat[0]' AND sid='$cat[1]'");

 305          */
 306          // end old categories

 307  
 308          // begin new categories

 309          // (comment lines to transfer existing datas)

 310          $db->sql_query("update " . $prefix . "_links_links set cid='$cidto' where cid='$cidfrom'");
 311          // end new categorie

 312          Header("Location: ".$admin_file.".php?op=Links");
 313      }
 314  
 315  	function LinksModLink($lid) {
 316          global $prefix, $db, $admin_file, $bgcolor1, $bgcolor2, $sitename;
 317          include  ("header.php");
 318          GraphicAdmin();
 319          global $anonymous;
 320          $lid = intval($lid);
 321          $result = $db->sql_query("SELECT cid, title, url, description, name, email, hits from " . $prefix . "_links_links where lid='$lid'");
 322          OpenTable();
 323          echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
 324          CloseTable();
 325          echo "<br>";
 326          OpenTable();
 327          echo "<center><font class=\"option\"><b>" . _MODLINK . "</b></font></center><br><br>";
 328          while($row = $db->sql_fetchrow($result)) {
 329              $cid = intval($row['cid']);
 330              $title = filter($row['title'], "nohtml");
 331              $url = filter($row['url'], "nohtml");
 332              $description = filter($row['description']);
 333              $name = filter($row['name'], "nohtml");
 334              $email = filter($row['email'], "nohtml");
 335              $hits = intval($row['hits']);
 336              echo "<form action=".$admin_file.".php method=post>"
 337              ."" . _LINKID . ": <b>$lid</b><br>"
 338              ."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
 339              ."" . _PAGEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\">&nbsp;[ <a href=\"$url\">Visit</a> ]<br>"
 340              ."" . _DESCRIPTION . ":<br><textarea name=\"description\" cols=\"70\" rows=\"15\">$description</textarea><br>"
 341              ."" . _NAME . ": <input type=\"text\" name=\"name\" size=\"50\" maxlength=\"100\" value=\"$name\"><br>"
 342              ."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"50\" maxlength=\"100\" value=\"$email\"><br>"
 343              ."" . _HITS . ": <input type=\"text\" name=\"hits\" value=\"$hits\" size=\"12\" maxlength=\"11\"><br>";
 344              echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
 345              ."" . _CATEGORY . ": <select name=\"cat\">";
 346              $result2 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by title");
 347              while($row2 = $db->sql_fetchrow($result2)) {
 348                  $cid2 = intval($row2['cid']);
 349                  $ctitle2 = filter($row2['title'], "nohtml");
 350                  $parentid2 = intval($row2['parentid']);
 351                  if ($cid2==$cid) {
 352                      $sel = "selected";
 353                  } else {
 354                      $sel = "";
 355                  }
 356                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 357                  echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
 358              }
 359  
 360              echo "</select>"
 361              ."<input type=\"hidden\" name=\"op\" value=\"LinksModLinkS\">"
 362              ."<input type=\"submit\" value=\"" . _MODIFY . "\"> [ <a href=\"".$admin_file.".php?op=LinksDelLink&amp;lid=$lid\">" . _DELETE . "</a> ]</form><br>";
 363              CloseTable();
 364              echo "<br>";
 365              /* Modify or Add Editorial */

 366              $resulted2 = $db->sql_query("SELECT adminid, editorialtimestamp, editorialtext, editorialtitle from " . $prefix . "_links_editorials where linkid='$lid'");
 367              $recordexist = $db->sql_numrows($resulted2);
 368              OpenTable();
 369              /* if returns 'bad query' status 0 (add editorial) */

 370              if ($recordexist == 0) {
 371                  echo "<center><font class=\"option\"><b>" . _ADDEDITORIAL . "</b></font></center><br><br>"
 372                  ."<form action=\"".$admin_file.".php\" method=\"post\">"
 373                  ."<input type=\"hidden\" name=\"linkid\" value=\"$lid\">"
 374                  ."" . _EDITORIALTITLE . ":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
 375                  ."" . _EDITORIALTEXT . ":<br><textarea name=\"editorialtext\" cols=\"70\" rows=\"15\">$editorialtext</textarea><br>"
 376                  ."</select><input type=\"hidden\" name=\"op\" value=\"LinksAddEditorial\"><input type=\"submit\" value=\"Add\">";
 377              } else {
 378                  /* if returns 'cool' then status 1 (modify editorial) */

 379                  while($row3 = $db->sql_fetchrow($resulted2)) {
 380                      $editorialtimestamp = $row3['editorialtimestamp'];
 381                      $editorialtext = filter($row3['editorialtext']);
 382                      $editorialtitle = filter($row3['editorialtitle'], "nohtml");
 383                      ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $editorialtimestamp, $editorialtime);
 384                      $editorialtime = strftime("%F",mktime($editorialtime[4],$editorialtime[5],$editorialtime[6],$editorialtime[2],$editorialtime[3],$editorialtime[1]));
 385                      $date_array = explode("-", $editorialtime);
 386                      $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 387                      $formatted_date = date("F j, Y", $timestamp);
 388                      echo "<center><font class=\"option\"><b>Modify Editorial</b></font></center><br><br>"
 389                      ."<form action=\"".$admin_file.".php\" method=\"post\">"
 390                      ."" . _AUTHOR . ": $adminid<br>"
 391                      ."" . _DATEWRITTEN . ": $formatted_date<br><br>"
 392                      ."<input type=\"hidden\" name=\"linkid\" value=\"$lid\">"
 393                      ."" . _EDITORIALTITLE . ":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
 394                      ."" . _EDITORIALTEXT . ":<br><textarea name=\"editorialtext\" cols=\"70\" rows=\"15\">$editorialtext</textarea><br>"
 395                      ."</select><input type=\"hidden\" name=\"op\" value=\"LinksModEditorial\"><input type=\"submit\" value=\"" . _MODIFY . "\"> [ <a href=\"".$admin_file.".php?op=LinksDelEditorial&amp;linkid=$lid\">" . _DELETE . "</a> ]";
 396                  }
 397              }
 398              CloseTable();
 399              echo "<br>";
 400              OpenTable();
 401              /* Show Comments */

 402              $result4 = $db->sql_query("SELECT ratingdbid, ratinguser, ratingcomments, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratingcomments != '' ORDER BY ratingtimestamp DESC");
 403              $totalcomments = $db->sql_numrows($result4);
 404              echo "<table valign=top width=100%>";
 405              echo "<tr><td colspan=7><b>Link Comments (total comments: $totalcomments)</b><br><br></td></tr>";
 406              echo "<tr><td width=20 colspan=1><b>User  </b></td><td colspan=5><b>Comment  </b></td><td><b><center>Delete</center></b></td><br></tr>";
 407              if ($totalcomments == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Comments<br></font></center></td></tr>";
 408              $x=0;
 409              $colorswitch=$bgcolor1;
 410              while($row4 = $db->sql_fetchrow($result4)) {
 411                  $ratingdbid = intval($row4['ratingdbid']);
 412                  $ratinguser = $row4['ratinguser'];
 413                  $ratingcomments = filter($row4['ratingcomments']);
 414                  $ratingtimestamp = $row4['ratingtimestamp'];
 415                  ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
 416                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 417                  $date_array = explode("-", $ratingtime);
 418                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 419                  $formatted_date = date("F j, Y", $timestamp);
 420                  echo "<tr><td valign=top bgcolor=$colorswitch>$ratinguser</td><td valign=top colspan=5 bgcolor=$colorswitch>$ratingcomments</td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelComment&lid=$lid&rid=$ratingdbid>X</a></b></center></td><br></tr>";
 421                  $x++;
 422                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 423                  else $colorswitch=$bgcolor1;
 424              }
 425  
 426  
 427              // Show Registered Users Votes

 428              $result5 = $db->sql_query("SELECT ratingdbid, ratinguser, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratinguser != 'outside' AND ratinguser != '$anonymous' ORDER BY ratingtimestamp DESC");
 429              $totalvotes = $db->sql_numrows($result5);
 430              echo "<tr><td colspan=7><br><br><b>Registered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
 431              echo "<tr><td><b>User  </b></td><td><b>IP Address  </b></td><td><b>Rating  </b></td><td><b>User AVG Rating  </b></td><td><b>Total Ratings  </b></td><td><b>Date  </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
 432              if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Registered User Votes<br></font></center></td></tr>";
 433              $x=0;
 434              $colorswitch=$bgcolor1;
 435              while($row5 = $db->sql_fetchrow($result5)) {
 436                  $ratingdbid = intval($row5['ratingdbid']);
 437                  $ratinguser = $row5['ratinguser'];
 438                  $rating = intval($row5['rating']);
 439                  $ratinghostname = filter($row5['ratinghostname'], "nohtml");
 440                  $ratingtimestamp = $row5['ratingtimestamp'];
 441                  ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
 442                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 443                  $date_array = explode("-", $ratingtime);
 444                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 445                  $formatted_date = date("F j, Y", $timestamp);
 446  
 447                  //Individual user information

 448                  $result6 = $db->sql_query("SELECT rating FROM " . $prefix . "_links_votedata WHERE ratinguser = '$ratinguser'");
 449                  $usertotalcomments = $db->sql_numrows($result6);
 450                  $useravgrating = 0;
 451                  while($row6 = $db->sql_fetchrow($result6)) $useravgrating = $useravgrating + $rating2;
 452                  $useravgrating = $useravgrating / $usertotalcomments;
 453                  $useravgrating = number_format($useravgrating, 1);
 454                  echo "<tr><td bgcolor=$colorswitch>$ratinguser</td><td bgcolor=$colorswitch>$ratinghostname</td><td bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$useravgrating</td><td bgcolor=$colorswitch>$usertotalcomments</td><td bgcolor=$colorswitch>$formatted_date  </font></b></td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
 455                  $x++;
 456                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 457                  else $colorswitch=$bgcolor1;
 458              }
 459  
 460              // Show Unregistered Users Votes

 461              $result7 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratinguser = '$anonymous' ORDER BY ratingtimestamp DESC");
 462              $totalvotes = $db->sql_numrows($result7);
 463              echo "<tr><td colspan=7><b><br><br>Unregistered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
 464              echo "<tr><td colspan=2><b>IP Address  </b></td><td colspan=3><b>Rating  </b></td><td><b>Date  </b></font></td><td><b><center>Delete</center></b></td><br></tr>";
 465              if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Unregistered User Votes<br></font></center></td></tr>";
 466              $x=0;
 467              $colorswitch=$bgcolor1;
 468              while($row7 = $db->sql_fetchrow($result7)) {
 469                  $ratingdbid = intval($row7['ratingdbid']);
 470                  $rating = intval($row7['rating']);
 471                  $ratinghostname = filter($row7['ratinghostname'], "nohtml");
 472                  $ratingtimestamp = $row7['ratingtimestamp'];
 473                  ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
 474                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 475                  $date_array = explode("-", $ratingtime);
 476                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 477                  $formatted_date = date("F j, Y", $timestamp);
 478                  echo "<td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date  </font></b></td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
 479                  $x++;
 480                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 481                  else $colorswitch=$bgcolor1;
 482              }
 483  
 484              // Show Outside Users Votes

 485              $result8 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratinguser = 'outside' ORDER BY ratingtimestamp DESC");
 486              $totalvotes = $db->sql_numrows($result8);
 487              echo "<tr><td colspan=7><b><br><br>Outside User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
 488              echo "<tr><td colspan=2><b>IP Address  </b></td><td colspan=3><b>Rating  </b></td><td><b>Date  </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
 489              if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Votes from Outside $sitename<br></font></center></td></tr>";
 490              $x=0;
 491              $colorswitch=$bgcolor1;
 492              while($row8 = $db->sql_fetchrow($result8)) {
 493                  $ratingdbid = intval($row8['ratingdbid']);
 494                  $rating = intval($row8['rating']);
 495                  $ratinghostname = filter($row8['ratinghostname'], "nohtml");
 496                  $ratingtimestamp = $row8['ratingtimestamp'];
 497                  ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
 498                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 499                  $date_array = explode("-", $ratingtime);
 500                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 501                  $formatted_date = date("F j, Y", $timestamp);
 502                  echo "<tr><td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date  </font></b></td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
 503                  $x++;
 504                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 505                  else $colorswitch=$bgcolor1;
 506              }
 507  
 508              echo "<tr><td colspan=6><br></td></tr>";
 509              echo "</table>";
 510          }
 511          echo "</form>";
 512          CloseTable();
 513          echo "<br>";
 514          include  ("footer.php");
 515      }
 516  
 517  	function LinksDelComment($lid, $rid) {
 518          global $prefix, $db, $admin_file;
 519          $rid = intval($rid);
 520          $lid = intval($lid);
 521          $db->sql_query("UPDATE " . $prefix . "_links_votedata SET ratingcomments='' WHERE ratingdbid = '$rid'");
 522          $db->sql_query("UPDATE " . $prefix . "_links_links SET totalcomments = (totalcomments - 1) WHERE lid = '$lid'");
 523          Header("Location: ".$admin_file.".php?op=LinksModLink&lid=$lid");
 524  
 525      }
 526  
 527  	function LinksDelVote($lid, $rid) {
 528          global $prefix, $db, $admin_file;
 529          $rid = intval($rid);
 530          $lid = intval($lid);
 531          $db->sql_query("delete from " . $prefix . "_links_votedata where ratingdbid=$rid");
 532          $voteresult = $db->sql_query("SELECT rating, ratinguser, ratingcomments FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid'");
 533          $totalvotesDB = $db->sql_numrows($voteresult);
 534          include ("voteinclude.php");
 535          $db->sql_query("UPDATE " . $prefix . "_links_links SET linkratingsummary='$finalrating', totalvotes='$totalvotesDB', totalcomments='$truecomments' WHERE lid = '$lid'");
 536          Header("Location: ".$admin_file.".php?op=LinksModLink&lid=$lid");
 537      }
 538  
 539  	function LinksEditBrokenLinks($lid) {
 540          global $prefix, $db, $admin_file;
 541          include  ("header.php");
 542          GraphicAdmin();
 543          OpenTable();
 544          echo "<center><font class=\"option\"><b>" . _EZBROKENLINKS . "</b></font></center><br><br>";
 545          $row = $db->sql_fetchrow($db->sql_query("SELECT requestid, lid, cid, title, url, description, modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='1' order by requestid"));
 546          $requestid = intval($row['requestid']);
 547          $lid = intval($row['lid']);
 548          $cid = intval($row['cid']);
 549          $title = filter($row['title'], "nohtml");
 550          $url = filter($row['url'], "nohtml");
 551          $url2 = urlencode($url);
 552          $description = filter($row['description']);
 553          $modifysubmitter = $row['modifysubmitter'];
 554          $row2 = $db->sql_fetchrow($db->sql_query("SELECT name,email,hits from " . $prefix . "_links_links where lid='$lid'"));
 555          $name = filter($row2['name'], "nohtml");
 556          $email = filter($row2['email'], "nohtml");
 557          $hits = intval($row2['hits']);
 558          echo "<form action=\"".$admin_file.".php\" method=\"post\">"
 559          ."<b>" . _LINKID . ": $lid</b><br><br>"
 560          ."" . _SUBMITTER . ":  $modifysubmitter<br>"
 561          ."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
 562          ."" . _PAGEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\">&nbsp;[ <a href=\"index.php?url=$url2\" target=\"_blank\">" . _VISIT . "</a> ]<br>"
 563          ."" . _DESCRIPTION . ": <br><textarea name=\"description\" cols=\"70\" rows=\"15\">$description</textarea><br>"
 564          ."" . _NAME . ": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\">&nbsp;&nbsp;"
 565          ."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\"><br>";
 566          echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
 567          echo "<input type=\"hidden\" name=\"hits\" value=\"$hits\">";
 568          echo "" . _CATEGORY . ": <select name=\"cat\">";
 569          $result = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by title");
 570          while ($row = $db->sql_fetchrow($result)) {
 571              $cid2 = intval($row['cid']);
 572              $ctitle2 = filter($row['title'], "nohtml");
 573              $parentid2 = intval($row['parentid']);
 574              if ($cid2==$cid) {
 575                  $sel = "selected";
 576              } else {
 577                  $sel = "";
 578              }
 579              if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 580              echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
 581          }
 582          echo "</select><input type=\"hidden\" name=\"op\" value=\"LinksModLinkS\"><input type=\"submit\" value=" . _MODIFY . "> [ <a href=\"".$admin_file.".php?op=LinksDelNew&amp;lid=$lid\">" . _DELETE . "</a> ]</form><br><hr noshade><br>";
 583          CloseTable();
 584          echo "<br>";
 585          include ("footer.php");
 586      }
 587  
 588  	function LinksListBrokenLinks() {
 589          global $bgcolor1, $bgcolor2, $prefix, $db, $user_prefix, $admin_file;
 590          include  ("header.php");
 591          GraphicAdmin();
 592          OpenTable();
 593          echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
 594          CloseTable();
 595          echo "<br>";
 596          OpenTable();
 597          $result = $db->sql_query("SELECT requestid, lid, modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='1' order by requestid");
 598          $totalbrokenlinks = $db->sql_numrows($result);
 599          echo "<center><font class=\"option\"><b>" . _USERREPBROKEN . " ($totalbrokenlinks)</b></font></center><br><br><center>"
 600          ."" . _IGNOREINFO . "<br>"
 601          ."" . _DELETEINFO . "</center><br><br><br>"
 602          ."<table align=\"center\" width=\"450\">";
 603          if ($totalbrokenlinks==0) {
 604              echo "<center><font class=\"option\">" . _NOREPORTEDBROKEN . "</font></center><br><br><br>";
 605          } else {
 606              $colorswitch = $bgcolor2;
 607              echo "<tr>"
 608              ."<td><b>" . _LINK . "</b></td>"
 609              ."<td><b>" . _SUBMITTER . "</b></td>"
 610              ."<td><b>" . _LINKOWNER . "</b></td>"
 611              ."<td><b>" . _EDIT . "</b></td>"
 612              ."<td><b>" . _IGNORE . "</b></td>"
 613              ."<td><b>" . _DELETE . "</b></td>"
 614              ."</tr>";
 615              while($row = $db->sql_fetchrow($result)) {
 616                  $requestid = intval($row['requestid']);
 617                  $lid = intval($row['lid']);
 618                  $modifysubmitter = filter($row['modifysubmitter'], "nohtml");
 619                  $result2 = $db->sql_query("SELECT title, url, submitter from " . $prefix . "_links_links where lid='$lid'");
 620                  if ($modifysubmitter != '$anonymous') {
 621                      $row3 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$modifysubmitter'"));
 622                      $email = filter($row3['user_email'], "nohtml");
 623                  }
 624                  $row2 = $db->sql_fetchrow($result2);
 625                  $title = filter($row2['title'], "nohtml");
 626                  $url = filter($row2['url'], "nohtml");
 627                  $url2 = urlencode($url);
 628                  $owner = filter($row2['submitter'], "nohtml");
 629                  $row4 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$owner'"));
 630                  $owneremail = filter($row4['user_email'], "nohtml");
 631                  $url = urlencode($url);
 632                  echo "<tr>"
 633                  ."<td bgcolor=\"$colorswitch\"><a href=\"index.php?url=$url2\">$title</a>"
 634                  ."</td>";
 635                  if (empty($email)) {
 636                      echo "<td bgcolor=\"$colorswitch\">$modifysubmitter";
 637                  } else {
 638                      echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$email\">$modifysubmitter</a>";
 639                  }
 640                  echo "</td>";
 641                  if (empty($owneremail)) {
 642                      echo "<td bgcolor=\"$colorswitch\">$owner";
 643                  } else {
 644                      echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$owneremail\">$owner</a>";
 645                  }
 646                  echo "</td>"
 647                  ."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=LinksEditBrokenLinks&amp;lid=$lid\">X</a></center>"
 648                  ."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=LinksIgnoreBrokenLinks&amp;lid=$lid\">X</a></center>"
 649                  ."</td>"
 650                  ."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=LinksDelBrokenLinks&amp;lid=$lid\">X</a></center>"
 651                  ."</td>"
 652                  ."</tr>";
 653                  if ($colorswitch == $bgcolor2) {
 654                      $colorswitch = $bgcolor1;
 655                  } else {
 656                      $colorswitch = $bgcolor2;
 657                  }
 658              }
 659          }
 660          echo "</table>";
 661          CloseTable();
 662          include  ("footer.php");
 663      }
 664  
 665  	function LinksDelBrokenLinks($lid) {
 666          global $prefix, $db, $admin_file;
 667          $lid = intval($lid);
 668          $db->sql_query("delete from " . $prefix . "_links_modrequest where lid='$lid'");
 669          $db->sql_query("delete from " . $prefix . "_links_links where lid='$lid'");
 670          Header("Location: ".$admin_file.".php?op=LinksListBrokenLinks");
 671      }
 672  
 673  	function LinksIgnoreBrokenLinks($lid) {
 674          global $prefix, $db, $admin_file;
 675          $db->sql_query("delete from " . $prefix . "_links_modrequest where lid='$lid' and brokenlink='1'");
 676          Header("Location: ".$admin_file.".php?op=LinksListBrokenLinks");
 677      }
 678  
 679  	function LinksListModRequests() {
 680          global $bgcolor2, $prefix, $db, $user_prefix, $admin_file;
 681          include  ("header.php");
 682          GraphicAdmin();
 683          OpenTable();
 684          echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
 685          CloseTable();
 686          echo "<br>";
 687          OpenTable();
 688          $result = $db->sql_query("SELECT requestid, lid, cid, sid, title, url, description, modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='0' order by requestid");
 689          $totalmodrequests = $db->sql_numrows($result);
 690          echo "<center><font class=\"option\"><b>" . _USERMODREQUEST . " ($totalmodrequests)</b></font></center><br><br><br>";
 691          echo "<table width=\"95%\"><tr><td>";
 692          while($row = $db->sql_fetchrow($result)) {
 693              $requestid = intval($row['requestid']);
 694              $lid = intval($row['lid']);
 695              $cid = intval($row['cid']);
 696              $sid = intval($row['sid']);
 697              $title = filter($row['title'], "nohtml");
 698              $url = filter($row['url'], "nohtml");
 699              $url = urlencode($url);
 700              $description = filter($row['description']);
 701              $xdescription = eregi_replace("<a href=\"http://", "<a href=\"index.php?url=http://", $description);
 702              $modifysubmitter = filter($row['modifysubmitter'], "nohtml");
 703              $row2 = $db->sql_fetchrow($db->sql_query("SELECT cid, sid, title, url, description, submitter from " . $prefix . "_links_links where lid='$lid'"));
 704              $origcid = intval($row2['cid']);
 705              $origsid = intval($row2['sid']);
 706              $origtitle = filter($row2['title'], "nohtml");
 707              $origurl = filter($row2['url'], "nohtml");
 708              $origurl = urlencode($origurl);
 709              $origdescription = filter($row2['description']);
 710              $xorigdescription = eregi_replace("<a href=\"http://", "<a href=\"index.php?url=http://", $xorigdescription);
 711              $owner = filter($row2['submitter'], "nohtml");
 712              $result3 = $db->sql_query("SELECT title from " . $prefix . "_links_categories where cid='$cid'");
 713              $result5 = $db->sql_query("SELECT title from " . $prefix . "_links_categories where cid='$origcid'");
 714              $result7 = $db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$modifysubmitter'");
 715              $result8 = $db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$owner'");
 716              $row3 = $db->sql_fetchrow($result3);
 717              $cidtitle = filter($row3['title'], "nohtml");
 718              $row5 = $db->sql_fetchrow($result5);
 719              $origcidtitle = filter($row5['title'], "nohtml");
 720              $row7 = $db->sql_fetchrow($result7);
 721              $modifysubmitteremail = filter($row7['user_email'], "nohtml");
 722              $row8 = $db->sql_fetchrow($result8);
 723              $owneremail = filter($row8['user_email'], "nohtml");
 724              if (empty($owner)) {
 725                  $owner = _OWNERISADMIN;
 726              }
 727              if (empty($origsidtitle)) {
 728                  $origsidtitle = "-----";
 729              }
 730              if (empty($sidtitle)) {
 731                  $sidtitle = "-----";
 732              }
 733              echo "<table border=\"1\" bordercolor=\"black\" cellpadding=\"5\" cellspacing=\"0\" align=\"center\" width=\"450\">"
 734              ."<tr>"
 735              ."<td>"
 736              ."<table width=\"100%\" bgcolor=\"$bgcolor2\">"
 737              ."<tr>"
 738              ."<td valign=\"top\" width=\"45%\"><b>" . _ORIGINAL . "</b></td>"
 739              ."<td rowspan=\"5\" valign=\"top\" align=\"left\"><font class=\"tiny\"><br>" . _DESCRIPTION . ":<br>$xorigdescription</font></td>"
 740              ."</tr>"
 741              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _TITLE . ": $origtitle</td></tr>"
 742              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _URL . ": <a href=\"index.php?url=$origurl\">$origurl</a></td></tr>"
 743              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _CATEGORY . ": $origcidtitle</td></tr>"
 744              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _SUBCATEGORY . ": $origsidtitle</td></tr>"
 745              ."</table>"
 746              ."</td>"
 747              ."</tr>"
 748              ."<tr>"
 749              ."<td>"
 750              ."<table width=\"100%\">"
 751              ."<tr>"
 752              ."<td valign=\"top\" width=\"45%\"><b>" . _PROPOSED . "</b></td>"
 753              ."<td rowspan=\"5\" valign=\"top\" align=\"left\"><font class=\"tiny\"><br>" . _DESCRIPTION . ":<br>$xdescription</font></td>"
 754              ."</tr>"
 755              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _TITLE . ": $title</td></tr>"
 756              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _URL . ": <a href=\"index.php?url=$url\">$url</a></td></tr>"
 757              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _CATEGORY . ": $cidtitle</td></tr>"
 758              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _SUBCATEGORY . ": $sidtitle</td></tr>"
 759              ."</table>"
 760              ."</td>"
 761              ."</tr>"
 762              ."</table>"
 763              ."<table align=\"center\" width=\"450\">"
 764              ."<tr>";
 765              if (empty($modifysubmitteremail)) {
 766                  echo "<td align=\"left\"><font class=\"tiny\">" . _SUBMITTER . ":  $modifysubmitter</font></td>";
 767              } else {
 768                  echo "<td align=\"left\"><font class=\"tiny\">" . _SUBMITTER . ":  <a href=\"mailto:$modifysubmitteremail\">$modifysubmitter</a></font></td>";
 769              }
 770              if (empty($owneremail)) {
 771                  echo "<td align=\"center\"><font class=\"tiny\">" . _OWNER . ":  $owner</font></td>";
 772              } else {
 773                  echo "<td align=\"center\"><font class=\"tiny\">" . _OWNER . ": <a href=\"mailto:$owneremail\">$owner</a></font></td>";
 774              }
 775              echo "<td align=\"right\"><font class=\"tiny\">( <a href=\"".$admin_file.".php?op=LinksChangeModRequests&amp;requestid=$requestid\">" . _ACCEPT . "</a> / <a href=\"".$admin_file.".php?op=LinksChangeIgnoreRequests&amp;requestid=$requestid\">" . _IGNORE . "</a> )</font></td></tr></table>";
 776          }
 777          if ($totalmodrequests == 0) {
 778              echo "<center>" . _NOMODREQUESTS . "</center><br><br>";
 779          }
 780          echo "</td></tr></table>";
 781          CloseTable();
 782          include  ("footer.php");
 783      }
 784  
 785  	function LinksChangeModRequests($requestid) {
 786          global $prefix, $db, $admin_file;
 787          $requestid = intval($requestid);
 788          $result = $db->sql_query("SELECT requestid, lid, cid, sid, title, url, description from " . $prefix . "_links_modrequest where requestid='$requestid'");
 789          while ($row = $db->sql_fetchrow($result)) {
 790              $requestid = intval($row['requestid']);
 791              $lid = intval($row['lid']);
 792              $cid = intval($row['cid']);
 793              $sid = intval($row['sid']);
 794              $title = filter($row['title'], "nohtml", 1);
 795              $url = filter($row['url'], "nohtml", 1);
 796              $description = filter($row['description'], "", 1);
 797              $db->sql_query("UPDATE " . $prefix . "_links_links SET cid='$cid', sid='$sid', title='$title', url='$url', description='$description' WHERE lid = '$lid'");
 798          }
 799          $db->sql_query("delete from " . $prefix . "_links_modrequest where requestid='$requestid'");
 800          Header("Location: ".$admin_file.".php?op=LinksListModRequests");
 801      }
 802  
 803  	function LinksChangeIgnoreRequests($requestid) {
 804          global $prefix, $db, $admin_file;
 805          $requestid = intval($requestid);
 806          $db->sql_query("delete from " . $prefix . "_links_modrequest where requestid=$requestid");
 807          Header("Location: ".$admin_file.".php?op=LinksListModRequests");
 808      }
 809  
 810  	function LinksCleanVotes() {
 811          global $prefix, $db, $admin_file;
 812          $result = $db->sql_query("SELECT distinct ratinglid FROM " .$prefix  . "_links_votedata");
 813          while ($row = $db->sql_fetchrow($result)) {
 814              $lid = intval($row['ratinglid']);
 815              $voteresult = $db->sql_query("SELECT rating, ratinguser, ratingcomments FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid'");
 816              $totalvotesDB = $db->sql_numrows($voteresult);
 817              include ("voteinclude.php");
 818              $db->sql_query("UPDATE " . $prefix . "_links_links SET linkratingsummary='$finalrating', totalvotes='$totalvotesDB', totalcomments='$truecomments' WHERE lid = '$lid'");
 819          }
 820          Header("Location: ".$admin_file.".php?op=Links");
 821      }
 822  
 823  	function LinksModLinkS($lid, $title, $url, $description, $name, $email, $hits, $cat) {
 824          global $prefix, $db, $admin_file;
 825          $cat = explode("-", $cat);
 826          if (empty($cat[1])) {
 827              $cat[1] = 0;
 828          }
 829          $title = filter($title, "nohtml", 1);
 830          $url = filter($url, "nohtml", 1);
 831          $description = filter($description, "", 1);
 832          $name = filter($name, "nohtml", 1);
 833          $email = filter($email, "nohtml", 1);
 834          $hists = intval($hits);
 835          $db->sql_query("update " . $prefix . "_links_links set cid='$cat[0]', sid='$cat[1]', title='$title', url='$url', description='$description', name='$name', email='$email', hits='$hits' where lid='$lid'");
 836          $sql = "SELECT * FROM " . $prefix . "_links_modrequest where lid='$lid'";
 837          $result = $db->sql_query($sql);
 838          $numrows = $db->sql_numrows($result);
 839          if ($numrows>0) {
 840          $db->sql_query("delete from " . $prefix . "_links_modrequest where lid='$lid'");
 841          }
 842          Header("Location: ".$admin_file.".php?op=Links");
 843      }
 844  
 845  	function LinksDelLink($lid) {
 846          global $prefix, $db, $admin_file;
 847          $lid = intval($lid);
 848          $db->sql_query("delete from " . $prefix . "_links_links where lid='$lid'");
 849          $sql = "SELECT * FROM " . $prefix . "_links_modrequest where lid='$lid'";
 850          $result = $db->sql_query($sql);
 851          $numrows = $db->sql_numrows($result);
 852          if ($numrows>0) {
 853          $db->sql_query("delete from " . $prefix . "_links_modrequest where lid='$lid'");
 854          }
 855          Header("Location: ".$admin_file.".php?op=Links");
 856      }
 857  
 858  	function LinksModCat($cat) {
 859          global $prefix, $db, $admin_file;
 860          include  ("header.php");
 861          GraphicAdmin();
 862          OpenTable();
 863          echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
 864          CloseTable();
 865          echo "<br>";
 866          $cat = explode("-", $cat);
 867          if (empty($cat[1])) {
 868              $cat[1] = 0;
 869          }
 870          OpenTable();
 871          echo "<center><font class=\"option\"><b>" . _MODCATEGORY . "</b></font></center><br><br>";
 872          if ($cat[1]==0) {
 873              $row = $db->sql_fetchrow($db->sql_query("SELECT title, cdescription from " . $prefix . "_links_categories where cid='$cat[0]'"));
 874              $title = filter($row['title'], "nohtml");
 875              $cdescription = filter($row['cdescription']);
 876              echo "<form action=\"".$admin_file.".php\" method=\"get\">"
 877              ."" . _NAME . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"51\" maxlength=\"50\"><br>"
 878              ."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"70\" rows=\"15\">$cdescription</textarea><br>"
 879              ."<input type=\"hidden\" name=\"sub\" value=\"0\">"
 880              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 881              ."<input type=\"hidden\" name=\"op\" value=\"LinksModCatS\">"
 882              ."<table border=\"0\"><tr><td>"
 883              ."<input type=\"submit\" value=\"" . _SAVECHANGES . "\"></form></td><td>"
 884              ."<form action=\"".$admin_file.".php\" method=\"get\">"
 885              ."<input type=\"hidden\" name=\"sub\" value=\"0\">"
 886              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 887              ."<input type=\"hidden\" name=\"op\" value=\"LinksDelCat\">"
 888              ."<input type=\"submit\" value=\"" . _DELETE . "\"></form></td></tr></table>";
 889          } else {
 890              $row2 = $db->sql_fetchrow($db->sql_query("SELECT title from " . $prefix . "_links_categories where cid='$cat[0]'"));
 891              $ctitle = filter($row2['title'], "nohtml");
 892              $row3 = $db->sql_fetchrow($db->sql_query("SELECT title from " . $prefix . "_links_subcategories where sid='$cat[1]'"));
 893              $stitle = filter($row3['title'], "nohtml");
 894              echo "<form action=\"".$admin_file.".php\" method=\"get\">"
 895              ."" . _CATEGORY . ": $ctitle<br>"
 896              ."" . _SUBCATEGORY . ": <input type=\"text\" name=\"title\" value=\"$stitle\" size=\"51\" maxlength=\"50\"><br>"
 897              ."<input type=\"hidden\" name=\"sub\" value=\"1\">"
 898              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 899              ."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
 900              ."<input type=\"hidden\" name=\"op\" value=\"LinksModCatS\">"
 901              ."<table border=\"0\"><tr><td>"
 902              ."<input type=\"submit\" value=\"" . _SAVECHANGES . "\"></form></td><td>"
 903              ."<form action=\"".$admin_file.".php\" method=\"get\">"
 904              ."<input type=\"hidden\" name=\"sub\" value=\"1\">"
 905              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 906              ."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
 907              ."<input type=\"hidden\" name=\"op\" value=\"LinksDelCat\">"
 908              ."<input type=\"submit\" value=\"" . _DELETE . "\"></form></td></tr></table>";
 909          }
 910          CloseTable();
 911          include ("footer.php");
 912      }
 913  
 914  	function LinksModCatS($cid, $sid, $sub, $title, $cdescription) {
 915          global $prefix, $db, $admin_file;
 916          $cid = intval($cid);
 917          $sid = intval($sid);
 918          $sub = intval($sub);
 919          $title = filter($title, "nohtml", 1);
 920          $cdescription = filter($cdescription, "", 1);
 921          if ($sub==0) {
 922              $db->sql_query("update " . $prefix . "_links_categories set title='$title', cdescription='$cdescription' where cid='$cid'");
 923          } else {
 924              $db->sql_query("update " . $prefix . "_links_subcategories set title='$title' where sid='$sid'");
 925          }
 926          Header("Location: ".$admin_file.".php?op=Links");
 927      }
 928  
 929  	function LinksDelCat($cid, $sid, $sub, $ok=0) {
 930          global $prefix, $db, $admin_file;
 931          include ("header.php");
 932          $cid = intval($cid);
 933          $sid = intval($sid);
 934          $sub = intval($sub);
 935          if($ok==1) {
 936              if ($sub>0) {
 937                  $db->sql_query("delete from " . $prefix . "_links_categories where cid='$cid'");
 938                  $db->sql_query("delete from " . $prefix . "_links_links where cid='$cid'");
 939              } else {
 940                  $db->sql_query("delete from " . $prefix . "_links_links where cid='$cid'");
 941                  // suppression des liens de catégories filles

 942                  $result2 = $db->sql_query("SELECT cid from " . $prefix . "_links_categories where parentid='$cid'");
 943                  while ($row2 = $db->sql_fetchrow($result2)) {
 944                      $cid2 = intval($row2['cid']);
 945                      $db->sql_query("delete from " . $prefix . "_links_links where cid='$cid2'");
 946                  }
 947                  $db->sql_query("delete from " . $prefix . "_links_categories where parentid='$cid'");
 948                  $db->sql_query("delete from " . $prefix . "_links_categories where cid='$cid'");
 949              }
 950              Header("Location: ".$admin_file.".php?op=Links");
 951          } else {
 952              $result = $db->sql_query("SELECT * from " . $prefix . "_links_categories where parentid='$cid'");
 953              $nbsubcat = $db->sql_numrows($result);
 954              $result3 = $db->sql_query("SELECT cid from " . $prefix . "_links_categories where parentid='$cid'");
 955              while ($row3 = $db->sql_fetchrow($result3)) {
 956                  $cid2 = intval($row3['cid']);
 957                  $result4 = $db->sql_query("SELECT * from " . $prefix . "_links_links where cid='$cid2'");
 958                  $nblink += $db->sql_numrows($result4);
 959              }
 960              GraphicAdmin();
 961              OpenTable();
 962              echo "<br><center><font class=\"option\">";
 963              echo "<b>" . _EZTHEREIS . " $nbsubcat " . _EZSUBCAT . " " . _EZATTACHEDTOCAT . "</b><br>";
 964              echo "<b>" . _EZTHEREIS . " $nblink " . _links . " " . _EZATTACHEDTOCAT . "</b><br>";
 965              echo "<b>" . _DELEZLINKCATWARNING . "</b><br><br>";
 966          }
 967          echo "[ <a href=\"".$admin_file.".php?op=LinksDelCat&amp;cid=$cid&amp;sid=$sid&amp;sub=$sub&amp;ok=1\">" . _YES . "</a> | <a href=\"".$admin_file.".php?op=Links\">" . _NO . "</a> ]<br><br>";
 968          CloseTable();
 969          include ("footer.php");
 970      }
 971  
 972  	function LinksDelNew($lid) {
 973          global $prefix, $db, $admin_file;
 974          $lid = intval($lid);
 975          $db->sql_query("delete from " . $prefix . "_links_newlink where lid='$lid'");
 976          Header("Location: ".$admin_file.".php?op=Links");
 977      }
 978  
 979  	function LinksAddCat($title, $cdescription) {
 980          global $prefix, $db, $admin_file;
 981          $parentid = 0;
 982          $title = filter($title, "nohtml", 1);
 983          $cdescription = filter($cdescription, "", 1);
 984          $result = $db->sql_query("SELECT cid from " . $prefix . "_links_categories where title='$title'");
 985          $numrows = $db->sql_numrows($result);
 986          if ($numrows>0) {
 987              include ("header.php");
 988              GraphicAdmin();
 989              OpenTable();
 990              echo "<br><center><font class=\"option\">"
 991              ."<b>" . _ERRORTHECATEGORY . " $title " . _ALREADYEXIST . "</b><br><br>"
 992              ."" . _GOBACK . "<br><br>";
 993              CloseTable();
 994              include ("footer.php");
 995          } else {
 996              $db->sql_query("insert into " . $prefix . "_links_categories values (NULL, '$title', '$cdescription', '$parentid')");
 997              Header("Location: ".$admin_file.".php?op=Links");
 998          }
 999      }
1000  
1001  	function LinksAddSubCat($cid, $title, $cdescription) {
1002          global $prefix, $db, $admin_file;
1003          $cid = intval($cid);
1004          $title = filter($title, "nohtml", 1);
1005          $cdescription = filter($cdescription, "", 1);
1006          $result = $db->sql_query("SELECT cid from " . $prefix . "_links_categories where title='$title' AND cid='$cid'");
1007          $numrows = $db->sql_numrows($result);
1008          if ($numrows>0) {
1009              include ("header.php");
1010              GraphicAdmin();
1011              OpenTable();
1012              echo "<br><center>";
1013              echo "<font class=\"option\">"
1014              ."<b>" . _ERRORTHESUBCATEGORY . " $title " . _ALREADYEXIST . "</b><br><br>"
1015              ."" . _GOBACK . "<br><br>";
1016              include ("footer.php");
1017          } else {
1018              $db->sql_query("insert into " . $prefix . "_links_categories values (NULL, '$title', '$cdescription', '$cid')");
1019              Header("Location: ".$admin_file.".php?op=Links");
1020          }
1021      }
1022  
1023  	function LinksAddEditorial($linkid, $editorialtitle, $editorialtext) {
1024          global $aid, $prefix, $db, $admin_file;
1025          $linkid = intval($linkid);
1026          $editorialtext = filter($editorialtext, "", 1);
1027          $editorialtitle = filter($editorialtitle, "nohtml", 1);
1028          $db->sql_query("insert into " . $prefix . "_links_editorials values ('$linkid', '$aid', now(), '$editorialtext', '$editorialtitle')");
1029          include ("header.php");
1030          GraphicAdmin();
1031          OpenTable();
1032          echo "<center><br>"
1033          ."<font class=option>"
1034          ."" . _EDITORIALADDED . "<br><br>"
1035          ."[ <a href=\"".$admin_file.".php?op=Links\">" . _WEBLINKSADMIN . "</a> ]<br><br>";
1036          echo "$linkid  $adminid, $editorialtitle, $editorialtext";
1037          CloseTable();
1038          include ("footer.php");
1039      }
1040  
1041  	function LinksModEditorial($linkid, $editorialtitle, $editorialtext) {
1042          global $prefix, $db, $admin_file;
1043          $linkid = intval($linkid);
1044          $editorialtext = filter($editorialtext, "", 1);
1045          $editorialtitle = filter($editorialtitle, "nohtml", 1);
1046          $editorialtext = stripslashes(FixQuotes($editorialtext));
1047          $db->sql_query("update " . $prefix . "_links_editorials set editorialtext='$editorialtext', editorialtitle='$editorialtitle' where linkid='$linkid'");
1048          include ("header.php");
1049          GraphicAdmin();
1050          OpenTable();
1051          echo "<br><center>"
1052          ."<font class=\"option\">"
1053          ."" . _EDITORIALMODIFIED . "<br><br>"
1054          ."[ <a href=\"".$admin_file.".php?op=Links\">" . _WEBLINKSADMIN . "</a> ]<br><br>";
1055          CloseTable();
1056          include ("footer.php");
1057      }
1058  
1059  	function LinksDelEditorial($linkid) {
1060          global $prefix, $db, $admin_file;
1061          $linkid = intval($linkid);
1062          $db->sql_query("delete from " . $prefix . "_links_editorials where linkid='$linkid'");
1063          include ("header.php");
1064          GraphicAdmin();
1065          OpenTable();
1066          echo "<br><center>"
1067          ."<font class=\"option\">"
1068          ."" . _EDITORIALREMOVED . "<br><br>"
1069          ."[ <a href=\"".$admin_file.".php?op=Links\">" . _WEBLINKSADMIN . "</a> ]<br><br>";
1070          CloseTable();
1071          include ("footer.php");
1072      }
1073  
1074  	function LinksLinkCheck() {
1075          global $prefix, $db, $admin_file;
1076          include  ("header.php");
1077          GraphicAdmin();
1078          OpenTable();
1079          echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
1080          CloseTable();
1081          echo "<br>";
1082          OpenTable();
1083          echo "<center><font class=\"option\"><b>" . _LINKVALIDATION . "</b></font></center><br>"
1084          ."<table width=\"100%\" align=\"center\"><tr><td colspan=\"2\" align=\"center\">"
1085          ."<a href=\"".$admin_file.".php?op=LinksValidate&amp;cid=0&amp;sid=0\">" . _CHECKALLLINKS . "</a><br><br></td></tr>"
1086          ."<tr><td valign=\"top\"><center><b>" . _CHECKCATEGORIES . "</b><br>" . _INCLUDESUBCATEGORIES . "<br><br><font class=\"tiny\">";
1087          $result = $db->sql_query("SELECT cid, title from " . $prefix . "_links_categories order by title");
1088          while ($row = $db->sql_fetchrow($result)) {
1089              $cid = intval($row['cid']);
1090              $title = filter($row['title'], "nohtml");
1091              $transfertitle = str_replace (" ", "_", $title);
1092              echo "<a href=\"".$admin_file.".php?op=LinksValidate&amp;cid=$cid&amp;sid=0&amp;ttitle=$transfertitle\">$title</a><br>";
1093          }
1094          echo "</font></center></td></tr></table>";
1095          CloseTable();
1096          include  ("footer.php");
1097      }
1098  
1099  	function LinksValidate($cid, $sid, $ttitle) {
1100          global $bgcolor2, $prefix, $db, $admin_file;
1101          $cid = intval($cid);
1102          $sid = intval($sid);
1103          $title = filter($title, "nohtml");
1104          include  ("header.php");
1105          GraphicAdmin();
1106          OpenTable();
1107          echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
1108          CloseTable();
1109          echo "<br>";
1110          OpenTable();
1111          $transfertitle = str_replace ("_", "", $ttitle);
1112          /* Check ALL Links */

1113          echo "<table width=100% border=0>";
1114          if ($cid==0 && $sid==0) {
1115              echo "<tr><td colspan=\"3\"><center><b>" . _CHECKALLLINKS . "</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
1116              $result = $db->sql_query("SELECT lid, title, url from " . $prefix . "_links_links order by title");
1117          }
1118          /* Check Categories & Subcategories */

1119          if ($cid!=0 && $sid==0) {
1120              echo "<tr><td colspan=\"3\"><center><b>" . _VALIDATINGCAT . ": $transfertitle</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
1121              $result = $db->sql_query("SELECT lid, title, url from " . $prefix . "_links_links where cid='$cid' order by title");
1122          }
1123          /* Check Only Subcategory */

1124          if ($cid==0 && $sid!=0) {
1125              echo "<tr><td colspan=\"3\"><center><b>" . _VALIDATINGSUBCAT . ": $transfertitle</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
1126              $result = $db->sql_query("SELECT lid, title, url from " . $prefix . "_links_links where sid='$sid' order by title");
1127          }
1128          echo "<tr><td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _STATUS . "</b></td><td bgcolor=\"$bgcolor2\" width=\"100%\"><b>" . _LINKTITLE . "</b></td><td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _FUNCTIONS . "</b></td></tr>";
1129          while($row = $db->sql_fetchrow($result)) {
1130              $lid = intval($row3['lid']);
1131              $title = filter($row['title'], "nohtml");
1132              $row['url'] = filter($row['url'], "nohtml");
1133              $vurl = parse_url($row['url']);
1134              $fp = fsockopen($vurl['host'], 80, $errno, $errstr, 15);
1135              if (!$fp){
1136                  echo "<tr><td align=\"center\"><b>&nbsp;&nbsp;" . _FAILED . "&nbsp;&nbsp;</b></td>"
1137                  ."<td>&nbsp;&nbsp;<a href=\"$url\" target=\"new\">$title</a>&nbsp;&nbsp;</td>"
1138                  ."<td align=\"center\"><font class=\"content\">&nbsp;&nbsp;[ <a href=\"".$admin_file.".php?op=LinksModLink&amp;lid=$lid\">" . _EDIT . "</a> | <a href=\"".$admin_file.".php?op=LinksDelLink&amp;lid=$lid\">" . _DELETE . "</a> ]&nbsp;&nbsp;</font>"
1139                  ."</td></tr>";
1140              }
1141              if ($fp){
1142                  echo "<tr><td align=\"center\">&nbsp;&nbsp;" . _OK . "&nbsp;&nbsp;</td>"
1143                  ."<td>&nbsp;&nbsp;<a href=\"$url\" target=\"new\">$title</a>&nbsp;&nbsp;</td>"
1144                  ."<td align=\"center\"><font class=\"content\">&nbsp;&nbsp;" . _NONE . "&nbsp;&nbsp;</font>"
1145                  ."</td></tr>";
1146              }
1147          }
1148          echo "</table>";
1149          CloseTable();
1150          include  ("footer.php");
1151      }
1152  
1153  	function LinksAddLink($new, $lid, $title, $url, $cat, $description, $name, $email, $submitter) {
1154          global $prefix, $db, $sitename, $nukeurl, $admin_file;
1155          $title = filter($title, "nohtml", 1);
1156          $url = filter($url, "nohtml", 1);
1157          $description = filter($description, "", 1);
1158          $name = filter($name, "nohtml", 1);
1159          $email = filter($email, "nohtml", 1);
1160          $submitter = filter($submitter, "nohtml", 1);
1161          $result = $db->sql_query("SELECT url from " . $prefix . "_links_links where url='$url'");
1162          $numrows = $db->sql_numrows($result);
1163          if ($numrows>0) {
1164              include ("header.php");
1165              GraphicAdmin();
1166              OpenTable();
1167              echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
1168              CloseTable();
1169              echo "<br>";
1170              OpenTable();
1171              echo "<br><center>"
1172              ."<font class=\"option\">"
1173              ."<b>" . _ERRORURLEXIST . "</b><br><br>"
1174              ."" . _GOBACK . "<br><br>";
1175              CloseTable();
1176              include ("footer.php");
1177          } else {
1178              /* Check if Title exist */

1179              if (empty($title)) {
1180                  include ("header.php");
1181                  GraphicAdmin();
1182                  OpenTable();
1183                  echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
1184                  CloseTable();
1185                  echo "<br>";
1186                  OpenTable();
1187                  echo "<br><center>"
1188                  ."<font class=\"option\">"
1189                  ."<b>" . _ERRORNOTITLE . "</b><br><br>"
1190                  ."" . _GOBACK . "<br><br>";
1191                  CloseTable();
1192                  include ("footer.php");
1193              }
1194              /* Check if URL exist */

1195              if (empty($url)) {
1196                  include ("header.php");
1197                  GraphicAdmin();
1198                  OpenTable();
1199                  echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
1200                  CloseTable();
1201                  echo "<br>";
1202                  OpenTable();
1203                  echo "<br><center>"
1204                  ."<font class=\"option\">"
1205                  ."<b>" . _ERRORNOURL . "</b><br><br>"
1206                  ."" . _GOBACK . "<br><br>";
1207                  CloseTable();
1208                  include ("footer.php");
1209              }
1210              // Check if Description exist

1211              if (empty($description)) {
1212                  include ("header.php");
1213                  GraphicAdmin();
1214                  OpenTable();
1215                  echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
1216                  CloseTable();
1217                  echo "<br>";
1218                  OpenTable();
1219                  echo "<br><center>"
1220                  ."<font class=\"option\">"
1221                  ."<b>" . _ERRORNODESCRIPTION . "</b><br><br>"
1222                  ."" . _GOBACK . "<br><br>";
1223                  CloseTable();
1224                  include ("footer.php");
1225              }
1226              $cat = explode("-", $cat);
1227              if (empty($cat[1])) {
1228                  $cat[1] = 0;
1229              }
1230              $db->sql_query("insert into " . $prefix . "_links_links values (NULL, '$cat[0]', '$cat[1]', '$title', '$url', '$description', now(), '$name', '$email', '0', '$submitter', '0', '0', '0')");
1231              global $nukeurl, $sitename;
1232              include ("header.php");
1233              GraphicAdmin();
1234              OpenTable();
1235              echo "<br><center>";
1236              echo "<font class=\"option\">";
1237              echo "" . _NEWLINKADDED . "<br><br>";
1238              echo "[ <a href=\"".$admin_file.".php?op=Links\">" . _WEBLINKSADMIN . "</a> ]</center><br><br>";
1239              CloseTable();
1240              if ($new==1) {
1241                  $db->sql_query("delete from " . $prefix . "_links_newlink where lid='$lid'");
1242                  if (empty($email)) {
1243                  } else {
1244                      $subject = "" . _YOURLINKAT . " $sitename";
1245                      $message = "" . _HELLO . " $name:\n\n" . _LINKAPPROVEDMSG . "\n\n" . _LINKTITLE . ": $title\n" . _URL . ": $url\n" . _DESCRIPTION . ": $description\n\n\n" . _YOUCANBROWSEUS . " $nukeurl/modules.php?name=Web_Links\n\n" . _THANKS4YOURSUBMISSION . "\n\n$sitename " . _TEAM . "";
1246                      $from = "$sitename";
1247                      mail($email, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
1248                  }
1249              }
1250              include ("footer.php");
1251          }
1252      }
1253  
1254      switch ($op) {
1255  
1256          case "Links":
1257          links();
1258          break;
1259  
1260          case "LinksDelNew":
1261          LinksDelNew($lid);
1262          break;
1263  
1264          case "LinksAddCat":
1265          LinksAddCat($title, $cdescription);
1266          break;
1267  
1268          case "LinksAddSubCat":
1269          LinksAddSubCat($cid, $title, $cdescription);
1270          break;
1271  
1272          case "LinksAddLink":
1273          LinksAddLink($new, $lid, $title, $url, $cat, $description, $name, $email, $submitter);
1274          break;
1275  
1276          case "LinksAddEditorial":
1277          LinksAddEditorial($linkid, $editorialtitle, $editorialtext);
1278          break;
1279  
1280          case "LinksModEditorial":
1281          LinksModEditorial($linkid, $editorialtitle, $editorialtext);
1282          break;
1283  
1284          case "LinksLinkCheck":
1285          LinksLinkCheck();
1286          break;
1287  
1288          case "LinksValidate":
1289          LinksValidate($cid, $sid, $ttitle);
1290          break;
1291  
1292          case "LinksDelEditorial":
1293          LinksDelEditorial($linkid);
1294          break;
1295  
1296          case "LinksCleanVotes":
1297          LinksCleanVotes();
1298          break;
1299  
1300          case "LinksListBrokenLinks":
1301          LinksListBrokenLinks();
1302          break;
1303  
1304          case "LinksEditBrokenLinks":
1305          LinksEditBrokenLinks($lid);
1306          break;
1307  
1308          case "LinksDelBrokenLinks":
1309          LinksDelBrokenLinks($lid);
1310          break;
1311  
1312          case "LinksIgnoreBrokenLinks":
1313          LinksIgnoreBrokenLinks($lid);
1314          break;
1315  
1316          case "LinksListModRequests":
1317          LinksListModRequests();
1318          break;
1319  
1320          case "LinksChangeModRequests":
1321          LinksChangeModRequests($requestid);
1322          break;
1323  
1324          case "LinksChangeIgnoreRequests":
1325          LinksChangeIgnoreRequests($requestid);
1326          break;
1327  
1328          case "LinksDelCat":
1329          LinksDelCat($cid, $sid, $sub, $ok);
1330          break;
1331  
1332          case "LinksModCat":
1333          LinksModCat($cat);
1334          break;
1335  
1336          case "LinksModCatS":
1337          LinksModCatS($cid, $sid, $sub, $title, $cdescription);
1338          break;
1339  
1340          case "LinksModLink":
1341          LinksModLink($lid);
1342          break;
1343  
1344          case "LinksModLinkS":
1345          LinksModLinkS($lid, $title, $url, $description, $name, $email, $hits, $cat);
1346          break;
1347  
1348          case "LinksDelLink":
1349          LinksDelLink($lid);
1350          break;
1351  
1352          case "LinksDelVote":
1353          LinksDelVote($lid, $rid);
1354          break;
1355  
1356          case "LinksDelComment":
1357          LinksDelComment($lid, $rid);
1358          break;
1359  
1360          case "LinksTransfer":
1361          LinksTransfer($cidfrom,$cidto);
1362          break;
1363  
1364      }
1365  
1366  } else {
1367      include ("header.php");
1368      GraphicAdmin();
1369      OpenTable();
1370      echo "<center><b>"._ERROR."</b><br><br>You do not have administration permission for module \"$module_name\"</center>";
1371      CloseTable();
1372      include ("footer.php");
1373  }
1374  
1375  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7