function post_save_each($doquery = true)
 {
     if (!$this->condition and $this->fetch_field('dateline') == TIMENOW) {
         $this->insert_dupehash(0);
     }
     $this->post_save_each_post($doquery);
     if (!$this->condition and $this->fetch_field('dateline') == TIMENOW) {
         $this->insert_postlog_data();
     }
     $threadid = intval($this->fetch_field('threadid'));
     if ($this->thread['visible'] === 0) {
         $postid = intval($this->fetch_field('firstpostid'));
         /*insert query*/
         $this->dbobject->query_write("INSERT IGNORE INTO " . TABLE_PREFIX . "moderation (primaryid, type, dateline) VALUES ({$threadid}, 'thread', " . TIMENOW . ")");
     }
     if ($this->info['forum']['podcast'] and $postid = intval($this->fetch_field('firstpostid'))) {
         $this->dbobject->query_write("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "podcastitem\n\t\t\t\t\t(postid, url, length, explicit, author, keywords, subtitle)\n\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t\t{$postid},\n\t\t\t\t\t\t'" . $this->dbobject->escape_string($this->info['podcasturl']) . "',\n\t\t\t\t\t\t" . intval($this->info['podcastsize']) . ",\n\t\t\t\t\t\t" . intval($this->info['podcastexplicit']) . ",\n\t\t\t\t\t\t'" . $this->dbobject->escape_string($this->info['podcastauthor']) . "',\n\t\t\t\t\t\t'" . $this->dbobject->escape_string($this->info['podcastkeywords']) . "',\n\t\t\t\t\t\t'" . $this->dbobject->escape_string($this->info['podcastsubtitle']) . "'\n\t\t\t\t\t)\n\t\t\t");
         // reset rss cache for this forum
         $this->dbobject->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "externalcache\n\t\t\t\tWHERE forumid = " . intval($this->info['forum']['forumid']) . "\n\t\t\t");
     }
     if ($this->info['mark_thread_read'] and $this->info['forum'] and $this->registry->options['threadmarking'] and $userid = $this->fetch_field('postuserid')) {
         $threadinfo = fetch_threadinfo($threadid);
         if ($threadinfo) {
             require_once DIR . '/includes/functions_bigthree.php';
             mark_thread_read($threadinfo, $this->info['forum'], $userid, $this->fetch_field('dateline'));
         }
     }
     $this->insert_moderator_log();
     if (!$this->condition) {
         $this->email_moderators(array('newthreademail', 'newpostemail'));
     }
     if ($this->info['forum'] and $this->fetch_field('firstpostid')) {
         // ### UPDATE SEARCH INDEX ###
         require_once DIR . '/includes/functions_databuild.php';
         build_post_index($this->fetch_field('firstpostid'), $this->info['forum'], 1);
     }
     ($hook = vBulletinHook::fetch_hook('threadfpdata_postsave')) ? eval($hook) : false;
 }
