[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_plugins/links_page/ -> link_class.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |    e107 website system
   5  |
   6  |    ©Steve Dunstan 2001-2002
   7  |    http://e107.org
   8  |    jalist@e107.org
   9  |
  10  |    Released   under the   terms and   conditions of the
  11  |    GNU    General Public  License (http://gnu.org).
  12  |
  13  |    $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/link_class.php,v $
  14  |    $Revision: 1.40 $
  15  |    $Date: 2007/01/15 10:41:47 $
  16  |    $Author: lisa_ $
  17  +----------------------------------------------------------------------------+
  18  */
  19  
  20  if (!defined('e107_INIT')) { exit; }
  21  
  22  class linkclass {
  23  
  24      function LinkPageDefaultPrefs(){
  25  
  26          $linkspage_pref['link_page_categories'] = "0";
  27          $linkspage_pref['link_submit'] = "0";
  28          $linkspage_pref['link_submit_class'] = "0";
  29          $linkspage_pref['link_submit_directpost'] = "0";
  30          $linkspage_pref["link_nextprev"] = "1";
  31          $linkspage_pref["link_nextprev_number"] = "20";
  32          $linkspage_pref['link_comment'] = "";
  33          $linkspage_pref['link_rating'] = "";
  34  
  35          $linkspage_pref['link_navigator_frontpage'] = "";
  36          $linkspage_pref['link_navigator_submit'] = "";
  37          $linkspage_pref['link_navigator_manager'] = "";
  38          $linkspage_pref['link_navigator_refer'] = "";
  39          $linkspage_pref['link_navigator_rated'] = "";
  40          $linkspage_pref['link_navigator_allcat'] = "";
  41          $linkspage_pref['link_navigator_links'] = "";
  42          $linkspage_pref['link_navigator_category'] = "";
  43  
  44          $linkspage_pref['link_cat_icon'] = "1";
  45          $linkspage_pref['link_cat_desc'] = "1";
  46          $linkspage_pref['link_cat_amount'] = "1";
  47          $linkspage_pref['link_cat_total'] = "1";
  48          $linkspage_pref['link_cat_empty'] = "1";
  49          $linkspage_pref['link_cat_icon_empty'] = "0";
  50          $linkspage_pref['link_cat_sortorder'] = "0";
  51          $linkspage_pref['link_cat_sort'] = "link_category_name";
  52          $linkspage_pref['link_cat_order'] = "ASC";
  53          $linkspage_pref['link_cat_resize_value'] = "50";
  54  
  55          $linkspage_pref['link_icon'] = "1";
  56          $linkspage_pref['link_referal'] = "1";
  57          $linkspage_pref['link_url'] = "0";
  58          $linkspage_pref['link_desc'] = "1";
  59          $linkspage_pref['link_icon_empty'] = "0";
  60          $linkspage_pref['link_sortorder'] = "0";
  61          $linkspage_pref['link_sort'] = "order";
  62          $linkspage_pref['link_order'] = "ASC";
  63          $linkspage_pref['link_open_all'] = "5";         //use individual link open type setting
  64          $linkspage_pref['link_resize_value'] = "100";
  65  
  66          $linkspage_pref['link_manager'] = "0";
  67          $linkspage_pref['link_manager_class'] = "0";
  68          $linkspage_pref['link_directpost'] = "0";
  69          $linkspage_pref['link_directdelete'] = "0";
  70  
  71          $linkspage_pref['link_refer_minimum'] = "";
  72  
  73          $linkspage_pref['link_rating_minimum'] = "";
  74  
  75          $linkspage_pref['link_menu_caption'] = LCLAN_OPT_86;
  76          $linkspage_pref['link_menu_navigator_frontpage'] = "1";
  77          $linkspage_pref['link_menu_navigator_submit'] = "1";
  78          $linkspage_pref['link_menu_navigator_manager'] = "1";
  79          $linkspage_pref['link_menu_navigator_refer'] = "1";
  80          $linkspage_pref['link_menu_navigator_rated'] = "1";
  81          $linkspage_pref['link_menu_navigator_links'] = "1";
  82          $linkspage_pref['link_menu_navigator_category'] = "1";
  83          $linkspage_pref['link_menu_navigator_rendertype'] = "";
  84          $linkspage_pref['link_menu_navigator_caption'] = LCLAN_OPT_82;
  85          $linkspage_pref['link_menu_category'] = "1";
  86          $linkspage_pref['link_menu_category_amount'] = "1";
  87          $linkspage_pref['link_menu_category_rendertype'] = "";
  88          $linkspage_pref['link_menu_category_caption'] = LCLAN_OPT_83;
  89          $linkspage_pref['link_menu_recent'] = "1";
  90          $linkspage_pref['link_menu_recent_category'] = "";
  91          $linkspage_pref['link_menu_recent_description'] = "";
  92          $linkspage_pref["link_menu_recent_number"] = "5";
  93          $linkspage_pref['link_menu_recent_caption'] = LCLAN_OPT_84;
  94  
  95          return $linkspage_pref;
  96      }
  97  
  98      function getLinksPagePref(){
  99          global $sql, $eArrayStorage;
 100  
 101          $num_rows = $sql -> db_Select("core", "*", "e107_name='links_page' ");
 102          if ($num_rows == 0) {
 103              $linkspage_pref = $this->LinkPageDefaultPrefs();
 104              $tmp = $eArrayStorage->WriteArray($linkspage_pref);
 105              $sql -> db_Insert("core", "'links_page', '{$tmp}' ");
 106              $sql -> db_Select("core", "*", "e107_name='links_page' ");
 107          }
 108          $row = $sql -> db_Fetch();
 109          $linkspage_pref = $eArrayStorage->ReadArray($row['e107_value']);
 110  
 111          return $linkspage_pref;
 112      }
 113  
 114      function UpdateLinksPagePref(){
 115          global $sql, $eArrayStorage, $tp;
 116  
 117          $num_rows = $sql -> db_Select("core", "*", "e107_name='links_page' ");
 118          if ($num_rows == 0) {
 119              $sql -> db_Insert("core", "'links_page', '' ");
 120          }else{
 121              $row = $sql -> db_Fetch();
 122  
 123              //assign new preferences
 124              foreach($_POST as $k => $v){
 125                  if(strpos($k, "link_") === 0){
 126                      $linkspage_pref[$k] = $tp->toDB($v);
 127                  }
 128              }
 129  
 130              //create new array of preferences
 131              $tmp = $eArrayStorage->WriteArray($linkspage_pref);
 132  
 133              $sql -> db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = 'links_page' ");
 134          }
 135          return $linkspage_pref;
 136      }
 137  
 138  	function ShowNextPrev($from='0', $number, $total){
 139          global $linkspage_pref, $qs, $tp, $link_shortcodes, $LINK_NEXTPREV, $LINK_NP_TABLE, $pref;
 140  
 141          $number = (e_PAGE == 'admin_linkspage_config.php' ? '20' : $number);
 142          if($total<=$number){
 143              return;
 144          }
 145          if(e_PAGE == 'admin_linkspage_config.php' || (isset($linkspage_pref["link_nextprev"]) && $linkspage_pref["link_nextprev"])){
 146              $np_querystring = e_SELF."?[FROM]".(isset($qs[0]) ? ".".$qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
 147              $parms = $total.",".$number.",".$from.",".$np_querystring."";
 148              $LINK_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
 149  
 150              if(!isset($LINK_NP_TABLE)){
 151                  $template = (e_PAGE == 'admin_linkspage_config.php' ? e_THEME.$pref['sitetheme']."/" : THEME)."links_template.php";
 152                  if(is_readable($template)){
 153                      require_once($template);
 154                  }else{
 155                      require_once(e_PLUGIN."links_page/links_template.php");
 156                  }
 157              }
 158              echo $tp -> parseTemplate($LINK_NP_TABLE, FALSE, $link_shortcodes);
 159          }
 160      }
 161  
 162      function setPageTitle(){
 163          global $sql, $qs, $linkspage_pref;
 164  
 165          //show all categories
 166          if(!isset($qs[0]) && $linkspage_pref['link_page_categories']){
 167              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_2;
 168          }
 169          //show all categories
 170          if(isset($qs[0]) && $qs[0] == "cat" && !isset($qs[1]) ){
 171              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_2;
 172          }
 173          //show all links in all categories
 174          if( (!isset($qs[0]) && !$linkspage_pref['link_page_categories']) || (isset($qs[0]) && $qs[0] == "all") ){
 175              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_3;
 176          }
 177          //show all links in one categories
 178          if(isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && is_numeric($qs[1])){
 179              $sql -> db_Select("links_page_cat", "link_category_name", "link_category_id='".$qs[1]."' ");
 180              $row2 = $sql -> db_Fetch();
 181              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_4." / ".$row2['link_category_name'];
 182          }
 183          //view top rated
 184          if(isset($qs[0]) && $qs[0] == "rated"){
 185              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_5;
 186          }
 187          //view top refer
 188          if(isset($qs[0]) && $qs[0] == "top"){
 189              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_6;
 190          }
 191          //personal link managers
 192          if (isset($qs[0]) && $qs[0] == "manage"){
 193              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_7;
 194          }
 195          //comments on links
 196          if (isset($qs[0]) && $qs[0] == "comment" && isset($qs[1]) && is_numeric($qs[1]) ){
 197              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_8;
 198          }
 199          //submit link
 200          if (isset($qs[0]) && $qs[0] == "submit" && check_class($linkspage_pref['link_submit_class'])) {
 201              $page = LCLAN_PAGETITLE_1." / ".LCLAN_PAGETITLE_9;
 202          }
 203          //define("e_PAGETITLE", strtolower($page));
 204          define("e_PAGETITLE", $page);
 205      }
 206  
 207  
 208  
 209  
 210      function parse_link_append($rowl){
 211  
 212          global $tp, $linkspage_pref;
 213          if($linkspage_pref['link_open_all'] && $linkspage_pref['link_open_all'] == "5"){
 214              $link_open_type = $rowl['link_open'];
 215          }else{
 216              $link_open_type = $linkspage_pref['link_open_all'];
 217          }
 218  
 219          switch ($link_open_type) {
 220              case 1:
 221              $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"open_window('".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."','full');return false;\" >"; // Googlebot won't see it any other way.
 222              break;
 223              case 2:
 224              $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"location.href='".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."';return false\" >";  // Googlebot won't see it any other way.
 225              break;
 226              case 3:
 227              $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"location.href='".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."';return false\" >";  // Googlebot won't see it any other way.
 228              break;
 229              case 4:
 230              $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"open_window('".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."');return false\">"; // Googlebot won't see it any other way.
 231              break;
 232              default:
 233              $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"location.href='".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."';return false\" >";  // Googlebot won't see it any other way.
 234          }
 235          return $lappend;
 236      }
 237  
 238  
 239  
 240  
 241  
 242      function showLinkSort($mode=''){
 243          global $rs, $ns, $qs, $linkspage_pref;
 244  
 245          $check = "";
 246          if($qs){
 247              for($i=0;$i<count($qs);$i++){
 248                  if($qs[$i] && substr($qs[$i],0,5) == "order"){
 249                      $check = $qs[$i];
 250                      break;
 251                  }
 252              }
 253          }
 254          if($check){
 255              //string is like : order + a + heading
 256              $checks = substr($check,6);
 257              $checko = substr($check,5,1);
 258          }else{
 259              $checks = "";
 260              $checko = "";
 261          }
 262          $baseurl = e_PLUGIN."links_page/links.php";
 263          $qry = (isset($qs[0]) && substr($qs[0],0,5) != "order" ? $qs[0] : "").(isset($qs[1]) && substr($qs[1],0,5) != "order" ? ".".$qs[1] : "").(isset($qs[2]) && substr($qs[2],0,5) != "order" ? ".".$qs[2] : "").(isset($qs[3]) && substr($qs[3],0,5) != "order" ? ".".$qs[3] : "");
 264  
 265          $sotext = "
 266          ".$rs -> form_open("post", e_SELF, "linkorder", "", "enctype='multipart/form-data'")."
 267              ".LAN_LINKS_15."
 268              ".$rs -> form_select_open("link_sort");
 269              if($mode == "cat"){
 270                  $sotext .= "
 271                  ".$rs -> form_option(LAN_LINKS_4, ($checks == "heading" ? "1" : "0"), "heading", "")."
 272                  ".$rs -> form_option(LAN_LINKS_44, ($checks == "id" ? "1" : "0"), "id", "")."
 273                  ".$rs -> form_option(LAN_LINKS_6, ($checks == "order" ? "1" : "0"), "order", "");
 274              }else{
 275                  $sotext .= "
 276                  ".$rs -> form_option(LAN_LINKS_4, ($checks == "heading" ? "1" : "0"), "heading", "")."
 277                  ".$rs -> form_option(LAN_LINKS_5, ($checks == "url" ? "1" : "0"), "url", "")."
 278                  ".$rs -> form_option(LAN_LINKS_6, ($checks == "order" ? "1" : "0"), "order", "")."
 279                  ".$rs -> form_option(LAN_LINKS_7, ($checks == "refer" ? "1" : "0"), "refer", "")."
 280                  ".$rs -> form_option(LAN_LINKS_38, ($checks == "date" ? "1" : "0"), "date", "");
 281              }
 282              $sotext .= "
 283              ".$rs -> form_select_close()."
 284              ".LAN_LINKS_6."
 285              ".$rs -> form_select_open("link_order")."
 286              ".$rs -> form_option(LAN_LINKS_8, ($checko == "a" ? "1" : "0"), $baseurl."?".($qry ? $qry."." : "")."ordera", "")."
 287              ".$rs -> form_option(LAN_LINKS_9, ($checko == "d" ? "1" : "0"), $baseurl."?".($qry ? $qry."." : "")."orderd", "")."
 288              ".$rs -> form_select_close()."
 289              ".$rs -> form_button("button", "submit", LCLAN_ITEM_36, "style='width:25px;' onclick=\"document.location=link_order.options[link_order.selectedIndex].value+link_sort.options[link_sort.selectedIndex].value;\"", "", "")."
 290          ".$rs -> form_close();
 291  
 292          return $sotext;
 293      }
 294  
 295      function parseOrderCat($orderstring){
 296          if(substr($orderstring,6) == "heading"){
 297              $orderby        = "link_category_name";
 298              $orderby2       = "";
 299          }elseif(substr($orderstring,6) == "id"){
 300              $orderby        = "link_category_id";
 301              $orderby2       = ", link_category_name ASC";
 302          }elseif(substr($orderstring,6) == "order"){
 303              $orderby        = "link_category_order";
 304              $orderby2       = ", link_category_name ASC";
 305          }else{
 306              $orderstring    = "orderdheading";
 307              $orderby        = "link_category_name";
 308              $orderby2       = ", link_category_name ASC";
 309          }
 310          return $orderby." ".(substr($orderstring,5,1) == "a" ? "ASC" : "DESC")." ".$orderby2;
 311      }
 312  
 313      function parseOrderLink($orderstring){
 314          if(substr($orderstring,6) == "heading"){
 315              $orderby        = "link_name";
 316              $orderby2       = "";
 317          }elseif(substr($orderstring,6) == "url"){
 318              $orderby        = "link_url";
 319              $orderby2       = ", link_name ASC";
 320          }elseif(substr($orderstring,6) == "refer"){
 321              $orderby        = "link_refer";
 322              $orderby2       = ", link_name ASC";
 323          }elseif(substr($orderstring,6) == "date"){
 324              $orderby        = "link_datestamp";
 325              $orderby2       = ", link_name ASC";
 326          }elseif(substr($orderstring,6) == "order"){
 327              $orderby        = "link_order";
 328              $orderby2       = ", link_name ASC";
 329          }else{
 330              $orderstring    = "orderaorder";
 331              $orderby        = "link_order";
 332              $orderby2       = ", link_name ASC";
 333          }
 334          return $orderby." ".(substr($orderstring,5,1) == "a" ? "ASC" : "DESC")." ".$orderby2;
 335      }
 336  
 337      function getOrder($mode=''){
 338          global $qs, $linkspage_pref;
 339  
 340          if(isset($qs[0]) && substr($qs[0],0,5) == "order"){
 341              $orderstring    = $qs[0];
 342          }elseif(isset($qs[1]) && substr($qs[1],0,5) == "order"){
 343              $orderstring    = $qs[1];
 344          }elseif(isset($qs[2]) && substr($qs[2],0,5) == "order"){
 345              $orderstring    = $qs[2];
 346          }elseif(isset($qs[3]) && substr($qs[3],0,5) == "order"){
 347              $orderstring    = $qs[3];
 348          }else{
 349              if($mode == "cat"){
 350                  $orderstring    = "order".($linkspage_pref["link_cat_order"] == "ASC" ? "a" : "d" ).($linkspage_pref["link_cat_sort"] ? $linkspage_pref["link_cat_sort"] : "date" );
 351              }else{
 352                  $orderstringcat = "order".($linkspage_pref["link_cat_order"] == "ASC" ? "a" : "d" ).($linkspage_pref["link_cat_sort"] ? $linkspage_pref["link_cat_sort"] : "date" );
 353  
 354                  $orderstring    = "order".($linkspage_pref["link_order"] == "ASC" ? "a" : "d" ).($linkspage_pref["link_sort"] ? $linkspage_pref["link_sort"] : "date" );
 355              }
 356          }
 357  
 358          if($mode == "cat"){
 359              $str = $this -> parseOrderCat($orderstring);
 360          }else{
 361              if(isset($orderstringcat)){
 362                  $str = $this -> parseOrderCat($orderstringcat);
 363                  $str .= ", ".$this -> parseOrderLink($orderstring);
 364              }else{
 365                  $str = $this -> parseOrderLink($orderstring);
 366              }
 367          }
 368  
 369          $order = " ORDER BY ".$str;
 370          return $order;
 371      }
 372  
 373      function show_message($message, $caption='') {
 374          global $ns;
 375          $ns->tablerender($caption, "<div style='text-align:center'><b>".$message."</b></div>");
 376      }
 377  
 378      function uploadLinkIcon(){
 379          global $ns, $pref;
 380          $pref['upload_storagetype'] = "1";
 381          require_once(e_HANDLER."upload_handler.php");
 382          $pathicon = e_PLUGIN."links_page/link_images/";
 383          $uploaded = file_upload($pathicon);
 384  
 385          $icon = "";
 386          if($uploaded) {
 387              $icon = $uploaded[0]['name'];
 388              if($_POST['link_resize_value']){
 389                  require_once(e_HANDLER."resize_handler.php");
 390                  resize_image($pathicon.$icon, $pathicon.$icon, $_POST['link_resize_value'], "nocopy");
 391              }
 392          }
 393          $msg = ($icon ? LCLAN_ADMIN_7 : LCLAN_ADMIN_8);
 394          $this -> show_message($msg);
 395      }
 396  
 397      function uploadCatLinkIcon(){
 398          global $ns, $pref;
 399          $pref['upload_storagetype'] = "1";
 400          require_once(e_HANDLER."upload_handler.php");
 401          $pathicon = e_PLUGIN."links_page/cat_images/";
 402          $uploaded = file_upload($pathicon);
 403  
 404          $icon = "";
 405          if($uploaded) {
 406              $icon = $uploaded[0]['name'];
 407              if($_POST['link_cat_resize_value']){
 408                  require_once(e_HANDLER."resize_handler.php");
 409                  resize_image($pathicon.$icon, $pathicon.$icon, $_POST['link_cat_resize_value'], "nocopy");
 410              }
 411          }
 412          $msg = ($icon ? LCLAN_ADMIN_7 : LCLAN_ADMIN_8);
 413          $this -> show_message($msg);
 414      }
 415  
 416      function dbCategoryCreate() {
 417          global $sql, $tp;
 418          $link_t = $sql->db_Count("links_page_cat", "(*)");
 419          $sql->db_Insert("links_page_cat", " '0', '".$tp -> toDB($_POST['link_category_name'])."', '".$tp -> toDB($_POST['link_category_description'])."', '".$tp -> toDB($_POST['link_category_icon'])."', '".($link_t+1)."', '".$tp -> toDB($_POST['link_category_class'])."', '".time()."' ");
 420          $this->show_message(LCLAN_ADMIN_4);
 421      }
 422      function dbCategoryUpdate() {
 423          global $sql, $tp;
 424          $time = ($_POST['update_datestamp'] ? time() : ($_POST['link_category_datestamp'] != "0" ? $_POST['link_category_datestamp'] : time()) );
 425          $sql->db_Update("links_page_cat", "link_category_name ='".$tp -> toDB($_POST['link_category_name'])."', link_category_description='".$tp -> toDB($_POST['link_category_description'])."', link_category_icon='".$tp -> toDB($_POST['link_category_icon'])."', link_category_order='".$tp -> toDB($_POST['link_category_order'])."', link_category_class='".$tp -> toDB($_POST['link_category_class'])."', link_category_datestamp='".intval($time)."'   WHERE link_category_id='".intval($_POST['link_category_id'])."'");
 426          $this->show_message(LCLAN_ADMIN_5);
 427      }
 428  
 429      function dbOrderUpdate($order) {
 430          global $sql;
 431          foreach ($order as $order_id) {
 432              $tmp = explode(".", $order_id);
 433          $sql->db_Update("links_page", "link_order=".intval($tmp[1])." WHERE link_id=".intval($tmp[0]));
 434          }
 435          $this->show_message(LCLAN_ADMIN_9);
 436      }
 437  
 438      function dbOrderCatUpdate($order) {
 439          global $sql;
 440          foreach ($order as $order_id) {
 441              $tmp = explode(".", $order_id);
 442              $sql->db_Update("links_page_cat", "link_category_order=".intval($tmp[1])." WHERE link_category_id=".intval($tmp[0]));
 443          }
 444          $this->show_message(LCLAN_ADMIN_9);
 445      }
 446  
 447      function dbOrderUpdateInc($inc) {
 448          global $sql;
 449          $tmp = explode(".", $inc);
 450          $linkid = intval($tmp[0]);
 451          $link_order = intval($tmp[1]);
 452          $location = $tmp[2];
 453          if(isset($location)){
 454              $location = intval($location);
 455              $sql->db_Update("links_page", "link_order=link_order+1 WHERE link_order='".($link_order-1)."' AND link_category='$location'");
 456              $sql->db_Update("links_page", "link_order=link_order-1 WHERE link_id='$linkid' AND link_category='$location'");
 457          }else{
 458              $sql->db_Update("links_page_cat", "link_category_order=link_category_order+1 WHERE link_category_order='".($link_order-1)."' ");
 459              $sql->db_Update("links_page_cat", "link_category_order=link_category_order-1 WHERE link_category_id='$linkid' ");
 460          }
 461      }
 462  
 463      function dbOrderUpdateDec($dec) {
 464          global $sql;
 465          $tmp = explode(".", $dec);
 466          $linkid = intval($tmp[0]);
 467          $link_order = intval($tmp[1]);
 468          $location = $tmp[2];
 469          if(isset($location)){
 470              $location = intval($location);
 471              $sql->db_Update("links_page", "link_order=link_order-1 WHERE link_order='".($link_order+1)."' AND link_category='$location'");
 472              $sql->db_Update("links_page", "link_order=link_order+1 WHERE link_id='$linkid' AND link_category='$location'");
 473          }else{
 474              $sql->db_Update("links_page_cat", "link_category_order=link_category_order-1 WHERE link_category_order='".($link_order+1)."' ");
 475              $sql->db_Update("links_page_cat", "link_category_order=link_category_order+1 WHERE link_category_id='$linkid' ");
 476          }
 477      }
 478  
 479      function dbLinkCreate($mode='') {
 480          global $ns, $tp, $qs, $sql, $e107cache, $e_event, $linkspage_pref;
 481  
 482          $link_name          = $tp->toDB($_POST['link_name']);
 483          $link_url           = $tp->toDB($_POST['link_url']);
 484          $link_description   = $tp->toDB($_POST['link_description']);
 485          $link_button        = $tp->toDB($_POST['link_but']);
 486  
 487          if (!strstr($link_url, "http")) {
 488              $link_url = "http://".$link_url;
 489          }
 490  
 491          //create link, submit area, tmp table
 492          if(isset($mode) && $mode == "submit"){
 493              if (!$_POST['link_name'] || !$_POST['link_url'] || !$_POST['link_description']) {
 494                   message_handler("ALERT", 5);
 495              } else {
 496                  $username           = (defined('USERNAME')) ? USERNAME : LAN_LINKS_3;
 497  
 498                  $submitted_link     = intval($_POST['cat_id'])."^".$link_name."^".$link_url."^".$link_description."^".$link_button."^".$username;
 499                  $sql->db_Insert("tmp", "'submitted_link', '".time()."', '$submitted_link' ");
 500  
 501                  $edata_ls = array("link_category" => $_POST['cat_id'], "link_name" => $link_name, "link_url" => $link_url, "link_description" => $link_description, "link_button" => $link_button, "username" => $username, "submitted_link" => $submitted_link);
 502                  $e_event->trigger("linksub", $edata_ls);
 503                  //header("location:".e_SELF."?s");
 504                  js_location(e_SELF."?s");
 505              }
 506          }else{
 507              $link_t = $sql->db_Count("links_page", "(*)", "WHERE link_category='".intval($_POST['cat_id'])."'");
 508              $time   = ($_POST['update_datestamp'] ? time() : ($_POST['link_datestamp'] != "0" ? $_POST['link_datestamp'] : time()) );
 509  
 510              //update link
 511              if (is_numeric($qs[2]) && $qs[1] != "sn") {
 512                  $link_class = $_POST['link_class'];
 513                  if($qs[1] == "manage"){
 514                      $link_author = USERID;
 515                  }else{
 516                      $link_author = ($_POST['link_author'] && $_POST['link_author']!='' ? $tp -> toDB($_POST['link_author']) : USERID);
 517                  }
 518  
 519                  $sql->db_Update("links_page", "link_name='$link_name', link_url='$link_url', link_description='$link_description', link_button= '$link_button', link_category='".intval($_POST['cat_id'])."', link_open='".intval($_POST['linkopentype'])."', link_class='".intval($link_class)."', link_datestamp='".intval($time)."', link_author='".$link_author."' WHERE link_id='".intval($qs[2])."'");
 520                  $e107cache->clear("sitelinks");
 521                  $this->show_message(LCLAN_ADMIN_3);
 522              //create link
 523              } else {
 524  
 525                  $sql->db_Insert("links_page", "0, '$link_name', '$link_url', '$link_description', '$link_button', '".intval($_POST['cat_id'])."', '".($link_t+1)."', '0', '".intval($_POST['linkopentype'])."', '".intval($_POST['link_class'])."', '".time()."', '".USERID."' ");
 526                  $e107cache->clear("sitelinks");
 527                  $this->show_message(LCLAN_ADMIN_2);
 528              }
 529              //delete from tmp table after approval
 530              if (is_numeric($qs[2]) && $qs[1] == "sn") {
 531                  $sql->db_Delete("tmp", "tmp_time='".intval($qs[2])."' ");
 532              }
 533          }
 534      }
 535  
 536      function show_link_create() {
 537          global $sql, $rs, $qs, $ns, $fl, $linkspage_pref;
 538  
 539          $row['link_category']       = "";
 540          $row['link_name']           = "";
 541          $row['link_url']            = "";
 542          $row['link_description']    = "";
 543          $row['link_button']         = "";
 544          $row['link_open']           = "";
 545          $row['link_class']          = "";
 546          $link_resize_value          = (isset($linkspage_pref['link_resize_value']) && $linkspage_pref['link_resize_value'] ? $linkspage_pref['link_resize_value'] : "100");
 547  
 548          if (isset($qs[1]) && $qs[1] == 'edit' && !isset($_POST['submit'])) {
 549              if ($sql->db_Select("links_page", "*", "link_id='".intval($qs[2])."' ")) {
 550                  $row = $sql->db_Fetch();
 551              }
 552          }
 553  
 554          if (isset($qs[1]) && $qs[1] == 'sn') {
 555              if ($sql->db_Select("tmp", "*", "tmp_time='".intval($qs[2])."'")) {
 556                  $row = $sql->db_Fetch();
 557                  $submitted                  = explode("^", $row['tmp_info']);
 558                  $row['link_category']       = $submitted[0];
 559                  $row['link_name']           = $submitted[1];
 560                  $row['link_url']            = $submitted[2];
 561                  $row['link_description']    = $submitted[3]."\n[i]".LCLAN_ITEM_1." ".$submitted[5]."[/i]";
 562                  $row['link_button']         = $submitted[4];
 563  
 564              }
 565          }
 566  
 567          if(isset($_POST['uploadlinkicon'])){
 568              $row['link_category']       = $_POST['cat_id'];
 569              $row['link_name']           = $_POST['link_name'];
 570              $row['link_url']            = $_POST['link_url'];
 571              $row['link_description']    = $_POST['link_description'];
 572              $row['link_button']         = $_POST['link_but'];
 573              $row['link_open']           = $_POST['linkopentype'];
 574              $row['link_class']          = $_POST['link_class'];
 575              $link_resize_value          = (isset($_POST['link_resize_value']) && $_POST['link_resize_value'] ? $_POST['link_resize_value'] : $link_resize_value);
 576          }
 577          $width = (e_PAGE == "admin_linkspage_config.php" ? ADMIN_WIDTH : "width:100%;");
 578          $text = "
 579          <div style='text-align:center'>
 580          ".$rs -> form_open("post", e_SELF."?".e_QUERY, "linkform", "", "enctype='multipart/form-data'", "")."
 581          <table style='".$width."' class='fborder' cellspacing='0' cellpadding='0'>
 582          <tr>
 583          <td style='width:30%' class='forumheader3'>".LCLAN_ITEM_2."</td>
 584          <td style='width:70%' class='forumheader3'>";
 585  
 586          if (!$link_cats = $sql->db_Select("links_page_cat")) {
 587              $text .= LCLAN_ITEM_3."<br />";
 588          } else {
 589              $text .= $rs -> form_select_open("cat_id", "");
 590              while (list($cat_id, $cat_name, $cat_description) = $sql->db_Fetch()) {
 591                  if ( (isset($row['link_category']) && $row['link_category'] == $cat_id) || (isset($row['linkid']) && $cat_id == $row['linkid'] && $action == "add") ) {
 592                      $text .= $rs -> form_option($cat_name, "1", $cat_id, "");
 593                  } else {
 594                      $text .= $rs -> form_option($cat_name, "0", $cat_id, "");
 595                  }
 596              }
 597              $text .= $rs -> form_select_close();
 598          }
 599          $text .= "
 600          </td>
 601          </tr>
 602          <tr>
 603          <td style='width:30%' class='forumheader3'>".LCLAN_ITEM_4."</td>
 604          <td style='width:70%' class='forumheader3'>
 605              ".$rs -> form_text("link_name", 60, $row['link_name'], 100)."
 606          </td>
 607          </tr>
 608          <tr>
 609          <td style='width:30%' class='forumheader3'>".LCLAN_ITEM_5."</td>
 610          <td style='width:70%' class='forumheader3'>
 611              ".$rs -> form_text("link_url", 60, $row['link_url'], 200)."
 612          </td>
 613          </tr>
 614          <tr>
 615          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_ITEM_6."</td>
 616          <td style='width:70%' class='forumheader3'>
 617              ".$rs -> form_textarea("link_description", '59', '3', $row['link_description'], "", "", "", "", "")."
 618          </td>
 619          </tr>
 620          <tr>
 621          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_ITEM_7."</td>
 622          <td style='width:70%' class='forumheader3'>";
 623              if(!FILE_UPLOADS){
 624                  $text .= "<b>".LCLAN_ITEM_9."</b>";
 625              }else{
 626                  if(!is_writable(e_PLUGIN."links_page/link_images/")){
 627                      $text .= "<b>".LCLAN_ITEM_10." ".e_PLUGIN."links_page/link_images/ ".LCLAN_ITEM_11."</b><br />";
 628                  }
 629                  $text .= "
 630                  <input class='tbox' type='file' name='file_userfile[]'  size='58' /><br />
 631                  ".LCLAN_ITEM_8." ".$rs -> form_text("link_resize_value", 3, $link_resize_value, 3)."&nbsp;".LCLAN_ITEM_12."
 632                  ".$rs -> form_button("submit", "uploadlinkicon", LCLAN_ITEM_13, "", "", "");
 633              }
 634          $text .= "
 635          </td>
 636          </tr>";
 637  
 638          $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'blank*');
 639          $iconpath = e_PLUGIN."links_page/link_images/";
 640          $iconlist = $fl->get_files($iconpath,"",$rejectlist);
 641  
 642          $text .= "
 643          <tr>
 644          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_ITEM_14."</td>
 645          <td style='width:70%; vertical-align:top;' class='forumheader3'>
 646          <input class='tbox' type='text' name='link_but' id='link_but' size='60' value='".$row['link_button']."' maxlength='100' />
 647              <div id='linkbut' style='display:block; vertical-align:top;'><table style='text-align:left; width:100%;'><tr><td style='width:20%; padding-right:10px;'>";
 648              $selectjs   = " onchange=\"document.getElementById('link_but').value=this.options[this.selectedIndex].value; if(this.options[this.selectedIndex].value!=''){document.getElementById('iconview').src='".$iconpath."'+this.options[this.selectedIndex].value; document.getElementById('iconview').style.display='block';}else{document.getElementById('iconview').src='';document.getElementById('iconview').style.display='none';}\"";
 649              $text       .= $rs -> form_select_open("link_button", $selectjs);
 650              $text       .= $rs -> form_option(LCLAN_ITEM_34, ($row['link_button'] ? "0" : "1"), "");
 651              foreach($iconlist as $icon){
 652                  $text   .= $rs -> form_option($icon['fname'], ($icon['fname'] == $row['link_button'] ? "1" : "0"), $icon['fname'] );
 653              }
 654              $text .= $rs -> form_select_close();
 655              if(isset($row['link_button']) && $row['link_button']){
 656                  $img = $iconpath.$row['link_button'];
 657              }else{
 658                  $blank_display = 'display: none';
 659                  $img = e_PLUGIN."links_page/images/blank.gif";
 660              }
 661              $text .= "</td><td><img id='iconview' src='".$img."' style='width:".$link_resize_value."px; border:0; ".$blank_display."' /><br /><br /></td></tr></table>";
 662              $text .= "</div>
 663          </td>
 664          </tr>";
 665  
 666          //0=same window, 1=_blank, 2=_parent, 3=_top, 4=miniwindow
 667          $text .= "
 668          <tr>
 669          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_ITEM_16."</td>
 670          <td style='width:70%' class='forumheader3'>
 671              ".$rs -> form_select_open("linkopentype")."
 672              ".$rs -> form_option(LCLAN_ITEM_17, ($row['link_open'] == "0" ? "1" : "0"), "0", "")."
 673              ".$rs -> form_option(LCLAN_ITEM_18, ($row['link_open'] == "1" ? "1" : "0"), "1", "")."
 674              ".$rs -> form_option(LCLAN_ITEM_19, ($row['link_open'] == "4" ? "1" : "0"), "4", "")."
 675              ".$rs -> form_select_close()."
 676          </td>
 677          </tr>
 678          <tr>
 679          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_ITEM_20."</td>
 680          <td style='width:70%' class='forumheader3'>
 681              ".r_userclass("link_class", $row['link_class'], "off", "public,guest,nobody,member,admin,classes")."
 682          </td>
 683          </tr>
 684          <tr style='vertical-align:top'>
 685          <td colspan='2' style='text-align:center' class='forumheader'>";
 686          if (isset($qs[2]) && $qs[2] && $qs[1] == "edit") {
 687              $text .= $rs -> form_hidden("link_datestamp", $row['link_datestamp']);
 688              $text .= $rs -> form_checkbox("update_datestamp", 1, 0)." ".LCLAN_ITEM_21."<br /><br />";
 689              $text .= $rs -> form_button("submit", "add_link", LCLAN_ITEM_22, "", "", "").$rs -> form_hidden("link_id", $row['link_id']).$rs -> form_hidden("link_author", $row['link_author']);
 690  
 691          } else {
 692              $text .= $rs -> form_button("submit", "add_link", LCLAN_ITEM_23, "", "", "");
 693          }
 694          $text .= "</td>
 695          </tr>
 696          </table>
 697          ".$rs -> form_close()."
 698          </div>";
 699  
 700          $ns->tablerender(LCLAN_ITEM_24, $text);
 701      }
 702  
 703      function show_links() {
 704          global $sql, $qs, $rs, $ns, $tp, $from;
 705          $number = "20";
 706  
 707          if($qs[2] == "all"){
 708              $caption = LCLAN_ITEM_38;
 709              $qry = " link_id != '' ORDER BY link_category ASC, link_order ASC";
 710          }else{
 711              if ($sql->db_Select("links_page_cat", "link_category_name", "link_category_id='".intval($qs[2])."' " )) {
 712                  $row = $sql->db_Fetch();
 713                  $caption = LCLAN_ITEM_2." ".$row['link_category_name'];
 714              }
 715              $qry = " link_category=".intval($qs[2])." ORDER BY link_order, link_id ASC";
 716          }
 717  
 718          $link_total = $sql->db_Select("links_page", "*", " ".$qry." ");
 719          if (!$sql->db_Select("links_page", "*", " ".$qry." LIMIT ".intval($from).",".intval($number)." ")) {
 720              js_location(e_SELF."?link");
 721          }else{
 722              $text = $rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "myform_{$row['link_id']}", "", "");
 723              $text .= "<div style='text-align:center'>
 724              <table class='fborder' style='".ADMIN_WIDTH."'>
 725              <tr>
 726              <td class='fcaption' style='width:5%'>".LCLAN_ITEM_25."</td>
 727              <td class='fcaption' style='width:65%'>".LCLAN_ITEM_26."</td>
 728              <td class='fcaption' style='width:10%'>".LCLAN_ITEM_27."</td>
 729              <td class='fcaption' style='width:10%'>".LCLAN_ITEM_28."</td>
 730              <td class='fcaption' style='width:10%'>".LCLAN_ITEM_29."</td>
 731              </tr>";
 732              while ($row = $sql->db_Fetch()) {
 733                  $linkid = $row['link_id'];
 734                  $img = "";
 735                  if ($row['link_button']) {
 736                      if (strpos($row['link_button'], "http://") !== FALSE) {
 737                          $img = "<img style='border:0;' src='".$row['link_button']."' alt='".$LINK_CAT_NAME."' />";
 738                      } else {
 739                          if(strstr($row['link_button'], "/")){
 740                              $img = "<img style='border:0;' src='".e_BASE.$row['link_button']."' alt='".$LINK_CAT_NAME."' />";
 741                          }else{
 742                              $img = "<img style='border:0' src='".e_PLUGIN."links_page/link_images/".$row['link_button']."' alt='".$LINK_CAT_NAME."' />";
 743                          }
 744                      }
 745                  }
 746                  if($row['link_order'] == "1"){
 747                      $up = "&nbsp;&nbsp;&nbsp;";
 748                  }else{
 749                      $up = "<input type='image' src='".LINK_ICON_ORDER_UP_BASE."' value='".$linkid.".".$row['link_order'].".".$row['link_category']."' name='inc' />";
 750                  }
 751                  if($row['link_order'] == $link_total){
 752                      $down = "&nbsp;&nbsp;&nbsp;";
 753                  }else{
 754                      $down = "<input type='image' src='".LINK_ICON_ORDER_DOWN_BASE."' value='".$linkid.".".$row['link_order'].".".$row['link_category']."' name='dec' />";
 755                  }
 756                  $text .= "
 757                  <tr>
 758                  <td class='forumheader3' style='width:5%; text-align: center; vertical-align: middle'>".$img."</td>
 759                  <td style='width:65%' class='forumheader3'>
 760                      <a href='".e_PLUGIN."links_page/links.php?".$row['link_id']."' rel='external'>".LINK_ICON_LINK."</a> ".$row['link_name']."
 761                  </td>
 762                  <td style='width:10%; text-align:center; white-space: nowrap' class='forumheader3'>
 763                      <a href='".e_SELF."?link.edit.".$linkid."' title='".LCLAN_ITEM_31."'>".LINK_ICON_EDIT."</a>
 764                      <input type='image' title='delete' name='delete[main_{$linkid}]' alt='".LCLAN_ITEM_32."' src='".LINK_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_ITEM_33." [ ".$row['link_name']." ]")."')\" />
 765                  </td>
 766                  <td style='width:10%; text-align:center; white-space: nowrap' class='forumheader3'>
 767                      ".$up."
 768                      ".$down."
 769                  </td>
 770                  <td style='width:10%; text-align:center' class='forumheader3'>
 771                      <select name='link_order[]' class='tbox'>";
 772                      //".$rs -> form_select_open("link_order[]");
 773                      for($a = 1; $a <= $link_total; $a++) {
 774                          $text .= $rs -> form_option($a, ($row['link_order'] == $a ? "1" : "0"), $linkid.".".$a, "");
 775                      }
 776                      $text .= $rs -> form_select_close()."
 777                  </td>
 778                  </tr>";
 779              }
 780              $text .= "
 781              <tr>
 782              <td class='forumheader' colspan='4'>&nbsp;</td>
 783              <td class='forumheader' style='width:5%; text-align:center'>
 784              ".$rs->form_button("submit", "update_order", LCLAN_ITEM_30)."
 785              </td>
 786              </tr>
 787              </table></div>
 788              ".$rs->form_close();
 789          }
 790          $ns->tablerender($caption, $text);
 791          $this->ShowNextPrev($from, $number, $link_total);
 792      }
 793  
 794      function show_cat_create() {
 795          global $qs, $sql, $rs, $ns, $tp, $fl;
 796  
 797          $row['link_category_name']          = "";
 798          $row['link_category_description']   = "";
 799          $row['link_category_icon']          = "";
 800          $link_cat_resize_value              = (isset($linkspage_pref['link_cat_resize_value']) && $linkspage_pref['link_cat_resize_value'] ? $linkspage_pref['link_cat_resize_value'] : "50");
 801  
 802          if(isset($_POST['uploadcatlinkicon'])){
 803              $row['link_category_name']          = $_POST['link_category_name'];
 804              $row['link_category_description']   = $_POST['link_category_description'];
 805              $row['link_category_icon']          = $_POST['link_category_icon'];
 806              $link_cat_resize_value              = (isset($_POST['link_cat_resize_value']) && $_POST['link_cat_resize_value'] ? $_POST['link_cat_resize_value'] : $link_cat_resize_value);
 807          }
 808          if ($qs[1] == "edit") {
 809              if ($sql->db_Select("links_page_cat", "*", "link_category_id='".intval($qs[2])."' ")) {
 810                  $row = $sql->db_Fetch();
 811              }
 812          }
 813          if(isset($_POST['category_clear'])){
 814              $row['link_category_name']          = "";
 815              $row['link_category_description']   = "";
 816              $row['link_category_icon']          = "";
 817          }
 818          $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
 819          $iconlist = $fl->get_files(e_PLUGIN."links_page/cat_images/","",$rejectlist);
 820  
 821          $text = "<div style='text-align:center'>
 822          ".$rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "linkform", "", "enctype='multipart/form-data'", "")."
 823          <table class='fborder' style='".ADMIN_WIDTH."'>
 824          <tr>
 825          <td class='forumheader3' style='width:30%'>".LCLAN_CAT_13."</td>
 826          <td class='forumheader3' style='width:70%'>".$rs->form_text("link_category_name", 50, $row['link_category_name'], 200)."</td>
 827          </tr>
 828          <tr>
 829          <td class='forumheader3' style='width:30%; vertical-align:top;'>".LCLAN_CAT_14."</td>
 830          <td class='forumheader3' style='width:70%'>".$rs->form_text("link_category_description", 60, $row['link_category_description'], 200)."</td>
 831          </tr>
 832          <tr>
 833          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_CAT_15."</td>
 834          <td style='width:70%' class='forumheader3'>";
 835              if(!FILE_UPLOADS){
 836                  $text .= "<b>".LCLAN_CAT_17."</b>";
 837              }else{
 838                  if(!is_writable(e_PLUGIN."links_page/cat_images/")){
 839                      $text .= "<b>".LCLAN_CAT_18." ".e_PLUGIN."links_page/cat_images/ ".LCLAN_CAT_19."</b><br />";
 840                  }
 841                  $text .= "
 842                  <input class='tbox' type='file' name='file_userfile[]'  size='58' /><br />
 843                  ".LCLAN_CAT_16." ".$rs -> form_text("link_cat_resize_value", 3, $link_cat_resize_value, 3)."&nbsp;".LCLAN_CAT_20."
 844                  ".$rs -> form_button("submit", "uploadcatlinkicon", LCLAN_CAT_21, "", "", "");
 845              }
 846          $text .= "
 847          </td>
 848          </tr>
 849          <tr>
 850          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_CAT_22."</td>
 851          <td style='width:70%' class='forumheader3'>
 852              ".$rs -> form_text("link_category_icon", 60, $row['link_category_icon'], 100)."
 853              ".$rs -> form_button("button", '', LCLAN_CAT_23, "onclick=\"expandit('catico')\"")."
 854              <div id='catico' style='{head}; display:none'>";
 855              foreach($iconlist as $icon){
 856                  $text .= "<a href=\"javascript:insertext('".$icon['fname']."','link_category_icon','catico')\"><img src='".$icon['path'].$icon['fname']."' style='border:0' alt='' /></a> ";
 857              }
 858              $text .= "</div>
 859          </td>
 860          </tr>
 861          <tr>
 862          <td style='width:30%; vertical-align:top;' class='forumheader3'>".LCLAN_CAT_24."</td>
 863          <td style='width:70%' class='forumheader3'>
 864              ".r_userclass("link_category_class", $row['link_category_class'], "off", "public,guest,nobody,member,admin,classes")."
 865          </td>
 866          </tr>
 867          <tr><td colspan='2' style='text-align:center' class='forumheader'>";
 868          if (is_numeric($qs[2])) {
 869              $text .= $rs -> form_hidden("link_category_order", $row['link_category_order']);
 870              $text .= $rs -> form_hidden("link_category_datestamp", $row['link_category_datestamp']);
 871              $text .= $rs -> form_checkbox("update_datestamp", 1, 0)." ".LCLAN_CAT_25."<br /><br />";
 872              $text .= $rs -> form_button("submit", "update_category", LCLAN_CAT_26, "", "", "");
 873              $text .= $rs -> form_button("submit", "category_clear", LCLAN_CAT_27). $rs->form_hidden("link_category_id", $qs[2]);
 874  
 875          } else {
 876              $text .= $rs -> form_button("submit", "create_category", LCLAN_CAT_28, "", "", "");
 877          }
 878          $text .= "</td></tr></table>
 879          ".$rs->form_close()."
 880          </div>";
 881  
 882          $ns->tablerender(LCLAN_CAT_29, $text);
 883          unset($row['link_category_name'], $row['link_category_description'], $row['link_category_icon']);
 884      }
 885  
 886      function show_categories($mode) {
 887          global $sql, $rs, $ns, $tp, $fl;
 888  
 889          if ($category_total = $sql->db_Select("links_page_cat", "*", "ORDER BY link_category_order ASC", "mode=no_where")) {
 890              $text = "
 891              <div style='text-align: center'>
 892              ".$rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "", "", "")."
 893              <table class='fborder' style='".ADMIN_WIDTH."'>
 894              <tr>
 895              <td style='width:5%' class='fcaption'>".LCLAN_CAT_1."</td>
 896              <td class='fcaption'>".LCLAN_CAT_2."</td>
 897              <td style='width:10%' class='fcaption'>".LCLAN_CAT_3."</td>";
 898              if($mode == "cat"){
 899                  $text .= "
 900                  <td class='fcaption' style='width:10%'>".LCLAN_CAT_4."</td>
 901                  <td class='fcaption' style='width:10%'>".LCLAN_CAT_5."</td>";
 902              }
 903              $text .= "
 904              </tr>";
 905              while ($row = $sql->db_Fetch()) {
 906                  $linkcatid = $row['link_category_id'];
 907                  if ($row['link_category_icon']) {
 908                      $img = (strstr($row['link_category_icon'], "/") ? "<img src='".e_BASE.$row['link_category_icon']."' alt='' style='vertical-align:middle' />" : "<img src='".e_PLUGIN."links_page/cat_images/".$row['link_category_icon']."' alt='' style='vertical-align:middle' />");
 909                  } else {
 910                      $img = "&nbsp;";
 911                  }
 912                  $text .= "
 913                  <tr>
 914                  <td style='width:5%; text-align:center' class='forumheader3'>".$img."</td>
 915                  <td class='forumheader3'>
 916                      <a href='".e_PLUGIN."links_page/links.php?cat.".$linkcatid."' rel='external'>".LINK_ICON_LINK."</a>
 917                      ".$row['link_category_name']."<br /><span class='smalltext'>".$row['link_category_description']."</span>
 918                  </td>";
 919                  if($mode == "cat"){
 920                      if($row['link_category_order'] == "1"){
 921                          $up = "&nbsp;&nbsp;&nbsp;";
 922                      }else{
 923                          $up = "<input type='image' src='".LINK_ICON_ORDER_UP_BASE."' value='".$linkcatid.".".$row['link_category_order']."' name='inc' />";
 924                      }
 925                      if($row['link_category_order'] == $category_total){
 926                          $down = "&nbsp;&nbsp;&nbsp;";
 927                      }else{
 928                          $down = "<input type='image' src='".LINK_ICON_ORDER_DOWN_BASE."' value='".$linkcatid.".".$row['link_category_order']."' name='dec' />";
 929                      }
 930                      $text .= "
 931                      <td style='width:10%; text-align:center; white-space: nowrap' class='forumheader3'>
 932                          <a href='".e_SELF."?cat.edit.".$linkcatid."' title='".LCLAN_CAT_6."'>".LINK_ICON_EDIT."</a>
 933                          <input type='image' title='delete' name='delete[category_{$linkcatid}]' alt='".LCLAN_CAT_7."' src='".LINK_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_CAT_8." [ ".$row['link_category_name']." ]")."')\"/>
 934                      </td>
 935                      <td style='width:10%; text-align:center; white-space: nowrap' class='forumheader3'>
 936                          ".$up."
 937                          ".$down."
 938                      </td>
 939                      <td style='width:10%; text-align:center' class='forumheader3'>
 940                          <select name='link_category_order[]' class='tbox'>";
 941                          for($a = 1; $a <= $category_total; $a++) {
 942                              $text .= $rs -> form_option($a, ($row['link_category_order'] == $a ? "1" : "0"), $linkcatid.".".$a, "");
 943                          }
 944                          $text .= $rs -> form_select_close()."
 945                      </td>";
 946                  }else{
 947                      $text .= "<td style='width:10%; text-align:center; white-space: nowrap' class='forumheader3'>
 948                      <a href='".e_SELF."?link.view.".$linkcatid."' title='".LCLAN_CAT_9."'>".LINK_ICON_EDIT."</a></td>";
 949                  }
 950                  $text .= "
 951                  </tr>\n";
 952              }
 953              if($mode == "cat"){
 954                  $text .= "
 955                  <tr>
 956                  <td class='forumheader' colspan='4'>&nbsp;</td>
 957                  <td class='forumheader' style='width:5%; text-align:center'>
 958                  ".$rs->form_button("submit", "update_category_order", LCLAN_CAT_10)."
 959                  </td>
 960                  </tr>";
 961              }else{
 962                  $text .= "
 963                  <tr>
 964                  <td class='forumheader' colspan='2'>&nbsp;</td>
 965                  <td class='forumheader' style='width:5%; text-align:center'>".$rs->form_button("button", "viewalllinks", LCLAN_ITEM_37, "onclick=\"document.location='".e_SELF."?link.view.all';\"")."
 966                  </td>
 967                  </tr>";
 968              }
 969              $text .= "
 970              </table>
 971              ".$rs->form_close()."
 972              </div>";
 973          } else {
 974              $text = "<div style='text-align:center'>".LCLAN_CAT_11."</div>";
 975          }
 976          $ns->tablerender(LCLAN_CAT_12, $text);
 977          unset($row['link_category_name'], $row['link_category_description'], $row['link_category_icon']);
 978      }
 979  
 980      function show_submitted() {
 981          global $sql, $rs, $qs, $ns, $tp;
 982  
 983          if (!$submitted_total = $sql->db_Select("tmp", "*", "tmp_ip='submitted_link' ")) {
 984              $text = "<div style='text-align:center'>".LCLAN_SL_2."</div>";
 985          }else{
 986              $text = "
 987              ".$rs->form_open("post", e_SELF."?sn", "submitted_links")."
 988              <table class='fborder' style='".ADMIN_WIDTH."'>
 989              <tr>
 990              <td style='width:60%' class='fcaption'>".LCLAN_SL_3."</td>
 991              <td style='width:30%' class='fcaption'>".LCLAN_SL_4."</td>
 992              <td style='width:10%; white-space:nowrap; text-align:center' class='fcaption'>".LCLAN_SL_5."</td>
 993              </tr>";
 994              while ($row = $sql->db_Fetch()) {
 995                  $tmp_time = $row['tmp_time'];
 996                  $submitted = explode("^", $row['tmp_info']);
 997                  if (!strstr($submitted[2], "http")) {
 998                      $submitted[2] = "http://".$submitted[2];
 999                  }
1000                  $text .= "<tr>
1001                  <td style='width:60%' class='forumheader3'><a href='".$submitted[2]."' rel='external'>".$submitted[2]."</a></td>
1002                  <td style='width:30%' class='forumheader3'>".$submitted[5]."</td>
1003                  <td style='width:10%; white-space:nowrap; text-align:center; vertical-align:top' class='forumheader3'>
1004                      <a href='".e_SELF."?link.sn.".$tmp_time."' title='".LCLAN_SL_6."'>".LINK_ICON_EDIT."</a>
1005                      <input type='image' title='delete' name='delete[sn_{$tmp_time}]' alt='".LCLAN_SL_7."' src='".LINK_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_SL_8." [ ".$tmp_time." ]")."')\" />
1006                  </td>
1007                  </tr>\n";
1008              }
1009              $text .= "</table>".$rs->form_close();
1010          }
1011          $ns->tablerender(LCLAN_SL_1, $text);
1012      }
1013  
1014      function show_pref_options() {
1015          global $linkspage_pref, $ns, $rs, $pref;
1016  
1017          $text = "
1018          <script type=\"text/javascript\">
1019          <!--
1020          var hideid=\"optgeneral\";
1021          function showhideit(showid){
1022              if (hideid!=showid){
1023                  show=document.getElementById(showid).style;
1024                  hide=document.getElementById(hideid).style;
1025                  show.display=\"\";
1026                  hide.display=\"none\";
1027  
1028                  //showh=document.getElementById(showid+'help').style;
1029                  //hideh=document.getElementById(hideid+'help').style;
1030                  //showh.display=\"\";
1031                  //hideh.display=\"none\";
1032  
1033                  hideid = showid;
1034              }
1035          }
1036          //-->
1037          </script>";
1038  
1039          $TOPIC_ROW = "
1040          <tr>
1041              <td class='forumheader3' style='width:25%; white-space:nowrap; vertical-align:top;'>{TOPIC_TOPIC}</td>
1042              <td class='forumheader3' style='vertical-align:top;'>{TOPIC_FIELD}</td>
1043          </tr>";
1044  
1045          $TOPIC_TITLE_ROW = "<tr><td colspan='2' class='fcaption'>{TOPIC_CAPTION}</td></tr>";
1046          $TOPIC_ROW_SPACER = "<tr><td style='height:20px;' colspan='2'></td></tr>";
1047          $TOPIC_TABLE_END = $this->pref_submit()."</table></div>";
1048  
1049          $text .= "
1050          <div style='text-align:center'>
1051          ".$rs -> form_open("post", e_SELF."?".e_QUERY, "optform", "", "", "")."
1052  
1053          <div id='optgeneral' style='text-align:center'>
1054          <table style='".ADMIN_WIDTH."' class='fborder'>";
1055  
1056          $TOPIC_CAPTION = LCLAN_OPT_MENU_1;
1057          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
1058  
1059          $TOPIC_TOPIC = LCLAN_OPT_7;
1060          $TOPIC_FIELD = "
1061          ".$rs -> form_radio("link_page_categories", "1", ($linkspage_pref['link_page_categories'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1062          ".$rs -> form_radio("link_page_categories", "0", ($linkspage_pref['link_page_categories'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1063          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1064  
1065          $TOPIC_TOPIC = LCLAN_OPT_8;
1066          $TOPIC_FIELD = "
1067          ".$rs -> form_radio("link_submit", "1", ($linkspage_pref['link_submit'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1068          ".$rs -> form_radio("link_submit", "0", ($linkspage_pref['link_submit'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1069          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1070  
1071          $TOPIC_TOPIC = LCLAN_OPT_9;
1072          $TOPIC_FIELD = r_userclass("link_submit_class", $linkspage_pref['link_submit_class']);
1073          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1074  
1075          $TOPIC_TOPIC = LCLAN_OPT_48;
1076          $TOPIC_FIELD = "
1077          ".$rs -> form_radio("link_submit_directpost", "1", ($linkspage_pref['link_submit_directpost'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1078          ".$rs -> form_radio("link_submit_directpost", "0", ($linkspage_pref['link_submit_directpost'] ? "0" : "1"), "", "").LCLAN_OPT_4."<br />".LCLAN_OPT_49;
1079          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1080  
1081          //link_nextprev
1082          $TOPIC_TOPIC = LCLAN_OPT_10;
1083          $TOPIC_FIELD = "
1084          ".$rs -> form_radio("link_nextprev", "1", ($linkspage_pref["link_nextprev"] ? "1" : "0"), "", "").LCLAN_OPT_3."
1085          ".$rs -> form_radio("link_nextprev", "0", ($linkspage_pref["link_nextprev"] ? "0" : "1"), "", "").LCLAN_OPT_4;
1086          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1087  
1088          //link_nextprev_number
1089          $TOPIC_TOPIC = LCLAN_OPT_11;
1090          $TOPIC_FIELD = $rs -> form_select_open("link_nextprev_number");
1091          for($i=2;$i<52;$i++){
1092              $TOPIC_FIELD .= $rs -> form_option($i, ($linkspage_pref["link_nextprev_number"] == $i ? "1" : "0"), $i);
1093              $i++;
1094          }
1095          $TOPIC_FIELD .= $rs -> form_select_close();
1096          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1097  
1098          //link_comment
1099          $TOPIC_TOPIC = LCLAN_OPT_55;
1100          $TOPIC_FIELD = "
1101          ".$rs -> form_radio("link_comment", "1", ($linkspage_pref["link_comment"] ? "1" : "0"), "", "").LCLAN_OPT_3."
1102          ".$rs -> form_radio("link_comment", "0", ($linkspage_pref["link_comment"] ? "0" : "1"), "", "").LCLAN_OPT_4;
1103          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1104  
1105          $TOPIC_TOPIC = LCLAN_OPT_27;
1106          $TOPIC_FIELD = "
1107          ".$rs -> form_radio("link_rating", "1", ($linkspage_pref['link_rating'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1108          ".$rs -> form_radio("link_rating", "0", ($linkspage_pref['link_rating'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1109          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1110  
1111          $TOPIC_TOPIC = LCLAN_OPT_62;
1112          $TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap; width:20%;'>
1113          ".$rs -> form_checkbox("link_navigator_frontpage", 1, ($linkspage_pref['link_navigator_frontpage'] ? "1" : "0"))." ".LCLAN_OPT_60."<br />
1114          ".$rs -> form_checkbox("link_navigator_submit", 1, ($linkspage_pref['link_navigator_submit'] ? "1" : "0"))." ".LCLAN_OPT_58."<br />
1115          ".$rs -> form_checkbox("link_navigator_manager", 1, ($linkspage_pref['link_navigator_manager'] ? "1" : "0"))." ".LCLAN_OPT_59."<br />
1116          ".$rs -> form_checkbox("link_navigator_refer", 1, ($linkspage_pref['link_navigator_refer'] ? "1" : "0"))." ".LCLAN_OPT_20."<br />
1117          </td><td style='white-space:nowrap;'>
1118          ".$rs -> form_checkbox("link_navigator_rated", 1, ($linkspage_pref['link_navigator_rated'] ? "1" : "0"))." ".LCLAN_OPT_21."<br />
1119          ".$rs -> form_checkbox("link_navigator_allcat", 1, ($linkspage_pref['link_navigator_allcat'] ? "1" : "0"))." ".LCLAN_OPT_66."<br />
1120          ".$rs -> form_checkbox("link_navigator_links", 1, ($linkspage_pref['link_navigator_links'] ? "1" : "0"))." ".LCLAN_OPT_67."<br />
1121          ".$rs -> form_checkbox("link_navigator_category", 1, ($linkspage_pref['link_navigator_category'] ? "1" : "0"))." ".LCLAN_OPT_61."<br />
1122          </td></tr></table>";
1123          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1124  
1125          $text .= $TOPIC_TABLE_END;
1126  
1127          $text .= "
1128          <div id='optmanager' style='display:none; text-align:center'>
1129          <table style='".ADMIN_WIDTH."' class='fborder'>";
1130  
1131          $TOPIC_CAPTION = LCLAN_OPT_MENU_2;
1132          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
1133  
1134          $TOPIC_TOPIC = LCLAN_OPT_54;
1135          $TOPIC_FIELD = "
1136          ".$rs -> form_radio("link_manager", "1", ($linkspage_pref['link_manager'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1137          ".$rs -> form_radio("link_manager", "0", ($linkspage_pref['link_manager'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1138          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1139  
1140          $TOPIC_TOPIC = LCLAN_OPT_46;
1141          $TOPIC_FIELD = r_userclass("link_manager_class", $linkspage_pref['link_manager_class'])."<br />".LCLAN_OPT_47;
1142          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1143  
1144          $TOPIC_TOPIC = LCLAN_OPT_48;
1145          $TOPIC_FIELD = "
1146          ".$rs -> form_radio("link_directpost", "1", ($linkspage_pref['link_directpost'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1147          ".$rs -> form_radio("link_directpost", "0", ($linkspage_pref['link_directpost'] ? "0" : "1"), "", "").LCLAN_OPT_4."<br />".LCLAN_OPT_49;
1148          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1149  
1150          $TOPIC_TOPIC = LCLAN_OPT_50;
1151          $TOPIC_FIELD = "
1152          ".$rs -> form_radio("link_directdelete", "1", ($linkspage_pref['link_directdelete'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1153          ".$rs -> form_radio("link_directdelete", "0", ($linkspage_pref['link_directdelete'] ? "0" : "1"), "", "").LCLAN_OPT_4."<br />".LCLAN_OPT_51;
1154          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1155  
1156          $text .= $TOPIC_TABLE_END;
1157  
1158          $text .= "
1159          <div id='optcategory' style='display:none; text-align:center'>
1160          <table style='".ADMIN_WIDTH."' class='fborder'>";
1161  
1162          $TOPIC_CAPTION = LCLAN_OPT_MENU_3;
1163          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
1164  
1165          $TOPIC_TOPIC = LCLAN_OPT_13;
1166          $TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap; width:20%;'>
1167          ".$rs -> form_checkbox("link_cat_icon", 1, ($linkspage_pref['link_cat_icon'] ? "1" : "0"))." ".LCLAN_OPT_14."<br />
1168          ".$rs -> form_checkbox("link_cat_desc", 1, ($linkspage_pref['link_cat_desc'] ? "1" : "0"))." ".LCLAN_OPT_15."<br />
1169          </td><td style='white-space:nowrap;'>
1170          ".$rs -> form_checkbox("link_cat_amount", 1, ($linkspage_pref['link_cat_amount'] ? "1" : "0"))." ".LCLAN_OPT_16."<br />
1171          ".$rs -> form_checkbox("link_cat_total", 1, ($linkspage_pref['link_cat_total'] ? "1" : "0"))." ".LCLAN_OPT_19."<br />
1172          </td></tr></table>";
1173          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1174  
1175          $TOPIC_TOPIC = LCLAN_OPT_65;
1176          $TOPIC_FIELD = "
1177          ".$rs -> form_radio("link_cat_empty", "1", ($linkspage_pref['link_cat_empty'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1178          ".$rs -> form_radio("link_cat_empty", "0", ($linkspage_pref['link_cat_empty'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1179          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1180  
1181          $TOPIC_TOPIC = LCLAN_OPT_22;
1182          $TOPIC_FIELD = "
1183          ".$rs -> form_radio("link_cat_icon_empty", "1", ($linkspage_pref['link_cat_icon_empty'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1184          ".$rs -> form_radio("link_cat_icon_empty", "0", ($linkspage_pref['link_cat_icon_empty'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1185          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1186  
1187          $TOPIC_TOPIC = LCLAN_OPT_29;
1188          $TOPIC_FIELD = "
1189          ".$rs -> form_radio("link_cat_sortorder", "1", ($linkspage_pref['link_cat_sortorder'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1190          ".$rs -> form_radio("link_cat_sortorder", "0", ($linkspage_pref['link_cat_sortorder'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1191          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1192  
1193          $TOPIC_TOPIC = LCLAN_OPT_23;
1194          $TOPIC_FIELD = "
1195          ".$rs -> form_select_open("link_cat_sort")."
1196          ".$rs -> form_option(LCLAN_OPT_40, ($linkspage_pref['link_cat_sort'] == "heading" ? "1" : "0"), "heading", "")."
1197          ".$rs -> form_option(LCLAN_OPT_41, ($linkspage_pref['link_cat_sort'] == "id" ? "1" : "0"), "id", "")."
1198          ".$rs -> form_option(LCLAN_OPT_36, ($linkspage_pref['link_cat_sort'] == "order" ? "1" : "0"), "order", "")."
1199          ".$rs -> form_select_close();
1200          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1201  
1202          $TOPIC_TOPIC = LCLAN_OPT_24;
1203          $TOPIC_FIELD = "
1204          ".$rs -> form_select_open("link_cat_order")."
1205          ".$rs -> form_option(LCLAN_OPT_30, ($linkspage_pref['link_cat_order'] == "ASC" ? "1" : "0"), "ASC", "")."
1206          ".$rs -> form_option(LCLAN_OPT_31, ($linkspage_pref['link_cat_order'] == "DESC" ? "1" : "0"), "DESC", "")."
1207          ".$rs -> form_select_close();
1208          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1209  
1210          $TOPIC_TOPIC = LCLAN_OPT_25;
1211          $TOPIC_FIELD = $rs -> form_text("link_cat_resize_value", "3", $linkspage_pref['link_cat_resize_value'], "3", "tbox", "", "", "")." ".LCLAN_OPT_5;
1212          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1213  
1214          $text .= $TOPIC_TABLE_END;
1215  
1216          $text .= "
1217          <div id='optlinks' style='display:none; text-align:center'>
1218          <table style='".ADMIN_WIDTH."' class='fborder'>";
1219  
1220          $TOPIC_CAPTION = LCLAN_OPT_MENU_4;
1221          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
1222  
1223          $TOPIC_TOPIC = LCLAN_OPT_13;
1224          $TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap; width:20%;'>
1225          ".$rs -> form_checkbox("link_icon", 1, ($linkspage_pref['link_icon'] ? "1" : "0"))." ".LCLAN_OPT_14."<br />
1226          ".$rs -> form_checkbox("link_referal", 1, ($linkspage_pref['link_referal'] ? "1" : "0"))." ".LCLAN_OPT_17."<br />
1227          </td><td style='white-space:nowrap;'>
1228          ".$rs -> form_checkbox("link_url", 1, ($linkspage_pref['link_url'] ? "1" : "0"))." ".LCLAN_OPT_18."<br />
1229          ".$rs -> form_checkbox("link_desc", 1, ($linkspage_pref['link_desc'] ? "1" : "0"))." ".LCLAN_OPT_15."<br />
1230          </td></tr></table>";
1231          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1232  
1233          $TOPIC_TOPIC = LCLAN_OPT_28;
1234          $TOPIC_FIELD = "
1235          ".$rs -> form_radio("link_icon_empty", "1", ($linkspage_pref['link_icon_empty'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1236          ".$rs -> form_radio("link_icon_empty", "0", ($linkspage_pref['link_icon_empty'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1237          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1238  
1239          $TOPIC_TOPIC = LCLAN_OPT_29;
1240          $TOPIC_FIELD = "
1241          ".$rs -> form_radio("link_sortorder", "1", ($linkspage_pref['link_sortorder'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1242          ".$rs -> form_radio("link_sortorder", "0", ($linkspage_pref['link_sortorder'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1243          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1244  
1245          $TOPIC_TOPIC = LCLAN_OPT_23;
1246          $TOPIC_FIELD = "
1247          ".$rs -> form_select_open("link_sort")."
1248          ".$rs -> form_option(LCLAN_OPT_34, ($linkspage_pref['link_sort'] == "heading" ? "1" : "0"), "heading", "")."
1249          ".$rs -> form_option(LCLAN_OPT_35, ($linkspage_pref['link_sort'] == "url" ? "1" : "0"), "url", "")."
1250          ".$rs -> form_option(LCLAN_OPT_36, ($linkspage_pref['link_sort'] == "order" ? "1" : "0"), "order", "")."
1251          ".$rs -> form_option(LCLAN_OPT_37, ($linkspage_pref['link_sort'] == "refer" ? "1" : "0"), "refer", "")."
1252          ".$rs -> form_option(LCLAN_OPT_53, ($linkspage_pref['link_sort'] == "date" ? "1" : "0"), "date", "")."
1253          ".$rs -> form_select_close();
1254          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1255  
1256          $TOPIC_TOPIC = LCLAN_OPT_24;
1257          $TOPIC_FIELD = "
1258          ".$rs -> form_select_open("link_order")."
1259          ".$rs -> form_option(LCLAN_OPT_30, ($linkspage_pref['link_order'] == "ASC" ? "1" : "0"), "ASC", "")."
1260          ".$rs -> form_option(LCLAN_OPT_31, ($linkspage_pref['link_order'] == "DESC" ? "1" : "0"), "DESC", "")."
1261          ".$rs -> form_select_close();
1262          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1263  
1264          //0=same window, 1=_blank, 2=_parent, 3=_top, 4=miniwindow
1265          $TOPIC_TOPIC = LCLAN_OPT_32;
1266          $TOPIC_FIELD = "
1267          ".$rs -> form_select_open("link_open_all")."
1268          ".$rs -> form_option(LCLAN_OPT_42, ($linkspage_pref['link_open_all'] == "5" ? "1" : "0"), "5", "")."
1269          ".$rs -> form_option(LCLAN_OPT_43, ($linkspage_pref['link_open_all'] == "0" ? "1" : "0"), "0", "")."
1270          ".$rs -> form_option(LCLAN_OPT_44, ($linkspage_pref['link_open_all'] == "1" ? "1" : "0"), "1", "")."
1271          ".$rs -> form_option(LCLAN_OPT_45, ($linkspage_pref['link_open_all'] == "4" ? "1" : "0"), "4", "")."
1272          ".$rs -> form_select_close();
1273          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1274  
1275          $TOPIC_TOPIC = LCLAN_OPT_33;
1276          $TOPIC_FIELD = $rs -> form_text("link_resize_value", "3", $linkspage_pref['link_resize_value'], "3", "tbox", "", "", "")." ".LCLAN_OPT_5;
1277          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1278  
1279          $text .= $TOPIC_TABLE_END;
1280  
1281          $text .= "
1282          <div id='optrefer' style='display:none; text-align:center'>
1283          <table style='".ADMIN_WIDTH."' class='fborder'>";
1284  
1285          $TOPIC_CAPTION = LCLAN_OPT_MENU_5;
1286          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
1287  
1288          $TOPIC_TOPIC = LCLAN_OPT_56;
1289          $TOPIC_FIELD = $rs -> form_text("link_refer_minimum", "3", $linkspage_pref['link_refer_minimum'], "3", "tbox", "", "", "")." ".LCLAN_OPT_57;
1290          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1291  
1292          $text .= $TOPIC_TABLE_END;
1293  
1294          $text .= "
1295          <div id='optrating' style='display:none; text-align:center'>
1296          <table style='".ADMIN_WIDTH."' class='fborder'>";
1297  
1298          $TOPIC_CAPTION = LCLAN_OPT_MENU_6;
1299          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
1300  
1301          $TOPIC_TOPIC = LCLAN_OPT_63;
1302          $TOPIC_FIELD = "";
1303          $TOPIC_FIELD = $rs -> form_text("link_rating_minimum", "3", $linkspage_pref['link_rating_minimum'], "3", "tbox", "", "", "")." ".LCLAN_OPT_64;
1304          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1305  
1306          $text .= $TOPIC_TABLE_END;
1307  
1308  
1309  
1310  
1311  
1312  
1313          $text .= "
1314          <div id='optmenu' style='display:none; text-align:center'>
1315          <table style='".ADMIN_WIDTH."' class='fborder'>";
1316  
1317          $TOPIC_CAPTION = LCLAN_OPT_MENU_7;
1318          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
1319  
1320          $TOPIC_TOPIC = LCLAN_OPT_85;
1321          $TOPIC_FIELD = $rs -> form_text("link_menu_caption", "15", $linkspage_pref['link_menu_caption'], "100", "tbox", "", "", "");
1322          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1323  
1324  
1325          $TOPIC_TOPIC = LCLAN_OPT_62;
1326          $TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap; width:20%;'>
1327          ".$rs -> form_checkbox("link_menu_navigator_frontpage", 1, ($linkspage_pref['link_menu_navigator_frontpage'] ? "1" : "0"))." ".LCLAN_OPT_60."<br />
1328          ".$rs -> form_checkbox("link_menu_navigator_submit", 1, ($linkspage_pref['link_menu_navigator_submit'] ? "1" : "0"))." ".LCLAN_OPT_58."<br />
1329          ".$rs -> form_checkbox("link_menu_navigator_manager", 1, ($linkspage_pref['link_menu_navigator_manager'] ? "1" : "0"))." ".LCLAN_OPT_59."<br />
1330          ".$rs -> form_checkbox("link_menu_navigator_refer", 1, ($linkspage_pref['link_menu_navigator_refer'] ? "1" : "0"))." ".LCLAN_OPT_20."<br />
1331          </td><td style='white-space:nowrap;'>
1332          ".$rs -> form_checkbox("link_menu_navigator_rated", 1, ($linkspage_pref['link_menu_navigator_rated'] ? "1" : "0"))." ".LCLAN_OPT_21."<br />
1333          ".$rs -> form_checkbox("link_menu_navigator_links", 1, ($linkspage_pref['link_menu_navigator_links'] ? "1" : "0"))." ".LCLAN_OPT_67."<br />
1334          ".$rs -> form_checkbox("link_menu_navigator_category", 1, ($linkspage_pref['link_menu_navigator_category'] ? "1" : "0"))." ".LCLAN_OPT_61."<br />
1335          </td></tr></table>";
1336          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1337  
1338          $TOPIC_TOPIC = LCLAN_OPT_79;
1339          $TOPIC_FIELD = $rs -> form_text("link_menu_navigator_caption", "15", $linkspage_pref['link_menu_navigator_caption'], "100", "tbox", "", "", "");
1340          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1341  
1342          $TOPIC_TOPIC = LCLAN_OPT_69;
1343          $TOPIC_FIELD = "
1344          ".$rs -> form_radio("link_menu_navigator_rendertype", "1", ($linkspage_pref['link_menu_navigator_rendertype'] ? "1" : "0"), "", "").LCLAN_OPT_76."
1345          ".$rs -> form_radio("link_menu_navigator_rendertype", "0", ($linkspage_pref['link_menu_navigator_rendertype'] ? "0" : "1"), "", "").LCLAN_OPT_75;
1346          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1347  
1348  
1349  
1350          $TOPIC_TOPIC = LCLAN_OPT_70;
1351          $TOPIC_FIELD = "
1352          ".$rs -> form_radio("link_menu_category", "1", ($linkspage_pref['link_menu_category'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1353          ".$rs -> form_radio("link_menu_category", "0", ($linkspage_pref['link_menu_category'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1354          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1355  
1356          $TOPIC_TOPIC = LCLAN_OPT_80;
1357          $TOPIC_FIELD = $rs -> form_text("link_menu_category_caption", "15", $linkspage_pref['link_menu_category_caption'], "100", "tbox", "", "", "");
1358          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1359  
1360          $TOPIC_TOPIC = LCLAN_OPT_87;
1361          $TOPIC_FIELD = "
1362          ".$rs -> form_radio("link_menu_category_amount", "1", ($linkspage_pref['link_menu_category_amount'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1363          ".$rs -> form_radio("link_menu_category_amount", "0", ($linkspage_pref['link_menu_category_amount'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1364          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1365  
1366          $TOPIC_TOPIC = LCLAN_OPT_71;
1367          $TOPIC_FIELD = "
1368          ".$rs -> form_radio("link_menu_category_rendertype", "1", ($linkspage_pref['link_menu_category_rendertype'] ? "1" : "0"), "", "").LCLAN_OPT_76."
1369          ".$rs -> form_radio("link_menu_category_rendertype", "0", ($linkspage_pref['link_menu_category_rendertype'] ? "0" : "1"), "", "").LCLAN_OPT_75;
1370          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1371  
1372  
1373  
1374          $TOPIC_TOPIC = LCLAN_OPT_72;
1375          $TOPIC_FIELD = "
1376          ".$rs -> form_radio("link_menu_recent", "1", ($linkspage_pref['link_menu_recent'] ? "1" : "0"), "", "").LCLAN_OPT_3."
1377          ".$rs -> form_radio("link_menu_recent", "0", ($linkspage_pref['link_menu_recent'] ? "0" : "1"), "", "").LCLAN_OPT_4;
1378          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1379  
1380          $TOPIC_TOPIC = LCLAN_OPT_73;
1381          $TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap; width:20%;'>
1382          ".$rs -> form_checkbox("link_menu_recent_category", 1, ($linkspage_pref['link_menu_recent_category'] ? "1" : "0"))." ".LCLAN_OPT_77."<br />
1383          ".$rs -> form_checkbox("link_menu_recent_description", 1, ($linkspage_pref['link_menu_recent_description'] ? "1" : "0"))." ".LCLAN_OPT_78."<br />
1384          </td></tr></table>";
1385          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1386  
1387          $TOPIC_TOPIC = LCLAN_OPT_81;
1388          $TOPIC_FIELD = $rs -> form_text("link_menu_recent_caption", "15", $linkspage_pref['link_menu_recent_caption'], "100", "tbox", "", "", "");
1389          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1390  
1391          $TOPIC_TOPIC = LCLAN_OPT_74;
1392          $TOPIC_FIELD = $rs -> form_select_open("link_menu_recent_number");
1393          for($i=1;$i<15;$i++){
1394              $TOPIC_FIELD .= $rs -> form_option($i, ($linkspage_pref["link_menu_recent_number"] == $i ? "1" : "0"), $i);
1395          }
1396          $TOPIC_FIELD .= $rs -> form_select_close();
1397          $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
1398  
1399  
1400  
1401          $text .= $TOPIC_TABLE_END;
1402  
1403  
1404          $text .= "
1405          ".$rs->form_close()."
1406          </div>";
1407          $ns->tablerender(LCLAN_OPT_2, $text);
1408      }
1409  
1410      function pref_submit() {
1411          global $rs;
1412          $text = "
1413          <tr>
1414          <td colspan='2' style='text-align:center' class='forumheader'>
1415          <input class='button' type='submit' name='updateoptions' value='".LCLAN_ADMIN_1."' />
1416          </td>
1417          </tr>";
1418  
1419          return $text;
1420      }
1421  
1422  
1423  
1424  }
1425  
1426  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7