Beispiel #1
0
 foreach ($checkChannels as $checkChannel) {
     $forums = $vbulletin->db->query_read("\n\t\t\tSELECT node.nodeid\n\t\t\tFROM " . TABLE_PREFIX . "node AS node\n\t\t\tINNER JOIN " . TABLE_PREFIX . "closure AS cl ON cl.parent = {$checkChannel} AND cl.child = node.nodeid\n\t\t\tWHERE node.contenttypeid = {$channelContentType}\n\t\t\tAND node.nodeid <> {$checkChannel}\n\t\t");
     while ($forum = $vbulletin->db->fetch_array($forums)) {
         $gotforums .= ',' . $forum['nodeid'];
     }
 }
 $users = $vbulletin->db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "user\n\t\tWHERE userid >= " . $vbulletin->GPC['startat'] . "\n\t\tORDER BY userid\n\t\tLIMIT " . $vbulletin->GPC['perpage']);
 $finishat = $vbulletin->GPC['startat'];
 while ($user = $vbulletin->db->fetch_array($users)) {
     $starterCount = $vbulletin->db->query_first("\n\t\t\tSELECT COUNT(*) AS count\n\t\t\tFROM " . TABLE_PREFIX . "node AS thread\n\t\t\tWHERE thread.userid = " . $user['userid'] . "\n\t\t\tAND thread.parentid IN (0{$gotforums})\n\t\t\tAND thread.starter = thread.nodeid\n\t\t\tAND thread.publishdate IS NOT NULL\n\t\t\tAND thread.approved = 1\n\t\t\tAND thread.showpublished = 1\n\t\t\tAND thread.contenttypeid <> " . intval($channelContentType) . "\n\t\t");
     $replyCount = $vbulletin->db->query_first("\n\t\t\tSELECT COUNT(*) AS count\n\t\t\tFROM " . TABLE_PREFIX . "node AS post\n\t\t\tINNER JOIN " . TABLE_PREFIX . "node AS thread ON (thread.nodeid = post.parentid)\n\t\t\tWHERE post.userid = " . $user['userid'] . "\n\t\t\tAND thread.parentid IN (0{$gotforums})\n\t\t\tAND thread.publishdate IS NOT NULL\n\t\t\tAND thread.approved = 1\n\t\t\tAND post.starter = thread.nodeid\n\t\t\tAND post.publishdate IS NOT NULL\n\t\t\tAND post.approved = 1\n\t\t\tAND post.showpublished = 1\n\t\t\tAND post.contenttypeid <> " . intval($channelContentType) . "\n\t\t");
     $totalPosts = (int) $starterCount['count'] + $replyCount['count'];
     $userdm = new vB_Datamanager_User($vbulletin, vB_DataManager_Constants::ERRTYPE_CP);
     $userdm->set_existing($user);
     $userdm->set('posts', $totalPosts);
     $userdm->set_ladder_usertitle($totalposts['posts']);
     $userdm->save();
     unset($userdm);
     echo construct_phrase($vbphrase['processing_x'], $user['userid']) . "<br />\n";
     vbflush();
     $finishat = $user['userid'] > $finishat ? $user['userid'] : $finishat;
 }
 $finishat++;
 if ($checkmore = $vbulletin->db->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE userid >= {$finishat} LIMIT 1")) {
     $args = array();
     parse_str(vB::getCurrentSession()->get('sessionurl'), $args);
     $args['do'] = 'updateposts';
     $args['startat'] = $finishat;
     $args['pp'] = $vbulletin->GPC['perpage'];
     print_cp_redirect2('misc', $args);
     echo "<p><a href=\"misc.php?" . vB::getCurrentSession()->get('sessionurl') . "do=updateposts&amp;startat={$finishat}&amp;pp=" . $vbulletin->GPC['perpage'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>";