[Top level directory]     [Classes]     [Functions]     [Constants]     [Variables]

XMB Open Source Forum Software - PHP Cross Reference

title

Body

[close]

/ -> cp.php (source)

   1  <?php
   2  /**
   3   * eXtreme Message Board
   4   * XMB 1.9.11
   5   *
   6   * Developed And Maintained By The XMB Group
   7   * Copyright (c) 2001-2010, The XMB Group
   8   * http://www.xmbforum.com
   9   *
  10   * Sponsored By iEntry, Inc.
  11   * http://www.ientry.com
  12   *
  13   * This program is free software; you can redistribute it and/or
  14   * modify it under the terms of the GNU General Public License
  15   * as published by the Free Software Foundation; either version 2
  16   * of the License, or (at your option) any later version.
  17   *
  18   * This program is distributed in the hope that it will be useful,
  19   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21   * GNU General Public License for more details.
  22   *
  23   * You should have received a copy of the GNU General Public License
  24   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  25   *
  26   **/
  27  
  28  define('X_SCRIPT', 'cp.php');
  29  
  30  require  'header.php';
  31  require  ROOT.'include/admin.inc.php';
  32  
  33  header('X-Robots-Tag: noindex');
  34  
  35  loadtemplates('error_nologinsession');
  36  
  37  nav($lang['textcp']);
  38  
  39  eval('$css = "'.template('css').'";');
  40  eval('echo "'.template('header').'";');
  41  echo '<script language="JavaScript" type="text/javascript" src="./js/admin.js"></script>';
  42  
  43  if (!X_ADMIN) {
  44      eval('echo "'.template('error_nologinsession').'";');
  45      end_time();
  46      eval('echo "'.template('footer').'";');
  47      exit();
  48  }
  49  
  50  $auditaction = $_SERVER['REQUEST_URI'];
  51  $aapos = strpos($auditaction, "?");
  52  if ($aapos !== false) {
  53      $auditaction = substr($auditaction, $aapos + 1);
  54  }
  55  $auditaction = addslashes("$onlineip|#|$auditaction");
  56  audit($xmbuser, $auditaction, 0, 0);
  57  
  58  displayAdminPanel();
  59  
  60  $action = postedVar('action', '', FALSE, FALSE, FALSE, 'g');
  61  
  62  if ($action == "settings") {
  63      if (noSubmit('settingsubmit1')
  64      And noSubmit('settingsubmit2')
  65      And noSubmit('settingsubmit3')
  66      And noSubmit('settingsubmit4')
  67      And noSubmit('settingsubmit5')
  68      And noSubmit('settingsubmit6')
  69      And noSubmit('settingsubmit7')) {
  70          $langfileselect = createLangFileSelect($SETTINGS['langfile']);
  71  
  72          $themelist = array();
  73          $themelist[] = '<select name="themenew">';
  74          $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
  75          while($themeinfo = $db->fetch_array($query)) {
  76              if ($themeinfo['themeid'] == $SETTINGS['theme']) {
  77                  $themelist[] = '<option value="'.intval($themeinfo['themeid']).'" '.$selHTML.'>'.stripslashes($themeinfo['name']).'</option>';
  78              } else {
  79                  $themelist[] = '<option value="'.intval($themeinfo['themeid']).'">'.stripslashes($themeinfo['name']).'</option>';
  80              }
  81          }
  82          $themelist[] = '</select>';
  83          $themelist = implode("\n", $themelist);
  84          $db->free_result($query);
  85  
  86          $onselect = $offselect = '';
  87          settingHTML('bbstatus', $onselect, $offselect);
  88  
  89          $whosonlineon = $whosonlineoff = '';
  90          settingHTML('whosonlinestatus', $whosonlineon, $whosonlineoff);
  91  
  92          $regon = $regoff = '';
  93          settingHTML('regstatus', $regon, $regoff);
  94  
  95          $regonlyon = $regonlyoff = '';
  96          settingHTML('regviewonly', $regonlyon, $regonlyoff);
  97  
  98          $catsonlyon = $catsonlyoff = '';
  99          settingHTML('catsonly', $catsonlyon, $catsonlyoff);
 100  
 101          $hideon = $hideoff = '';
 102          settingHTML('hideprivate', $hideon, $hideoff);
 103  
 104          $echeckon = $echeckoff = '';
 105          settingHTML('emailcheck', $echeckon, $echeckoff);
 106  
 107          $ruleson = $rulesoff = '';
 108          settingHTML('bbrules', $ruleson, $rulesoff);
 109  
 110          $searchon = $searchoff = '';
 111          settingHTML('searchstatus', $searchon, $searchoff);
 112  
 113          $faqon = $faqoff = '';
 114          settingHTML('faqstatus', $faqon, $faqoff);
 115  
 116          $memliston = $memlistoff = '';
 117          settingHTML('memliststatus', $memliston, $memlistoff);
 118  
 119          $todayon = $todayoff = '';
 120          settingHTML('todaysposts', $todayon, $todayoff);
 121  
 122          $statson = $statsoff = '';
 123          settingHTML('stats', $statson, $statsoff);
 124  
 125          $gzipcompresson = $gzipcompressoff = '';
 126          settingHTML('gzipcompress', $gzipcompresson, $gzipcompressoff);
 127  
 128          $coppaon = $coppaoff = '';
 129          settingHTML('coppa', $coppaon, $coppaoff);
 130  
 131          $sigbbcodeon = $sigbbcodeoff = '';
 132          settingHTML('sigbbcode', $sigbbcodeon, $sigbbcodeoff);
 133  
 134          $sightmlon = $sightmloff = '';
 135          settingHTML('sightml', $sightmlon, $sightmloff);
 136  
 137          $reportposton = $reportpostoff = '';
 138          settingHTML('reportpost', $reportposton, $reportpostoff);
 139  
 140          $bbinserton = $bbinsertoff = '';
 141          settingHTML('bbinsert', $bbinserton, $bbinsertoff);
 142  
 143          $smileyinserton = $smileyinsertoff = '';
 144          settingHTML('smileyinsert', $smileyinserton, $smileyinsertoff);
 145  
 146          $doubleeon = $doubleeoff = '';
 147          settingHTML('doublee', $doubleeon, $doubleeoff);
 148  
 149          $editedbyon = $editedbyoff = '';
 150          settingHTML('editedby', $editedbyon, $editedbyoff);
 151  
 152          $dotfolderson = $dotfoldersoff = '';
 153          settingHTML('dotfolders', $dotfolderson, $dotfoldersoff);
 154  
 155          $attachimgposton = $attachimgpostoff = '';
 156          settingHTML('attachimgpost', $attachimgposton, $attachimgpostoff);
 157  
 158          $tickerstatuson = $tickerstatusoff = '';
 159          settingHTML('tickerstatus', $tickerstatuson, $tickerstatusoff);
 160  
 161          $spacecatson = $spacecatsoff = '';
 162          settingHTML('space_cats', $spacecatson, $spacecatsoff);
 163  
 164          $subjectInTitleOn = $subjectInTitleOff = '';
 165          settingHTML('subject_in_title', $subjectInTitleOn, $subjectInTitleOff);
 166  
 167          $allowrankediton = $allowrankeditoff = '';
 168          settingHTML('allowrankedit', $allowrankediton, $allowrankeditoff);
 169  
 170          $spellcheckon = $spellcheckoff = '';
 171          settingHTML('spellcheck', $spellcheckon, $spellcheckoff);
 172  
 173          $resetSigOn = $resetSigOff = '';
 174          settingHTML('resetsigs', $resetSigOn, $resetSigOff);
 175  
 176          $captchaOn = $captchaOff = '';
 177          settingHTML('captcha_status', $captchaOn, $captchaOff);
 178  
 179          $captcharegOn = $captcharegOff = '';
 180          settingHTML('captcha_reg_status', $captcharegOn, $captcharegOff);
 181  
 182          $captchapostOn = $captchapostOff = '';
 183          settingHTML('captcha_post_status', $captchapostOn, $captchapostOff);
 184  
 185          $captchasearchOn = $captchasearchOff = '';
 186          settingHTML('captcha_search_status', $captchasearchOn, $captchasearchOff);
 187  
 188          $captchacodecaseOn = $captchacodecaseOff = '';
 189          settingHTML('captcha_code_casesensitive', $captchacodecaseOn, $captchacodecaseOff);
 190  
 191          $captchacodeshadowOn = $captchacodeshadowOff = '';
 192          settingHTML('captcha_code_shadow', $captchacodeshadowOn, $captchacodeshadowOff);
 193  
 194          $captchaimagecolorOn = $captchaimagecolorOff = '';
 195          settingHTML('captcha_image_color', $captchaimagecolorOn, $captchaimagecolorOff);
 196  
 197          $showsubson = $showsubsoff = '';
 198          settingHTML('showsubforums', $showsubson, $showsubsoff);
 199  
 200          $regoptionalon = $regoptionaloff = '';
 201          settingHTML('regoptional', $regoptionalon, $regoptionaloff);
 202  
 203          $quickreply_statuson = $quickreply_statusoff = '';
 204          settingHTML('quickreply_status', $quickreply_statuson, $quickreply_statusoff);
 205  
 206          $quickjump_statuson = $quickjump_statusoff = '';
 207          settingHTML('quickjump_status', $quickjump_statuson, $quickjump_statusoff);
 208  
 209          $index_statson = $index_statsoff = '';
 210          settingHTML('index_stats', $index_statson, $index_statsoff);
 211  
 212          $onlinetoday_statuson = $onlinetoday_statusoff = '';
 213          settingHTML('onlinetoday_status', $onlinetoday_statuson, $onlinetoday_statusoff);
 214  
 215          $remoteimageson = $remoteimagesoff = '';
 216          settingHTML('attach_remote_images', $remoteimageson, $remoteimagesoff);
 217  
 218          $check12 = $check24 = '';
 219          if ($SETTINGS['timeformat'] == 24) {
 220              $check24 = $cheHTML;
 221          } else {
 222              $check12 = $cheHTML;
 223          }
 224  
 225          $indexShowBarCats = $indexShowBarTop = $indexShowBarNone = false;
 226          switch($SETTINGS['indexshowbar']) {
 227              case 1:
 228                  $indexShowBarCats = true;
 229                  break;
 230              case 3:
 231                  $indexShowBarNone = true;
 232                  break;
 233              default:
 234                  $indexShowBarTop = true;
 235                  break;
 236          }
 237  
 238          $spell_off_reason = '';
 239          if (!defined('PSPELL_FAST')) {
 240              $spell_off_reason = $lang['pspell_needed'];
 241              $SETTINGS['spellcheck'] = 'off';
 242          }
 243  
 244          $notifycheck[0] = $notifycheck[1] = $notifycheck[2] = false;
 245          if ($SETTINGS['notifyonreg'] == 'off') {
 246              $notifycheck[0] = true;
 247          } else if ($SETTINGS['notifyonreg'] == 'u2u') {
 248              $notifycheck[1] = true;
 249          } else {
 250              $notifycheck[2] = true;
 251          }
 252  
 253          $allowipreg[0] = $allowipreg[1] = false;
 254          if ($SETTINGS['ipreg'] == 'on') {
 255              $allowipreg[0] = true;
 256          } else {
 257              $allowipreg[1] = true;
 258          }
 259  
 260          $footer_options = explode('-', $SETTINGS['footer_options']);
 261          if (in_array('serverload', $footer_options)) {
 262              $sel_serverload = true;
 263          } else {
 264              $sel_serverload = false;
 265          }
 266  
 267          if (in_array('queries', $footer_options)) {
 268              $sel_queries = true;
 269          } else {
 270              $sel_queries = false;
 271          }
 272  
 273          if (in_array('phpsql', $footer_options)) {
 274              $sel_phpsql = true;
 275          } else {
 276              $sel_phpsql = false;
 277          }
 278  
 279          if (in_array('loadtimes', $footer_options)) {
 280              $sel_loadtimes = true;
 281          } else {
 282              $sel_loadtimes = false;
 283          }
 284  
 285          $avchecked[0] = $avchecked[1] = $avchecked[2] = false;
 286          if ($SETTINGS['avastatus'] == 'list') {
 287              $avchecked[1] = true;
 288          } else if ($SETTINGS['avastatus'] == 'off') {
 289              $avchecked[2] = true;
 290          } else {
 291              $avchecked[0] = true;
 292          }
 293  
 294          $timezone1 = $timezone2 = $timezone3 = $timezone4 = $timezone5 = $timezone6 = false;
 295          $timezone7 = $timezone8 = $timezone9 = $timezone10 = $timezone11 = $timezone12 = false;
 296          $timezone13 = $timezone14 = $timezone15 = $timezone16 = $timezone17 = $timezone18 = false;
 297          $timezone19 = $timezone20 = $timezone21 = $timezone22 = $timezone23 = $timezone24 = false;
 298          $timezone25 = $timezone26 = $timezone27 = $timezone28 = $timezone29 = $timezone30 = false;
 299          $timezone31 = $timezone32 = $timezone33 = false;
 300          switch($SETTINGS['def_tz']) {
 301              case '-12.00':
 302                  $timezone1 = true;
 303                  break;
 304              case '-11.00':
 305                  $timezone2 = true;
 306                  break;
 307              case '-10.00':
 308                  $timezone3 = true;
 309                  break;
 310              case '-9.00':
 311                  $timezone4 = true;
 312                  break;
 313              case '-8.00':
 314                  $timezone5 = true;
 315                  break;
 316              case '-7.00':
 317                  $timezone6 = true;
 318                  break;
 319              case '-6.00':
 320                  $timezone7 = true;
 321                  break;
 322              case '-5.00':
 323                  $timezone8 = true;
 324                  break;
 325              case '-4.00':
 326                  $timezone9 = true;
 327                  break;
 328              case '-3.50':
 329                  $timezone10 = true;
 330                  break;
 331              case '-3.00':
 332                  $timezone11 = true;
 333                  break;
 334              case '-2.00':
 335                  $timezone12 = true;
 336                  break;
 337              case '-1.00':
 338                  $timezone13 = true;
 339                  break;
 340              case '1.00':
 341                  $timezone15 = true;
 342                  break;
 343              case '2.00':
 344                  $timezone16 = true;
 345                  break;
 346              case '3.00':
 347                  $timezone17 = true;
 348                  break;
 349              case '3.50':
 350                  $timezone18 = true;
 351                  break;
 352              case '4.00':
 353                  $timezone19 = true;
 354                  break;
 355              case '4.50':
 356                  $timezone20 = true;
 357                  break;
 358              case '5.00':
 359                  $timezone21 = true;
 360                  break;
 361              case '5.50':
 362                  $timezone22 = true;
 363                  break;
 364              case '5.75':
 365                  $timezone23 = true;
 366                  break;
 367              case '6.00':
 368                  $timezone24 = true;
 369                  break;
 370              case '6.50':
 371                  $timezone25 = true;
 372                  break;
 373              case '7.00':
 374                  $timezone26 = true;
 375                  break;
 376              case '8.00':
 377                  $timezone27 = true;
 378                  break;
 379              case '9.00':
 380                  $timezone28 = true;
 381                  break;
 382              case '9.50':
 383                  $timezone29 = true;
 384                  break;
 385              case '10.00':
 386                  $timezone30 = true;
 387                  break;
 388              case '11.00':
 389                  $timezone31 = true;
 390                  break;
 391              case '12.00':
 392                  $timezone32 = true;
 393                  break;
 394              case '13.00':
 395                  $timezone33 = true;
 396                  break;
 397              case '0.00':
 398              default:
 399                  $timezone14 = true;
 400                  break;
 401          }
 402  
 403          $values = array('serverload', 'queries', 'phpsql', 'loadtimes');
 404          $names = array($lang['Enable_Server_Load'], $lang['Enable_Queries'], $lang['Enable_PHP_SQL'], $lang['Enable_Page_load']);
 405          $checked = array($sel_serverload, $sel_queries, $sel_phpsql, $sel_loadtimes);
 406  
 407          $max_avatar_sizes = explode('x', $SETTINGS['max_avatar_size']);
 408          $lang['spell_checker'] .= $spell_off_reason;
 409          ?>
 410          <tr bgcolor="<?php echo $altbg2?>">
 411          <td align="center">
 412          <span class="smalltxt">
 413          <a href="#1"><?php echo $lang['admin_main_settings1']; ?></a><br />
 414          <a href="#2"><?php echo $lang['admin_main_settings2']; ?></a><br />
 415          <a href="#3"><?php echo $lang['admin_main_settings3']; ?></a><br />
 416          <a href="#4"><?php echo $lang['admin_main_settings4']; ?></a><br />
 417          <a href="#5"><?php echo $lang['admin_main_settings5']; ?></a><br />
 418          <a href="#8"><?php echo $lang['admin_main_settings8']; ?></a><br />
 419          <a href="#6"><?php echo $lang['admin_main_settings6']; ?></a><br />
 420          <a href="#7"><?php echo $lang['admin_main_settings7']; ?></a><br />
 421          </span>
 422          <form method="post" action="cp.php?action=settings">
 423          <table cellspacing="0" cellpadding="0" border="0" width="<?php echo $tablewidth?>" align="center">
 424          <tr>
 425          <td bgcolor="<?php echo $bordercolor?>">
 426          <table border="0" cellspacing="<?php echo $THEME['borderwidth']?>" cellpadding="<?php echo $tablespace?>" width="100%">
 427          <tr class="category">
 428          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="1" />&raquo;&nbsp;<?php echo $lang['admin_main_settings1']?></font></strong></td>
 429          </tr>
 430          <?php
 431          printsetting2($lang['textsitename'], 'sitenamenew', $SETTINGS['sitename'], 50);
 432          printsetting2($lang['bbname'], 'bbnamenew', $SETTINGS['bbname'], 50);
 433          printsetting2($lang['textsiteurl'], 'siteurlnew', $SETTINGS['siteurl'], 50);
 434          printsetting2($lang['adminemail'], 'adminemailnew', $SETTINGS['adminemail'], 50);
 435          printsetting1($lang['textbbrules'], 'bbrulesnew', $ruleson, $rulesoff);
 436          ?>
 437          <?php
 438          printsetting4($lang['textbbrulestxt'], 'bbrulestxtnew', cdataOut($SETTINGS['bbrulestxt']), 5, 50);
 439          printsetting1($lang['textbstatus'], 'bbstatusnew', $onselect, $offselect);
 440          printsetting4($lang['textbboffreason'], 'bboffreasonnew', $SETTINGS['bboffreason'], 5, 50);
 441          printsetting1($lang['gzipcompression'], 'gzipcompressnew', $gzipcompresson, $gzipcompressoff);
 442          ?>
 443          <tr class="ctrtablerow">
 444          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit1" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 445          </tr>
 446          <tr class="category">
 447          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="2" />&raquo;&nbsp;<?php echo $lang['admin_main_settings2']?></font></strong></td>
 448          </tr>
 449          <tr class="tablerow">
 450          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textlanguage']?></td>
 451          <td bgcolor="<?php echo $altbg2?>"><?php echo $langfileselect?></td>
 452          </tr>
 453          <tr class="tablerow">
 454          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['texttheme']?></td>
 455          <td bgcolor="<?php echo $altbg2?>"><?php echo $themelist?></td>
 456          </tr>
 457          <?php
 458          printsetting2($lang['textppp'], 'postperpagenew', ((int)$SETTINGS['postperpage']), 3);
 459          printsetting2($lang['texttpp'], 'topicperpagenew', ((int)$SETTINGS['topicperpage']), 3);
 460          printsetting2($lang['textmpp'], 'memberperpagenew', ((int)$SETTINGS['memberperpage']), 3);
 461          ?>
 462          <tr class="tablerow">
 463          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['texttimeformat']?></td>
 464          <td bgcolor="<?php echo $altbg2?>"><input type="radio" value="24" name="timeformatnew" <?php echo $check24?> />&nbsp;<?php echo $lang['text24hour']?>&nbsp;<input type="radio" value="12" name="timeformatnew" <?php echo $check12?> />&nbsp;<?php echo $lang['text12hour']?></td>
 465          </tr>
 466          <?php
 467          printsetting2($lang['dateformat'], 'dateformatnew', $SETTINGS['dateformat'], 20);
 468          ?>
 469          <tr class="ctrtablerow">
 470          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit2" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 471          </tr>
 472          <tr class="category">
 473          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="3" />&raquo;&nbsp;<?php echo $lang['admin_main_settings3']?></font></strong></td>
 474          </tr>
 475          <?php
 476          printsetting1($lang['textsearchstatus'], 'searchstatusnew', $searchon, $searchoff);
 477          printsetting1($lang['textfaqstatus'], 'faqstatusnew', $faqon, $faqoff);
 478          printsetting1($lang['texttodaystatus'], 'todaystatusnew', $todayon, $todayoff);
 479          printsetting1($lang['textstatsstatus'], 'statsstatusnew', $statson,  $statsoff);
 480          printsetting1($lang['textmemliststatus'], 'memliststatusnew', $memliston, $memlistoff);
 481          printsetting1($lang['spell_checker'], 'spellchecknew', $spellcheckon, $spellcheckoff);
 482          printsetting1($lang['coppastatus'], 'coppanew', $coppaon, $coppaoff);
 483          printsetting1($lang['reportpoststatus'], 'reportpostnew', $reportposton, $reportpostoff);
 484          ?>
 485          <tr class="ctrtablerow">
 486          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit3" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 487          </tr>
 488          <tr class="category">
 489          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="4" />&raquo;&nbsp;<?php echo $lang['admin_main_settings4']?></font></strong></td>
 490          </tr>
 491          <?php
 492          printsetting1($lang['showsubforums'], 'showsubforumsnew', $showsubson, $showsubsoff);
 493          printsetting1($lang['space_cats'], 'space_catsnew', $spacecatson, $spacecatsoff);
 494          printsetting3($lang['indexShowBarDesc'], 'indexShowBarNew', array($lang['indexShowBarCats'], $lang['indexShowBarTop'], $lang['indexShowBarNone']), array(1, 2, 3), array($indexShowBarCats, $indexShowBarTop, $indexShowBarNone), false);
 495          printsetting1($lang['index_stats'], 'index_statsnew', $index_statson, $index_statsoff);
 496          printsetting1($lang['quickreply_status'], 'quickreply_statusnew', $quickreply_statuson, $quickreply_statusoff);
 497          printsetting1($lang['quickjump_status'], 'quickjump_statusnew', $quickjump_statuson, $quickjump_statusoff);
 498          printsetting1($lang['allowrankedit'], 'allowrankeditnew', $allowrankediton, $allowrankeditoff);
 499          printsetting1($lang['subjectInTitle'], 'subjectInTitleNew', $subjectInTitleOn, $subjectInTitleOff);
 500          printsetting1($lang['textcatsonly'], 'catsonlynew', $catsonlyon, $catsonlyoff);
 501          printsetting1($lang['whosonline_on'], 'whos_on', $whosonlineon, $whosonlineoff);
 502          printsetting1($lang['onlinetoday_status'], 'onlinetoday_statusnew', $onlinetoday_statuson, $onlinetoday_statusoff);
 503          printsetting2($lang['max_onlinetodaycount'], 'onlinetodaycountnew', ((int)$SETTINGS['onlinetodaycount']), 5);
 504          printsetting2($lang['smtotal'], 'smtotalnew', ((int)$SETTINGS['smtotal']), 5);
 505          printsetting2($lang['smcols'], 'smcolsnew', ((int)$SETTINGS['smcols']), 5);
 506          printsetting1($lang['dotfolders'], 'dotfoldersnew', $dotfolderson, $dotfoldersoff);
 507          printsetting1($lang['editedby'], 'editedbynew', $editedbyon, $editedbyoff);
 508          ?>
 509          <tr class="ctrtablerow">
 510          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit3" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 511          </tr>
 512          <tr class="category">
 513          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="5" />&raquo;&nbsp;<?php echo $lang['admin_main_settings5']?></font></strong></td>
 514          </tr>
 515          <?php
 516          printsetting1($lang['reg_on'], 'reg_on', $regon, $regoff);
 517          printsetting3($lang['ipreg'], 'ipReg', array($lang['texton'], $lang['textoff']), array('on', 'off'), $allowipreg, false);
 518          printsetting2($lang['max_daily_regs'], 'maxDayReg', ((int)$SETTINGS['maxdayreg']), 3);
 519          printsetting3($lang['notifyonreg'], 'notifyonregnew', array($lang['textoff'], $lang['viau2u'], $lang['viaemail']), array('off', 'u2u', 'email'), $notifycheck, false);
 520          printsetting1($lang['textreggedonly'], 'regviewnew', $regonlyon, $regonlyoff);
 521          printsetting1($lang['texthidepriv'], 'hidepriv', $hideon, $hideoff);
 522          printsetting1($lang['emailverify'], 'emailchecknew',$echeckon, $echeckoff);
 523          printsetting1($lang['regoptional'], 'regoptionalnew',$regoptionalon, $regoptionaloff);
 524          printsetting2($lang['textflood'], 'floodctrlnew', ((int)$SETTINGS['floodctrl']), 3);
 525          printsetting2($lang['u2uquota'], 'u2uquotanew', ((int)$SETTINGS['u2uquota']), 3);
 526          printsetting3($lang['textavastatus'], 'avastatusnew', array($lang['texton'], $lang['textlist'], $lang['textoff']), array('on', 'list', 'off'), $avchecked, false);
 527          printsetting1($lang['resetSigDesc'], 'resetSigNew', $resetSigOn, $resetSigOff);
 528          printsetting1($lang['doublee'], 'doubleenew', $doubleeon, $doubleeoff);
 529          printsetting2($lang['pruneusers'], 'pruneusersnew', ((int)$SETTINGS['pruneusers']), 3);
 530          ?>
 531          <tr class="ctrtablerow">
 532          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit4" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 533          </tr>
 534          <tr class="category">
 535          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="8" />&raquo;&nbsp;<?php echo $lang['admin_main_settings8']?></font></strong></td>
 536          </tr>
 537          <?php
 538          $max_image_sizes = explode('x', $SETTINGS['max_image_size']);
 539          $max_thumb_sizes = explode('x', $SETTINGS['max_thumb_size']);
 540          for($i=0; $i<=4; $i++) {
 541              $urlformatchecked[$i] = ($SETTINGS['file_url_format'] == $i + 1);
 542          }
 543          for($i=0; $i<=1; $i++) {
 544              $subdirchecked[$i] = ($SETTINGS['files_subdir_format'] == $i + 1);
 545          }
 546          printsetting2($lang['textfilesperpost'], 'filesperpostnew', ((int)$SETTINGS['filesperpost']), 3);
 547          printsetting2($lang['max_attachment_size'], 'maxAttachSize', ((int)$SETTINGS['maxattachsize']), 12);
 548          printsetting2($lang['textfilessizew'], 'max_image_size_w_new', $max_image_sizes[0], 5);
 549          printsetting2($lang['textfilessizeh'], 'max_image_size_h_new', $max_image_sizes[1], 5);
 550          printsetting2($lang['textfilesthumbw'], 'max_thumb_size_w_new', $max_thumb_sizes[0], 5);
 551          printsetting2($lang['textfilesthumbh'], 'max_thumb_size_h_new', $max_thumb_sizes[1], 5);
 552          if (!ini_get('allow_url_fopen')) {
 553              printsetting5($lang['attachimginpost'], $lang['no_url_fopen']);
 554          } else {
 555              printsetting1($lang['attachimginpost'], 'attachimgpostnew', $attachimgposton, $attachimgpostoff);
 556          }
 557          printsetting1($lang['textremoteimages'], 'remoteimages', $remoteimageson, $remoteimagesoff);
 558          printsetting2($lang['textfilespath'], 'filespathnew', $SETTINGS['files_storage_path'], 50);
 559          printsetting2($lang['textfilesminsize'], 'filesminsizenew', ((int)$SETTINGS['files_min_disk_size']), 7);
 560          printsetting3($lang['textfilessubdir'], 'filessubdirnew', array($lang['textfilessubdir1'], $lang['textfilessubdir2']), array('1', '2'), $subdirchecked, false);
 561          printsetting3($lang['textfilesurlpath'], 'filesurlpathnew', array($lang['textfilesurlpath1'], $lang['textfilesurlpath2'], $lang['textfilesurlpath3'], $lang['textfilesurlpath4'], $lang['textfilesurlpath5']), array('1', '2', '3', '4', '5'), $urlformatchecked, false);
 562          printsetting2($lang['textfilesbase'], 'filesbasenew', $SETTINGS['files_virtual_url'], 50);
 563          ?>
 564          <tr class="ctrtablerow">
 565          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit5" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 566          </tr>
 567          <tr class="category">
 568          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="6" />&raquo;&nbsp;<?php echo $lang['admin_main_settings6']?></font></strong></td>
 569          </tr>
 570          <?php
 571          printsetting2($lang['texthottopic'], 'hottopicnew', ((int)$SETTINGS['hottopic']), 3);
 572          printsetting1($lang['bbinsert'], 'bbinsertnew', $bbinserton, $bbinsertoff);
 573          printsetting1($lang['smileyinsert'], 'smileyinsertnew', $smileyinserton, $smileyinsertoff);
 574          printsetting3($lang['footer_options'], 'new_footer_options', $names, $values, $checked);
 575          printsetting3($lang['defaultTimezoneDesc'], 'def_tz_new', array($lang['timezone1'], $lang['timezone2'], $lang['timezone3'], $lang['timezone4'], $lang['timezone5'], $lang['timezone6'], $lang['timezone7'], $lang['timezone8'], $lang['timezone9'], $lang['timezone10'], $lang['timezone11'], $lang['timezone12'], $lang['timezone13'], $lang['timezone14'], $lang['timezone15'], $lang['timezone16'], $lang['timezone17'], $lang['timezone18'], $lang['timezone19'], $lang['timezone20'], $lang['timezone21'], $lang['timezone22'], $lang['timezone23'], $lang['timezone24'], $lang['timezone25'], $lang['timezone26'], $lang['timezone27'], $lang['timezone28'], $lang['timezone29'], $lang['timezone30'], $lang['timezone31'], $lang['timezone32'], $lang['timezone33']), array('-12', '-11', '-10', '-9', '-8', '-7', '-6', '-5', '-4', '-3.5', '-3', '-2', '-1', '0', '1', '2', '3', '3.5', '4', '4.5', '5', '5.5', '5.75', '6', '6.5', '7', '8', '9', '9.5', '10', '11', '12', '13'), array($timezone1, $timezone2, $timezone3, $timezone4, $timezone5, $timezone6, $timezone7, $timezone8, $timezone9, $timezone10, $timezone11, $timezone12, $timezone13, $timezone14, $timezone15, $timezone16, $timezone17, $timezone18, $timezone19, $timezone20, $timezone21, $timezone22, $timezone23, $timezone24, $timezone25, $timezone26, $timezone27, $timezone28, $timezone29, $timezone30, $timezone31, $timezone32, $timezone33), false);
 576          printsetting2($lang['addtime'], 'addtimenew', $SETTINGS['addtime'], 3);
 577          printsetting1($lang['sigbbcode'], 'sigbbcodenew', $sigbbcodeon, $sigbbcodeoff);
 578          printsetting1($lang['sightml'], 'sightmlnew', $sightmlon, $sightmloff);
 579          if (!ini_get('allow_url_fopen')) {
 580              printsetting5($lang['max_avatar_size_w'], $lang['no_url_fopen']);
 581          } else {
 582              printsetting2($lang['max_avatar_size_w'], 'max_avatar_size_w_new', $max_avatar_sizes[0], 4);
 583              printsetting2($lang['max_avatar_size_h'], 'max_avatar_size_h_new', $max_avatar_sizes[1], 4);
 584          }
 585          printsetting1($lang['what_tickerstatus'], 'tickerstatusnew', $tickerstatuson, $tickerstatusoff);
 586          printsetting2($lang['what_tickerdelay'], 'tickerdelaynew', ((int)$SETTINGS['tickerdelay']), 5);
 587          printsetting4($lang['tickercontents'], 'tickercontentsnew', $SETTINGS['tickercontents'], 5, 50);
 588          ?>
 589          <tr class="ctrtablerow">
 590          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit6" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 591          </tr>
 592          <tr class="category">
 593          <td colspan="2"><strong><font color="<?php echo $cattext?>"><a name="7" />&raquo;&nbsp;<?php echo $lang['admin_main_settings7']?></font></strong></td>
 594          </tr>
 595          <?php
 596          if (DEBUG) {
 597              printsetting5($lang['captchastatus'], $lang['captchaindebug']);
 598          } else {
 599              printsetting1($lang['captchastatus'], 'captchanew', $captchaOn, $captchaOff);
 600              printsetting1($lang['captcharegstatus'], 'captcharegnew', $captcharegOn, $captcharegOff);
 601              printsetting1($lang['captchapoststatus'], 'captchapostnew', $captchapostOn, $captchapostOff);
 602              printsetting1($lang['captchasearchstatus'], 'captchasearchnew', $captchasearchOn, $captchasearchOff);
 603              printsetting2($lang['captchacharset'], 'captchacharsetnew', $SETTINGS['captcha_code_charset'], 50);
 604              printsetting2($lang['captchacodelength'], 'captchacodenew', ((int)$SETTINGS['captcha_code_length']), 3);
 605              printsetting1($lang['captchacodecase'], 'captchacodecasenew', $captchacodecaseOn, $captchacodecaseOff);
 606              printsetting1($lang['captchacodeshadow'], 'captchacodeshadownew', $captchacodeshadowOn, $captchacodeshadowOff);
 607              printsetting2($lang['captchaimagetype'], 'captchaimagetypenew', $SETTINGS['captcha_image_type'], 5);
 608              printsetting2($lang['captchaimagewidth'], 'captchaimagewidthnew', ((int)$SETTINGS['captcha_image_width']), 5);
 609              printsetting2($lang['captchaimageheight'], 'captchaimageheightnew', ((int)$SETTINGS['captcha_image_height']), 5);
 610              printsetting2($lang['captchaimagebg'], 'captchaimagebgnew', $SETTINGS['captcha_image_bg'], 50);
 611              printsetting2($lang['captchaimagedots'], 'captchaimagedotsnew', ((int)$SETTINGS['captcha_image_dots']), 3);
 612              printsetting2($lang['captchaimagelines'], 'captchaimagelinesnew', ((int)$SETTINGS['captcha_image_lines']), 3);
 613              printsetting2($lang['captchaimagefonts'], 'captchaimagefontsnew', $SETTINGS['captcha_image_fonts'], 50);
 614              printsetting2($lang['captchaimageminfont'], 'captchaimageminfontnew', ((int)$SETTINGS['captcha_image_minfont']), 3);
 615              printsetting2($lang['captchaimagemaxfont'], 'captchaimagemaxfontnew', ((int)$SETTINGS['captcha_image_maxfont']), 3);
 616              printsetting1($lang['captchaimagecolor'], 'captchaimagecolornew', $captchaimagecolorOn, $captchaimagecolorOff);
 617          }
 618          ?>
 619          <tr class="ctrtablerow">
 620          <td bgcolor="<?php echo $altbg2?>" colspan="2"><input class="submit" type="submit" name="settingsubmit7" value="<?php echo $lang['textsubmitchanges']?>" /></td>
 621          </tr>
 622          </table>
 623          </td>
 624          </tr>
 625          </table>
 626          </form>
 627          </td>
 628          </tr>
 629          <?php
 630      } else {
 631          $sitenamenew = postedVar('sitenamenew');
 632          $bbnamenew = postedVar('bbnamenew');
 633          $siteurlnew = postedVar('siteurlnew');
 634          $adminemailnew = postedVar('adminemailnew');
 635          $bbrulesnew = formOnOff('bbrulesnew');
 636          $bbrulestxtnew = postedVar('bbrulestxtnew', '', FALSE);
 637          $bbstatusnew = formOnOff('bbstatusnew');
 638          $bboffreasonnew = postedVar('bboffreasonnew');
 639          $gzipcompressnew = formOnOff('gzipcompressnew');
 640  
 641          $langfilenew = postedVar('langfilenew');
 642          $result = $db->query("SELECT devname FROM ".X_PREFIX."lang_base WHERE devname='$langfilenew'");
 643          if ($db->num_rows($result) == 0) {
 644              $langfilenew = $SETTINGS['langfile'];
 645          }
 646  
 647          $themenew = formInt('themenew');
 648          $postperpagenew = formInt('postperpagenew');
 649          $topicperpagenew = formInt('topicperpagenew');
 650          $memberperpagenew = formInt('memberperpagenew');
 651          $timeformatnew = formInt('timeformatnew');
 652          $dateformatnew = postedVar('dateformatnew');
 653          $searchstatusnew = formOnOff('searchstatusnew');
 654          $faqstatusnew = formOnOff('faqstatusnew');
 655          $todaystatusnew = formOnOff('todaystatusnew');
 656          $statsstatusnew = formOnOff('statsstatusnew');
 657          $memliststatusnew = formOnOff('memliststatusnew');
 658          $spellchecknew = ($_POST['spellchecknew'] == 'on' && defined('PSPELL_FAST')) ? 'on' : 'off';
 659          $coppanew = formOnOff('coppanew');
 660          $reportpostnew = formOnOff('reportpostnew');
 661          $space_catsnew = formOnOff('space_catsnew');
 662          $indexShowBarNew = formInt('indexShowBarNew');
 663          $allowrankeditnew = formOnOff('allowrankeditnew');
 664          $subjectInTitleNew = formOnOff('subjectInTitleNew');
 665          $catsonlynew = formOnOff('catsonlynew');
 666          $whos_on = formOnOff('whos_on');
 667          $smtotalnew = formInt('smtotalnew');
 668          $smcolsnew = formInt('smcolsnew');
 669          $dotfoldersnew = formOnOff('dotfoldersnew');
 670          $editedbynew = formOnOff('editedbynew');
 671          $attachimgpostnew = formOnOff('attachimgpostnew');
 672          $reg_on = formOnOff('reg_on');
 673          $ipReg = formOnOff('ipReg');
 674          $maxDayReg = formInt('maxDayReg');
 675          $notifyonregnew = ($_POST['notifyonregnew'] == 'off') ? 'off' : ($_POST['notifyonregnew'] == 'u2u' ? 'u2u' : 'email');
 676          $regviewnew = formOnOff('regviewnew');
 677          $hidepriv = formOnOff('hidepriv');
 678          $emailchecknew = formOnOff('emailchecknew');
 679          $floodctrlnew = formInt('floodctrlnew');
 680          $u2uquotanew = formInt('u2uquotanew');
 681          $avastatusnew = postedVar('avastatusnew');
 682          if ($avastatusnew != 'on' And $avastatusnew != 'list') {
 683              $avastatusnew = 'off';
 684          }
 685          $resetSigNew = formOnOff('resetSigNew');
 686          $doubleenew = formOnOff('doubleenew');
 687          $pruneusersnew = formInt('pruneusersnew');
 688          $hottopicnew = formInt('hottopicnew');
 689          $bbinsertnew = formOnOff('bbinsertnew');
 690          $smileyinsertnew = formOnOff('smileyinsertnew');
 691  
 692          $new_footer_options = postedArray('new_footer_options');
 693          if (!empty($new_footer_options)) {
 694              $footer_options = implode('-', $new_footer_options);
 695          } else {
 696              $footer_options = '';
 697          }
 698  
 699          $maxAttachSize = formInt('maxAttachSize');
 700          $def_tz_new = isset($_POST['def_tz_new']) && is_numeric($_POST['def_tz_new']) ? $_POST['def_tz_new'] : 0;
 701          $addtimenew = isset($_POST['addtimenew']) && is_numeric($_POST['addtimenew']) ? $_POST['addtimenew'] : 0;
 702          $sigbbcodenew = formOnOff('sigbbcodenew');
 703          $sightmlnew = formOnOff('sightmlnew');
 704          $max_avatar_size_w_new = formInt('max_avatar_size_w_new');
 705          $max_avatar_size_h_new = formInt('max_avatar_size_h_new');
 706          $tickerstatusnew = formOnOff('tickerstatusnew');
 707          $tickerdelaynew = formInt('tickerdelaynew');
 708          $tickercontentsnew = postedVar('tickercontentsnew');
 709          $maxDayReg = formInt('maxDayReg');
 710          $showsubforumsnew = formOnOff('showsubforumsnew');
 711          $max_avatar_size = $max_avatar_size_w_new.'x'.$max_avatar_size_h_new;
 712          $regoptionalnew = formOnOff('regoptionalnew');
 713          $quickreply_statusnew = formOnOff('quickreply_statusnew');
 714          $quickjump_statusnew = formOnOff('quickjump_statusnew');
 715          $index_statsnew = formOnOff('index_statsnew');
 716          $onlinetodaycountnew = formInt('onlinetodaycountnew');
 717          $onlinetoday_statusnew = formOnOff('onlinetoday_statusnew');
 718          
 719          $filespathnew = postedVar('filespathnew');
 720          $filesbasenew = postedVar('filesbasenew');
 721          $filesminsizenew = formInt('filesminsizenew');
 722          $filesperpostnew = formInt('filesperpostnew');
 723          $filesurlpathnew = formInt('filesurlpathnew');
 724          $filessubdirnew = formInt('filessubdirnew');
 725          $max_image_size_w_new = formInt('max_image_size_w_new');
 726          $max_image_size_h_new = formInt('max_image_size_h_new');
 727          $max_thumb_size_w_new = formInt('max_thumb_size_w_new');
 728          $max_thumb_size_h_new = formInt('max_thumb_size_h_new');
 729          $max_image_size = $max_image_size_w_new.'x'.$max_image_size_h_new;
 730          $max_thumb_size = $max_thumb_size_w_new.'x'.$max_thumb_size_h_new;
 731          $remoteimages = formOnOff('remoteimages');
 732  
 733          $sql = "UPDATE ".X_PREFIX."settings SET
 734              langfile='$langfilenew',
 735              bbname='$bbnamenew',
 736              postperpage='$postperpagenew',
 737              topicperpage='$topicperpagenew',
 738              hottopic='$hottopicnew',
 739              theme='$themenew',
 740              bbstatus='$bbstatusnew',
 741              whosonlinestatus='$whos_on',
 742              regstatus='$reg_on',
 743              bboffreason='$bboffreasonnew',
 744              regviewonly='$regviewnew',
 745              floodctrl='$floodctrlnew',
 746              memberperpage='$memberperpagenew',
 747              catsonly='$catsonlynew',
 748              hideprivate='$hidepriv',
 749              emailcheck='$emailchecknew',
 750              bbrules='$bbrulesnew',
 751              bbrulestxt='$bbrulestxtnew',
 752              searchstatus='$searchstatusnew',
 753              faqstatus='$faqstatusnew',
 754              memliststatus='$memliststatusnew',
 755              sitename='$sitenamenew',
 756              siteurl='$siteurlnew',
 757              avastatus='$avastatusnew',
 758              u2uquota='$u2uquotanew',
 759              gzipcompress='$gzipcompressnew',
 760              coppa='$coppanew',
 761              timeformat='$timeformatnew',
 762              adminemail='$adminemailnew',
 763              dateformat='$dateformatnew',
 764              sigbbcode='$sigbbcodenew',
 765              sightml='$sightmlnew',
 766              reportpost='$reportpostnew',
 767              bbinsert='$bbinsertnew',
 768              smileyinsert='$smileyinsertnew',
 769              doublee='$doubleenew',
 770              smtotal='$smtotalnew',
 771              smcols='$smcolsnew',
 772              editedby='$editedbynew',
 773              dotfolders='$dotfoldersnew',
 774              attachimgpost='$attachimgpostnew',
 775              tickerstatus='$tickerstatusnew',
 776              tickercontents='$tickercontentsnew',
 777              tickerdelay='$tickerdelaynew',
 778              addtime='$addtimenew',
 779              todaysposts='$todaystatusnew',
 780              stats='$statsstatusnew',
 781              max_avatar_size='$max_avatar_size',
 782              footer_options='$footer_options',
 783              space_cats='$space_catsnew',
 784              spellcheck='$spellchecknew',
 785              allowrankedit='$allowrankeditnew',
 786              notifyonreg='$notifyonregnew',
 787              indexshowbar='$indexShowBarNew',
 788              subject_in_title='$subjectInTitleNew',
 789              def_tz='$def_tz_new',
 790              resetsigs='$resetSigNew',
 791              pruneusers='$pruneusersnew',
 792              ipreg='$ipReg',
 793              maxdayreg='$maxDayReg',
 794              maxattachsize='$maxAttachSize',
 795              showsubforums='$showsubforumsnew',
 796              regoptional='$regoptionalnew',
 797              quickreply_status='$quickreply_statusnew',
 798              quickjump_status='$quickjump_statusnew',
 799              index_stats='$index_statsnew',
 800              onlinetodaycount='$onlinetodaycountnew',
 801              onlinetoday_status='$onlinetoday_statusnew',
 802              attach_remote_images='$remoteimages',
 803              files_min_disk_size='$filesminsizenew',
 804              files_storage_path='$filespathnew',
 805              files_subdir_format='$filessubdirnew',
 806              file_url_format='$filesurlpathnew',
 807              files_virtual_url='$filesbasenew',
 808              filesperpost='$filesperpostnew',
 809              max_image_size='$max_image_size',
 810              max_thumb_size='$max_thumb_size'
 811          ";
 812          
 813          if (!DEBUG) {
 814              $captchanew = formOnOff('captchanew');
 815              $captcharegnew = formOnOff('captcharegnew');
 816              $captchapostnew = formOnOff('captchapostnew');
 817              $captchasearchnew = formOnOff('captchasearchnew');
 818              $captchacharsetnew = postedVar('captchacharsetnew');
 819              $captchacodenew = formInt('captchacodenew');
 820              $captchacodecasenew = formOnOff('captchacodecasenew');
 821              $captchacodeshadownew = formOnOff('captchacodeshadownew');
 822              $captchaimagetypenew = postedVar('captchaimagetypenew');
 823              $captchaimagewidthnew = formInt('captchaimagewidthnew');
 824              $captchaimageheightnew = formInt('captchaimageheightnew');
 825              $captchaimagebgnew = postedVar('captchaimagebgnew');
 826              $captchaimagedotsnew = formInt('captchaimagedotsnew');
 827              $captchaimagelinesnew = formInt('captchaimagelinesnew');
 828              $captchaimagefontsnew = postedVar('captchaimagefontsnew');
 829              $captchaimageminfontnew = formInt('captchaimageminfontnew');
 830              $captchaimagemaxfontnew = formInt('captchaimagemaxfontnew');
 831              $captchaimagecolornew = formOnOff('captchaimagecolornew');
 832  
 833              $sql .= ",
 834              captcha_status='$captchanew',
 835              captcha_reg_status='$captcharegnew',
 836              captcha_post_status='$captchapostnew',
 837              captcha_search_status='$captchasearchnew',
 838              captcha_code_charset='$captchacharsetnew',
 839              captcha_code_length='$captchacodenew',
 840              captcha_code_casesensitive='$captchacodecasenew',
 841              captcha_code_shadow='$captchacodeshadownew',
 842              captcha_image_type='$captchaimagetypenew',
 843              captcha_image_width='$captchaimagewidthnew',
 844              captcha_image_height='$captchaimageheightnew',
 845              captcha_image_bg='$captchaimagebgnew',
 846              captcha_image_dots='$captchaimagedotsnew',
 847              captcha_image_lines='$captchaimagelinesnew',
 848              captcha_image_fonts='$captchaimagefontsnew',
 849              captcha_image_minfont='$captchaimageminfontnew',
 850              captcha_image_maxfont='$captchaimagemaxfontnew',
 851              captcha_image_color='$captchaimagecolornew'
 852              ";
 853          }
 854          
 855          $db->query($sql);
 856  
 857          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textsettingsupdate'].'</td></tr>';
 858      }
 859  }
 860  
 861  if ($action == 'rename') {
 862      if (!X_SADMIN) {
 863          error($lang['superadminonly'], false, '</td></tr></table></td></tr></table><br />');
 864      }
 865  
 866      if (onSubmit('renamesubmit')) {
 867          $vUserFrom = postedVar('frmUserFrom', '', TRUE, FALSE);
 868          $vUserTo = postedVar('frmUserTo', '', TRUE, FALSE);
 869          $adm = new admin();
 870          $myErr = $adm->rename_user($vUserFrom, $vUserTo);
 871          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$myErr.'</td></tr>';
 872      } else {
 873          ?>
 874          <tr bgcolor="<?php echo $altbg2?>">
 875          <td>
 876          <form action="cp.php?action=rename" method="post">
 877          <table cellspacing="0" cellpadding="0" border="0" width="550" align="center">
 878          <tr>
 879          <td bgcolor="<?php echo $bordercolor?>">
 880          <table border="0" cellspacing="<?php echo $THEME['borderwidth']?>" cellpadding="<?php echo $tablespace?>" width="100%">
 881          <tr>
 882          <td class="category" colspan="2"><strong><font color="<?php echo $cattext?>"><?php echo $lang['admin_rename_txt']?></font></strong></td>
 883          </tr>
 884          <tr class="tablerow">
 885          <td bgcolor="<?php echo $altbg1?>" width="22%"><?php echo $lang['admin_rename_userfrom']?></td>
 886          <td bgcolor="<?php echo $altbg2?>"><input type="text" name="frmUserFrom" size="25" /></td>
 887          </tr>
 888          <tr class="tablerow">
 889          <td bgcolor="<?php echo $altbg1?>" width="22%"><?php echo $lang['admin_rename_userto']?></td>
 890          <td bgcolor="<?php echo $altbg2?>"><input type="text" name="frmUserTo" size="25" /></td>
 891          </tr>
 892          <tr>
 893          <td bgcolor="<?php echo $altbg2?>" class="ctrtablerow" colspan="2"><input type="submit" class="submit" name="renamesubmit" value="<?php echo $lang['admin_rename_txt']?>" /></td>
 894          </tr>
 895          </table>
 896          </td>
 897          </tr>
 898          </table>
 899          </form>
 900          </td>
 901          </tr>
 902          <?php
 903      }
 904  }
 905  
 906  if ($action == 'forum') {
 907      $fdetails = getInt('fdetails');
 908      if (noSubmit('forumsubmit') && !$fdetails) {
 909          $groups = array();
 910          $forums = array();
 911          $forums[0] = array();
 912          $forumlist = array();
 913          $subs = array();
 914          $i = 0;
 915          $query = $db->query("SELECT fid, type, name, displayorder, status, fup FROM ".X_PREFIX."forums ORDER BY fup ASC, displayorder ASC");
 916          while($selForums = $db->fetch_array($query)) {
 917              if ($selForums['type'] == 'group') {
 918                  $groups[$i]['fid'] = $selForums['fid'];
 919                  $groups[$i]['name'] = $selForums['name'];
 920                  $groups[$i]['displayorder'] = $selForums['displayorder'];
 921                  $groups[$i]['status'] = $selForums['status'];
 922                  $groups[$i]['fup'] = $selForums['fup'];
 923              } else if ($selForums['type'] == 'forum') {
 924                  $id = (empty($selForums['fup'])) ? 0 : $selForums['fup'];
 925                  $forums[$id][$i]['fid'] = $selForums['fid'];
 926                  $forums[$id][$i]['name'] = $selForums['name'];
 927                  $forums[$id][$i]['displayorder'] = $selForums['displayorder'];
 928                  $forums[$id][$i]['status'] = $selForums['status'];
 929                  $forums[$id][$i]['fup'] = $selForums['fup'];
 930                  $forumlist[$i]['fid'] = $selForums['fid'];
 931                  $forumlist[$i]['name'] = $selForums['name'];
 932              } else if ($selForums['type'] == 'sub') {
 933                  $subs[$selForums['fup']][$i]['fid'] = $selForums['fid'];
 934                  $subs[$selForums['fup']][$i]['name'] = $selForums['name'];
 935                  $subs[$selForums['fup']][$i]['displayorder'] = $selForums['displayorder'];
 936                  $subs[$selForums['fup']][$i]['status'] = $selForums['status'];
 937                  $subs[$selForums['fup']][$i]['fup'] = $selForums['fup'];
 938              }
 939              $i++;
 940          }
 941          ?>
 942          <tr bgcolor="<?php echo $altbg2?>">
 943          <td>
 944          <form method="post" action="cp.php?action=forum">
 945          <table cellspacing="0" cellpadding="0" border="0" width="90%" align="center">
 946          <tr>
 947          <td bgcolor="<?php echo $bordercolor?>">
 948          <table border="0" cellspacing="<?php echo $THEME['borderwidth']?>" cellpadding="<?php echo $tablespace?>" width="100%">
 949          <tr>
 950          <td class="category"><font color="<?php echo $cattext?>"><strong><?php echo $lang['textforumopts']?></strong></font></td>
 951          </tr>
 952          <?php
 953          foreach($forums[0] as $forum) {
 954              $on = $off = '';
 955              if ($forum['status'] == 'on') {
 956                  $on = $selHTML;
 957              } else {
 958                  $off = $selHTML;
 959              }
 960              ?>
 961              <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
 962              <td class="smalltxt"><input type="checkbox" name="delete<?php echo $forum['fid']?>" value="<?php echo $forum['fid']?>" />
 963              &nbsp;<input type="text" name="name<?php echo $forum['fid']?>" value="<?php echo stripslashes($forum['name'])?>" />
 964              &nbsp; <?php echo $lang['textorder']?> <input type="text" name="displayorder<?php echo $forum['fid']?>" size="2" value="<?php echo $forum['displayorder']?>" />
 965              &nbsp; <select name="status<?php echo $forum['fid']?>">
 966              <option value="on" <?php echo $on?>><?php echo $lang['texton']?></option><option value="off" <?php echo $off?>><?php echo $lang['textoff']?></option></select>
 967              &nbsp; <select name="moveto<?php echo $forum['fid']?>"><option value="" selected="selected">-<?php echo $lang['textnone']?>-</option>
 968              <?php
 969              if (!isset($subs[$forum['fid']])) { //Ungrouped forum options.
 970                  foreach($forums[0] as $moveforum) {
 971                      if ($moveforum['fid'] != $forum['fid']) {
 972                          echo "<option value=\"$moveforum[fid]\"> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
 973                      }
 974                  }
 975              }
 976              foreach($groups as $moveforum) { //Groups and grouped forum options.
 977                  echo "<option value=\"$moveforum[fid]\">".stripslashes($moveforum['name'])."</option>";
 978                  if (isset($forums[$moveforum['fid']]) And !isset($subs[$forum['fid']])) {
 979                      foreach($forums[$moveforum['fid']] as $moveforum) {
 980                          echo "<option value=\"$moveforum[fid]\"> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
 981                      }
 982                  }
 983              }
 984              ?>
 985              </select>
 986              <a href="cp.php?action=forum&amp;fdetails=<?php echo $forum['fid']?>"><?php echo $lang['textmoreopts']?></a></td>
 987              </tr>
 988              <?php
 989              if (array_key_exists($forum['fid'], $subs)) {
 990                  foreach($subs[$forum['fid']] as $subforum) {
 991                      $on = $off = '';
 992                      if ($subforum['status'] == 'on') {
 993                          $on = $selHTML;
 994                      } else {
 995                          $off = $selHTML;
 996                      }
 997                      ?>
 998                      <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
 999                      <td class="smalltxt"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="checkbox" name="delete<?php echo $subforum['fid']?>" value="<?php echo $subforum['fid']?>" />
1000                      &nbsp;<input type="text" name="name<?php echo $subforum['fid']?>" value="<?php echo stripslashes($subforum['name'])?>" />
1001                      &nbsp; <?php echo $lang['textorder']?> <input type="text" name="displayorder<?php echo $subforum['fid']?>" size="2" value="<?php echo $subforum['displayorder']?>" />
1002                      &nbsp; <select name="status<?php echo $subforum['fid']?>">
1003                      <option value="on" <?php echo $on?>><?php echo $lang['texton']?></option><option value="off" <?php echo $off?>><?php echo $lang['textoff']?></option></select>
1004                      &nbsp; <select name="moveto<?php echo $subforum['fid']?>"><option value="" selected="selected">-<?php echo $lang['textnone']?>-</option>
1005                      <?php
1006                      foreach($forums[0] as $moveforum) { //Ungrouped forum options.
1007                          if ($moveforum['fid'] == $subforum['fup']) {
1008                              $curgroup = $selHTML;
1009                          } else {
1010                              $curgroup = '';
1011                          }
1012                          echo "<option value=\"$moveforum[fid]\" $curgroup> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
1013                      }
1014                      foreach($groups as $moveforum) { //Groups and grouped forum options.
1015                          echo '<option value="'.$moveforum['fid'].'">'.stripslashes($moveforum['name']).'</option>';
1016                          if (isset($forums[$moveforum['fid']])) {
1017                              foreach($forums[$moveforum['fid']] as $moveforum) {
1018                                  echo "<option value=\"$moveforum[fid]\"> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
1019                              }
1020                          }
1021                      }
1022                      ?>
1023                      </select>
1024                      <a href="cp.php?action=forum&amp;fdetails=<?php echo $subforum['fid']?>"><?php echo $lang['textmoreopts']?></a></td>
1025                      </tr>
1026                      <?php
1027                  }
1028              }
1029          }
1030  
1031          foreach($groups as $group) {
1032              $on = $off = '';
1033              if ($group['status'] == 'on') {
1034                  $on = $selHTML;
1035              } else {
1036                  $off = $selHTML;
1037              }
1038              ?>
1039              <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
1040              <td>&nbsp;</td>
1041              </tr>
1042              <tr bgcolor="<?php echo $altbg1?>" class="tablerow">
1043              <td class="smalltxt"><input type="checkbox" name="delete<?php echo $group['fid']?>" value="<?php echo $group['fid']?>" />
1044              <input type="text" name="name<?php echo $group['fid']?>" value="<?php echo stripslashes($group['name'])?>" />
1045              &nbsp; <?php echo $lang['textorder']?> <input type="text" name="displayorder<?php echo $group['fid']?>" size="2" value="<?php echo $group['displayorder']?>" />
1046              &nbsp; <select name="status<?php echo $group['fid']?>">
1047              <option value="on" <?php echo $on?>><?php echo $lang['texton']?></option><option value="off" <?php echo $off?>><?php echo $lang['textoff']?></option></select>
1048              </td>
1049              </tr>
1050              <?php
1051              if (array_key_exists($group['fid'], $forums)) {
1052                  foreach($forums[$group['fid']] as $forum) {
1053                      $on = $off = '';
1054                      if ($forum['status'] == 'on') {
1055                          $on = $selHTML;
1056                      } else {
1057                          $off = $selHTML;
1058                      }
1059                      ?>
1060                      <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
1061                      <td class="smalltxt"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="checkbox" name="delete<?php echo $forum['fid']?>" value="<?php echo $forum['fid']?>" />
1062                      &nbsp;<input type="text" name="name<?php echo $forum['fid']?>" value="<?php echo stripslashes($forum['name'])?>" />
1063                      &nbsp; <?php echo $lang['textorder']?> <input type="text" name="displayorder<?php echo $forum['fid']?>" size="2" value="<?php echo $forum['displayorder']?>" />
1064                      &nbsp; <select name="status<?php echo $forum['fid']?>">
1065                      <option value="on" <?php echo $on?>><?php echo $lang['texton']?></option><option value="off" <?php echo $off?>><?php echo $lang['textoff']?></option></select>
1066                      &nbsp; <select name="moveto<?php echo $forum['fid']?>"><option value="">-<?php echo $lang['textnone']?>-</option>
1067                      <?php
1068                      if (!isset($subs[$forum['fid']])) { //Ungrouped forum options.
1069                          foreach($forums[0] as $moveforum) {
1070                              echo "<option value=\"$moveforum[fid]\"> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
1071                          }
1072                      }
1073                      foreach($groups as $moveforum) { //Groups and grouped forum options.
1074                          if ($moveforum['fid'] == $forum['fup']) {
1075                              $curgroup = $selHTML;
1076                          } else {
1077                              $curgroup = '';
1078                          }
1079                          echo '<option value="'.$moveforum['fid'].'" '.$curgroup.'>'.stripslashes($moveforum['name']).'</option>';
1080                          if (!isset($subs[$forum['fid']]) And isset($forums[$moveforum['fid']])) {
1081                              foreach($forums[$moveforum['fid']] as $moveforum) {
1082                                  if ($moveforum['fid'] != $forum['fid']) {
1083                                      echo "<option value=\"$moveforum[fid]\"> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
1084                                  }
1085                              }
1086                          }
1087                      }
1088                      ?>
1089                      </select>
1090                      <a href="cp.php?action=forum&amp;fdetails=<?php echo $forum['fid']?>"><?php echo $lang['textmoreopts']?></a></td>
1091                      </tr>
1092                      <?php
1093                      if (array_key_exists($forum['fid'], $subs)) {
1094                          foreach($subs[$forum['fid']] as $forum) {
1095                              $on = $off = '';
1096                              if ($forum['status'] == 'on') {
1097                                  $on = $selHTML;
1098                              } else {
1099                                  $off = $selHTML;
1100                              }
1101                              ?>
1102                              <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
1103                              <td class="smalltxt"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input type="checkbox" name="delete<?php echo $forum['fid']?>" value="<?php echo $forum['fid']?>" />
1104                              &nbsp;<input type="text" name="name<?php echo $forum['fid']?>" value="<?php echo stripslashes($forum['name'])?>" />
1105                              &nbsp; <?php echo $lang['textorder']?> <input type="text" name="displayorder<?php echo $forum['fid']?>" size="2" value="<?php echo $forum['displayorder']?>" />
1106                              &nbsp; <select name="status<?php echo $forum['fid']?>">
1107                              <option value="on" <?php echo $on?>><?php echo $lang['texton']?></option><option value="off" <?php echo $off?>><?php echo $lang['textoff']?></option></select>
1108                              &nbsp; <select name="moveto<?php echo $forum['fid']?>"><option value="" selected="selected">-<?php echo $lang['textnone']?>-</option>
1109                              <?php
1110                              foreach($forums[0] as $moveforum) { //Ungrouped forum options.
1111                                  echo "<option value=\"$moveforum[fid]\" $curgroup> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
1112                              }
1113                              foreach($groups as $moveforum) { //Groups and grouped forum options.
1114                                  echo '<option value="'.$moveforum['fid'].'">'.stripslashes($moveforum['name']).'</option>';
1115                                  if (isset($forums[$moveforum['fid']])) {
1116                                      foreach($forums[$moveforum['fid']] as $moveforum) {
1117                                          if ($moveforum['fid'] == $forum['fup']) {
1118                                              $curgroup = $selHTML;
1119                                          } else {
1120                                              $curgroup = '';
1121                                          }
1122                                          echo "<option value=\"$moveforum[fid]\" $curgroup> &nbsp; &raquo; ".stripslashes($moveforum['name'])."</option>";
1123                                      }
1124                                  }
1125                              }
1126                              ?>
1127                              </select>
1128                              <a href="cp.php?action=forum&amp;fdetails=<?php echo $forum['fid']?>"><?php echo $lang['textmoreopts']?></a></td>
1129                              </tr>
1130                              <?php
1131                          }
1132                      }
1133                  }
1134              }
1135          }
1136          ?>
1137          <tr bgcolor="<?php echo $altbg1?>" class="tablerow">
1138          <td>&nbsp;</td>
1139          </tr>
1140          <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
1141          <td class="smalltxt"><input type="text" name="newgname" value="<?php echo $lang['textnewgroup']?>" />
1142          &nbsp; <?php echo $lang['textorder']?> <input type="text" name="newgorder" size="2" />
1143          &nbsp; <select name="newgstatus">
1144          <option value="on"><?php echo $lang['texton']?></option><option value="off"><?php echo $lang['textoff']?></option></select></td>
1145          </tr>
1146          <tr class="tablerow">
1147          <td bgcolor="<?php echo $altbg2?>" class="smalltxt"><input type="text" name="newfname" value="<?php echo $lang['textnewforum']?>" />
1148          &nbsp; <?php echo $lang['textorder']?> <input type="text" name="newforder" size="2" />
1149          &nbsp; <select name="newfstatus">
1150          <option value="on"><?php echo $lang['texton']?></option><option value="off"><?php echo $lang['textoff']?></option></select>
1151          &nbsp; <select name="newffup"><option value="" selected="selected">-<?php echo $lang['textnone']?>-</option>
1152          <?php
1153          foreach($groups as $group) {
1154              echo '<option value="'.$group['fid'].'">'.fnameOut($group['name']).'</option>';
1155          }
1156          ?>
1157          </select>
1158          </td>
1159          </tr>
1160          <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
1161          <td class="smalltxt"><input type="text" name="newsubname" value="<?php echo $lang['textnewsubf']?>" />
1162          &nbsp; <?php echo $lang['textorder']?> <input type="text" name="newsuborder" size="2" />
1163          &nbsp; <select name="newsubstatus"><option value="on"><?php echo $lang['texton']?></option><option value="off"><?php echo $lang['textoff']?></option></select>
1164          &nbsp; <select name="newsubfup">
1165          <?php
1166          foreach($forumlist as $group) {
1167              echo '<option value="'.$group['fid'].'">'.fnameOut($group['name']).'</option>';
1168          }
1169          ?>
1170          </select>
1171          </td>
1172          </tr>
1173          <tr>
1174          <td bgcolor="<?php echo $altbg2?>" class="ctrtablerow"><input type="submit" name="forumsubmit" value="<?php echo $lang['textsubmitchanges']?>" class="submit" /></td>
1175          </tr>
1176          </table>
1177          </td>
1178          </tr>
1179          </table>
1180          </form>
1181          </td>
1182          </tr>
1183          <?php
1184      } else if ($fdetails && noSubmit('forumsubmit')) {
1185          ?>
1186          <tr bgcolor="<?php echo $altbg2?>">
1187          <td align="center">
1188          <form method="post" action="cp.php?action=forum&amp;fdetails=<?php echo $fdetails?>">
1189          <table cellspacing="0" cellpadding="0" border="0" width="100%" align="center">
1190          <tr>
1191          <td bgcolor="<?php echo $bordercolor?>">
1192          <table border="0" cellspacing="<?php echo $THEME['borderwidth']?>" cellpadding="<?php echo $tablespace?>" width="100%">
1193          <tr>
1194          <td class="category" colspan="2"><font color="<?php echo $cattext?>"><strong><?php echo $lang['textforumopts']?></strong></font></td>
1195          </tr>
1196          <?php
1197          $queryg = $db->query("SELECT * FROM ".X_PREFIX."forums WHERE fid='$fdetails'");
1198          $forum = $db->fetch_array($queryg);
1199  
1200          $themelist = array();
1201          $themelist[] = '<select name="themeforumnew">';
1202          $themelist[] = '<option value="0">'.$lang['textusedefault'].'</option>';
1203          $query = $db->query("SELECT themeid, name FROM ".X_PREFIX."themes ORDER BY name ASC");
1204          while($themeinfo = $db->fetch_array($query)) {
1205              if ($themeinfo['themeid'] == $forum['theme']) {
1206                  $themelist[] = '<option value="'.intval($themeinfo['themeid']).'" '.$selHTML.'>'.stripslashes($themeinfo['name']).'</option>';
1207              } else {
1208                  $themelist[] = '<option value="'.intval($themeinfo['themeid']).'">'.stripslashes($themeinfo['name']).'</option>';
1209              }
1210          }
1211          $themelist[] = '</select>';
1212          $themelist = implode("\n", $themelist);
1213          $db->free_result($query);
1214  
1215          if ($forum['allowhtml'] == "yes") {
1216              $checked2 = $cheHTML;
1217          } else {
1218              $checked2 = '';
1219          }
1220  
1221          if ($forum['allowsmilies'] == "yes") {
1222              $checked3 = $cheHTML;
1223          } else {
1224              $checked3 = '';
1225          }
1226  
1227          if ($forum['allowbbcode'] == "yes") {
1228              $checked4 = $cheHTML;
1229          } else {
1230              $checked4 = '';
1231          }
1232  
1233          if ($forum['allowimgcode'] == "yes") {
1234              $checked5 = $cheHTML;
1235          } else {
1236              $checked5 = '';
1237          }
1238  
1239          if ($forum['attachstatus'] == "on") {
1240              $checked6 = $cheHTML;
1241          } else {
1242              $checked6 = '';
1243          }
1244  
1245          $forum['name'] = stripslashes($forum['name']);
1246          ?>
1247          <tr class="tablerow">
1248          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textforumname']?></td>
1249          <td bgcolor="<?php echo $altbg2?>"><input type="text" name="namenew" value="<?php echo $forum['name']; ?>" /></td>
1250          </tr>
1251          <tr class="tablerow">
1252          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textdesc']?></td>
1253          <td bgcolor="<?php echo $altbg2?>"><textarea rows="4" cols="30" name="descnew">
1254  <?php // Linefeed required here - Do not edit!
1255          echo $forum['description'];
1256          ?></textarea></td>
1257          </tr>
1258          <tr class="tablerow">
1259          <td bgcolor="<?php echo $altbg1?>" valign="top"><?php echo $lang['textallow']?></td>
1260          <td bgcolor="<?php echo $altbg2?>" class="smalltxt">
1261          <input type="checkbox" name="allowhtmlnew" value="yes" <?php echo $checked2?> /><?php echo $lang['texthtml']?><br />
1262          <input type="checkbox" name="allowsmiliesnew" value="yes" <?php echo $checked3?> /><?php echo $lang['textsmilies']?><br />
1263          <input type="checkbox" name="allowbbcodenew" value="yes" <?php echo $checked4?> /><?php echo $lang['textbbcode']?><br />
1264          <input type="checkbox" name="allowimgcodenew" value="yes" <?php echo $checked5?> /><?php echo $lang['textimgcode']?><br />
1265          <input type="checkbox" name="attachstatusnew" value="on" <?php echo $checked6?> /><?php echo $lang['attachments']?><br />
1266          </td>
1267          </tr>
1268          <tr class="tablerow">
1269          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['texttheme']?></td>
1270          <td bgcolor="<?php echo $altbg2?>"><?php echo $themelist?></td>
1271          </tr>
1272  
1273          <tr class="tablerow">
1274          <td style="background-color: <?php echo $THEME['altbg1']?>"><?php echo $lang['forumpermissions']?></td>
1275          <td style="background-color: <?php echo $THEME['altbg2']?>"><table style="width: 100%; text-align: center;">
1276          <tr>
1277              <td class="tablerow" style="width: 25ex;">&nbsp;</td>
1278              <td class="category" style="color: <?php echo $THEME['cattext']?>; font-weight: bold; text-align: center;"><?php echo $lang['polls'];   ?></td>
1279              <td class="category" style="color: <?php echo $THEME['cattext']?>; font-weight: bold; text-align: center;"><?php echo $lang['threads']; ?></td>
1280              <td class="category" style="color: <?php echo $THEME['cattext']?>; font-weight: bold; text-align: center;"><?php echo $lang['replies']; ?></td>
1281              <td class="category" style="color: <?php echo $THEME['cattext']?>; font-weight: bold; text-align: center;"><?php echo $lang['view'];    ?></td>
1282          </tr>
1283          <?php
1284          $perms = explode(',', $forum['postperm']);
1285          foreach($status_enum as $key=>$val) {
1286              if ($key != '' And $val <= $status_enum['Guest']) {
1287                  if (!X_SADMIN and $key == 'Super Administrator') {
1288                      $disabled = 'disabled="disabled"';
1289                  } else {
1290                      $disabled = '';
1291                  }
1292                  ?>
1293                  <tr class="tablerow">
1294                      <td class="category" style="color: <?php echo $THEME['cattext']; ?>; font-weight: bold; text-align: right;"><?php echo $lang[$status_translate[$val]]; ?></td>
1295                      <td class="altbg1 ctrtablerow"><input type="checkbox" name="permsNew[<?php echo X_PERMS_RAWPOLL; ?>][]" value="<?php echo $val;?>" <?php echo ((($perms[X_PERMS_RAWPOLL]&$val) == $val) ? 'checked="checked"' : ''); ?> <?php echo $disabled;?> /></td>
1296                      <td class="altbg1 ctrtablerow"><input type="checkbox" name="permsNew[<?php echo X_PERMS_RAWTHREAD; ?>][]" value="<?php echo $val;?>" <?php echo ((($perms[X_PERMS_RAWTHREAD]&$val) == $val) ? 'checked="checked"' : ''); ?> <?php echo $disabled;?> /></td>
1297                      <td class="altbg1 ctrtablerow"><input type="checkbox" name="permsNew[<?php echo X_PERMS_RAWREPLY; ?>][]" value="<?php echo $val;?>" <?php echo ((($perms[X_PERMS_RAWREPLY]&$val) == $val) ? 'checked="checked"' : ''); ?> <?php echo $disabled;?> /></td>
1298                      <td class="altbg1 ctrtablerow"><input type="checkbox" name="permsNew[<?php echo X_PERMS_RAWVIEW; ?>][]" value="<?php echo $val;?>" <?php echo ((($perms[X_PERMS_RAWVIEW]&$val) == $val) ? 'checked="checked"' : ''); ?> <?php echo $disabled;?> /></td>
1299                  </tr>
1300                  <?php
1301              }
1302          }
1303          ?>
1304          </table></td>
1305          </tr>
1306  
1307          <tr class="tablerow">
1308          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textuserlist']?></td>
1309          <td bgcolor="<?php echo $altbg2?>"><textarea rows="4" cols="30" name="userlistnew">
1310  <?php // Linefeed required here - Do not edit!
1311          echo $forum['userlist'];
1312          ?></textarea></td>
1313          </tr>
1314          <tr class="tablerow">
1315          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['forumpw']?></td>
1316          <td bgcolor="<?php echo $altbg2?>"><input type="text" name="passwordnew" value="<?php echo attrOut($forum['password'], 'javascript')?>" /></td>
1317          </tr>
1318          <tr class="tablerow">
1319          <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textdeleteques']?></td>
1320          <td bgcolor="<?php echo $altbg2?>"><input type="checkbox" name="delete" value="<?php echo $forum['fid']?>" /></td>
1321          </tr>
1322          <tr>
1323          <td bgcolor="<?php echo $altbg2?>" class="ctrtablerow" colspan="2"><input type="submit" name="forumsubmit" value="<?php echo $lang['textsubmitchanges']?>" class="submit" /></td>
1324          </tr>
1325          </table>
1326          </td>
1327          </tr>
1328          </table>
1329          </form>
1330          </td>
1331          </tr>
1332          <?php
1333      } else if (onSubmit('forumsubmit') && !$fdetails) {
1334          $queryforum = $db->query("SELECT fid, type, fup FROM ".X_PREFIX."forums WHERE type='forum' OR type='sub'");
1335          while($forum = $db->fetch_array($queryforum)) {
1336              $displayorder = formInt('displayorder'.$forum['fid']);
1337              $forum['status'] = formOnOff('status'.$forum['fid']);
1338              $name = addslashes(htmlspecialchars(postedVar('name'.$forum['fid'], 'javascript', FALSE), ENT_COMPAT)); //Forum names are historically double-slashed.  We also have an unusual situation where ENT_COMPAT is the XMB standard.
1339              $delete = formInt('delete'.$forum['fid']);
1340              $moveto = formInt('moveto'.$forum['fid']);
1341  
1342              $dsuccess = FALSE;
1343              if ($delete == $forum['fid']) {
1344                  if ($db->num_rows($db->query('SELECT tid FROM '.X_PREFIX.'threads WHERE fid='.$forum['fid'])) > 0) {
1345                      $dsuccess = FALSE;
1346                  } elseif ($db->num_rows($db->query('SELECT fid FROM '.X_PREFIX.'forums WHERE fup='.$forum['fid'])) > 0) {
1347                      $dsuccess = FALSE;
1348                  } elseif ($db->num_rows($db->query('SELECT pid FROM '.X_PREFIX.'posts WHERE fid='.$forum['fid'])) > 0) {
1349                      $dsuccess = FALSE;
1350                  } else {
1351                      $db->query("DELETE FROM ".X_PREFIX."forums WHERE (type='forum' OR type='sub') AND fid=".$forum['fid']);
1352                      $dsuccess = TRUE;
1353                  }
1354                  if (!$dsuccess) {
1355                      message($lang['deleteaborted'].'<br />'.$lang['forumnotempty'], FALSE, '', '', FALSE, FALSE, FALSE, FALSE);
1356                  }
1357              }
1358              
1359              if (!$dsuccess) {
1360                  $settype = '';
1361                  if ($forum['fup'] != $moveto And $moveto != $forum['fid'] And $forum['type'] != 'group') { //Forum is being moved
1362                      if ($moveto == 0) {
1363                          $settype = ", type='forum', fup=0";
1364                      } else {
1365                          $query = $db->query("SELECT type FROM ".X_PREFIX."forums WHERE fid=$moveto");
1366                          if ($frow = $db->fetch_array($query)) {
1367                              if ($frow['type'] == 'group') {
1368                                  $settype = ", type='forum', fup=$moveto";
1369                              } else if ($frow['type'] == 'forum') {
1370                                  if ($forum['type'] == 'sub') {
1371                                      $settype = ", fup=$moveto";
1372                                  } else if ($forum['type'] == 'forum') { //Make sure the admin didn't try to demote a parent
1373                                      $query2 = $db->query("SELECT COUNT(*) AS subcount FROM ".X_PREFIX."forums WHERE fup={$forum['fid']}");
1374                                      $frow = $db->fetch_array($query2);
1375                                      $db->free_result($query2);
1376                                      if ($frow['subcount'] == 0) {
1377                                          $settype = ", type='sub', fup=$moveto";
1378                                      }
1379                                  }
1380                              }
1381                          }
1382                          $db->free_result($query);
1383                      }
1384                  }
1385                  $db->query("UPDATE ".X_PREFIX."forums SET name='$name', displayorder=".$displayorder.", status='{$forum['status']}'$settype WHERE fid='".$forum['fid']."'");
1386              }
1387          }
1388  
1389          $querygroup = $db->query("SELECT fid FROM ".X_PREFIX."forums WHERE type='group'");
1390          while($group = $db->fetch_array($querygroup)) {
1391              $name = addslashes(htmlspecialchars(postedVar('name'.$group['fid'], 'javascript', FALSE), ENT_COMPAT));  //Forum names are historically double-slashed.  We also have an unusual situation where ENT_COMPAT is the XMB standard.
1392              $displayorder = formInt('displayorder'.$group['fid']);
1393              $group['status'] = formOnOff('status'.$group['fid']);
1394              $delete = formInt('delete'.$group['fid']);
1395  
1396              if ($delete == $group['fid']) {
1397                  $query = $db->query("SELECT fid FROM ".X_PREFIX."forums WHERE type='forum' AND fup=$delete");
1398                  if ($db->num_rows($query) > 0) {
1399                      message($lang['deleteaborted'].'<br />'.$lang['forumnotempty'], FALSE, '', '', FALSE, FALSE, FALSE, FALSE);
1400                  } else {
1401                      $db->query("DELETE FROM ".X_PREFIX."forums WHERE type='group' AND fid=$delete");
1402                  }
1403              } else {
1404                  $db->query("UPDATE ".X_PREFIX."forums SET name='$name', displayorder=$displayorder, status='{$group['status']}' WHERE fid={$group['fid']}");
1405              }
1406          }
1407  
1408          $newgname = addslashes(htmlspecialchars(postedVar('newgname', 'javascript', FALSE), ENT_COMPAT));  //Forum names are historically double-slashed.  We also have an unusual situation where ENT_COMPAT is the XMB standard.
1409          $newfname = addslashes(htmlspecialchars(postedVar('newfname', 'javascript', FALSE), ENT_COMPAT));
1410          $newsubname = addslashes(htmlspecialchars(postedVar('newsubname', 'javascript', FALSE), ENT_COMPAT));
1411          $newgorder = formInt('newgorder');
1412          $newforder = formInt('newforder');
1413          $newsuborder = formInt('newsuborder');
1414          $newgstatus = formOnOff('newgstatus');
1415          $newfstatus = formOnOff('newfstatus');
1416          $newsubstatus = formOnOff('newsubstatus');
1417          $newffup = formInt('newffup');
1418          $newsubfup = formInt('newsubfup');
1419  
1420          if ($newfname != $lang['textnewforum'] And $newfname != '') {
1421              $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('forum', '$newfname', '$newfstatus', '', '', $newforder, '', 'no', 'yes', 'yes', '', 0, 0, 0, $newffup, '31,31,31,63', 'yes', 'on', '')");
1422          }
1423  
1424          if ($newgname != $lang['textnewgroup'] And $newgname != '') {
1425              $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('group', '$newgname', '$newgstatus', '', '', $newgorder, '', '', '', '', '', 0, 0, 0, 0, '', '', '', '')");
1426          }
1427  
1428          if ($newsubname != $lang['textnewsubf'] And $newsubname != '') {
1429              $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('sub', '$newsubname', '$newsubstatus', '', '', $newsuborder, '', 'no', 'yes', 'yes', '', 0, 0, 0, $newsubfup, '31,31,31,63', 'yes', 'on', '')");
1430          }
1431          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textforumupdate'].'</td></tr>';
1432      } else {
1433          $namenew = addslashes(htmlspecialchars(postedVar('namenew', 'javascript', FALSE), ENT_COMPAT));  //Forum names are historically double-slashed.  We also have an unusual situation where ENT_COMPAT is the XMB standard.
1434          $descnew = postedVar('descnew');
1435          $allowhtmlnew = formYesNo('allowhtmlnew');
1436          $allowsmiliesnew = formYesNo('allowsmiliesnew');
1437          $allowbbcodenew = formYesNo('allowbbcodenew');
1438          $allowimgcodenew = formYesNo('allowimgcodenew');
1439          $attachstatusnew = formOnOff('attachstatusnew');
1440          $themeforumnew = formInt('themeforumnew');
1441          $userlistnew = postedVar('userlistnew', 'javascript');
1442          $passwordnew = postedVar('passwordnew', '', FALSE, TRUE);
1443          $delete = formInt('delete');
1444  
1445          $overrule = array(0,0,0,0);
1446          if (!X_SADMIN) {
1447              $forum = $db->fetch_array($db->query("SELECT postperm FROM ".X_PREFIX."forums WHERE fid=$fdetails"));
1448              $parts = explode(',', $forum['postperm']);
1449              foreach($parts as $p=>$v) {
1450                  if ($v & 1 == 1) {
1451                      // super admin status set
1452                      $overrule[$p] = 1;
1453                  }
1454              }
1455          }
1456  
1457          $perms = array(0,0,0,0);
1458          foreach($_POST['permsNew'] as $key=>$val) {
1459              $perms[$key] = array_sum($_POST['permsNew'][$key]);
1460              $perms[$key] |= $overrule[$key];
1461          }
1462          $perms = implode(',', $perms);
1463  
1464          $db->query("UPDATE ".X_PREFIX."forums SET
1465              name='$namenew',
1466              description='$descnew',
1467              allowhtml='$allowhtmlnew',
1468              allowsmilies='$allowsmiliesnew',
1469              allowbbcode='$allowbbcodenew',
1470              theme='$themeforumnew',
1471              userlist='$userlistnew',
1472              postperm='$perms',
1473              allowimgcode='$allowimgcodenew',
1474              attachstatus='$attachstatusnew',
1475              password='$passwordnew'
1476              WHERE fid='$fdetails'"
1477          );
1478  
1479          $dsuccess = TRUE;
1480          if ($delete) {
1481              if ($delete == $fdetails) {
1482                  if ($db->num_rows($db->query('SELECT tid FROM '.X_PREFIX.'threads WHERE fid='.$fdetails)) > 0) {
1483                      $dsuccess = FALSE;
1484                  } elseif ($db->num_rows($db->query('SELECT fid FROM '.X_PREFIX.'forums WHERE fup='.$fdetails)) > 0) {
1485                      $dsuccess = FALSE;
1486                  } elseif ($db->num_rows($db->query('SELECT pid FROM '.X_PREFIX.'posts WHERE fid='.$fdetails)) > 0) {
1487                      $dsuccess = FALSE;
1488                  } else {
1489                      $db->query("DELETE FROM ".X_PREFIX."forums WHERE (type='forum' OR type='sub') AND fid=".$fdetails);
1490                      $dsuccess = TRUE;
1491                  }
1492                  if (!$dsuccess) {
1493                      message($lang['deleteaborted'].'<br />'.$lang['forumnotempty'], FALSE, '', '', FALSE, FALSE, FALSE, FALSE);
1494                  }
1495              }
1496          }
1497          if ($dsuccess) {
1498              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textforumupdate'].'</td></tr>';
1499          }
1500      }
1501  }
1502  
1503  if ($action == "mods") {
1504      if (noSubmit('modsubmit')) {
1505          ?>
1506          <tr bgcolor="<?php echo $altbg2?>">
1507          <td>
1508          <form method="post" action="cp.php?action=mods">
1509          <table cellspacing="0" cellpadding="0" border="0" width="90%" align="center">
1510          <tr>
1511          <td bgcolor="<?php echo $bordercolor?>">
1512          <table border="0" cellspacing="<?php echo $THEME['borderwidth']?>" cellpadding="<?php echo $tablespace?>" width="100%">
1513          <tr class="category">
1514          <td><strong><font color="<?php echo $cattext?>"><?php echo $lang['textforum']?></font></strong></td>
1515          <td><strong><font color="<?php echo $cattext?>"><?php echo $lang['textmoderator']?></font></strong></td>
1516          </tr>
1517          <?php
1518          $oldfid = 0;
1519          $query = $db->query("SELECT f.moderator, f.name, f.fid, c.name as cat_name, c.fid as cat_fid FROM ".X_PREFIX."forums f LEFT JOIN ".X_PREFIX."forums c ON (f.fup = c.fid) WHERE (c.type='group' AND f.type='forum') OR (f.type='forum' AND f.fup='') ORDER BY c.displayorder, f.displayorder");
1520          while($forum = $db->fetch_array($query)) {
1521              if ($oldfid != $forum['cat_fid']) {
1522                  $oldfid = $forum['cat_fid']
1523                  ?>
1524                  <tr bgcolor="<?php echo $altbg1?>" class="tablerow">
1525                  <td colspan="2"><strong><?php echo fnameOut($forum['cat_name'])?></strong></td>
1526                  </tr>
1527                  <?php
1528              }
1529              ?>
1530              <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
1531              <td><?php echo fnameOut($forum['name'])?></td>
1532              <td><input type="text" name="mod[<?php echo $forum['fid']?>]"" value="<?php echo $forum['moderator']?>" /></td>
1533              </tr>
1534              <?php
1535              $querys = $db->query("SELECT name, fid, moderator FROM ".X_PREFIX."forums WHERE fup='".$forum['fid']."' AND type='sub'");
1536              while($sub = $db->fetch_array($querys)) {
1537                  ?>
1538                  <tr bgcolor="<?php echo $altbg2?>" class="tablerow">
1539                  <td><?php echo $lang['4spaces']?><?php echo $lang['4spaces']?><em><?php echo fnameOut($sub['name'])?></em></td>
1540                  <td><input type="text" name="mod[<?php echo $sub['fid']?>]"" value="<?php echo $sub['moderator']?>" /></td>
1541                  </tr>
1542                  <?php
1543              }
1544          }
1545          ?>
1546          <tr>
1547          <td colspan="2" class="tablerow" bgcolor="<?php echo $altbg1?>"><span class="smalltxt"><?php echo $lang['multmodnote']?></span></td>
1548          </tr>
1549          <tr>
1550          <td colspan="2" class="ctrtablerow" bgcolor="<?php echo $altbg2?>"><input type="submit" class="submit" name="modsubmit" value="<?php echo $lang['textsubmitchanges']?>" /></td>
1551          </tr>
1552          </table>
1553          </td>
1554          </tr>
1555          </table>
1556          </form>
1557          </td>
1558          </tr>
1559          <?php
1560      } else {
1561          $mod = postedArray('mod');
1562          if (is_array($mod)) {
1563              foreach($mod as $fid=>$mods) {
1564                  $db->query("UPDATE ".X_PREFIX."forums SET moderator='$mods' WHERE fid='$fid'");
1565              }
1566          }
1567          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textmodupdate'].'</td></tr>';
1568      }
1569  }
1570  
1571  if ($action == "members") {
1572      $members = postedVar('members', '', FALSE, FALSE, FALSE, 'g');
1573  
1574      $srchmem = postedVar('srchmem', 'javascript', TRUE, FALSE, TRUE);
1575      $srchemail = postedVar('srchemail', 'javascript', TRUE, FALSE, TRUE);
1576      $srchip = postedVar('srchip', 'javascript', TRUE, FALSE, TRUE);
1577      $srchstatus = postedVar('srchstatus', 'javascript', TRUE, TRUE, TRUE);
1578      $dblikemem = $db->like_escape($srchmem);
1579      $dblikeemail = $db->like_escape($srchemail);
1580      $dblikeip = $db->like_escape($srchip);
1581  
1582      $where = array();
1583  
1584      if ($srchmem != '') {
1585          $where[] = "username LIKE '%$dblikemem%' ";
1586      }
1587      if ($srchemail != '') {
1588          $where[] = "email LIKE '%$dblikeemail%' ";
1589      }
1590      if ($srchip != '') {
1591          $where[] = "regip LIKE '%$dblikeip%' ";
1592      }
1593      if ($srchstatus != '') {
1594          if ($srchstatus == 'Pending') {
1595              $where[] = "lastvisit = 0 ";
1596          } else {
1597              $where[] = "status = '$srchstatus' ";
1598          }
1599      }
1600  
1601      if (count($where) == 0) {
1602          $where = '';
1603      } else {
1604          $where = 'WHERE '.implode('AND ', $where);
1605      }
1606  
1607  
1608      if (noSubmit('membersubmit')) {
1609          if (!$members) {
1610              ?>
1611              <tr bgcolor="<?php echo $altbg2?>">
1612              <td>
1613              <form method="post" action="cp.php?action=members&amp;members=search">
1614              <table cellspacing="0" cellpadding="0" border="0" width="90%" align="center">
1615              <tr>
1616              <td bgcolor="<?php echo $bordercolor?>">
1617              <table border="0" cellspacing="<?php echo $THEME['borderwidth']?>" cellpadding="<?php echo $tablespace?>" width="100%">
1618              <tr>
1619              <td class="category" colspan="2"><font color="<?php echo $cattext?>"><strong><?php echo $lang['textmembers']?></strong></font></td>
1620              </tr>
1621              <tr class="tablerow">
1622              <td bgcolor="<?php echo $altbg1?>" width="22%"><?php echo $lang['textsrchusr']?></td>
1623              <td bgcolor="<?php echo $altbg2?>"><input type="text" name="srchmem" /></td>
1624              </tr>
1625              <tr class="tablerow">
1626              <td bgcolor="<?php echo $altbg1?>" width="22%"><?php echo $lang['textsrchemail']?></td>
1627              <td bgcolor="<?php echo $altbg2?>"><input type="text" name="srchemail" /></td>
1628              </tr>
1629              <tr class="tablerow">
1630              <td bgcolor="<?php echo $altbg1?>" width="22%"><?php echo $lang['textsrchip']?></td>
1631              <td bgcolor="<?php echo $altbg2?>"><input type="text" name="srchip" /></td>
1632              </tr>
1633              <tr class="tablerow">
1634              <td bgcolor="<?php echo $altbg1?>" width="22%"><?php echo $lang['textwithstatus']?></td>
1635              <td bgcolor="<?php echo $altbg2?>">
1636              <select name="srchstatus">
1637              <option value=""><?php echo $lang['anystatus']?></option>
1638              <option value="Super Administrator"><?php echo $lang['superadmin']?></option>
1639              <option value="Administrator"><?php echo $lang['textadmin']?></option>
1640              <option value="Super Moderator"><?php echo $lang['textsupermod']?></option>
1641              <option value="Moderator"><?php echo $lang['textmod']?></option>
1642              <option value="Member"><?php ech