[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_plugins/forum/ -> forum_admin.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/forum/forum_admin.php,v $
  14  |     $Revision: 1.44 $
  15  |     $Date: 2006/11/15 01:06:16 $
  16  |     $Author: mcfly_e107 $
  17  +----------------------------------------------------------------------------+
  18  */
  19  $eplug_admin = true;
  20  require_once ("../../class2.php");
  21  @include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php';
  22  @include_once e_PLUGIN.'forum/languages/English/lan_forum_admin.php';
  23  
  24  if (!getperms("P"))
  25  {
  26      header("location:".e_BASE."index.php");
  27      exit;
  28  }
  29  $e_sub_cat = 'forum';
  30  
  31  $forum = new forum;
  32  require_once(e_ADMIN.'auth.php');
  33  require_once(e_HANDLER."userclass_class.php");
  34  require_once(e_HANDLER."form_handler.php");
  35  require_once(e_HANDLER."ren_help.php");
  36  require_once(e_PLUGIN."forum/forum_class.php");
  37  $rs = new form;
  38  $for = new e107forum;
  39  define("IMAGE_new", "<img src='".img_path('new.png')."' alt='' style='border:0' />");
  40  define("IMAGE_sub", "<img src='".e_PLUGIN."forum/images/forums_16.png' alt='".FORLAN_145."' title='".FORLAN_145."' style='border:0' />");
  41  define("IMAGE_nosub", "<img src='".e_PLUGIN."forum/images/sub_forums_16.png' alt='".FORLAN_145."' title='".FORLAN_145."' style='border:0' />");
  42  
  43  $deltest = array_flip($_POST);
  44  if (e_QUERY)
  45  {
  46      $tmp = explode(".", e_QUERY);
  47      $action = $tmp[0];
  48      $sub_action = $tmp[1];
  49      $id = $tmp[2];
  50      unset($tmp);
  51  }
  52  
  53  if(isset($_POST['delete']))
  54  {
  55      $tmp = array_pop(array_flip($_POST['delete']));
  56      list($delete, $del_id) = explode("_", $tmp);
  57  }
  58  
  59  if(isset($_POST['setMods']))
  60  {
  61      foreach($_POST['mods'] as $fid => $modid)
  62      {
  63          $sql->db_Update('forum',"forum_moderators = '{$modid}' WHERE forum_id = {$fid}");
  64      }
  65      $forum->show_message(FORLAN_144);
  66  }
  67  
  68  if(isset($_POST['tools']))
  69  {
  70      $msg = "";
  71      if(isset($_POST['forum_all']))
  72      {
  73          $fList[]='all';
  74      }
  75      else
  76      {
  77          foreach(array_keys($_POST['forumlist']) as $k)
  78          {
  79              $fList[] = $k;
  80          }
  81      }
  82      foreach($fList as $fid)
  83      {
  84          if(isset($_POST['counts']))
  85          {
  86              $for->forum_update_counts($fid, $_POST['counts_threads']);
  87              $msg .= FORLAN_167.": $fid <br />";
  88          }
  89          if(isset($_POST['lastpost']))
  90          {
  91              $with_threads = (isset($_POST['lastpost_nothread'])) ? FALSE : TRUE;
  92              $for->update_lastpost('forum', $fid, $with_threads);
  93              $msg .= FORLAN_168.": $fid <br />";
  94          }
  95      }
  96      if(isset($_POST['userpostcounts']))
  97      {
  98          $list = $for->get_user_counts();
  99          foreach($list as $uid => $cnt)
 100          {
 101              $sql->db_Update("user","user_forums = '{$cnt}' WHERE user_id = '{$uid}'");
 102          }
 103          $msg .= FORLAN_169." <br />";
 104      }
 105  
 106      $forum->show_message($msg);
 107  }
 108  
 109  if(isset($_POST['create_sub']))
 110  {
 111      $fid = intval($sub_action);
 112      $_name  = $tp->toDB($_POST['subname_new']);
 113      $_desc  = $tp->toDB($_POST['subdesc_new']);
 114      $_order = intval($_POST['suborder_new']);
 115      if($_name != "" && $sql->db_Select('forum', '*', "forum_id = {$fid}"))
 116      {
 117          $row = $sql->db_Fetch();
 118          if($sql->db_Insert("forum", "0, '{$_name}', '{$_desc}', '{$row['forum_parent']}', '{$fid}', '".time()."', '{$row['forum_moderators']}', 0, 0, '', '', '{$row['forum_class']}', '{$_order}', '{$row['forum_postclass']}'"))
 119          {
 120              $forum->show_message(LAN_CREATED);
 121          }
 122          else
 123          {
 124              $forum->show_message(LAN_CREATED_FAILED);
 125          }
 126      }
 127  }
 128  
 129  if(isset($_POST['update_subs']))
 130  {
 131      $msg = "";
 132      foreach(array_keys($_POST['subname']) as $id)
 133      {
 134          if($_POST['subname'][$id] == "")
 135          {
 136              if ($sql->db_Delete("forum", "forum_id='$id' "))
 137              {
 138                  $msg .= FORLAN_150." ".$id." ".LAN_DELETED."<br />";
 139                  $cnt = $sql->db_Delete("forum_t", "thread_forum_id = {$id}");
 140                  $msg .= $cnt." ".FORLAN_152." ".LAN_DELETED."<br />";
 141              }
 142          }
 143          else
 144          {
 145              $_name  = $tp->toDB($_POST['subname'][$id]);
 146              $_desc  = $tp->toDB($_POST['subdesc'][$id]);
 147              $_order = intval($_POST['suborder'][$id]);
 148              if($sql->db_Update("forum", "forum_name='{$_name}', forum_description='{$_desc}', forum_order='{$_order}' WHERE forum_id = {$id}"))
 149              {
 150                  $msg .= FORLAN_150." ".$id." ".LAN_UPDATED."<br />";
 151              }
 152          }
 153      }
 154      if($msg)
 155      {
 156          $forum->show_message($msg);
 157      }
 158  }
 159  
 160  if(isset($_POST['submit_parent']))
 161  {
 162      $_POST['forum_name'] = $tp->toDB($_POST['forum_name']);
 163      $sql->db_Insert("forum", "0, '".$_POST['forum_name']."', '', '0', '0', '".time()."', '', '0', '0', '', '', '".$_POST['forum_class']."', '0', '{$_POST['forum_postclass']}'");
 164      $forum->show_message(FORLAN_13);
 165  }
 166  
 167  if(isset($_POST['update_parent']))
 168  {
 169      $_POST['forum_name'] = $tp->toDB($_POST['forum_name']);
 170      $sql->db_Update("forum", "forum_name='".$_POST['forum_name']."', forum_class='".$_POST['forum_class']."', forum_postclass='{$_POST['forum_postclass']}'  WHERE forum_id=$id");
 171      $forum->show_message(FORLAN_14);
 172      $action = "main";
 173  }
 174  
 175  if(isset($_POST['submit_forum']))
 176  {
 177      $mods = $_POST['forum_moderators'];
 178      $_POST['forum_name'] = $tp->toDB($_POST['forum_name']);
 179      $_POST['forum_description'] = $tp->toDB($_POST['forum_description']);
 180      $sql->db_Insert("forum", "0, '".$_POST['forum_name']."', '".$_POST['forum_description']."', '".$_POST['forum_parent']."', '0', '".time()."', '".$mods."', 0, 0, '', '', '".$_POST['forum_class']."', 0, '{$_POST['forum_postclass']}'");
 181      $forum->show_message(FORLAN_11);
 182  }
 183  
 184  if(isset($_POST['update_forum']))
 185  {
 186      $mods = $_POST['forum_moderators'];
 187      $_POST['forum_name'] = $tp->toDB($_POST['forum_name']);
 188      $_POST['forum_description'] = $tp->toDB($_POST['forum_description']);
 189      $forum_parent = $row['forum_id'];
 190      $sql->db_Update("forum", "forum_name='".$_POST['forum_name']."', forum_description='".$_POST['forum_description']."', forum_parent='".$_POST['forum_parent']."', forum_moderators='".$mods."', forum_class='".$_POST['forum_class']."', forum_postclass='{$_POST['forum_postclass']}' WHERE forum_id=$id");
 191      $sql->db_Update("forum", "forum_moderators='".$mods."', forum_class='".$_POST['forum_class']."', forum_postclass='{$_POST['forum_postclass']}' WHERE forum_sub=$id");
 192      $forum->show_message(FORLAN_12);
 193      $action = "main";
 194  }
 195  
 196  if (isset($_POST['update_order']))
 197  {
 198      extract($_POST);
 199      while (list($key, $id) = each($forum_order))
 200      {
 201          $tmp = explode(".", $id);
 202          $sql->db_Update("forum", "forum_order=".$tmp[1]." WHERE forum_id=".$tmp[0]);
 203      }
 204      $forum->show_message(FORLAN_73);
 205  }
 206  
 207  if (isset($_POST['updateoptions']))
 208  {
 209      $pref['email_notify'] = $_POST['email_notify'];
 210      $pref['email_notify_on'] = $_POST['email_notify_on'];
 211      $pref['forum_poll'] = $_POST['forum_poll'];
 212      $pref['forum_popular'] = $_POST['forum_popular'];
 213      $pref['forum_track'] = $_POST['forum_track'];
 214      $pref['forum_eprefix'] = $_POST['forum_eprefix'];
 215      $pref['forum_enclose'] = $_POST['forum_enclose'];
 216      $pref['forum_title'] = $_POST['forum_title'];
 217      $pref['forum_postspage'] = $_POST['forum_postspage'];
 218      $pref['html_post'] = $_POST['html_post'];
 219      $pref['forum_attach'] = $_POST['forum_attach'];
 220      $pref['forum_redirect'] = $_POST['forum_redirect'];
 221      $pref['forum_user_customtitle'] = $_POST['forum_user_customtitle'];
 222      $pref['reported_post_email'] = $_POST['reported_post_email'];
 223      $pref['forum_tooltip'] = $_POST['forum_tooltip'];
 224      $pref['forum_tiplength'] = $_POST['forum_tiplength'];
 225      $pref['forum_hilightsticky'] = $_POST['forum_hilightsticky'];
 226      $pref['forum_maxwidth'] = $_POST['forum_maxwidth'];
 227      $pref['forum_linkimg'] = $_POST['forum_linkimg'];
 228      save_prefs();
 229      $forum->show_message(FORLAN_10);
 230  }
 231  
 232  if (isset($_POST['do_prune']))
 233  {
 234      $msg = $for->forum_prune($_POST['prune_type'], $_POST['prune_days'], $_POST['pruneForum']);
 235      $forum->show_message($msg);
 236      $action = "main";
 237  }
 238  
 239  if (isset($_POST['set_ranks']))
 240  {
 241      extract($_POST);
 242      for($a = 0; $a <= 9; $a++)
 243      {
 244          $r_names .= $tp->toDB($rank_names[$a]).",";
 245          $r_thresholds .= $tp->toDB($rank_thresholds[$a]).",";
 246          $r_images .= $tp->toDB($rank_images[$a]).",";
 247      }
 248      $pref['rank_main_admin'] = $_POST['rank_main_admin'];
 249      $pref['rank_main_admin_image'] = $_POST['rank_main_admin_image'];
 250      $pref['rank_admin'] = $_POST['rank_admin'];
 251      $pref['rank_admin_image'] = $_POST['rank_admin_image'];
 252      $pref['rank_moderator'] = $_POST['rank_moderator'];
 253      $pref['rank_moderator_image'] = $_POST['rank_moderator_image'];
 254      $pref['forum_levels'] = $r_names;
 255      $pref['forum_thresholds'] = $r_thresholds;
 256      $pref['forum_images'] = $r_images;
 257      save_prefs();
 258      $forum->show_message(FORLAN_95);
 259  }
 260  
 261  if (isset($_POST['frsubmit']))
 262  {
 263      $guestrules = $tp->toDB($_POST['guestrules']);
 264      $memberrules = $tp->toDB($_POST['memberrules']);
 265      $adminrules = $tp->toDB($_POST['adminrules']);
 266      if(!$sql->db_Update("generic", "gen_chardata ='$guestrules', gen_intdata='".$_POST['guest_active']."' WHERE gen_type='forum_rules_guest' "))
 267      {
 268          $sql -> db_Insert("generic", "0, 'forum_rules_guest', '".time()."', 0, '', '".$_POST['guest_active']."', '$guestrules' ");
 269      }
 270      if(!$sql->db_Update("generic", "gen_chardata ='$memberrules', gen_intdata='".$_POST['member_active']."' WHERE gen_type='forum_rules_member' "))
 271      {
 272          $sql -> db_Insert("generic", "0, 'forum_rules_member', '".time()."', 0, '', '".$_POST['member_active']."', '$memberrules' ");
 273      }
 274      if(!$sql->db_Update("generic", "gen_chardata ='$adminrules', gen_intdata='".$_POST['admin_active']."' WHERE gen_type='forum_rules_admin' "))
 275      {
 276          $sql -> db_Insert("generic", "0, 'forum_rules_admin', '".time()."', 0, '', '".$_POST['admin_active']."', '$adminrules' ");
 277      }
 278  }
 279  
 280  
 281  if ($delete == 'main') {
 282      if ($sql->db_Delete("forum", "forum_id='$del_id' ")) {
 283          $forum->show_message(FORLAN_96);
 284      }
 285  }
 286  
 287  if ($action == "create")
 288  {
 289      if ($sql->db_Select("forum", "*", "forum_parent='0' "))
 290      {
 291          $forum->create_forums($sub_action, $id);
 292      }
 293      else
 294      {
 295          header("location:".e_ADMIN."forum.php");
 296          exit;
 297      }
 298  }
 299  
 300  if ($delete == 'cat')
 301  {
 302      if ($sql->db_Delete("forum", "forum_id='$del_id' "))
 303      {
 304          $sql->db_Delete("forum", "forum_parent='$del_id' ");
 305          $forum->show_message(FORLAN_97);
 306          $action = "main";
 307      }
 308  }
 309  
 310  if($action == "delete")
 311  {
 312      $forum->delete_item(intval($sub_action));
 313  }
 314  
 315  if ($action == "cat") {
 316      $forum->create_parents($sub_action, $id);
 317  }
 318  
 319  if ($action == "order") {
 320      $forum->show_existing_forums($sub_action, $id, TRUE);
 321  }
 322  
 323  if ($action == "opt")
 324  {
 325      $forum->show_prefs();
 326  }
 327  
 328  if ($action == "mods")
 329  {
 330      $forum->show_mods();
 331  }
 332  
 333  if ($action == "tools")
 334  {
 335      $forum->show_tools();
 336  }
 337  
 338  if ($action == "prune")
 339  {
 340      $forum->show_prune();
 341  }
 342  
 343  if ($action == "rank")
 344  {
 345      $forum->show_levels();
 346  }
 347  
 348  if ($action == "rules")
 349  {
 350      $forum->show_rules();
 351  }
 352  
 353  if($action == 'subs')
 354  {
 355      $forum->show_subs($sub_action);
 356  }
 357  
 358  if ($delete == 'reported')
 359  {
 360      $sql->db_Delete("generic", "gen_id='$del_id' ");
 361      $forum->show_message(FORLAN_118);
 362  }
 363  
 364  
 365  if ($action == "sr")
 366  {
 367      $forum->show_reported($sub_action);
 368  }
 369  
 370  if (!e_QUERY || $action == "main")
 371  {
 372      $forum->show_existing_forums($sub_action, $id);
 373  }
 374  
 375  //$forum->show_options($action);
 376  require_once(e_ADMIN."footer.php");
 377  function headerjs()
 378  {
 379      global $tp;
 380      // These functions need to be removed and replaced with the generic jsconfirm() function.
 381      $headerjs = "<script type=\"text/javascript\">
 382  	function confirm_(mode, forum_id, forum_name) {
 383          if (mode == 'sr') {
 384              return confirm(\"".$tp->toJS(FORLAN_117)."\");
 385          } else if(mode == 'parent') {
 386              return confirm(\"".$tp->toJS(FORLAN_81)." [ID: \" + forum_name + \"]\");
 387          } else {
 388              return confirm(\"".$tp->toJS(FORLAN_82)." [ID: \" + forum_name + \"]\");
 389          }
 390      }
 391      </script>";
 392      return $headerjs;
 393  }
 394  
 395  class forum
 396  {
 397  
 398  	function show_options($action)
 399      {
 400          global $sql;
 401          if ($action == "")
 402          {
 403              $action = "main";
 404          }
 405          // ##### Display options ---------------------------------------------------------------------------------------------------------
 406          $var['main']['text'] = FORLAN_76;
 407          $var['main']['link'] = e_SELF;
 408          $var['cat']['text'] = FORLAN_83;
 409          $var['cat']['link'] = e_SELF."?cat";
 410          if ($sql->db_Select("forum", "*", "forum_parent='0' "))
 411          {
 412              $var['create']['text'] = FORLAN_77;
 413              $var['create']['link'] = e_SELF."?create";
 414          }
 415          $var['order']['text'] = FORLAN_78;
 416          $var['order']['link'] = e_SELF."?order";
 417          $var['opt']['text'] = FORLAN_79;
 418          $var['opt']['link'] = e_SELF."?opt";
 419          $var['prune']['text'] = FORLAN_59;
 420          $var['prune']['link'] = e_SELF."?prune";
 421          $var['rank']['text'] = FORLAN_63;
 422          $var['rank']['link'] = e_SELF."?rank";
 423          $var['rules']['text'] = FORLAN_123;
 424          $var['rules']['link'] = e_SELF."?rules";
 425          $var['sr']['text'] = FORLAN_116;
 426          $var['sr']['link'] = e_SELF."?sr";
 427          $var['mods']['text'] = FORLAN_33;
 428          $var['mods']['link'] = e_SELF."?mods";
 429          $var['tools']['text'] = FORLAN_153;
 430          $var['tools']['link'] = e_SELF."?tools";
 431  
 432          show_admin_menu(FORLAN_7, $action, $var);
 433      }
 434  
 435  	function delete_item($id)
 436      {
 437          global $sql;
 438          $id = intval($id);
 439          $confirm = isset($_POST['confirm']) ? TRUE : FALSE;
 440  
 441          if($sql->db_Select('forum', '*', "forum_id = {$id}"))
 442          {
 443              $txt = "";
 444              $row = $sql->db_Fetch();
 445              if($row['forum_parent'] == 0)
 446              {
 447                  $txt .= $this->delete_parent($id, $confirm);
 448              }
 449              elseif($row['forum_sub'] > 0)
 450              {
 451                  $txt .= $this->delete_sub($id, $confirm);
 452              }
 453              else
 454              {
 455                  $txt .= $this->delete_forum($id, $confirm);
 456              }
 457              if($confirm)
 458              {
 459                  $this->show_message($txt);
 460              }
 461              else
 462              {
 463                  $this->delete_show_confirm($txt);
 464              }
 465          }
 466      }
 467  
 468  	function delete_parent($id, $confirm = FALSE)
 469      {
 470          global $sql;
 471          $ret = "";
 472          if($sql->db_Select("forum", "forum_id", "forum_parent = {$id} AND forum_sub = 0"))
 473          {
 474              $fList = $sql->db_getList();
 475              foreach($fList as $f)
 476              {
 477                  $ret .= $this->delete_forum($f['forum_id'], $confirm);
 478              }
 479          }
 480          if($confirm)
 481          {
 482              if($sql->db_Delete("forum", "forum_id = {$id}"))
 483              {
 484                  $ret .= "Forum parent successfully deleted";
 485              }
 486              else
 487              {
 488                  $ret .= "Forum parent could not be deleted";
 489              }
 490              return $ret;
 491          }
 492          return "The forum parent has the following info: <br />".$ret;
 493  
 494      }
 495  
 496  	function delete_forum($id, $confirm = FALSE)
 497      {
 498          global $sql, $tp;
 499          $ret = "";
 500          if($sql->db_Select("forum", "forum_id", "forum_sub = {$id}"))
 501          {
 502              $fList = $sql->db_getList();
 503              foreach($fList as $f)
 504              {
 505                  $ret .= $this->delete_sub($f['forum_id'], $confirm);
 506              }
 507          }
 508          if($confirm)
 509          {
 510              $cnt = $sql->db_Delete("forum_t","thread_forum_id = {$id}");
 511              $ret .= $cnt." forum {$id} thread(s) deleted <br />";
 512              if($sql->db_Delete("forum", "forum_id = {$id}"))
 513              {
 514                  $ret .= "Forum {$id} successfully deleted";
 515              }
 516              else
 517              {
 518                  $ret .= "Forum {$id} could not be deleted";
 519              }
 520              return $ret;
 521          }
 522  
 523          $sql->db_Select("forum", "*", "forum_id = {$id}");
 524          $row = $sql->db_Fetch();
 525          return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies. <br />".$ret;
 526      }
 527  
 528  	function delete_sub($id, $confirm = FALSE)
 529      {
 530          global $sql, $tp;
 531          if($confirm)
 532          {
 533              $cnt = $sql->db_Delete("forum_t","thread_forum_id = {$id}");
 534              $ret .= $cnt." Sub-forum {$id} thread(s) deleted <br />";
 535              if($sql->db_Delete("forum", "forum_id = {$id}"))
 536              {
 537                  $ret .= "Sub-forum {$id} successfully deleted";
 538              }
 539              else
 540              {
 541                  $ret .= "Sub-forum {$id} could not be deleted";
 542              }
 543              return $ret;
 544          }
 545  
 546          $sql->db_Select("forum", "*", "forum_id = {$id}");
 547          $row = $sql->db_Fetch();
 548          return "Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies. <br />".$ret;
 549      }
 550  
 551  	function delete_show_confirm($txt)
 552      {
 553          global $ns;
 554          $this->show_message($txt);
 555          $txt = "
 556          <form method='post' action='".e_SELF."?".e_QUERY."'>
 557          <div style='text-align:center'>".FORLAN_180."<br /><br />
 558          <input type='submit' class='button' name='confirm' value='".FORLAN_181."' />
 559          </div>
 560          </form>
 561          ";
 562          $ns->tablerender(FORLAN_181, $txt);
 563      }
 564  
 565  	function show_subs($id)
 566      {
 567          global $sql, $tp, $ns;
 568          $txt = "
 569          <form method='post' action='".e_SELF."?".e_QUERY."'>
 570          <table style='width:100%'>
 571          <tr>
 572          <td class='fcaption'>".FORLAN_151."</td>
 573          <td class='fcaption'>".FORLAN_31."</td>
 574          <td class='fcaption'>".FORLAN_32."</td>
 575          <td class='fcaption'>".FORLAN_37."</td>
 576          <td class='fcaption'>".FORLAN_20."</td>
 577          </tr>
 578          ";
 579          if($sql->db_Select('forum', 'forum_id, forum_name, forum_description, forum_order', "forum_sub = {$id} ORDER by forum_order ASC"))
 580          {
 581              $subList = $sql->db_getList();
 582              foreach($subList as $sub)
 583              {
 584                  $txt .= "
 585                  <tr>
 586                  <td class='forumheader2' style='vertical-align:top'>{$sub['forum_id']}</td>
 587                  <td class='forumheader2' style='vertical-align:top'><input class='tbox' type='text' name='subname[{$sub['forum_id']}]' value='{$sub['forum_name']}' size='30' maxlength='255' /></td>
 588                  <td class='forumheader2' style='vertical-align:top'><textarea cols='60' rows='2' class='tbox' name='subdesc[{$sub['forum_id']}]'>{$sub['forum_description']}</textarea></td>
 589                  <td class='forumheader2' style='vertical-align:top'><input class='tbox' type='text' name='suborder[{$sub['forum_id']}]' value='{$sub['forum_order']}' size='3' maxlength='4' /></td>
 590                  <td class='forumheader2' style='vertical-align:top; text-align:center'>
 591                  <a href='".e_SELF."?delete.{$sub['forum_id']}'>".ADMIN_DELETE_ICON."</a>
 592                  </td>
 593                  </tr>
 594                  ";
 595              }
 596              $txt .= "
 597              <tr>
 598              <td class='forumheader3' colspan='5' style='text-align:center'><input type='submit' class='button' name='update_subs' value='".FORLAN_147."' /></td>
 599              </tr>
 600              <tr>
 601              <td colspan='5' style='text-align:center'>&nbsp;</td>
 602              </tr>
 603              ";
 604  
 605          }
 606          else
 607          {
 608              $txt .= "<tr><td colspan='5' class='forumheader3' style='text-align:center'>".FORLAN_146."</td>";
 609          }
 610  
 611          $txt .= "
 612          <tr>
 613          <td class='fcaption'>".FORLAN_151."</td>
 614          <td class='fcaption'>".FORLAN_31."</td>
 615          <td class='fcaption'>".FORLAN_32."</td>
 616          <td class='fcaption'>".FORLAN_37."</td>
 617          <td class='fcaption'>&nbsp;</td>
 618          </tr>
 619          <tr>
 620          <td class='forumheader2' style='vertical-align:top'>&nbsp;</td>
 621          <td class='forumheader2'><input class='tbox' type='text' name='subname_new' value='' size='30' maxlength='255' /></td>
 622          <td class='forumheader2'><textarea cols='60' rows='2' class='tbox' name='subdesc_new'></textarea></td>
 623          <td class='forumheader2'><input class='tbox' type='text' name='suborder_new' value='' size='3' maxlength='4' /></td>
 624          <td class='forumheader2'>&nbsp;</td>
 625          </tr>
 626          <tr>
 627          <td class='forumheader3' colspan='5' style='text-align:center'><input type='submit' class='button' name='create_sub' value='".FORLAN_148."' /></td>
 628          </tr>
 629          </table>
 630          </form>
 631          ";
 632          $ns->tablerender(FORLAN_149, $txt);
 633      }
 634  
 635  	function show_existing_forums($sub_action, $id, $mode = FALSE)
 636      {
 637          global $sql, $rs, $ns, $sql2, $sql3, $tp, $for;
 638  
 639          $subList = $for->forum_getsubs();
 640          if (!is_object($sql2))
 641          {
 642              $sql2 = new db;
 643          }
 644          if (!is_object($sql3))
 645          {
 646              $sql3 = new db;
 647          }
 648          if (!$mode)
 649          {
 650              $text = "<div style='padding : 1px; ".ADMIN_WIDTH."; margin-left: auto; margin-right: auto; text-align: center;'>";
 651          } else {
 652              $text = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
 653          }
 654          $text .= "
 655          <table style='".ADMIN_WIDTH."' class='fborder'>
 656          <tr>
 657          <td colspan='2' style='width:70%; text-align:center' class='fcaption'>".FORLAN_28."</td>
 658          <td style='width:30%; text-align:center' class='fcaption'>".FORLAN_80."</td>
 659          </tr>";
 660  
 661          if (!$parent_amount = $sql->db_Select("forum", "*", "forum_parent='0' ORDER BY forum_order ASC"))
 662          {
 663              $text .= "<tr><td class='forumheader3' style='text-align:center' colspan='3'>".FORLAN_29."</td></tr>";
 664          }
 665          else
 666          {
 667              $sql2 = new db;
 668              $sql3 = new db;
 669              while ($row = $sql->db_Fetch())
 670              {
 671                  extract($row);
 672                  $parent_id = $forum_id;
 673                  $text .= "
 674                  <tr>
 675                  <td colspan='2' class='forumheader'>".$forum_name."
 676                  <br /><b>".FORLAN_140.":</b> ".r_userclass_name($forum_class)."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".r_userclass_name($forum_postclass)."
 677                  </td>";
 678  
 679                  $text .= "<td class='forumheader' style='text-align:center'>";
 680  
 681                  if ($mode)
 682                  {
 683                      $text .= "<select name='forum_order[]' class='tbox'>\n";
 684                      for($a = 1; $a <= $parent_amount; $a++)
 685                      {
 686                          $text .= ($forum_order == $a ? "<option value='$forum_id.$a' selected='selected'>$a</option>\n" : "<option value='$forum_id.$a'>$a</option>\n");
 687                      }
 688                      $text .= "</select>";
 689                  }
 690                  else
 691                  {
 692                      $forum_heading = str_replace("&#39;", "\'", $forum_name);
 693                      $text .= "
 694                      <div style='text-align:left; padding-left: 30px'>
 695                      <a href='".e_SELF."?cat.edit.{$forum_id}'>".ADMIN_EDIT_ICON."</a>
 696                      <a href='".e_SELF."?delete.{$forum_id}'>".ADMIN_DELETE_ICON."</a>
 697                      </div>
 698                      ";
 699                  }
 700                  $text .= "</td></tr>";
 701  
 702                  $forums = $sql2->db_Select("forum", "*", "forum_parent='".$forum_id."' AND forum_sub = 0 ORDER BY forum_order ASC");
 703                  if (!$forums)
 704                  {
 705                      $text .= "<td colspan='4' style='text-align:center' class='forumheader3'>".FORLAN_29."</td>";
 706                  }
 707                  else
 708                  {
 709                      while ($row = $sql2->db_Fetch())
 710                      {
 711                          extract($row);
 712  
 713                          $text .= "
 714                          <tr>
 715                          <td style='width:5%; text-align:center' class='forumheader3'>".IMAGE_new."</td>\n<td style='width:55%' class='forumheader3'><a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".$forum_name."</a>" ;
 716  
 717                          $text .= "
 718                          <br /><span class='smallblacktext'>".$forum_description."&nbsp;</span>
 719                          <br /><b>".FORLAN_140.":</b> ".r_userclass_name($forum_class)."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".r_userclass_name($forum_postclass)."
 720  
 721                          </td>
 722  
 723                          <td colspan='2' class='forumheader3' style='text-align:center'>";
 724  
 725                          if ($mode)
 726                          {
 727                              $text .= "<select name='forum_order[]' class='tbox'>\n";
 728                              for($a = 1; $a <= $forums; $a++)
 729                              {
 730                                  $text .= ($forum_order == $a ? "<option value='$forum_id.$a' selected='selected'>$a</option>\n" : "<option value='$forum_id.$a'>$a</option>\n");
 731                              }
 732                              $text .= "</select>";
 733                          }
 734                          else
 735                          {
 736                              $forum_heading = str_replace("&#39;", "\'", $forum_name);
 737                              $sub_img = count($subList[$parent_id][$forum_id]) ? IMAGE_sub : IMAGE_nosub;
 738                              $text .= "
 739                              <div style='text-align:left; padding-left: 30px'>
 740                              <a href='".e_SELF."?create.edit.{$forum_id}'>".ADMIN_EDIT_ICON."</a>
 741                              <a href='".e_SELF."?delete.{$forum_id}'>".ADMIN_DELETE_ICON."</a>
 742                              &nbsp;&nbsp;<a href='".e_SELF."?subs.{$forum_id}'>".$sub_img."</a>
 743                              </div>
 744                              ";
 745                          }
 746                          $text .= "</td>\n</tr>";
 747                      }
 748                  }
 749              }
 750          }
 751  
 752          if (!$mode)
 753          {
 754              $text .= "</table></div>";
 755              $ns->tablerender(FORLAN_30, $text);
 756          }
 757          else
 758          {
 759              $text .= "<tr>\n<td colspan='4' style='text-align:center' class='forumheader'>\n<input class='button' type='submit' name='update_order' value='".FORLAN_72."' />\n</td>\n</tr>\n</table>\n</form>";
 760              $ns->tablerender(FORLAN_37, $text);
 761          }
 762  
 763      }
 764  
 765  	function create_parents($sub_action, $id)
 766      {
 767          global $sql, $ns;
 768  
 769          if ($sub_action == "edit" && !$_POST['update_parent'])
 770          {
 771              if ($sql->db_Select("forum", "*", "forum_id=$id"))
 772              {
 773                  $row = $sql->db_Fetch();
 774                  extract($row);
 775              }
 776          }
 777          $text = "<div style='text-align:center'>
 778          <form method='post' action='".e_SELF."?".e_QUERY."'>\n
 779          <table style='".ADMIN_WIDTH."' class='fborder'>
 780  
 781          <tr>
 782          <td style='width:40%' class='forumheader3'>".FORLAN_31.":</td>
 783          <td style='width:60%' class='forumheader3'>
 784          <input class='tbox' type='text' name='forum_name' size='60' value='$forum_name' maxlength='250' />
 785          </td>
 786          </tr>
 787  
 788          <tr>
 789          <td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
 790          <td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."</td>
 791          </tr>
 792  
 793          <tr>
 794          <td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
 795          <td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."</td>
 796          </tr>
 797  
 798          <tr style='vertical-align:top'>
 799          <td colspan='2'  style='text-align:center' class='forumheader'>";
 800  
 801          if ($sub_action == "edit")
 802          {
 803              $text .= "<input class='button' type='submit' name='update_parent' value='".FORLAN_25."' />";
 804          }
 805          else
 806          {
 807              $text .= "<input class='button' type='submit' name='submit_parent' value='".FORLAN_26."' />";
 808          }
 809  
 810          $text .= "</td>
 811          </tr>
 812          </table>
 813          </form>
 814          </div>";
 815  
 816          $ns->tablerender(FORLAN_75, $text);
 817      }
 818  
 819  	function create_forums($sub_action, $id)
 820      {
 821          global $sql, $ns;
 822  
 823          if ($sub_action == "edit" && !$_POST['update_forum'])
 824          {
 825              if ($sql->db_Select("forum", "*", "forum_id=$id"))
 826              {
 827                  $row = $sql->db_Fetch();
 828                  extract($row);
 829              }
 830          }
 831  
 832          $text = "<div style='text-align:center'>
 833          <form method='post' action='".e_SELF."?".e_QUERY."'>\n
 834          <table style='".ADMIN_WIDTH."' class='fborder'>
 835          <tr>
 836          <td style='width:40%' class='forumheader3'>".FORLAN_22.":</td>
 837          <td style='width:60%' class='forumheader3'>";
 838  
 839          $sql->db_Select("forum", "*", "forum_parent=0");
 840          $text .= "<select name='forum_parent' class='tbox'>\n";
 841          while (list($forum_id_, $forum_name_) = $sql->db_Fetch())
 842          {
 843              extract($row);
 844              if ($forum_id_ == $forum_parent)
 845              {
 846                  $text .= "<option value='$forum_id_' selected='selected'>".$forum_name_."</option>\n";
 847              }
 848              else
 849              {
 850                  $text .= "<option value='$forum_id_'>".$forum_name_."</option>\n";
 851              }
 852          }
 853          $text .= "</select>
 854          </td>
 855          </tr>
 856  
 857          <tr>
 858          <td style='width:40%' class='forumheader3'>".FORLAN_31.":
 859          <div class='smalltext'>".FORLAN_179."</div>
 860          </td>
 861          <td style='width:60%' class='forumheader3'>
 862          <input class='tbox' type='text' name='forum_name' size='60' value='$forum_name' maxlength='250' />
 863          </td>
 864          </tr>
 865  
 866          <tr>
 867          <td style='width:40%' class='forumheader3'>".FORLAN_32.": </td>
 868          <td style='width:60%' class='forumheader3'>
 869          <textarea class='tbox' name='forum_description' cols='50' rows='5'>$forum_description</textarea>
 870          </td>
 871          </tr>
 872  
 873          <tr>
 874          <td style='width:40%' class='forumheader3'>".FORLAN_33.":<br /><span class='smalltext'>(".FORLAN_34.")</span></td>
 875          <td style='width:60%' class='forumheader3'>";
 876          $text .= r_userclass("forum_moderators", $forum_moderators, 'off', 'admin,classes');
 877  
 878          //        $admin_no = $sql->db_Select("user", "*", "user_admin='1' AND user_perms REGEXP('A.') OR user_perms='0' ");
 879          //        while ($row = $sql->db_Fetch())
 880          //        {
 881          //            extract($row);
 882          //            $text .= "<input type='checkbox' name='mod[]' value='".$user_name ."'";
 883          //            if (preg_match('/'.preg_quote($user_name).'/', $forum_moderators))
 884          //            {
 885          //                $text .= " checked";
 886          //            }
 887          //            $text .= "/> ".$user_name ."<br />";
 888          //        }
 889  
 890          $text .= "</td>
 891          </tr>
 892          <tr>
 893          <td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
 894          <td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."</td>
 895          </tr>
 896  
 897          <tr>
 898          <td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
 899          <td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."</td>
 900          </tr>
 901  
 902          <tr style='vertical-align:top'>
 903          <td colspan='2'  style='text-align:center' class='forumheader'>";
 904          if ($sub_action == "edit")
 905          {
 906              $text .= "<input class='button' type='submit' name='update_forum' value='".FORLAN_35."' />";
 907          }
 908          else
 909          {
 910              $text .= "<input class='button' type='submit' name='submit_forum' value='".FORLAN_36."' />";
 911          }
 912          $text .= "</td>
 913          </tr>
 914          </table>
 915          </form>
 916          </div>";
 917          $ns->tablerender(FORLAN_28, $text);
 918      }
 919  
 920  	function show_message($message)
 921      {
 922          global $ns;
 923          $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 924      }
 925  
 926  	function show_tools()
 927      {
 928          global $sql, $ns, $tp;
 929          $txt = "
 930          <form method='post' action='".e_SELF."?".e_QUERY."'>
 931          <table style='width:".ADMIN_WIDTH."'>
 932          <tr style='width:100%'>
 933          <td class='fcaption'>".FORLAN_156."</td>
 934          </tr>
 935          <tr>
 936          <td class='forumheader3'>
 937          ";
 938          if($sql->db_Select("forum", "*", "1 ORDER BY forum_order"))
 939          {
 940              $fList = $sql->db_getList();
 941              foreach($fList as $f)
 942              {
 943                  $txt .= "<input type='checkbox' name='forumlist[{$f['forum_id']}]' value='1' /> ".$tp->toHTML($f['forum_name'])."<br />";
 944              }
 945              $txt .= "<input type='checkbox' name='forum_all' value='1' /> <strong>".FORLAN_157."</strong>";
 946          }
 947          $txt .= "
 948          </td>
 949          </tr>
 950          <tr>
 951          <td class='fcaption'>".FORLAN_158."</td>
 952          </tr>
 953          <tr>
 954          <td class='forumheader3'>
 955          <input type='checkbox' name='lastpost' value='1' /> ".FORLAN_159." <br />&nbsp;&nbsp;&nbsp;&nbsp;
 956          <input type='checkbox' name='lastpost_nothread' value='1' checked='checked' /> ".FORLAN_160."
 957          </td>
 958          </tr>
 959          <tr>
 960          <td class='fcaption'>".FORLAN_161."</td>
 961          </tr>
 962          <tr>
 963          <td class='forumheader3'>
 964              <input type='checkbox' name='counts' value='1' /> ".FORLAN_162."<br />
 965              &nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='counts_threads' value='1' /><span style='text-align: center'> ".FORLAN_182."<br />".FORLAN_183."</span><br />
 966          </td>
 967          </tr>
 968          <tr>
 969          <td class='fcaption'>".FORLAN_163."</td>
 970          </tr>
 971          <tr>
 972          <td class='forumheader3'>
 973          <input type='checkbox' name='userpostcounts' value='1' /> ".FORLAN_164."<br />
 974          </td>
 975          </tr>
 976          <tr>
 977          <td class='forumheader3' style='text-align:center'>
 978          <input class='button' type='submit' name='tools' value='".FORLAN_165."' />
 979          </td>
 980          </tr>
 981          </table>
 982          </form>
 983          ";
 984          $ns->tablerender(FORLAN_166, $txt);
 985      }
 986  
 987  	function show_prefs()
 988      {
 989          global $pref, $ns;
 990          $text = "<div style='text-align:center'>
 991          <form method='post' action='".e_SELF."?".e_QUERY."'>\n
 992          <table style='".ADMIN_WIDTH."' class='fborder'>
 993  
 994          <tr>
 995          <td style='width:75%' class='forumheader3'>".FORLAN_44."<br /><span class='smalltext'>".FORLAN_45."</span></td>
 996          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_enclose'] ? "<input type='checkbox' name='forum_enclose' value='1' checked='checked' />" : "<input type='checkbox' name='forum_enclose' value='1' />")."</td>
 997          </tr>
 998  
 999          <tr>
1000          <td style='width:75%' class='forumheader3'>".FORLAN_65."<br /><span class='smalltext'>".FORLAN_46."</span></td>
1001          <td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_title' size='15' value='".$pref['forum_title']."' maxlength='100' /></td>
1002          </tr>
1003  
1004          <tr>
1005          <td style='width:75%' class='forumheader3'>".FORLAN_47."<br /><span class='smalltext'>".FORLAN_48."</span></td>
1006          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['email_notify'] ? "<input type='checkbox' name='email_notify' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify' value='1' />")."</td>
1007          </tr>
1008  
1009          <tr>
1010          <td style='width:75%' class='forumheader3'>".FORLAN_177."<br /><span class='smalltext'>".FORLAN_178."</span></td>
1011          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['email_notify_on'] ? "<input type='checkbox' name='email_notify_on' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify_on' value='1' />")."</td>
1012          </tr>
1013  
1014          <tr>
1015          <td style='width:75%' class='forumheader3'>".FORLAN_49."<br /><span class='smalltext'>".FORLAN_50."</span></td>
1016          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_poll'] ? "<input type='checkbox' name='forum_poll' value='1' checked='checked' />" : "<input type='checkbox' name='forum_poll' value='1' />")."</td>
1017          </tr>
1018  
1019          <tr>
1020          <td style='width:75%' class='forumheader3'>".FORLAN_70."<br /><span class='smalltext'>".FORLAN_71." <a href='".e_ADMIN."upload.php'>".FORLAN_130."</a> ". FORLAN_131."</span>";
1021  
1022          if(!$pref['image_post'])
1023          {
1024              $text .= "<br /><b>".FORLAN_139."</b>";
1025          }
1026  
1027          $text .= "</td>
1028          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_attach'] ? "<input type='checkbox' name='forum_attach' value='1' checked='checked' />" : "<input type='checkbox' name='forum_attach' value='1' />")."</td>
1029          </tr>
1030  
1031          <tr>
1032          <td style='width:75%' class='forumheader3'>".FORLAN_134."<br /><span class='smalltext'>".FORLAN_135."</span></td>
1033          <td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' size='3' maxlength='5' name='forum_maxwidth' value='{$pref['forum_maxwidth']}' /></td>
1034          </tr>
1035  
1036          <tr>
1037          <td style='width:75%' class='forumheader3'>".FORLAN_136."<br /><span class='smalltext'>".FORLAN_137."</span></td>
1038          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_linkimg'] ? "<input type='checkbox' name='forum_linkimg' value='1' checked='checked' />" : "<input type='checkbox' name='forum_linkimg' value='1' />")."</td>
1039          </tr>
1040  
1041          <tr>
1042          <td style='width:75%' class='forumheader3'>".FORLAN_51."<br /><span class='smalltext'>".FORLAN_52."</span></td>
1043          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_track'] ? "<input type='checkbox' name='forum_track' value='1' checked='checked' />" : "<input type='checkbox' name='forum_track' value='1' />")."</td>
1044          </tr>
1045  
1046          <tr>
1047          <td style='width:75%' class='forumheader3'>".FORLAN_112."<br /><span class='smalltext'>".FORLAN_113."</span></td>
1048          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_redirect'] ? "<input type='checkbox' name='forum_redirect' value='1' checked='checked' />" : "<input type='checkbox' name='forum_redirect' value='1' />")."</td>
1049          </tr>
1050  
1051          <tr>
1052          <td style='width:75%' class='forumheader3'>".FORLAN_114."<br /><span class='smalltext'>".FORLAN_115."</span></td>
1053          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_user_customtitle'] ? "<input type='checkbox' name='forum_user_customtitle' value='1' checked='checked' />" : "<input type='checkbox' name='forum_user_customtitle' value='1' />")."</td>
1054          </tr>
1055  
1056          <tr>
1057          <td style='width:75%' class='forumheader3'>".FORLAN_116."<br /><span class='smalltext'>".FORLAN_122."</span></td>
1058          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['reported_post_email'] ? "<input type='checkbox' name='reported_post_email' value='1' checked='checked' />" : "<input type='checkbox' name='reported_post_email' value='1' />")."</td>
1059          </tr>
1060  
1061  
1062          <tr>
1063          <td style='width:75%' class='forumheader3'>".FORLAN_126."<br /><span class='smalltext'>".FORLAN_127."</span></td>
1064          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_tooltip'] ? "<input type='checkbox' name='forum_tooltip' value='1' checked='checked' />" : "<input type='checkbox' name='forum_tooltip' value='1' />")."</td>
1065          </tr>
1066  
1067          <tr>
1068          <td style='width:75%' class='forumheader3'>".FORLAN_128."<br /><span class='smalltext'>".FORLAN_129."</span></td>
1069          <td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_tiplength' size='15' value='".$pref['forum_tiplength']."' maxlength='20' /></td>
1070          </tr>
1071  
1072  
1073          <tr>
1074          <td style='width:75%' class='forumheader3'>".FORLAN_53."<br /><span class='smalltext'>".FORLAN_54."</span></td>
1075          <td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_eprefix' size='15' value='".$pref['forum_eprefix']."' maxlength='20' /></td>
1076          </tr>
1077  
1078          <tr>
1079          <td style='width:75%' class='forumheader3'>".FORLAN_55."<br /><span class='smalltext'>".FORLAN_56."</span></td>
1080          <td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_popular' size='3' value='".$pref['forum_popular']."' maxlength='3' /></td>
1081          </tr>
1082  
1083          <tr>
1084          <td style='width:75%' class='forumheader3'>".FORLAN_57."<br /><span class='smalltext'>".FORLAN_58."</span></td>
1085          <td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_postspage' size='3' value='".$pref['forum_postspage']."' maxlength='3' /></td>
1086          </tr>
1087  
1088          <tr>
1089          <td style='width:75%' class='forumheader3'>".FORLAN_132."<br /><span class='smalltext'>".FORLAN_133."</span></td>
1090          <td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_hilightsticky'] ? "<input type='checkbox' name='forum_hilightsticky' value='1' checked='checked' />" : "<input type='checkbox' name='forum_hilightsticky' value='1' />")."</td>
1091          </tr>
1092  
1093          <tr>
1094          <td colspan='2'  style='text-align:center' class='forumheader'>
1095          <input class='button' type='submit' name='updateoptions' value='".FORLAN_61."' />
1096          </td>
1097          </tr>
1098          </table>
1099          </form>
1100          </div>";
1101          $ns->tablerender(FORLAN_62, $text);
1102      }
1103  
1104  	function show_reported ($sub_action, $id)
1105      {
1106          global $sql, $rs, $ns, $tp;
1107          if ($sub_action) {
1108              $sql -> db_Select("generic", "*", "gen_id='".$sub_action."'");
1109              $row = $sql -> db_Fetch();
1110              $sql -> db_Select("user", "*", "user_id='". $row['gen_user_id']."'");
1111              $user = $sql -> db_Fetch();
1112              $con = new convert;
1113              $text = "<div style='text-align: center'>
1114              <table class='fborder' style='".ADMIN_WIDTH."'><tr>
1115              <td style='width:40%' class='forumheader3'>
1116              ".FORLAN_171.":
1117              </td>
1118              <td style='width:60%' class='forumheader3'>
1119              <a href='".e_PLUGIN."forum/forum_viewtopic.php?".$row['gen_intdata'].".post' rel='external'>#".$row['gen_intdata']."</a>
1120              </td>
1121              </tr>
1122              <tr>
1123              <td style='width:40%' class='forumheader3'>
1124              ".FORLAN_173.":
1125              </td>
1126              <td style='width:60%' class='forumheader3'>
1127              ".$row['gen_ip']."
1128              </td>
1129              </tr>
1130              <tr>
1131              <td style='width:40%' class='forumheader3'>
1132              ".FORLAN_174.":
1133              </td>
1134              <td style='width:60%' class='forumheader3'>
1135              <a href='".e_BASE."user.php?id.".$user['user_id']."'>".$user['user_name']."</a>
1136              </td>
1137              </tr>
1138              <tr>
1139              <td style='width:40%' class='forumheader3'>
1140              ".FORLAN_175.":
1141              </td>
1142              <td style='width:60%' class='forumheader3'>
1143              ".$con -> convert_date($row['gen_datestamp'], "long")."
1144              </td>
1145              </tr>
1146              <tr>
1147              <td style='width:40%' class='forumheader3'>
1148              ".FORLAN_176.":
1149              </td>
1150              <td style='width:60%' class='forumheader3'>
1151              ".$row['gen_chardata']."
1152              </td>
1153              </tr>
1154              <tr>
1155              <td style='text-align:center' class='forumheader' colspan='2'>
1156              ".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")."
1157              ".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)."
1158              ".$rs->form_close()."
1159              </td>
1160              </tr>\n";
1161              $text .= "</table>";
1162              $text .= "</div>";
1163              $ns -> tablerender(FORLAN_116, $text);
1164          } else {
1165              $text = "<div style='text-align: center'>";
1166              if ($reported_total = $sql->db_Select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'"))
1167              {
1168                  $text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
1169                  <tr>
1170                  <td style='width:80%' class='fcaption'>".FORLAN_170."</td>
1171                  <td style='width:20%; text-align:center' class='fcaption'>".FORLAN_80."</td>
1172                  </tr>";
1173                  while ($row = $sql->db_Fetch())
1174                  {
1175                      $text .= "<tr>
1176                      <td style='width:80%' class='forumheader3'><a href='".e_SELF."?sr.".$row['gen_id']."'>".FORLAN_171." #".$row['gen_intdata']."</a></td>
1177                      <td style='width:20%; text-align:center; vertical-align:top; white-space: nowrap' class='forumheader3'>
1178                      ".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")."
1179                      ".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)."
1180                      ".$rs->form_close()."
1181                      </td>
1182                      </tr>\n";
1183                  }
1184                  $text .= "</table>";
1185              }
1186              else
1187              {
1188                  $text .= "<div style='text-align:center'>".FORLAN_121."</div>";
1189              }
1190              $text .= "</div>";
1191              $ns->tablerender(FORLAN_116, $text);
1192          }
1193      }
1194  
1195  	function show_prune()
1196      {
1197          global $ns, $sql;
1198  
1199          //        $sql -> db_Select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC");
1200          $qry = "
1201          SELECT f.forum_id, f.forum_name, sp.forum_name AS sub_parent, fp.forum_name AS forum_parent
1202          FROM #forum AS f
1203          LEFT JOIN #forum AS sp ON sp.forum_id = f.forum_sub
1204          LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
1205          WHERE f.forum_parent != 0
1206          ORDER BY f.forum_parent ASC, f.forum_sub, f.forum_order ASC
1207          ";
1208          $sql -> db_Select_gen($qry);
1209          $forums = $sql -> db_getList();
1210  
1211          $text = "<div style='text-align:center'>
1212          <form method='post' action='".e_SELF."?".e_QUERY."'>\n
1213          <table style='".ADMIN_WIDTH."' class='fborder'>
1214          <tr>
1215          <td style='text-align:center' class='forumheader3'>".FORLAN_60."</td>
1216          </tr>
1217          <tr>
1218  
1219          <td style='text-align:center' class='forumheader3'>".FORLAN_87."
1220          <input class='tbox' type='text' name='prune_days' size='6' value='' maxlength='3' />
1221          </td>
1222          </tr>
1223  
1224          <tr>
1225          <td style='text-align:center' class='forumheader3'>".FORLAN_2."<br />
1226          ".FORLAN_89." <input type='radio' name='prune_type' value='".FORLAN_3."' />&nbsp;&nbsp;&nbsp;
1227          ".FORLAN_90." <input type='radio' name='prune_type' value='".FORLAN_111."' checked='checked' />
1228          </td>
1229          </tr>
1230  
1231          <tr>
1232          <td class='forumheader3'>".FORLAN_138.": <br />";
1233  
1234          foreach($forums as $forum)
1235          {
1236              $for_name = $forum['forum_parent']." -> ";
1237              $for_name .= ($forum['sub_parent'] ? $forum['sub_parent']." -> " : "");
1238              $for_name .= $forum['forum_name'];
1239              $text .= "<input type='checkbox' name='pruneForum[]' value='".$forum['forum_id']."' /> ".$for_name."<br />";
1240          }
1241  
1242  
1243          $text .= "<tr>
1244          <td colspan='2'  style='text-align:center' class='forumheader'>
1245          <input class='button' type='submit' name='do_prune' value='".FORLAN_5."' />
1246          </td>
1247          </tr>
1248          </table>
1249          </form>
1250          </div>";
1251          $ns->tablerender(FORLAN_59, $text);
1252      }
1253  
1254  	function show_levels()
1255      {
1256          global $sql, $pref, $ns, $rs;
1257  
1258          $rank_names = explode(",", $pref['forum_levels']);
1259          $rank_thresholds = ($pref['forum_thresholds'] ? explode(",", $pref['forum_thresholds']) : array(20, 100, 250, 410, 580, 760, 950, 1150, 1370, 1600));
1260          $rank_images = ($pref['forum_images'] ? explode(",", $pref['forum_images']) : array("lev1.png", "lev2.png", "lev3.png", "lev4.png", "lev5.png", "lev6.png", "lev7.png", "lev8.png", "lev9.png", "lev10.png"));
1261  
1262          $text = "<div style='text-align:center'>
1263          <form method='post' action='".e_SELF."?".e_QUERY."'>\n
1264          <table style='".ADMIN_WIDTH."' class='fborder'>
1265  
1266          <tr>
1267          <td class='fcaption' style='width:40%'>".FORLAN_98."</td>
1268          <td class='fcaption' style='width:20%'>".FORLAN_102."<br /></td>
1269          <td class='fcaption' style='width:40%'>".FORLAN_104."<br /></td>
1270          </tr>
1271  
1272          <tr>
1273          <td class='forumheader3' style='width:40%'>&nbsp;</td>
1274          <td class='forumheader3' style='width:20%'><span class='smalltext'>".FORLAN_99."</span></td>
1275          <td class='forumheader3' style='width:40%'><span class='smalltext'>".FORLAN_100."</span></td>
1276          </tr>";
1277  
1278          $text .= "<tr>
1279          <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_main_admin' size='30' value='".($pref['rank_main_admin'] ? $pref['rank_main_admin'] : FORLAN_101)."' maxlength='30' /></td>
1280          <td class='forumheader3' style='width:40%'>&nbsp;</td>
1281          <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_main_admin_image' size='30' value='".($pref['rank_main_admin_image'] ? $pref['rank_main_admin_image'] : e_LANGUAGE."_main_admin.png")."' maxlength='30' /></td>
1282          </tr>
1283  
1284          <tr>
1285          <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_admin' size='30' value='".($pref['rank_admin'] ? $pref['rank_admin'] : FORLAN_103)."' maxlength='30' /></td>
1286          <td class='forumheader3' style='width:40%'>&nbsp;</td>
1287          <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_admin_image' size='30' value='".($pref['rank_admin_image'] ? $pref['rank_admin_image'] : e_LANGUAGE."_admin.png")."' maxlength='30' /></td>
1288          </tr>
1289  
1290          <tr>
1291          <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_moderator' size='30' value='".($pref['rank_moderator'] ? $pref['rank_moderator'] : FORLAN_105)."' maxlength='30' /></td>
1292          <td class='forumheader3' style='width:40%'>&nbsp;</td>
1293          <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_moderator_image' size='30' value='".($pref['rank_moderator_image'] ? $pref['rank_moderator_image'] : e_LANGUAGE."_moderator.png")."' maxlength='30' /></td>
1294          </tr>";
1295  
1296          for($a = 0; $a <= 9; $a++)
1297          {
1298              $text .= "<tr>
1299              <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_names[]' size='30' value='".($rank_names[$a] ? $rank_names[$a] : "")."' maxlength='30' /></td>
1300              <td class='forumheader3' style='width:20%; text-align:center'><input class='tbox' type='text' name='rank_thresholds[]' size='10' value='".$rank_thresholds[$a]."' maxlength='5' /></td>
1301              <td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_images[]' size='30' value='".($rank_images[$a] ? $rank_images[$a] : "")."' maxlength='30' /></td>
1302              </tr>";
1303          }
1304  
1305          $text .= "<tr>
1306          <td colspan='3'  style='text-align:center' class='forumheader'>
1307          <input class='button' type='submit' name='set_ranks' value='".FORLAN_94."' />
1308          </td>
1309          </tr>
1310          </table>\n</form>\n</div>";
1311          $ns->tablerender("Ranks", $text);
1312      }
1313  
1314  	function show_mods()
1315      {
1316          global $sql, $ns, $for, $tp;
1317          $forumList = $for->forum_getforums('all');
1318          $parentList = $for->forum_getparents('list');
1319          $subList   = $for->forum_getsubs('bysub');
1320  
1321          $txt = "<form method='post' action='".e_SELF."?".e_QUERY."'><table class='fborder' style='width:100%'><tr><td> &nbsp; </td>";
1322  
1323          foreach($parentList as $p)
1324          {
1325              $txt .= "
1326              <tr>
1327              <td colspan='2' class='fcaption'><strong>".$tp->toHTML($p['forum_name'])."</strong></td>
1328              </tr>
1329              ";
1330  
1331              foreach($forumList[$p['forum_id']] as $f)
1332              {
1333                  $txt .= "
1334                  <tr>
1335                  <td class='forumheader'>{$f['forum_name']}</td>
1336                  <td class='forumheader'>".r_userclass("mods[{$f['forum_id']}]", $f['forum_moderators'], 'off', 'admin,classes')."</td>
1337                  </tr>
1338                  ";
1339                  foreach($subList[$f['forum_id']] as $s)
1340                  {
1341                      $txt .= "
1342                      <tr>
1343                      <td class='forumheader3'>&nbsp;&nbsp;&nbsp;&nbsp;{$s['forum_name']}</td>
1344                      <td class='forumheader3'>".r_userclass("mods[{$s['forum_id']}]", $s['forum_moderators'], 'off', 'admin,classes')."</td>
1345                      </tr>
1346                      ";
1347                  }
1348              }
1349          }
1350              $txt .= "
1351              <tr>
1352              <td colspan='2' class='fcaption' style='text-align:center'>
1353              <input class='button' type='submit' name='setMods' value='".WMGLAN_4." ".FORLAN_33."' />
1354              </td>
1355              </tr>
1356  
1357              </table></form>";
1358              $ns->tablerender(FORLAN_33, $txt);
1359          }
1360  
1361  		function show_rules()
1362          {
1363              global $sql, $pref, $ns, $tp;
1364  
1365              $sql->db_Select("wmessage");
1366              list($null) = $sql->db_Fetch();
1367              list($null) = $sql->db_Fetch();
1368              list($null) = $sql->db_Fetch();
1369              list($id, $guestrules, $wm_active4) = $sql->db_Fetch();
1370              list($id, $memberrules, $wm_active5) = $sql->db_Fetch();
1371              list($id, $adminrules, $wm_active6) = $sql->db_Fetch();
1372  
1373              if($sql->db_Select('generic','*',"gen_type='forum_rules_guest'"))
1374              {
1375                  $guest_rules = $sql->db_Fetch();
1376              }
1377              if($sql->db_Select('generic','*',"gen_type='forum_rules_member'"))
1378              {
1379                  $member_rules = $sql->db_Fetch();
1380              }
1381              if($sql->db_Select('generic','*',"gen_type='forum_rules_admin'"))
1382              {
1383                  $admin_rules = $sql->db_Fetch();
1384              }
1385  
1386              $guesttext = $tp->toFORM($guest_rules['gen_chardata']);
1387              $membertext = $tp->toFORM($member_rules['gen_chardata']);
1388              $admintext = $tp->toFORM($admin_rules['gen_chardata']);
1389  
1390              $text = "
1391              <div style='text-align:center'>
1392              <form method='post' action='".e_SELF."?rules'  id='wmform'>
1393              <table style='".ADMIN_WIDTH."' class='fborder'>
1394              <tr>";
1395  
1396              $text .= "
1397  
1398              <td style='width:20%' class='forumheader3'>".WMGLAN_1.": <br />
1399              ".WMGLAN_6.":";
1400              if ($guest_rules['gen_intdata'])
1401              {
1402                  $text .= "<input type='checkbox' name='guest_active' value='1'  checked='checked' />";
1403              }
1404              else
1405              {
1406                  $text .= "<input type='checkbox' name='guest_active' value='1' />";
1407              }
1408              $text .= "</td>
1409              <td style='width:60%' class='forumheader3'>
1410              <textarea class='tbox' name='guestrules' cols='70' rows='10'>$guesttext</textarea>
1411              <br />
1412              <input class='helpbox' type='text' name='helpguest' size='100' />
1413              <br />
1414              ".display_help('helpb', 1, 'addtext1', 'help1')."
1415              </td>
1416              </tr>
1417  
1418              <tr>
1419              <td style='width:20%' class='forumheader3'>".WMGLAN_2.": <br />
1420              ".WMGLAN_6.":";
1421              if ($member_rules['gen_intdata'])
1422              {
1423                  $text .= "<input type='checkbox' name='member_active' value='1'  checked='checked' />";
1424              }
1425              else
1426              {
1427                  $text .= "<input type='checkbox' name='member_active' value='1' />";
1428              }
1429              $text .= "</td>
1430              <td style='width:60%' class='forumheader3'>
1431              <textarea class='tbox' name='memberrules' cols='70' rows='10'>$membertext</textarea>
1432              <br />
1433              <input class='helpbox' type='text' name='helpmember' size='100' />
1434              <br />
1435              ".display_help('helpb', 1, 'addtext2', 'help2')."
1436              </td>
1437              </tr>
1438  
1439              <tr>
1440              <td style='width:20%' class='forumheader3'>".WMGLAN_3.": <br />
1441              ".WMGLAN_6.": ";
1442  
1443              if ($admin_rules['gen_intdata'])
1444              {
1445                  $text .= "<input type='checkbox' name='admin_active' value='1'  checked='checked' />";
1446              }
1447              else
1448              {
1449                  $text .= "<input type='checkbox' name='admin_active' value='1' />";
1450              }
1451  
1452              $text .= "</td>
1453              <td style='width:60%' class='forumheader3'>
1454              <textarea class='tbox' name='adminrules' cols='70' rows='10'>$admintext</textarea>
1455              <br />
1456              <input class='helpbox' type='text' name='helpadmin' size='100' />
1457              <br />
1458              ".display_help('helpb', 1, 'addtext3', 'help3')."
1459              </td>
1460              </tr>
1461  
1462              <tr style='vertical-align:top'>
1463              <td class='forumheader'>&nbsp;</td>
1464              <td style='width:60%' class='forumheader'>
1465              <input class='button' type='submit' name='frsubmit' value='".WMGLAN_4."' />
1466              </td>
1467              </tr>
1468              </table>
1469              </form>
1470              </div>";
1471  
1472              $ns->tablerender(WMGLAN_5, $text);
1473  
1474              echo "
1475              <script type=\"text/javascript\">
1476  			function addtext1(sc){
1477                  document.getElementById('wmform').guestrules.value += sc;
1478              }
1479  			function addtext2(sc){
1480                  document.getElementById('wmform').memberrules.value += sc;
1481              }
1482  			function addtext3(sc){
1483                  document.getElementById('wmform').adminrules.value += sc;
1484              }
1485  			function help1(help){
1486                  document.getElementById('wmform').helpguest.value = help;
1487              }
1488  			function help2(help){
1489                  document.getElementById('wmform').helpmember.value = help;
1490              }
1491  			function help3(help){
1492                  document.getElementById('wmform').helpadmin.value = help;
1493              }
1494              </script>
1495              ";
1496  
1497          }
1498      }
1499  
1500  	function forum_admin_adminmenu()
1501      {
1502          global $forum;
1503          global $action;
1504          $forum->show_options($action);
1505      }
1506      ?>


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