[ Index ]

PHP Cross Reference of MyBB 1.8.38

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


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