XMB PHP Cross Reference Discussion Forums

Source: /tools.php - 523 lines - 23794 bytes - Summary - Text - Print

Description: eXtreme Message Board XMB 1.9.11

   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-2012, The XMB Group
   8   * http://www.xmbforum2.com/
   9   *
  10   * This program is free software; you can redistribute it and/or
  11   * modify it under the terms of the GNU General Public License
  12   * as published by the Free Software Foundation; either version 2
  13   * of the License, or (at your option) any later version.
  14   *
  15   * This program is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  22   *
  23   **/
  24  
  25  define('X_SCRIPT', 'tools.php');
  26  
  27  require  'header.php';
  28  require  ROOT.'include/admin.inc.php';
  29  
  30  loadtemplates('error_nologinsession');
  31  eval('$css = "'.template('css').'";');
  32  
  33  nav('<a href="cp.php">'.$lang['textcp'].'</a>');
  34  eval('echo ("'.template('header').'");');
  35  echo '<script language="JavaScript" type="text/javascript" src="./js/admin.js"></script>';
  36  
  37  if (!X_ADMIN) {
  38      eval('echo "'.template('error_nologinsession').'";');
  39      end_time();
  40      eval('echo "'.template('footer').'";');
  41      exit();
  42  }
  43  
  44  $auditaction = $_SERVER['REQUEST_URI'];
  45  $aapos = strpos($auditaction, "?");
  46  if ($aapos !== false) {
  47      $auditaction = substr($auditaction, $aapos + 1);
  48  }
  49  $auditaction = addslashes("$onlineip|#|$auditaction");
  50  audit($xmbuser, $auditaction, 0, 0);
  51  
  52  displayAdminPanel();
  53  
  54  $action = postedVar('action', '', FALSE, FALSE, FALSE, 'g');
  55  
  56  switch($action) {
  57      case 'fixftotals':
  58          // Update all forums using as few queries as possible.
  59          $sql = "UPDATE ".X_PREFIX."forums AS f "
  60               . " LEFT JOIN (SELECT fid, COUNT(tid) AS tcount FROM ".X_PREFIX."threads GROUP BY fid) AS query2 ON f.fid=query2.fid "
  61               . " LEFT JOIN (SELECT fid, COUNT(pid) AS pcount FROM ".X_PREFIX."posts GROUP BY fid) AS query3 ON f.fid=query3.fid "
  62               . "SET f.threads = IFNULL(query2.tcount, 0), f.posts = IFNULL(query3.pcount, 0) "
  63               . "WHERE f.type = 'sub'";
  64          $db->query($sql);
  65  
  66          $sql = "UPDATE ".X_PREFIX."forums AS f "
  67               . " LEFT JOIN (SELECT fup, SUM(threads) AS tcount, SUM(posts) AS pcount FROM ".X_PREFIX."forums GROUP BY fup) AS query2 ON f.fid=query2.fup "
  68               . " LEFT JOIN (SELECT fid, COUNT(tid) AS tcount FROM ".X_PREFIX."threads GROUP BY fid) AS query3 ON f.fid=query3.fid "
  69               . " LEFT JOIN (SELECT fid, COUNT(pid) AS pcount FROM ".X_PREFIX."posts GROUP BY fid) AS query4 ON f.fid=query4.fid "
  70               . "SET f.threads = IFNULL(query2.tcount, 0) + IFNULL(query3.tcount, 0), "
  71               . "    f.posts   = IFNULL(query2.pcount, 0) + IFNULL(query4.pcount, 0) "
  72               . "WHERE f.type = 'forum'";
  73          $db->query($sql);
  74  
  75          nav($lang['tools']);
  76          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_forumtotal'].'</td></tr></table></table>';
  77          end_time();
  78          eval('echo "'.template('footer').'";');
  79          exit;
  80          break;
  81  
  82      case 'fixttotals':
  83          // Update all threads using as few queries as possible.
  84          $sql = "UPDATE ".X_PREFIX."threads AS t "
  85               . " INNER JOIN (SELECT tid, COUNT(pid) as pcount FROM ".X_PREFIX."posts GROUP BY tid) AS query2 USING (tid) "
  86               . "SET t.replies = query2.pcount - 1";
  87          $db->query($sql);
  88  
  89          nav($lang['tools']);
  90          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_threadtotal'].'</td></tr></table></table>';
  91          end_time();
  92          eval('echo "'.template('footer').'";');
  93          exit;
  94          break;
  95  
  96      case 'fixmposts':
  97          // Update all members using as few queries as possible.
  98          $sql = "UPDATE ".X_PREFIX."members AS m "
  99               . " LEFT JOIN (SELECT author, COUNT(pid) as pcount FROM ".X_PREFIX."posts GROUP BY author) AS query2 ON m.username = query2.author "
 100               . "SET m.postnum = IFNULL(query2.pcount, 0)";
 101          $db->query($sql);
 102  
 103          nav($lang['tools']);
 104          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_mempost'].'</td></tr></table></table>';
 105          end_time();
 106          eval('echo "'.template('footer').'";');
 107          exit;
 108          break;
 109  
 110      case 'fixlastposts':
 111          if (postedVar('scope', '', FALSE, FALSE, FALSE, 'g') == 'forumsonly') {
 112              // Update all forums using as few queries as possible
 113              $sql = 'SELECT f.fid, f.fup, f.type, f.lastpost, p.author, p.dateline, p.pid, log.username, log.date '
 114                   . 'FROM '.X_PREFIX.'forums AS f '
 115                   . 'LEFT JOIN ( '
 116                   . '    SELECT pid, p3.fid, author, dateline FROM '.X_PREFIX.'posts AS p3 '
 117                   . '    INNER JOIN ( '
 118                   . '        SELECT p2.fid, MAX(pid) AS lastpid '
 119                   . '        FROM '.X_PREFIX.'posts AS p2 '
 120                   . '        INNER JOIN ( '
 121                   . '            SELECT fid, MAX(dateline) AS lastdate '
 122                   . '            FROM '.X_PREFIX.'posts '
 123                   . '            GROUP BY fid '
 124                   . '        ) AS query3 ON p2.fid=query3.fid AND p2.dateline=query3.lastdate '
 125                   . '        GROUP BY p2.fid '
 126                   . '    ) AS query2 ON p3.pid=query2.lastpid '
 127                   . ') AS p ON f.fid=p.fid '
 128                   . 'LEFT JOIN ( /* Self-join order is critical with no unique key available */ '
 129                   . '    SELECT log2.fid, log2.date, log2.username '
 130                   . '    FROM '.X_PREFIX.'logs AS log2 '
 131                   . '    INNER JOIN ( '
 132                   . '        SELECT fid, MAX(`date`) AS lastdate '
 133                   . '        FROM '.X_PREFIX.'logs '
 134                   . '        WHERE `action` = "bump" '
 135                   . '        GROUP BY fid '
 136                   . '    ) AS query4 ON log2.fid=query4.fid AND log2.date=query4.lastdate '
 137                   . ') AS log ON f.fid=log.fid '
 138                   . 'WHERE f.type="forum" OR f.type="sub"';
 139  
 140              $q = $db->query($sql);
 141  
 142              // Structure results to accommodate a nested loop strategy.
 143              $forums_array = array();
 144              $subs_array = array();
 145              while ($row = $db->fetch_array($q)) {
 146                  if ($row['type'] == 'forum') {
 147                      $forums_array[] = $row;
 148                  } else {
 149                      $subs_array[] = $row;
 150                  }
 151              }
 152  
 153              $db->free_result($q);
 154  
 155              // Loop through all forums
 156              foreach($forums_array as $loner) {
 157                  $lastpost = array();
 158  
 159                  // Loop through all sub-forums
 160                  foreach($subs_array as $sub) {
 161                      if ($sub['fup'] == $loner['fid']) {
 162                          if ($sub['pid'] !== NULL) {
 163                              if ($sub['date'] !== NULL) {
 164                                  if ($sub['date'] > $sub['dateline']) {
 165                                      $sub['dateline'] = $sub['date'];
 166                                      $sub['author'] = $sub['username'];
 167                                  }
 168                              }
 169                              $lastpost[] = $sub;
 170                              $lp = $sub['dateline'].'|'.$sub['author'].'|'.$sub['pid'];
 171                          } else {
 172                              $lp = '';
 173                          }
 174                          if ($sub['lastpost'] != $lp) {
 175                              $db->escape_fast($lp);
 176                              $db->query("UPDATE ".X_PREFIX."forums SET lastpost='$lp' WHERE fid={$sub['fid']}");
 177                          }
 178                      }
 179                  }
 180  
 181                  if ($loner['pid'] !== NULL) {
 182                      if ($loner['date'] !== NULL) {
 183                          if ($loner['date'] > $loner['dateline']) {
 184                              $loner['dateline'] = $loner['date'];
 185                              $loner['author'] = $loner['username'];
 186                          }
 187                      }
 188                      $lastpost[] = $loner;
 189                  }
 190  
 191                  if (count($lastpost) == 0) {
 192                      $lastpost = '';
 193                  } else {
 194                      $top = 0;
 195                      $mkey = -1;
 196                      foreach($lastpost as $key => $v) {
 197                          if ($v['dateline'] > $top) {
 198                              $mkey = $key;
 199                              $top = $v['dateline'];
 200                          }
 201                      }
 202                      $lastpost = $lastpost[$mkey]['dateline'].'|'.$lastpost[$mkey]['author'].'|'.$lastpost[$mkey]['pid'];
 203                  }
 204                  $db->escape_fast($lastpost);
 205                  $db->query("UPDATE ".X_PREFIX."forums SET lastpost='$lastpost' WHERE fid='{$loner['fid']}'");
 206              }
 207  
 208          } else { // Update all threads using as few queries as possible
 209              $newsql = 'SELECT t.tid, t.lastpost, t.closed, p.author, p.dateline, p.pid, log.username, log.date '
 210                      . 'FROM '.X_PREFIX.'threads AS t '
 211                      . 'LEFT JOIN '.X_PREFIX.'posts AS p ON t.tid=p.tid '
 212                      . 'INNER JOIN ( '
 213                      . '    SELECT p2.tid, MAX(pid) AS lastpid '
 214                      . '    FROM '.X_PREFIX.'posts AS p2 '
 215                      . '    INNER JOIN ( '
 216                      . '        SELECT tid, MAX(dateline) AS lastdate '
 217                      . '        FROM '.X_PREFIX.'posts '
 218                      . '        GROUP BY tid '
 219                      . '    ) AS query3 ON p2.tid=query3.tid AND p2.dateline=query3.lastdate '
 220                      . '    GROUP BY p2.tid '
 221                      . ') AS query2 ON p.pid=query2.lastpid '
 222                      . 'LEFT JOIN ( /* Self-join order is critical with no unique key available */ '
 223                      . '    SELECT log2.tid, log2.date, log2.username '
 224                      . '    FROM '.X_PREFIX.'logs AS log2 '
 225                      . '    INNER JOIN ( '
 226                      . '        SELECT tid, MAX(`date`) AS lastdate '
 227                      . '        FROM '.X_PREFIX.'logs '
 228                      . '        WHERE `action` = "bump" '
 229                      . '        GROUP BY tid '
 230                      . '    ) AS query4 ON log2.tid=query4.tid AND log2.date=query4.lastdate '
 231                      . ') AS log ON t.tid=log.tid';
 232  
 233              $lpquery = $db->query($newsql);
 234  
 235              while($thread = $db->fetch_array($lpquery)) {
 236                  if (!is_null($thread['pid'])) {
 237                      if ($thread['dateline'] == '0' And substr($thread['closed'], 0, 6) == 'moved|') {
 238                          // Handle situation where versions before 1.9.11 set posts.dateline=0 when redirecting threads.
 239                          $newtid = intval(substr($thread['closed'], 6));
 240                          $lastdate = $db->result($db->query("SELECT MAX(dateline) AS lastdate FROM ".X_PREFIX."posts WHERE tid=$newtid"), 0);
 241                          if (is_null($lastdate)) {
 242                              // Redirector is orphaned.  Set dateline to some non-zero value.
 243                              $db->query("UPDATE ".X_PREFIX."posts SET dateline=1 WHERE tid={$thread['tid']} AND dateline = 0");
 244                          } else {
 245                              $thread['dateline'] = $lastdate;
 246                              $db->query("UPDATE ".X_PREFIX."posts SET dateline=$lastdate WHERE tid={$thread['tid']} AND dateline = 0");
 247                          }
 248                      }
 249                      $lp = $thread['dateline'].'|'.$thread['author'].'|'.$thread['pid'];
 250                      if (!is_null($thread['date'])) {
 251                          if ($thread['date'] > $thread['dateline']) {
 252                              $lp = $thread['date'].'|'.$thread['username'].'|'.$thread['pid'];
 253                          }
 254                      }
 255                  } else {
 256                      $lp = '';
 257                  }
 258  
 259                  if ($thread['lastpost'] != $lp) {
 260                      $db->escape_fast($lp);
 261                      $db->query("UPDATE ".X_PREFIX."threads SET lastpost='$lp' WHERE tid={$thread['tid']}");
 262                  }
 263              }
 264              $db->free_result($lpquery);
 265          }
 266  
 267          nav($lang['tools']);
 268          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_lastpost'].'</td></tr></table></table>';
 269          end_time();
 270          eval('echo "'.template('footer').'";');
 271          exit;
 272          break;
 273  
 274      case 'fixorphanedthreads':
 275          if (noSubmit('orphsubmit')) {
 276              echo '<form action="tools.php?action=fixorphanedthreads" method="post">';
 277              echo '<tr bgcolor="'.$altbg1.'" class="ctrtablerow"><td><input type="text" name="export_fid" size="4"/>&nbsp;'.$lang['export_fid_expl'].'</td></tr>';
 278              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td><input class="submit" type="submit" name="orphsubmit" value="'.$lang['textsubmitchanges'].'" /></td></tr>';
 279              echo '</form>';
 280          } else {
 281              $export_fid = formInt('export_fid');
 282              $export_forum = getForum($export_fid);
 283              if ($export_forum['type'] != 'forum' And $export_forum['type'] != 'sub') {
 284                  error($lang['export_fid_not_there'], false, '</table></table><br />');
 285              }
 286  
 287              $q = $db->query("SELECT fid FROM ".X_PREFIX."forums WHERE type='forum' OR type='sub'");
 288              while($f = $db->fetch_array($q)) {
 289                  $fids[] = $f['fid'];
 290              }
 291              $db->free_result($q);
 292  
 293              $fq = "fid != '";
 294              $fids = implode("' AND fid != '", $fids);
 295              $fq .= $fids;
 296              $fq .= "'";
 297  
 298              $q = $db->query("SELECT tid FROM ".X_PREFIX."threads WHERE $fq");
 299              $i = 0;
 300              while($t = $db->fetch_array($q)) {
 301                  $db->query("UPDATE ".X_PREFIX."threads SET fid='$export_fid' WHERE tid='$t[tid]'");
 302                  $db->query("UPDATE ".X_PREFIX."posts SET fid='$export_fid' WHERE tid='$t[tid]'");
 303                  $i++;
 304              }
 305              $db->free_result($q);
 306  
 307              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
 308              echo $i.$lang['o_threads_found'].'</td></tr>';
 309          }
 310          break;
 311  
 312      case 'fixorphanedposts':
 313          if (noSubmit('orphpostsubmit')) {
 314              echo '<form action="tools.php?action=fixorphanedposts" method="post">';
 315              echo '<tr bgcolor="'.$altbg1.'" class="ctrtablerow"><td><input type="text" name="export_tid" size="4"/>&nbsp;'.$lang['export_tid_expl'].'</td></tr>';
 316              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td><input class="submit" type="submit" name="orphpostsubmit" value="'.$lang['textsubmitchanges'].'" /></td></tr>';
 317              echo '</form>';
 318          } else {
 319              // Validate Input
 320              $export_tid = formInt('export_tid');
 321              $query = $db->query("SELECT fid FROM ".X_PREFIX."threads WHERE tid=$export_tid");
 322              if ($db->num_rows($query) != 1) {
 323                  error($lang['export_tid_not_there'], false, '</table></table><br />');
 324              }
 325              $row = $db->fetch_array($query);
 326              $export_fid = $row['fid'];
 327              $db->free_result($query);
 328  
 329              // Fix Invalid FIDs
 330              $db->query("UPDATE ".X_PREFIX."posts AS p INNER JOIN ".X_PREFIX."threads AS t USING (tid) "
 331                       . "SET p.fid = t.fid "
 332                       . "WHERE p.fid != t.fid");
 333              $i = $db->affected_rows();
 334  
 335              // Fix Invalid TIDs
 336              $db->query("UPDATE ".X_PREFIX."posts AS p LEFT JOIN ".X_PREFIX."threads AS t USING (tid) "
 337                       . "SET p.fid = $export_fid, p.tid = $export_tid "
 338                       . "WHERE t.tid IS NULL");
 339              $i += $db->affected_rows();
 340  
 341              updatethreadcount($export_tid);
 342              updateforumcount($export_fid);
 343              $forum = getForum($export_fid);
 344              if ($forum['type'] == 'sub') {
 345                  updateforumcount($forum['fup']);
 346              }
 347  
 348              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
 349              echo $i.$lang['o_posts_found'].'</td></tr>';
 350          }
 351          break;
 352  
 353      case 'fixorphanedattachments':
 354          if (noSubmit('orphattachsubmit')) {
 355              echo '<form action="tools.php?action=fixorphanedattachments" method="post">';
 356              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
 357              echo '<input type="submit" name="orphattachsubmit" value="'.$lang['o_attach_submit'].'" /></td></tr>';
 358              echo '</form>';
 359          } else {
 360              require ('include/attach-admin.inc.php');
 361              $i = deleteOrphans();
 362  
 363              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
 364              echo $i.$lang['o_attachments_found'].'</td></tr>';
 365          }
 366          break;
 367  
 368      case 'fixorphanedpolls':
 369          if (noSubmit('orphpollsubmit')) {
 370              echo '<form action="tools.php?action=fixorphanedpolls" method="post">';
 371              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
 372              echo '<input type="submit" name="orphpollsubmit" value="'.$lang['o_poll_submit'].'" /></td></tr>';
 373              echo '</form>';
 374          } else {
 375              $q = $db->query("SELECT topic_id "
 376                            . "FROM ".X_PREFIX."vote_desc AS v "
 377                            . "LEFT JOIN ".X_PREFIX."threads AS t ON t.tid=v.topic_id "
 378                            . "WHERE t.tid IS NULL");
 379              $i = $db->num_rows($q);
 380              if ($i > 0) {
 381                  $tids = array();
 382                  while($row = $db->fetch_array($q)) {
 383                      $tids[] = $row['topic_id'];
 384                  }
 385                  $tids = implode(', ', $tids);
 386  
 387                  // Important: Do not alias tables in multi-table delete queries as long as MySQL 4.0 is supported.
 388                  $db->query("DELETE FROM ".X_PREFIX."vote_desc, ".X_PREFIX."vote_results, ".X_PREFIX."vote_voters "
 389                           . "USING ".X_PREFIX."vote_desc "
 390                           . "LEFT JOIN ".X_PREFIX."vote_results ON ".X_PREFIX."vote_results.vote_id = ".X_PREFIX."vote_desc.vote_id "
 391                           . "LEFT JOIN ".X_PREFIX."vote_voters  ON ".X_PREFIX."vote_voters.vote_id  = ".X_PREFIX."vote_desc.vote_id "
 392                           . "WHERE ".X_PREFIX."vote_desc.topic_id IN ($tids)");
 393  
 394              }
 395  
 396              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>';
 397              echo $i.$lang['o_polls_found'].'</td></tr>';
 398          }
 399          break;
 400  
 401      case 'updatemoods':
 402          $db->query("UPDATE ".X_PREFIX."members SET mood='$lang[nomoodtext]' WHERE mood=''");
 403          nav($lang['tools']);
 404          echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_mood'].'</td></tr></table></table>';
 405          end_time();
 406          eval('echo "'.template('footer').'";');
 407          exit;
 408          break;
 409  
 410      case 'u2udump':
 411          if (noSubmit('yessubmit')) {
 412              ?>
 413              <tr bgcolor="<?php echo $altbg2; ?>" class="ctrtablerow"><td><?php echo $lang['u2udump_confirm']; ?><br />
 414              <form action="tools.php?action=u2udump" method="post">
 415                <input type="hidden" name="token" value="<?php echo nonce_create('truncateu2us'); ?>" />
 416                <input type="submit" name="yessubmit" value="<?php echo $lang['textyes']; ?>" /> -
 417                <input type="submit" name="yessubmit" value="<?php echo $lang['textno']; ?>" />
 418              </form></td></tr>
 419              <?php
 420          } else if ($lang['textyes'] == $yessubmit) {
 421              request_secure('truncateu2us', '', X_NONCE_AYS_EXP, FALSE);
 422              $db->query("TRUNCATE ".X_PREFIX."u2u");
 423              nav($lang['tools']);
 424              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_u2u'].'</td></tr></table></table>';
 425              end_time();
 426              eval('echo "'.template('footer').'";');
 427              exit();
 428          } else {
 429              redirect($full_url.'cp.php', 0);
 430          }
 431          break;
 432  
 433      case 'whosonlinedump':
 434          if (noSubmit('yessubmit')) {
 435              ?>
 436              <tr bgcolor="<?php echo $altbg2; ?>" class="ctrtablerow"><td><?php echo $lang['whoodump_confirm']; ?><br />
 437              <form action="tools.php?action=whosonlinedump" method="post">
 438                <input type="hidden" name="token" value="<?php echo nonce_create('truncatewhos'); ?>" />
 439                <input type="submit" name="yessubmit" value="<?php echo $lang['textyes']; ?>" /> -
 440                <input type="submit" name="yessubmit" value="<?php echo $lang['textno']; ?>" />
 441              </form></td></tr>
 442              <?php
 443          } else if ($lang['textyes'] == $yessubmit) {
 444              request_secure('truncatewhos', '', X_NONCE_AYS_EXP, FALSE);
 445              $db->query("TRUNCATE ".X_PREFIX."whosonline");
 446              nav($lang['tools']);
 447              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_whosonline'].'</td></tr></table></table>';
 448              end_time();
 449              eval('echo "'.template('footer').'";');
 450              exit();
 451          } else {
 452              redirect($full_url.'cp.php', 0);
 453          }
 454          break;
 455  
 456      case 'logsdump':
 457          if (!X_SADMIN) {
 458              error($lang['superadminonly'], false, '</td></tr></table></td></tr></table><br />');
 459          }
 460  
 461          if (noSubmit('yessubmit')) {
 462              ?>
 463              <tr bgcolor="<?php echo $altbg2; ?>" class="ctrtablerow"><td><?php echo $lang['logsdump_confirm']; ?><br />
 464              <form action="tools.php?action=logsdump" method="post">
 465                <input type="hidden" name="token" value="<?php echo nonce_create('deletecplogs'); ?>" />
 466                <input type="submit" name="yessubmit" value="<?php echo $lang['textyes']; ?>" /> -
 467                <input type="submit" name="yessubmit" value="<?php echo $lang['textno']; ?>" />
 468              </form></td></tr>
 469              <?php
 470          } else if ($lang['textyes'] == $yessubmit) {
 471              request_secure('deletecplogs', '', X_NONCE_AYS_EXP, FALSE);
 472              $db->query("DELETE FROM ".X_PREFIX."logs WHERE fid=0");
 473              nav($lang['tools']);
 474              echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['tool_completed'].' - '.$lang['tool_logs'].'</td></tr></table></table>';
 475              end_time();
 476              eval('echo "'.template('footer').'";');
 477              exit();
 478          } else {
 479              redirect($full_url.'cp.php', 0);
 480          }
 481          break;
 482  
 483      case 'repairtables':
 484          $start = TRUE;
 485          @set_time_limit(180);
 486          foreach($tables as $val) {
 487              dump_query($db->query('REPAIR TABLE `'.X_PREFIX.$val.'`'), $start);
 488              $start = FALSE;
 489          }
 490          break;
 491  
 492      case 'optimizetables':
 493          $start = TRUE;
 494          @set_time_limit(180);
 495          foreach($tables as $val) {
 496              dump_query($db->query('OPTIMIZE TABLE `'.X_PREFIX.$val.'`'), $start);
 497              $start = FALSE;
 498          }
 499          break;
 500  
 501      case 'analyzetables':
 502          $start = TRUE;
 503          @set_time_limit(180);
 504          foreach($tables as $val) {
 505              dump_query($db->query('ANALYZE TABLE `'.X_PREFIX.$val.'`'), $start);
 506              $start = FALSE;
 507          }
 508          break;
 509  
 510      case 'checktables':
 511          $start = TRUE;
 512          @set_time_limit(180);
 513          foreach($tables as $val) {
 514              dump_query($db->query('CHECK TABLE `'.X_PREFIX.$val.'`'), $start);
 515              $start = FALSE;
 516          }
 517          break;
 518  }
 519  
 520  echo '</td></tr></table></table>';
 521  end_time();
 522  eval('echo "'.template('footer').'";');
 523  ?>

title

Description

title

Description

title

Description

title

title

Body