Esempio n. 2
0
		$getfirstpost = $db->query_first("
			SELECT post.*
			FROM " . TABLE_PREFIX . "post AS post
			WHERE threadid = $threadinfo[threadid]
			ORDER BY dateline
			LIMIT 1
		");

		if ($threaddata->save())
		{
			// Reindex first post to set up title properly.
			require_once(DIR . '/includes/functions_databuild.php');
			delete_post_index($getfirstpost['postid'], $getfirstpost['title'], $getfirstpost['pagetext']);
			$getfirstpost['threadtitle'] = $threaddata->fetch_field('title');
			$getfirstpost['title'] =& $getfirstpost['threadtitle'];
			build_post_index($getfirstpost['postid'] , $foruminfo, 1, $getfirstpost);

			cache_ordered_forums(1);

			if ($vbulletin->forumcache["$threadinfo[forumid]"]['lastthreadid'] == $threadinfo['threadid'])
			{
				require_once(DIR . '/includes/functions_databuild.php');
				build_forum_counters($threadinfo['forumid']);
			}

			// we do not appear to log thread title updates
			$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
			$xml->add_group('foo');
				$xml->add_tag('linkhtml', $threaddata->thread['title']);
				$threadinfo['title'] = $threaddata->fetch_field('title');
				$xml->add_tag('linkhref', fetch_seo_url('thread', $threadinfo));
Esempio n. 3
0
 $firstpost = array();
 $posts = $db->query_read("\n\t\tSELECT postid, post.title, post.pagetext, post.threadid, thread.title AS threadtitle\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON(thread.threadid = post.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)\n\t\tWHERE (forum.options & " . $vbulletin->bf_misc_forumoptions['indexposts'] . ")\n\t\t\tAND post.postid >= " . $vbulletin->GPC['startat'] . "\n\t\tORDER BY post.postid\n\t\tLIMIT " . $vbulletin->GPC['perpage']);
 echo $vbphrase['posts_queried'] . '</p><p>';
 vbflush();
 $finishat = $vbulletin->GPC['startat'];
 while ($post = $db->fetch_array($posts) and (!$vbulletin->GPC['doprocess'] or $vbulletin->GPC['totalposts'] < $vbulletin->GPC['doprocess'])) {
     $vbulletin->GPC['totalposts']++;
     echo construct_phrase($vbphrase['processing_x'], $post['postid']) . ' ... ';
     vbflush();
     if (empty($firstpost["{$post['threadid']}"])) {
         echo '<i>' . $vbphrase['querying_first_post_of_thread'] . '</i> ';
         vbflush();
         $getfirstpost = $db->query_first("\n\t\t\t\tSELECT MIN(postid) AS postid\n\t\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\t\tWHERE threadid = {$post['threadid']}\n\t\t\t");
         $firstpost["{$post['threadid']}"] = $getfirstpost['postid'];
     }
     build_post_index($post['postid'], $foruminfo, iif($post['postid'] == $firstpost["{$post['threadid']}"], 1, 0), $post);
     echo $vbphrase['done'] . "<br />\n";
     vbflush();
     $finishat = $post['postid'] > $finishat ? $post['postid'] : $finishat;
 }
 $finishat++;
 require_once DIR . '/includes/functions_misc.php';
 $pagetime = vb_number_format(fetch_microtime_difference($starttime), 2);
 echo '</p><p><b>' . construct_phrase($vbphrase['processing_time_x'], $pagetime) . '<br />' . construct_phrase($vbphrase['total_posts_processed_x'], $vbulletin->GPC['totalposts']) . '</b></p>';
 vbflush();
 if (($vbulletin->GPC['totalposts'] < $vbulletin->GPC['doprocess'] or !$vbulletin->GPC['doprocess']) and $checkmore = $db->query_first("SELECT postid FROM " . TABLE_PREFIX . "post WHERE postid >= {$finishat} LIMIT 1")) {
     if ($vbulletin->GPC['autoredirect'] == 1) {
         print_cp_redirect("misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=buildpostindex&startat={$finishat}&pp=" . $vbulletin->GPC['perpage'] . "&autoredirect=" . $vbulletin->GPC['autoredirect'] . "&doprocess=" . $vbulletin->GPC['doprocess'] . "&totalposts=" . $vbulletin->GPC['totalposts']);
     }
     echo "<p><a href=\"misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=buildpostindex&amp;startat={$finishat}&amp;pp=" . $vbulletin->GPC['perpage'] . "&amp;autoredirect=" . $vbulletin->GPC['autoredirect'] . "&amp;doprocess=" . $vbulletin->GPC['doprocess'] . "&amp;totalposts=" . $vbulletin->GPC['totalposts'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>";
 } else {
Esempio n. 4
0
         if (!isset($userbyuserid["{$post['userid']}"])) {
             $userbyuserid["{$post['userid']}"] = 1;
         } else {
             $userbyuserid["{$post['userid']}"]++;
         }
     }
     if (!$post['visible']) {
         $hiddeninfo[] = "({$post['postid']}, 'post', " . (!empty($post['moderateddateline']) ? $post['moderateddateline'] : TIMENOW) . ")";
     } else {
         if ($post['visible'] == 2) {
             $deleteinfo[] = "({$post['postid']}, 'post', " . intval($post['deleteduserid']) . ", '" . $db->escape_string($post['deletedusername']) . "', '" . $db->escape_string($post['deletedreason']) . "', {$post['deleteddateline']})";
         }
     }
     if ($destforuminfo['indexposts']) {
         if ($update_post_title) {
             build_post_index($post['postid'], $destforuminfo, $newfirstpost, $post);
         } else {
             $dupeposts["{$oldpostid}"] = $post['postid'];
         }
     }
 }
 // need to read filedata in chunks and update in chunks!
 $attachments = $db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE postid IN (" . implode(', ', $postarray) . ")");
 while ($attachment = $db->fetch_array($attachments)) {
     $attachdata =& datamanager_init('Attachment', $vbulletin, ERRTYPE_ARRAY);
     $attachdata->setr('userid', $attachment['userid']);
     $attachdata->setr('dateline', $attachment['dateline']);
     $attachdata->setr('thumbnail_dateline', $attachment['thumbnail_dateline']);
     $attachdata->setr('filename', $attachment['filename']);
     $attachdata->setr('postid', $postassoc["{$attachment['postid']}"]);
     $attachdata->setr('visible', $attachment['visible']);
Esempio n. 5
0
        $merge_thread->set('visible', 1);
        $merge_thread->set('dateline', TIMENOW);
        $merge_thread->save();
        if ($vbulletin->GPC['redirect'] == 'expires') {
            $db->query_write("\n\t\t\t\tINSERT INTO " . TABLE_PREFIX . "threadredirect\n\t\t\t\t\t(threadid, expires)\n\t\t\t\tVALUES\n\t\t\t\t\t({$mergethreadinfo['threadid']}, {$expires})\n\t\t\t");
        }
    } else {
        // remove remnants of merge thread
        $merge_thread->delete(false, true, NULL, false);
    }
    unset($merge_thread);
    // update postindex for the 2 posts who's titles may have changed (first post of each thread)
    delete_post_index($thrd_firstpost['postid']);
    delete_post_index($mrgthrd_firstpost['postid']);
    build_post_index($thrd_firstpost['postid'], $foruminfo);
    build_post_index($mrgthrd_firstpost['postid'], $foruminfo);
    build_thread_counters($threadinfo['threadid']);
    build_forum_counters($threadinfo['forumid']);
    if ($mergethreadinfo['forumid'] != $threadinfo['forumid']) {
        build_forum_counters($mergethreadinfo['forumid']);
    }
    log_moderator_action($threadinfo, 'thread_merged_with_x', $mergethreadinfo['title']);
    ($hook = vBulletinHook::fetch_hook('threadmanage_merge_complete')) ? eval($hook) : false;
    $vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$threadinfo['threadid']}";
    eval(print_standard_redirect('redirect_mergethread'));
}
// ############################### start stick / unstick thread ###############################
if ($_POST['do'] == 'stick') {
    if ($threadinfo['isdeleted'] and !can_moderate($threadinfo['forumid'], 'candeleteposts') or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
        if (can_moderate($threadinfo['forumid'])) {
            print_no_permission();
Esempio n. 6
0
    if ($endat) {
        if ($stopat > $endat) {
            $stopat = $endat;
        }
        if ($startat >= $endat) {
            continue;
        }
    }
    $posts = $db->query_read("\n\t\tSELECT postid, post.title, post.pagetext, post.threadid, thread.title AS threadtitle\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON(thread.threadid = post.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)\n\t\tWHERE (forum.options & 16384)\n\t\t\tAND post.postid >= {$startat}\n\t\t\tAND post.postid <= {$stopat}\n\t\tORDER BY post.postid\n\t");
    while ($post = $db->fetch_array($posts)) {
        $notdone = TRUE;
        if (empty($firstpost["{$post['threadid']}"])) {
            $getfirstpost = $db->query_first("SELECT MIN(postid) AS postid FROM " . TABLE_PREFIX . "post WHERE threadid = {$post['threadid']}");
            $firstpost["{$post['threadid']}"] = $getfirstpost['postid'];
        }
        build_post_index($post['postid'], $foruminfo, $post['postid'] == $firstpost["{$post['threadid']}"] ? 1 : 0, $post);
        print "Processed post: {$post['postid']}\n";
        flush();
    }
    $startat += $perpage;
}
print_postindex_exec_time($start);
// ###################### Start getinput #######################
function fetch_stdin()
{
    static $fp;
    if ($fp) {
        $input = fgets($fp, 255);
    } else {
        $fp = fopen('php://stdin', 'r');
        $input = fgets($fp, 255);