[ Index ]

PHP Cross Reference of MyBB 1.8.22

title

Body

[close]

/admin/modules/tools/ -> recount_rebuild.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.8
   4   * Copyright 2014 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://www.mybb.com
   7   * License: http://www.mybb.com/about/license
   8   *
   9   */
  10  
  11  // Disallow direct access to this file for security reasons
  12  if(!defined("IN_MYBB"))
  13  {
  14      die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  15  }
  16  
  17  $page->add_breadcrumb_item($lang->recount_rebuild, "index.php?module=tools-recount_rebuild");
  18  
  19  $plugins->run_hooks("admin_tools_recount_rebuild");
  20  
  21  /**
  22   * Rebuild forum counters
  23   */
  24  function acp_rebuild_forum_counters()
  25  {
  26      global $db, $mybb, $lang;
  27  
  28      $query = $db->simple_select("forums", "COUNT(*) as num_forums");
  29      $num_forums = $db->fetch_field($query, 'num_forums');
  30  
  31      $page = $mybb->get_input('page', MyBB::INPUT_INT);
  32      $per_page = $mybb->get_input('forumcounters', MyBB::INPUT_INT);
  33  
  34      $start = ($page-1) * $per_page;
  35      $end = $start + $per_page;
  36  
  37      $query = $db->simple_select("forums", "fid", '', array('order_by' => 'fid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
  38      while($forum = $db->fetch_array($query))
  39      {
  40          $update['parentlist'] = make_parent_list($forum['fid']);
  41          $db->update_query("forums", $update, "fid='{$forum['fid']}'");
  42          rebuild_forum_counters($forum['fid']);
  43      }
  44  
  45      check_proceed($num_forums, $end, ++$page, $per_page, "forumcounters", "do_rebuildforumcounters", $lang->success_rebuilt_forum_counters);
  46  }
  47  
  48  /**
  49   * Rebuild thread counters
  50   */
  51  function acp_rebuild_thread_counters()
  52  {
  53      global $db, $mybb, $lang;
  54  
  55      $query = $db->simple_select("threads", "COUNT(*) as num_threads");
  56      $num_threads = $db->fetch_field($query, 'num_threads');
  57  
  58      $page = $mybb->get_input('page', MyBB::INPUT_INT);
  59      $per_page = $mybb->get_input('threadcounters', MyBB::INPUT_INT);
  60  
  61      $start = ($page-1) * $per_page;
  62      $end = $start + $per_page;
  63  
  64      $query = $db->simple_select("threads", "tid", '', array('order_by' => 'tid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
  65      while($thread = $db->fetch_array($query))
  66      {
  67          rebuild_thread_counters($thread['tid']);
  68      }
  69  
  70      check_proceed($num_threads, $end, ++$page, $per_page, "threadcounters", "do_rebuildthreadcounters", $lang->success_rebuilt_thread_counters);
  71  }
  72  
  73  /**
  74   * Rebuild poll counters
  75   */
  76  function acp_rebuild_poll_counters()
  77  {
  78      global $db, $mybb, $lang;
  79  
  80      $query = $db->simple_select("polls", "COUNT(*) as num_polls");
  81      $num_polls = $db->fetch_field($query, 'num_polls');
  82  
  83      $page = $mybb->get_input('page', MyBB::INPUT_INT);
  84      $per_page = $mybb->get_input('pollcounters', MyBB::INPUT_INT);
  85  
  86      $start = ($page-1) * $per_page;
  87      $end = $start + $per_page;
  88  
  89      $query = $db->simple_select("polls", "pid", '', array('order_by' => 'pid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
  90      while($poll = $db->fetch_array($query))
  91      {
  92          rebuild_poll_counters($poll['pid']);
  93      }
  94  
  95      check_proceed($num_polls, $end, ++$page, $per_page, "pollcounters", "do_rebuildpollcounters", $lang->success_rebuilt_poll_counters);
  96  }
  97  
  98  /**
  99   * Recount user posts
 100   */
 101  function acp_recount_user_posts()
 102  {
 103      global $db, $mybb, $lang;
 104  
 105      $query = $db->simple_select("users", "COUNT(uid) as num_users");
 106      $num_users = $db->fetch_field($query, 'num_users');
 107  
 108      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 109      $per_page = $mybb->get_input('userposts', MyBB::INPUT_INT);
 110  
 111      $start = ($page-1) * $per_page;
 112      $end = $start + $per_page;
 113  
 114      $query = $db->simple_select("forums", "fid", "usepostcounts = 0");
 115      while($forum = $db->fetch_array($query))
 116      {
 117          $fids[] = $forum['fid'];
 118      }
 119      if(is_array($fids))
 120      {
 121          $fids = implode(',', $fids);
 122      }
 123      if($fids)
 124      {
 125          $fids = " AND p.fid NOT IN($fids)";
 126      }
 127      else
 128      {
 129          $fids = "";
 130      }
 131  
 132      $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 133      while($user = $db->fetch_array($query))
 134      {
 135          $query2 = $db->query("
 136              SELECT COUNT(p.pid) AS post_count
 137              FROM ".TABLE_PREFIX."posts p
 138              LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
 139              WHERE p.uid='{$user['uid']}' AND t.visible > 0 AND p.visible > 0{$fids}
 140          ");
 141          $num_posts = $db->fetch_field($query2, "post_count");
 142  
 143          $db->update_query("users", array("postnum" => (int)$num_posts), "uid='{$user['uid']}'");
 144      }
 145  
 146      check_proceed($num_users, $end, ++$page, $per_page, "userposts", "do_recountuserposts", $lang->success_rebuilt_user_post_counters);
 147  }
 148  
 149  /**
 150   * Recount user threads
 151   */
 152  function acp_recount_user_threads()
 153  {
 154      global $db, $mybb, $lang;
 155  
 156      $query = $db->simple_select("users", "COUNT(uid) as num_users");
 157      $num_users = $db->fetch_field($query, 'num_users');
 158  
 159      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 160      $per_page = $mybb->get_input('userthreads', MyBB::INPUT_INT);
 161  
 162      $start = ($page-1) * $per_page;
 163      $end = $start + $per_page;
 164  
 165      $query = $db->simple_select("forums", "fid", "usethreadcounts = 0");
 166      while($forum = $db->fetch_array($query))
 167      {
 168          $fids[] = $forum['fid'];
 169      }
 170      if(is_array($fids))
 171      {
 172          $fids = implode(',', $fids);
 173      }
 174      if($fids)
 175      {
 176          $fids = " AND t.fid NOT IN($fids)";
 177      }
 178      else
 179      {
 180          $fids = "";
 181      }
 182  
 183      $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 184      while($user = $db->fetch_array($query))
 185      {
 186          $query2 = $db->query("
 187              SELECT COUNT(t.tid) AS thread_count
 188              FROM ".TABLE_PREFIX."threads t
 189              WHERE t.uid='{$user['uid']}' AND t.visible > 0 AND t.closed NOT LIKE 'moved|%'{$fids}
 190          ");
 191          $num_threads = $db->fetch_field($query2, "thread_count");
 192  
 193          $db->update_query("users", array("threadnum" => (int)$num_threads), "uid='{$user['uid']}'");
 194      }
 195  
 196      check_proceed($num_users, $end, ++$page, $per_page, "userthreads", "do_recountuserthreads", $lang->success_rebuilt_user_thread_counters);
 197  }
 198  
 199  /**
 200   * Recount reputation values
 201   */
 202  function acp_recount_reputation()
 203  {
 204      global $db, $mybb, $lang;
 205  
 206      $query = $db->simple_select("users", "COUNT(uid) as num_users");
 207      $num_users = $db->fetch_field($query, 'num_users');
 208  
 209      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 210      $per_page = $mybb->get_input('reputation', MyBB::INPUT_INT);
 211  
 212      $start = ($page-1) * $per_page;
 213      $end = $start + $per_page;
 214  
 215      $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 216      while($user = $db->fetch_array($query))
 217      {
 218          $query2 = $db->query("
 219              SELECT SUM(reputation) as total_rep
 220              FROM ".TABLE_PREFIX."reputation
 221              WHERE uid='{$user['uid']}'
 222          ");
 223          $total_rep = $db->fetch_field($query2, "total_rep");
 224  
 225          $db->update_query("users", array("reputation" => (int)$total_rep), "uid='{$user['uid']}'");
 226      }
 227  
 228      check_proceed($num_users, $end, ++$page, $per_page, "reputation", "do_recountreputation", $lang->success_rebuilt_reputation);
 229  }
 230  
 231  /**
 232   * Recount warnings for users
 233   */
 234  function acp_recount_warning()
 235  {
 236      global $db, $mybb, $lang;
 237  
 238      $query = $db->simple_select("users", "COUNT(uid) as num_users");
 239      $num_users = $db->fetch_field($query, 'num_users');
 240  
 241      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 242      $per_page = $mybb->get_input('warning', MyBB::INPUT_INT);
 243  
 244      $start = ($page-1) * $per_page;
 245      $end = $start + $per_page;
 246  
 247      $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 248      while($user = $db->fetch_array($query))
 249      {
 250          $query2 = $db->query("
 251              SELECT SUM(points) as warn_lev
 252              FROM ".TABLE_PREFIX."warnings
 253              WHERE uid='{$user['uid']}' AND expired='0'
 254          ");
 255          $warn_lev = $db->fetch_field($query2, "warn_lev");
 256  
 257          $db->update_query("users", array("warningpoints" => (int)$warn_lev), "uid='{$user['uid']}'");
 258      }
 259  
 260      check_proceed($num_users, $end, ++$page, $per_page, "warning", "do_recountwarning", $lang->success_rebuilt_warning);
 261  }
 262  
 263  /**
 264   * Recount private messages (total and unread) for users
 265   */
 266  function acp_recount_private_messages()
 267  {
 268      global $db, $mybb, $lang;
 269  
 270      $query = $db->simple_select("users", "COUNT(uid) as num_users");
 271      $num_users = $db->fetch_field($query, 'num_users');
 272  
 273      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 274      $per_page = $mybb->get_input('privatemessages', MyBB::INPUT_INT);
 275  
 276      $start = ($page-1) * $per_page;
 277      $end = $start + $per_page;
 278  
 279      require_once  MYBB_ROOT."inc/functions_user.php";
 280  
 281      $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 282      while($user = $db->fetch_array($query))
 283      {
 284          update_pm_count($user['uid']);
 285      }
 286  
 287      check_proceed($num_users, $end, ++$page, $per_page, "privatemessages", "do_recountprivatemessages", $lang->success_rebuilt_private_messages);
 288  }
 289  
 290  /**
 291   * Recount referrals for users
 292   */
 293  function acp_recount_referrals()
 294  {
 295      global $db, $mybb, $lang;
 296  
 297      $query = $db->simple_select("users", "COUNT(uid) as num_users");
 298      $num_users = $db->fetch_field($query, 'num_users');
 299  
 300      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 301      $per_page = $mybb->get_input('referral', MyBB::INPUT_INT);
 302      $start = ($page-1) * $per_page;
 303      $end = $start + $per_page;
 304  
 305      $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 306      while($user = $db->fetch_array($query))
 307      {
 308          $query2 = $db->query("
 309              SELECT COUNT(uid) as num_referrers
 310              FROM ".TABLE_PREFIX."users
 311              WHERE referrer='{$user['uid']}'
 312          ");
 313          $num_referrers = $db->fetch_field($query2, "num_referrers");
 314  
 315          $db->update_query("users", array("referrals" => (int)$num_referrers), "uid='{$user['uid']}'");
 316      }
 317  
 318      check_proceed($num_users, $end, ++$page, $per_page, "referral", "do_recountreferral", $lang->success_rebuilt_referral);
 319  }
 320  
 321  /**
 322   * Recount thread ratings
 323   */
 324  function acp_recount_thread_ratings()
 325  {
 326      global $db, $mybb, $lang;
 327  
 328      $query = $db->simple_select("threads", "COUNT(*) as num_threads");
 329      $num_threads = $db->fetch_field($query, 'num_threads');
 330  
 331      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 332      $per_page = $mybb->get_input('threadrating', MyBB::INPUT_INT);
 333  
 334      $start = ($page-1) * $per_page;
 335      $end = $start + $per_page;
 336  
 337      $query = $db->simple_select("threads", "tid", '', array('order_by' => 'tid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 338      while($thread = $db->fetch_array($query))
 339      {
 340          $query2 = $db->query("
 341              SELECT COUNT(tid) as num_ratings, SUM(rating) as total_rating
 342              FROM ".TABLE_PREFIX."threadratings
 343              WHERE tid='{$thread['tid']}'
 344          ");
 345          $recount = $db->fetch_array($query2);
 346  
 347          $db->update_query("threads", array("numratings" => (int)$recount['num_ratings'], "totalratings" => (int)$recount['total_rating']), "tid='{$thread['tid']}'");
 348      }
 349  
 350      check_proceed($num_threads, $end, ++$page, $per_page, "threadrating", "do_recountthreadrating", $lang->success_rebuilt_thread_ratings);
 351  }
 352  
 353  /**
 354   * Rebuild thumbnails for attachments
 355   */
 356  function acp_rebuild_attachment_thumbnails()
 357  {
 358      global $db, $mybb, $lang;
 359  
 360      $query = $db->simple_select("attachments", "COUNT(aid) as num_attachments");
 361      $num_attachments = $db->fetch_field($query, 'num_attachments');
 362  
 363      $page = $mybb->get_input('page', MyBB::INPUT_INT);
 364      $per_page = $mybb->get_input('attachmentthumbs', MyBB::INPUT_INT);
 365  
 366      $start = ($page-1) * $per_page;
 367      $end = $start + $per_page;
 368  
 369      $uploadspath = $mybb->settings['uploadspath'];
 370      if(my_substr($uploadspath, 0, 1) == '.')
 371      {
 372          $uploadspath = MYBB_ROOT . $mybb->settings['uploadspath'];
 373      }
 374  
 375      require_once  MYBB_ROOT."inc/functions_image.php";
 376  
 377      $query = $db->simple_select("attachments", "*", '', array('order_by' => 'aid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
 378      while($attachment = $db->fetch_array($query))
 379      {
 380          $ext = my_strtolower(my_substr(strrchr($attachment['filename'], "."), 1));
 381          if($ext == "gif" || $ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "jpe")
 382          {
 383              $thumbname = str_replace(".attach", "_thumb.$ext", $attachment['attachname']);
 384              $thumbnail = generate_thumbnail($uploadspath."/".$attachment['attachname'], $uploadspath, $thumbname, $mybb->settings['attachthumbh'], $mybb->settings['attachthumbw']);
 385              if($thumbnail['code'] == 4)
 386              {
 387                  $thumbnail['filename'] = "SMALL";
 388              }
 389              $db->update_query("attachments", array("thumbnail" => $thumbnail['filename']), "aid='{$attachment['aid']}'");
 390          }
 391      }
 392  
 393      check_proceed($num_attachments, $end, ++$page, $per_page, "attachmentthumbs", "do_rebuildattachmentthumbs", $lang->success_rebuilt_attachment_thumbnails);
 394  }
 395  
 396  /**
 397   * @param int $current
 398   * @param int $finish
 399   * @param int $next_page
 400   * @param int $per_page
 401   * @param string $name
 402   * @param string $name2
 403   * @param string $message
 404   */
 405  function check_proceed($current, $finish, $next_page, $per_page, $name, $name2, $message)
 406  {
 407      global $page, $lang;
 408  
 409      if($finish >= $current)
 410      {
 411          flash_message($message, 'success');
 412          admin_redirect("index.php?module=tools-recount_rebuild");
 413      }
 414      else
 415      {
 416          $page->output_header();
 417  
 418          $form = new Form("index.php?module=tools-recount_rebuild", 'post');
 419  
 420          echo $form->generate_hidden_field("page", $next_page);
 421          echo $form->generate_hidden_field($name, $per_page);
 422          echo $form->generate_hidden_field($name2, $lang->go);
 423          output_auto_redirect($form, $lang->confirm_proceed_rebuild);
 424  
 425          $form->end();
 426  
 427          $page->output_footer();
 428          exit;
 429      }
 430  }
 431  
 432  if(!$mybb->input['action'])
 433  {
 434      $plugins->run_hooks("admin_tools_recount_rebuild_start");
 435  
 436      if($mybb->request_method == "post")
 437      {
 438          require_once  MYBB_ROOT."inc/functions_rebuild.php";
 439  
 440          if(!isset($mybb->input['page']) || $mybb->get_input('page', MyBB::INPUT_INT) < 1)
 441          {
 442              $mybb->input['page'] = 1;
 443          }
 444  
 445          $plugins->run_hooks("admin_tools_do_recount_rebuild");
 446  
 447          if(isset($mybb->input['do_rebuildforumcounters']))
 448          {
 449              $plugins->run_hooks("admin_tools_recount_rebuild_forum_counters");
 450  
 451              if($mybb->input['page'] == 1)
 452              {
 453                  // Log admin action
 454                  log_admin_action("forum");
 455              }
 456  
 457              $per_page = $mybb->get_input('forumcounters', MyBB::INPUT_INT);
 458              if(!$per_page || $per_page <= 0)
 459              {
 460                  $mybb->input['forumcounters'] = 50;
 461              }
 462  
 463              acp_rebuild_forum_counters();
 464          }
 465          elseif(isset($mybb->input['do_rebuildthreadcounters']))
 466          {
 467              $plugins->run_hooks("admin_tools_recount_rebuild_thread_counters");
 468  
 469              if($mybb->input['page'] == 1)
 470              {
 471                  // Log admin action
 472                  log_admin_action("thread");
 473              }
 474  
 475              $per_page = $mybb->get_input('threadcounters', MyBB::INPUT_INT);
 476              if(!$per_page || $per_page <= 0)
 477              {
 478                  $mybb->input['threadcounters'] = 500;
 479              }
 480  
 481              acp_rebuild_thread_counters();
 482          }
 483          elseif(isset($mybb->input['do_recountuserposts']))
 484          {
 485              $plugins->run_hooks("admin_tools_recount_rebuild_user_posts");
 486  
 487              if($mybb->input['page'] == 1)
 488              {
 489                  // Log admin action
 490                  log_admin_action("userposts");
 491              }
 492  
 493              $per_page = $mybb->get_input('userposts', MyBB::INPUT_INT);
 494              if(!$per_page || $per_page <= 0)
 495              {
 496                  $mybb->input['userposts'] = 500;
 497              }
 498  
 499              acp_recount_user_posts();
 500          }
 501          elseif(isset($mybb->input['do_recountuserthreads']))
 502          {
 503              $plugins->run_hooks("admin_tools_recount_rebuild_user_threads");
 504  
 505              if($mybb->input['page'] == 1)
 506              {
 507                  // Log admin action
 508                  log_admin_action("userthreads");
 509              }
 510  
 511              $per_page = $mybb->get_input('userthreads', MyBB::INPUT_INT);
 512              if(!$per_page || $per_page <= 0)
 513              {
 514                  $mybb->input['userthreads'] = 500;
 515              }
 516  
 517              acp_recount_user_threads();
 518          }
 519          elseif(isset($mybb->input['do_rebuildattachmentthumbs']))
 520          {
 521              $plugins->run_hooks("admin_tools_recount_rebuild_attachment_thumbs");
 522  
 523              if($mybb->input['page'] == 1)
 524              {
 525                  // Log admin action
 526                  log_admin_action("attachmentthumbs");
 527              }
 528  
 529              $per_page = $mybb->get_input('attachmentthumbs', MyBB::INPUT_INT);
 530              if(!$per_page || $per_page <= 0)
 531              {
 532                  $mybb->input['attachmentthumbs'] = 500;
 533              }
 534  
 535              acp_rebuild_attachment_thumbnails();
 536          }
 537          elseif(isset($mybb->input['do_recountreputation']))
 538          {
 539              $plugins->run_hooks("admin_tools_recount_recount_reputation");
 540  
 541              if($mybb->input['page'] == 1)
 542              {
 543                  // Log admin action
 544                  log_admin_action("reputation");
 545              }
 546  
 547              $per_page = $mybb->get_input('reputation', MyBB::INPUT_INT);
 548              if(!$per_page || $per_page <= 0)
 549              {
 550                  $mybb->input['reputation'] = 500;
 551              }
 552  
 553              acp_recount_reputation();
 554          }
 555          elseif(isset($mybb->input['do_recountwarning']))
 556          {
 557              $plugins->run_hooks("admin_tools_recount_recount_warning");
 558  
 559              if($mybb->input['page'] == 1)
 560              {
 561                  // Log admin action
 562                  log_admin_action("warning");
 563              }
 564  
 565              $per_page = $mybb->get_input('warning', MyBB::INPUT_INT);
 566              if(!$per_page || $per_page <= 0)
 567              {
 568                  $mybb->input['warning'] = 500;
 569              }
 570  
 571              acp_recount_warning();
 572          }
 573          elseif(isset($mybb->input['do_recountprivatemessages']))
 574          {
 575              $plugins->run_hooks("admin_tools_recount_recount_private_messages");
 576  
 577              if($mybb->input['page'] == 1)
 578              {
 579                  // Log admin action
 580                  log_admin_action("privatemessages");
 581              }
 582  
 583              $per_page = $mybb->get_input('privatemessages', MyBB::INPUT_INT);
 584              if(!$per_page || $per_page <= 0)
 585              {
 586                  $mybb->input['privatemessages'] = 500;
 587              }
 588  
 589              acp_recount_private_messages();
 590          }
 591          elseif(isset($mybb->input['do_recountreferral']))
 592          {
 593              $plugins->run_hooks("admin_tools_recount_recount_referral");
 594  
 595              if($mybb->input['page'] == 1)
 596              {
 597                  // Log admin action
 598                  log_admin_action("referral");
 599              }
 600  
 601              $per_page = $mybb->get_input('referral', MyBB::INPUT_INT);
 602              if(!$per_page || $per_page <= 0)
 603              {
 604                  $mybb->input['referral'] = 500;
 605              }
 606  
 607              acp_recount_referrals();
 608          }
 609          elseif(isset($mybb->input['do_recountthreadrating']))
 610          {
 611              $plugins->run_hooks("admin_tools_recount_recount_thread_ratings");
 612  
 613              if($mybb->input['page'] == 1)
 614              {
 615                  // Log admin action
 616                  log_admin_action("threadrating");
 617              }
 618  
 619              $per_page = $mybb->get_input('threadrating', MyBB::INPUT_INT);
 620              if(!$per_page || $per_page <= 0)
 621              {
 622                  $mybb->input['threadrating'] = 500;
 623              }
 624  
 625              acp_recount_thread_ratings();
 626          }
 627          elseif(isset($mybb->input['do_rebuildpollcounters']))
 628          {
 629              $plugins->run_hooks("admin_tools_recount_rebuild_poll_counters");
 630  
 631              if($mybb->input['page'] == 1)
 632              {
 633                  // Log admin action
 634                  log_admin_action("poll");
 635              }
 636  
 637              $per_page = $mybb->get_input('pollcounters', MyBB::INPUT_INT);
 638              if(!$per_page || $per_page <= 0)
 639              {
 640                  $mybb->input['pollcounters'] = 500;
 641              }
 642  
 643              acp_rebuild_poll_counters();
 644          }
 645          else
 646          {
 647              $plugins->run_hooks("admin_tools_recount_rebuild_stats");
 648  
 649              $cache->update_stats();
 650  
 651              // Log admin action
 652              log_admin_action("stats");
 653  
 654              flash_message($lang->success_rebuilt_forum_stats, 'success');
 655              admin_redirect("index.php?module=tools-recount_rebuild");
 656          }
 657      }
 658  
 659      $page->output_header($lang->recount_rebuild);
 660  
 661      $sub_tabs['recount_rebuild'] = array(
 662          'title' => $lang->recount_rebuild,
 663          'link' => "index.php?module=tools-recount_rebuild",
 664          'description' => $lang->recount_rebuild_desc
 665      );
 666  
 667      $page->output_nav_tabs($sub_tabs, 'recount_rebuild');
 668  
 669      $form = new Form("index.php?module=tools-recount_rebuild", "post");
 670  
 671      $form_container = new FormContainer($lang->recount_rebuild);
 672      $form_container->output_row_header($lang->name);
 673      $form_container->output_row_header($lang->data_per_page, array('width' => 50));
 674      $form_container->output_row_header("&nbsp;");
 675  
 676      $form_container->output_cell("<label>{$lang->rebuild_forum_counters}</label><div class=\"description\">{$lang->rebuild_forum_counters_desc}</div>");
 677      $form_container->output_cell($form->generate_numeric_field("forumcounters", 50, array('style' => 'width: 150px;', 'min' => 0)));
 678      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildforumcounters")));
 679      $form_container->construct_row();
 680  
 681      $form_container->output_cell("<label>{$lang->rebuild_thread_counters}</label><div class=\"description\">{$lang->rebuild_thread_counters_desc}</div>");
 682      $form_container->output_cell($form->generate_numeric_field("threadcounters", 500, array('style' => 'width: 150px;', 'min' => 0)));
 683      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildthreadcounters")));
 684      $form_container->construct_row();
 685  
 686      $form_container->output_cell("<label>{$lang->rebuild_poll_counters}</label><div class=\"description\">{$lang->rebuild_poll_counters_desc}</div>");
 687      $form_container->output_cell($form->generate_numeric_field("pollcounters", 500, array('style' => 'width: 150px;', 'min' => 0)));
 688      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildpollcounters")));
 689      $form_container->construct_row();
 690  
 691      $form_container->output_cell("<label>{$lang->recount_user_posts}</label><div class=\"description\">{$lang->recount_user_posts_desc}</div>");
 692      $form_container->output_cell($form->generate_numeric_field("userposts", 500, array('style' => 'width: 150px;', 'min' => 0)));
 693      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountuserposts")));
 694      $form_container->construct_row();
 695  
 696      $form_container->output_cell("<label>{$lang->recount_user_threads}</label><div class=\"description\">{$lang->recount_user_threads_desc}</div>");
 697      $form_container->output_cell($form->generate_numeric_field("userthreads", 500, array('style' => 'width: 150px;', 'min' => 0)));
 698      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountuserthreads")));
 699      $form_container->construct_row();
 700  
 701      $form_container->output_cell("<label>{$lang->rebuild_attachment_thumbs}</label><div class=\"description\">{$lang->rebuild_attachment_thumbs_desc}</div>");
 702      $form_container->output_cell($form->generate_numeric_field("attachmentthumbs", 20, array('style' => 'width: 150px;', 'min' => 0)));
 703      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_rebuildattachmentthumbs")));
 704      $form_container->construct_row();
 705  
 706      $form_container->output_cell("<label>{$lang->recount_stats}</label><div class=\"description\">{$lang->recount_stats_desc}</div>");
 707      $form_container->output_cell($lang->na);
 708      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountstats")));
 709      $form_container->construct_row();
 710  
 711      $form_container->output_cell("<label>{$lang->recount_reputation}</label><div class=\"description\">{$lang->recount_reputation_desc}</div>");
 712      $form_container->output_cell($form->generate_numeric_field("reputation", 500, array('style' => 'width: 150px;', 'min' => 0)));
 713      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountreputation")));
 714      $form_container->construct_row();
 715  
 716      $form_container->output_cell("<label>{$lang->recount_warning}</label><div class=\"description\">{$lang->recount_warning_desc}</div>");
 717      $form_container->output_cell($form->generate_numeric_field("warning", 500, array('style' => 'width: 150px;', 'min' => 0)));
 718      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountwarning")));
 719      $form_container->construct_row();
 720  
 721      $form_container->output_cell("<label>{$lang->recount_private_messages}</label><div class=\"description\">{$lang->recount_private_messages_desc}</div>");
 722      $form_container->output_cell($form->generate_numeric_field("privatemessages", 500, array('style' => 'width: 150px;', 'min' => 0)));
 723      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountprivatemessages")));
 724      $form_container->construct_row();
 725  
 726      $form_container->output_cell("<label>{$lang->recount_referrals}</label><div class=\"description\">{$lang->recount_referrals_desc}</div>");
 727      $form_container->output_cell($form->generate_numeric_field("referral", 500, array('style' => 'width: 150px;', 'min' => 0)));
 728      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountreferral")));
 729      $form_container->construct_row();
 730  
 731      $form_container->output_cell("<label>{$lang->recount_thread_ratings}</label><div class=\"description\">{$lang->recount_thread_ratings_desc}</div>");
 732      $form_container->output_cell($form->generate_numeric_field("threadrating", 500, array('style' => 'width: 150px;', 'min' => 0)));
 733      $form_container->output_cell($form->generate_submit_button($lang->go, array("name" => "do_recountthreadrating")));
 734      $form_container->construct_row();
 735  
 736      $plugins->run_hooks("admin_tools_recount_rebuild_output_list");
 737  
 738      $form_container->end();
 739  
 740      $form->end();
 741  
 742      $page->output_footer();
 743  }
 744  


2005 - 2019 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref 0.7.1