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

XMB Open Source Forum Software - PHP Cross Reference

title

Body

[close]

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


Generated: Tue Jan 26 20:11:23 2010 Home | Forum | Download | SVN | Bug Tracker | Documentation Cross-referenced by PHPXref 0.7