function editPost($edit) { global $vbulletin; $postinfo = fetch_postinfo($edit['postid']); $foruminfo = fetch_foruminfo($edit['forumid']); $threadinfo = fetch_threadinfo($edit['threadid']); $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $threadman->set_existing($threadinfo); $threadman->set_info('forum', $foruminfo); $threadman->set_info('thread', $threadinfo); $threadman->set('title', $edit['title']); $threadman->set('prefixid', $edit['prefixid']); $threadman->save(); $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost'); $postman->set_existing($postinfo); $postman->setr('title', $edit['title']); $postman->setr('pagetext', $edit['pagetext']); $postman->save(); }
function post_save_each($doquery = true) { $this->insert_moderator_log(); if (!$this->condition and $this->fetch_field('visible') == 1 and $this->info['forum']) { $forumdata =& datamanager_init('Forum', $this->registry, ERRTYPE_SILENT); $forumdata->set_existing($this->info['forum']); $forumdata->set_info('disable_cache_rebuild', true); if (!empty($this->info['coventry']) and $this->info['coventry']['in_coventry'] == 1) { $forumdata->set_info('coventry', $this->info['coventry']); } $forumdata->set('threadcount', 'threadcount + 1', false); $forumdata->save(); } if ($this->condition and $fpid = $this->fetch_field('firstpostid')) { if ($this->existing['visible'] == 0 and $this->fetch_field('visible') == 1) { $this->akismet_mark_as_ham($fpid); } if (!$this->info['skip_first_post_update']) { // if we're updating the title/iconid of an existing thread, update the first post if ((isset($this->thread['title']) or isset($this->thread['iconid'])) and $fp = fetch_postinfo($fpid)) { $postdata =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost'); $postdata->set_existing($fp); if (isset($this->thread['title'])) { $postdata->set('title', $this->thread['title'], true, false); // don't clean it -- already been cleaned } if (isset($this->thread['iconid'])) { $postdata->set('iconid', $this->thread['iconid'], true, false); } $postdata->save(); } } } if ($this->condition and $this->thread['title'] and $this->existing['title']) { // we're updating the title of a thread, so update redirect titles as well if the redirect title is the same $this->dbobject->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "thread SET\n\t\t\t\t\ttitle = '" . $this->dbobject->escape_string($this->thread['title']) . "'\n\t\t\t\tWHERE\n\t\t\t\t\topen = 10 AND\n\t\t\t\t\tpollid = " . intval($this->fetch_field('threadid')) . " AND\n\t\t\t\t\ttitle = '" . $this->dbobject->escape_string($this->existing['title']) . "'\n\t\t\t"); } if (!empty($this->info['coventry']) and $this->info['coventry']['in_coventry'] == 1 and $this->setfields['replycount']) { $this->dbobject->query_read("SELECT * FROM " . TABLE_PREFIX . "tachythreadcounter WHERE userid = " . $this->info['coventry']['userid'] . " AND threadid = " . $this->fetch_field('threadid')); if ($this->dbobject->affected_rows() > 0) { $tachyupdate = 'replycount = ' . $this->tachythreadcounter['replycount']; $this->dbobject->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "tachythreadcounter SET " . $tachyupdate . " WHERE userid = " . $this->info['coventry']['userid'] . " AND threadid = " . $this->fetch_field('threadid')); } else { $this->tachythreadcounter['replycount'] = 1; $this->tachythreadcounter['userid'] = $this->info['coventry']['userid']; $this->tachythreadcounter['threadid'] = $this->fetch_field('threadid'); $this->dbobject->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "tachythreadcounter\n\t\t\t\t\t\t(userid, threadid, replycount)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(" . intval($this->tachythreadcounter['userid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadcounter['threadid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadcounter['replycount']) . ")\n\t\t\t\t"); } } if (empty($this->info['rebuild']) and $this->setfields['lastpost']) { if (!empty($this->info['coventry']) and $this->info['coventry']['in_coventry'] == 1) { $this->tachythreadpost['userid'] = $this->info['coventry']['userid']; $this->tachythreadpost['threadid'] = $this->fetch_field('threadid'); $this->dbobject->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "tachythreadpost\n\t\t\t\t\t\t(userid, threadid, lastpost, lastposter, lastpostid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(" . intval($this->tachythreadpost['userid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadpost['threadid']) . ",\n\t\t\t\t\t\t" . intval($this->tachythreadpost['lastpost']) . ",\n\t\t\t\t\t\t'" . $this->dbobject->escape_string($this->tachythreadpost['lastposter']) . "',\n\t\t\t\t\t\t" . intval($this->tachythreadpost['lastpostid']) . ")\n\t\t\t\t"); } else { $this->dbobject->query_write("\n\t\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "tachythreadpost\n\t\t\t\t\t\tWHERE threadid = " . intval($this->fetch_field('threadid'))); } } ($hook = vBulletinHook::fetch_hook('threaddata_postsave')) ? eval($hook) : false; }
/** * Sends Thread subscription Notifications * * @param integer The Thread ID * @param integer The User ID making the Post * @param integer The Post ID of the new post * */ function exec_send_notification($threadid, $userid, $postid) { // $threadid = threadid to send from; // $userid = userid of who made the post // $postid = only sent if post is moderated -- used to get username correctly global $vbulletin, $message, $postusername; if (!$vbulletin->options['enableemail']) { return; } // include for fetch_phrase require_once DIR . '/includes/functions_misc.php'; $threadinfo = fetch_threadinfo($threadid); $foruminfo = fetch_foruminfo($threadinfo['forumid']); // get last reply time if ($postid) { $dateline = $vbulletin->db->query_first("\n\t\t\tSELECT dateline, pagetext\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid = {$postid}\n\t\t"); $pagetext_orig = $dateline['pagetext']; $lastposttime = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tWHERE threadid = {$threadid}\n\t\t\t\tAND dateline < {$dateline['dateline']}\n\t\t\t\tAND visible = 1\n\t\t"); } else { $lastposttime = $vbulletin->db->query_first("\n\t\t\tSELECT MAX(postid) AS postid, MAX(dateline) AS dateline\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tWHERE threadid = {$threadid}\n\t\t\t\tAND visible = 1\n\t\t"); $pagetext = $vbulletin->db->query_first("\n\t\t\tSELECT pagetext\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid = {$lastposttime['postid']}\n\t\t"); $pagetext_orig = $pagetext['pagetext']; unset($pagetext); } $threadinfo['title'] = unhtmlspecialchars($threadinfo['title']); $foruminfo['title_clean'] = unhtmlspecialchars($foruminfo['title_clean']); $temp = $vbulletin->userinfo['username']; if ($postid) { $postinfo = fetch_postinfo($postid); $vbulletin->userinfo['username'] = unhtmlspecialchars($postinfo['username']); } else { $vbulletin->userinfo['username'] = unhtmlspecialchars(!$vbulletin->userinfo['userid'] ? $postusername : $vbulletin->userinfo['username']); } require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $pagetext_cache = array(); // used to cache the results per languageid for speed $mod_emails = fetch_moderator_newpost_emails('newpostemail', $foruminfo['parentlist'], $language_info); ($hook = vBulletinHook::fetch_hook('newpost_notification_start')) ? eval($hook) : false; $useremails = $vbulletin->db->query_read_slave("\n\t\tSELECT user.*, subscribethread.emailupdate, subscribethread.subscribethreadid\n\t\tFROM " . TABLE_PREFIX . "subscribethread AS subscribethread\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (subscribethread.userid = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\n\t\tWHERE subscribethread.threadid = {$threadid} AND\n\t\t\tsubscribethread.emailupdate IN (1, 4) AND\n\t\t\tsubscribethread.canview = 1 AND\n\t\t\t" . ($userid ? "CONCAT(' ', IF(usertextfield.ignorelist IS NULL, '', usertextfield.ignorelist), ' ') NOT LIKE '% " . intval($userid) . " %' AND" : '') . "\n\t\t\tuser.usergroupid <> 3 AND\n\t\t\tuser.userid <> " . intval($userid) . " AND\n\t\t\tuser.lastactivity >= " . intval($lastposttime['dateline']) . " AND\n\t\t\t(usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] . ")\n\t"); vbmail_start(); $evalemail = array(); while ($touser = $vbulletin->db->fetch_array($useremails)) { if (!($vbulletin->usergroupcache["{$touser['usergroupid']}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'])) { continue; } else { if (in_array($touser['email'], $mod_emails)) { // this user already received an email about this post via // a new post email for mods -- don't send another continue; } } $touser['username'] = unhtmlspecialchars($touser['username']); $touser['languageid'] = iif($touser['languageid'] == 0, $vbulletin->options['languageid'], $touser['languageid']); $touser['auth'] = md5($touser['userid'] . $touser['subscribethreadid'] . $touser['salt'] . COOKIE_SALT); if (empty($evalemail)) { $email_texts = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT text, languageid, fieldname\n\t\t\t\tFROM " . TABLE_PREFIX . "phrase\n\t\t\t\tWHERE fieldname IN ('emailsubject', 'emailbody') AND varname = 'notify'\n\t\t\t"); while ($email_text = $vbulletin->db->fetch_array($email_texts)) { $emails["{$email_text['languageid']}"]["{$email_text['fieldname']}"] = $email_text['text']; } require_once DIR . '/includes/functions_misc.php'; foreach ($emails as $languageid => $email_text) { // lets cycle through our array of notify phrases $text_message = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailbody']), $emails['-1']['emailbody'], $email_text['emailbody']))); $text_message = replace_template_variables($text_message); $text_subject = str_replace("\\'", "'", addslashes(iif(empty($email_text['emailsubject']), $emails['-1']['emailsubject'], $email_text['emailsubject']))); $text_subject = replace_template_variables($text_subject); $evalemail["{$languageid}"] = ' $message = "' . $text_message . '"; $subject = "' . $text_subject . '"; '; } } // parse the page text into plain text, taking selected language into account if (!isset($pagetext_cache["{$touser['languageid']}"])) { $plaintext_parser->set_parsing_language($touser['languageid']); $pagetext_cache["{$touser['languageid']}"] = $plaintext_parser->parse($pagetext_orig, $foruminfo['forumid']); } $pagetext = $pagetext_cache["{$touser['languageid']}"]; if ($threadinfo['prefixid']) { // need prefix in correct language $threadinfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, $touser['languageid'], false) . ' '; } else { $threadinfo['prefix_plain'] = ''; } ($hook = vBulletinHook::fetch_hook('newpost_notification_message')) ? eval($hook) : false; eval(iif(empty($evalemail["{$touser['languageid']}"]), $evalemail["-1"], $evalemail["{$touser['languageid']}"])); if ($touser['emailupdate'] == 4 and !empty($touser['icq'])) { // instant notification by ICQ $touser['email'] = $touser['icq'] . '@pager.icq.com'; } vbmail($touser['email'], $subject, $message); } unset($plaintext_parser, $pagetext_cache); $vbulletin->userinfo['username'] = $temp; vbmail_end(); }
/** * Verifies permissions to attach content to posts * * @param array Contenttype information - bypass reading environment settings * * @return boolean */ public function verify_permissions($info = array()) { global $show; if ($info) { $this->values['postid'] = $info['postid']; $this->values['threadid'] = $info['threadid']; $this->values['forumid'] = $info['forumid']; } else { $this->values['postid'] = intval($this->values['p']) ? intval($this->values['p']) : intval($this->values['postid']); $this->values['threadid'] = intval($this->values['t']) ? intval($this->values['t']) : intval($this->values['threadid']); $this->values['forumid'] = intval($this->values['f']) ? intval($this->values['f']) : intval($this->values['forumid']); } if ($this->values['postid']) { if (!($this->postinfo = fetch_postinfo($this->values['postid']))) { return false; } $this->values['threadid'] = $this->postinfo['threadid']; } if ($this->values['threadid']) { if (!($this->threadinfo = fetch_threadinfo($this->values['threadid']))) { return false; } $this->values['forumid'] = $this->threadinfo['forumid']; } if ($this->values['forumid'] and !($this->foruminfo = fetch_foruminfo($this->values['forumid']))) { return false; } if (!$this->foruminfo and !$this->threadinfo and !($this->postinfo and $this->values['editpost'])) { return false; } $forumperms = fetch_permissions($this->foruminfo['forumid']); // No permissions to post attachments in this forum or no permission to view threads in this forum. if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canpostattachment']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canview']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canviewthreads'])) { return false; } if (!$this->postinfo and !$this->foruminfo['allowposting'] or $this->foruminfo['link'] or !$this->foruminfo['cancontainthreads']) { return false; } if ($this->threadinfo) { if ($this->threadinfo['isdeleted'] or !$this->threadinfo['visible'] and !can_moderate($this->threadinfo['forumid'], 'canmoderateposts')) { return false; } if (!$this->threadinfo['open']) { if (!can_moderate($this->threadinfo['forumid'], 'canopenclose')) { return false; } } if ($this->registry->userinfo['userid'] != $this->threadinfo['postuserid'] and (!($forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canreplyothers']))) { return false; } // don't call this part on editpost.php (which will have a $postid) if (!$this->postinfo and !($forumperms & $this->registry->bf_ugp_forumpermissions['canreplyown']) and $this->registry->userinfo['userid'] == $this->threadinfo['postuserid']) { return false; } } else { if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canpostnew'])) { return false; } } if ($this->postinfo) { if (!can_moderate($this->threadinfo['forumid'], 'caneditposts')) { if (!($forumperms & $this->registry->bf_ugp_forumpermissions['caneditpost'])) { return false; } else { if ($this->registry->userinfo['userid'] != $this->postinfo['userid']) { // check user owns this post return false; } else { // check for time limits if ($this->postinfo['dateline'] < TIMENOW - $this->registry->options['edittimelimit'] * 60 and $this->registry->options['edittimelimit']) { return false; } } } } $this->contentid = $this->postinfo['postid']; $this->userinfo = fetch_userinfo($this->postinfo['userid']); cache_permissions($this->userinfo, true); } else { $this->userinfo = $this->registry->userinfo; } // check if there is a forum password and if so, ensure the user has it set verify_forum_password($this->foruminfo['forumid'], $this->foruminfo['password'], false); if (!$this->foruminfo['allowposting']) { $show['attachoption'] = false; $show['forumclosed'] = true; } return true; }
// Check URLs (get status and content size) $ci_urls_status = ci_check_urls($ci_urls); if (is_array($ci_urls_status)) { // Now we have status and content size on every url foreach ($ci_urls_status as $key => $url_data) { $ci_url_check_attempts = $ci_urls_data[$key]['attempts'] + 1; // If the status PROCESSING, but the number of attempts is over - set FAILED $ci_url_queue_status = 'PROCESSING' === $ci_url_queue_status && $ci_url_check_attempts >= CI_CHECK_COUNT ? 'FAILED' : $url_data['status']; if ($ci_url_queue_status == 'REPLACE' || $ci_url_queue_status == 'FAILED') { // Get classname from contenttypeid $ci_content_type = $ci_content_types->getContentTypeClass($ci_urls_data[$key]['contenttypeid']); // Replace IMG tag to URL switch ($ci_content_type) { case 'Post': case 'Thread': $ci_content = fetch_postinfo($ci_urls_data[$key]['contentid']); $ci_manager =& datamanager_init($ci_content_type, $vbulletin, ERRTYPE_STANDARD, 'threadpost'); $ci_manager->set_existing($ci_content); $ci_manager->set('pagetext', ci_replace_img_tag($ci_content['pagetext'], $ci_urls_data[$key]['url'], $url_data['size'])); $ci_manager->save(); break; case 'SocialGroupMessage': case 'SocialGroupDiscussion': $ci_content = fetch_groupmessageinfo($ci_urls_data[$key]['contentid']); $ci_manager =& datamanager_init('GroupMessage', $vbulletin); $ci_manager->set_existing($ci_content); $ci_manager->set('pagetext', ci_replace_img_tag($ci_content['pagetext'], $ci_urls_data[$key]['url'], $url_data['size'])); $ci_manager->save(); break; case 'BlogEntry': case 'BlogComment':
} $vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT, 'infractionid' => TYPE_UINT)); ($hook = vBulletinHook::fetch_hook('infraction_start')) ? eval($hook) : false; // ######################### VERIFY POST OR USER ######################## if ($postinfo['postid']) { $infractioninfo = $db->query_first_slave("\n\t\tSELECT inf.*, user.username, user2.username AS actionusername\n\t\tFROM " . TABLE_PREFIX . "infraction AS inf\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (inf.whoadded = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user2 ON (inf.actionuserid = user2.userid)\n\t\tWHERE postid = {$postinfo['postid']}\n\t\tORDER BY inf.dateline DESC\n\t\tLIMIT 1\n\t"); $userinfo = fetch_userinfo($postinfo['userid']); } else { if ($vbulletin->GPC['infractionid']) { if (!($infractioninfo = $db->query_first_slave("\n\t\tSELECT inf.*, user.username, user2.username AS actionusername\n\t\tFROM " . TABLE_PREFIX . "infraction AS inf\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (inf.whoadded = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user2 ON (inf.actionuserid = user2.userid)\n\t\tWHERE infractionid = " . $vbulletin->GPC['infractionid'] . "\n\t"))) { eval(standard_error(fetch_error('invalidid', $vbphrase['infraction'], $vbulletin->options['contactuslink']))); } if ($infractioninfo['postid']) { // this infraction belongs to a post $postinfo = $threadinfo = $foruminfo = array(); if ($postinfo = fetch_postinfo($infractioninfo['postid'])) { if ($threadinfo = fetch_threadinfo($postinfo['threadid'])) { $foruminfo = fetch_foruminfo($threadinfo['forumid']); } } } $userinfo = fetch_userinfo($infractioninfo['userid']); } else { if ($vbulletin->GPC['userid']) { $userinfo = verify_id('user', $vbulletin->GPC['userid'], 0, 1, 15); if (!$userinfo['userid']) { eval(standard_error(fetch_error('invalidid', $vbphrase['user'], $vbulletin->options['contactuslink']))); } } else { eval(standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']))); }
if ($threadinfo === false) { continue; } $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $threadman->set_existing($threadinfo); $threadman->delete(0); unset($threadman); echo ". \n"; vbflush(); } echo ' ' . $vbphrase['done'] . '</p>'; } if (!empty($deletepost)) { echo '<p><b>' . $vbphrase['deleting_posts'] . '</b>'; foreach ($deletepost as $postid) { $postinfo = fetch_postinfo($postid); // 3.5.1 Bug 1803: Make sure we have smth. to delete if ($postinfo === false) { continue; } $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $postman->set_existing($postinfo); $postman->delete(); unset($postman); echo ". \n"; vbflush(); } echo ' ' . $vbphrase['done'] . '</p>'; } //define('CP_REDIRECT', 'thread.php?do=prune'); define('CP_BACKURL', '');
/** * Extracts the threadid from the URL, correctly handles the different friendly URLs * * @param string The URL to try to pull the threadid from. * * @return integer Returns the threadid or 0 if no threadid is found. * */ function extract_threadid_from_url($url) { global $vbulletin; $threadid = 0; // Disallow relative URLs, since the t=threadid in the URL refers to another thread // Not needed since these URLs now redirect to the canonical URL? if (stripos($url, 'goto=next') !== false) { return $threadid; } $search = array('#[\\?&](?:threadid|t)=([0-9]+)#', '#showthread.php[\\?/]([0-9]+)#', '#/threads/([0-9]+)#'); foreach ($search as $regex) { if (preg_match($regex, $url, $matches)) { $threadid = intval($matches[1]); break; } } if (!$threadid) { if (preg_match('#[\\?&](postid|p)=([0-9]+)#', $url, $matches)) { $postid = verify_id('post', $matches[2], false); if ($postid) { $postinfo = fetch_postinfo($postid); $threadid = intval($postinfo['threadid']); } } } return $threadid; }
if ($strpos = strpos($vbulletin->GPC['mergethreadurl'], '?')) { $vbulletin->GPC['mergethreadurl'] = substr($vbulletin->GPC['mergethreadurl'], $strpos); } else { eval(standard_error(fetch_error('mergebadurl'))); } // pull out the thread/postid if (preg_match('#(threadid|t)=([0-9]+)#', $vbulletin->GPC['mergethreadurl'], $matches)) { $destthreadid = intval($matches[2]); } else { if (preg_match('#(postid|p)=([0-9]+)#', $vbulletin->GPC['mergethreadurl'], $matches)) { $destpostid = verify_id('post', $matches[2], 0); if ($destpostid == 0) { // do invalid url eval(standard_error(fetch_error('mergebadurl'))); } $postinfo = fetch_postinfo($destpostid); $destthreadid = $postinfo['threadid']; } else { eval(standard_error(fetch_error('mergebadurl'))); } } $destthreadid = verify_id('thread', $destthreadid); $destthreadinfo = fetch_threadinfo($destthreadid); $destforuminfo = fetch_foruminfo($destthreadinfo['forumid']); if ($destthreadinfo['isdeleted'] and !can_moderate($destthreadinfo['forumid'], 'candeleteposts') or !$destthreadinfo['visible'] and !can_moderate($destthreadinfo['forumid'], 'canmoderateposts')) { if (can_moderate($destthreadinfo['forumid'])) { print_no_permission(); } else { eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink']))); } }
function undelete_post($postid, $countposts, $postinfo = NULL, $threadinfo = NULL, $counterupdate = true) { global $vbulletin, $vbphrase; // Valid postinfo array will contain: postid, threadid, visible, userid, username, title // Invalid post or post is not deleted if (!$postinfo AND !$postinfo = fetch_postinfo($postid)) { return; } // Valid threadinfo array will contain: threadid, forumid, visible, firstpostid if (!$threadinfo AND !$threadinfo = fetch_threadinfo($postinfo['threadid'])) { return; } if ($threadinfo['firstpostid'] == $postid) { // undelete thread undelete_thread($threadinfo['threadid'], $countposts, $threadinfo); return; } // Post is not deleted if ($postinfo['visible'] != 2) { return; } // Only increment post for a visible thread in a counting forum if ($countposts AND $postinfo['userid'] AND $threadinfo['visible'] == 1) { $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT); $userdata->set_existing($postinfo); $userdata->set('posts', 'posts + 1', false); $userdata->set_ladder_usertitle_relative(1); $userdata->save(); unset($userdata); } $deletiondata =& datamanager_init('Deletionlog_ThreadPost', $vbulletin, ERRTYPE_SILENT, 'deletionlog'); $deletioninfo = array('type' => 'post', 'primaryid' => $postid); $deletiondata->set_existing($deletioninfo); $deletiondata->delete(); unset($deletiondata, $deletioninfo); $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $postman->set_existing($postinfo); $postman->set('visible', 1); $postman->save(); if ($counterupdate) { build_thread_counters($postinfo['threadid']); build_forum_counters($threadinfo['forumid']); } fetch_phrase_group('threadmanage'); $postinfo['forumid'] = $threadinfo['forumid']; require_once(DIR . '/includes/functions_log_error.php'); log_moderator_action($postinfo, 'post_y_by_x_undeleted', array($postinfo['title'], $postinfo['username'])); }
} $search = array('#[\\?&](?:threadid|t)=([0-9]+)#', '#showthread.php[\\?/]([0-9]+)#', '#/threads/([0-9]+)#'); foreach ($search as $regex) { if (preg_match($regex, $vbulletin->GPC['mergethreadurl'], $matches)) { $mergethreadid = intval($matches[1]); break; } } if (!$mergethreadid) { if (preg_match('#[\\?&](postid|p)=([0-9]+)#', $vbulletin->GPC['mergethreadurl'], $matches)) { $mergepostid = verify_id('post', $matches[2], 0); if ($mergepostid == 0) { // do invalid url eval(standard_error(fetch_error('mergebadurl'))); } $postinfo = fetch_postinfo($mergepostid); $mergethreadid = $postinfo['threadid']; } else { eval(standard_error(fetch_error('mergebadurl'))); } } $mergethreadid = verify_id('thread', $mergethreadid); $mergethreadinfo = fetch_threadinfo($mergethreadid); $mergeforuminfo = fetch_foruminfo($mergethreadinfo['forumid']); if ($mergethreadinfo['open'] == 10 or $mergethreadid == $threadid) { if (can_moderate($mergethreadinfo['forumid'])) { eval(standard_error(fetch_error('mergebadurl'))); } else { eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink']))); } }
/** * Resets infraction information in user and post record after a reversal or removal * */ function reset_infraction() { if ($this->existing['action'] != 0) { // Only reset infraction information for an active infraction. Expired and reversed infractions have already done this return; } if ($postinfo = $this->info['postinfo'] or $this->existing['postid'] and $postinfo = fetch_postinfo($this->existing['postid'])) { $dataman =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost'); $dataman->set_existing($postinfo); $dataman->set('infraction', 0); $dataman->save(); unset($dataman); } if ($userinfo = $this->info['userinfo'] or $this->existing['userid'] and $userinfo = fetch_userinfo($this->existing['userid'])) { // Decremement infraction counters and remove any points $userdata =& datamanager_init('User', $this->registry, ERRTYPE_SILENT); $userdata->set_existing($userinfo); if ($points = $this->existing['points']) { $userdata->set('ipoints', "ipoints - {$points}", false); $userdata->set('infractions', 'infractions - 1', false); } else { $userdata->set('warnings', 'warnings - 1', false); } $userdata->save(); unset($userdata); } }
if ($_REQUEST['do'] == 'special_actions') { ($hook = vBulletinHook::fetch_hook('post_thanks_admin_special_actions_start')) ? eval($hook) : false; print_form_header('post_thanks_admin', 'delete_all_users_thanks'); print_table_header($vbphrase['post_thanks_delete_all_users_thanks'], 2, 0); print_description_row($vbphrase['post_thanks_delete_all_users_thanks_help']); print_input_row($vbphrase['userid'], 'userid'); print_submit_row($vbphrase['post_thanks_delete_all_users_thanks']); ($hook = vBulletinHook::fetch_hook('post_thanks_admin_special_actions_end')) ? eval($hook) : false; } if ($_REQUEST['do'] == 'delete_all_users_thanks') { $vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT)); $userid = $vbulletin->GPC['userid']; ($hook = vBulletinHook::fetch_hook('post_thanks_admin_delete_all_users_thanks_start')) ? eval($hook) : false; echo '<p>' . $vbphrase['post_thanks_delete_all_users_thanks'] . '</p>'; $thanks = $db->query_read("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "post_thanks\n\t\tWHERE userid = {$userid}\n\t\tORDER BY postid\n\t"); while ($thank = $db->fetch_array($thanks)) { $postinfo = fetch_postinfo($thank['postid']); if ($postinfo === false) { $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "post_thanks WHERE postid = '{$thank['postid']}' AND userid = '{$userid}'"); } else { delete_thanks($postinfo, $userid); } echo construct_phrase($vbphrase['processing_x'], $thank['postid']) . "<br />\n"; vbflush(); } ($hook = vBulletinHook::fetch_hook('post_thanks_admin_delete_all_users_thanks_end')) ? eval($hook) : false; define('CP_REDIRECT', 'post_thanks_admin.php?do=special_actions'); print_stop_message('post_thanks_delete_all_users_thanks_successfully'); } ($hook = vBulletinHook::fetch_hook('post_thanks_admin_end')) ? eval($hook) : false; print_cp_footer();
// ######################## START MAIN SCRIPT ############################ // ####################################################################### $vbulletin->input->clean_array_gpc('r', array('targetid' => TYPE_INT, 'contenttype' => TYPE_STR, 'ajax' => TYPE_BOOL)); $need_ajax_response = FALSE; if (empty($vbulletin->GPC['contenttype'])) { $vbulletin->GPC['contenttype'] = 'vBForum_Post'; } define('VOTE_CONTENT_TYPE', $vbulletin->GPC['contenttype']); require_once DIR . '/includes/class_votes.php'; $target_id = 0; $target = array(); $target_id = $vbulletin->GPC['targetid']; // fetch target switch (VOTE_CONTENT_TYPE) { case 'vBForum_Post': $target = fetch_postinfo($target_id); break; case 'vBForum_SocialGroupMessage': if ($vbulletin->options['vbv_enable_sg_votes']) { require_once DIR . '/includes/functions_socialgroup.php'; $target = fetch_groupmessageinfo($target_id); break; } default: standard_error(fetch_error('vbv_unsupported_type', $vbulletin->options['contactuslink'])); } $permitted_actions = array('vote', 'remove'); if (in_array($_REQUEST['do'], $permitted_actions)) { // Init vote manager class $vote_manager = vtVotes::get_instance(VOTE_CONTENT_TYPE, $target); $need_ajax_response = TRUE;
public function buildpost($type) { global $vbulletin, $vbphrase; //set id if ($type == 'download') { $post['forumid'] = $vbulletin->options['yrms_vietsubmanga_id_truyendich']; $post['parentid'] = $this->manga->postid; $post['threadid'] = $this->manga->threadid; $post['postid'] = $this->postid; } else { if ($type == 'online') { $post['forumid'] = $vbulletin->options['yrms_vietsubmanga_id_doconline']; $post['threadid'] = extract_threadid_from_url(fetch_seo_url('post', fetch_postinfo($this->readonlinepostid))); $post['postid'] = $this->readonlinepostid; } } //title if ($this->manga->type == 2 && $this->type == 1) { $post['title'] = "{$this->manga->mangatitle}"; } else { $post['title'] = "{$this->manga->mangatitle} {$vbphrase["yrms_chaptertype{$this->type}"]} {$this->chapternumber}"; } if (!empty($this->chaptertitle)) { $post['title'] .= "- {$this->chaptertitle}"; } //other setting $post['allowsmilie'] = 1; $post['visible'] = 1; $post['parseurl'] = 1; if ($type == 'download') { if ($this->rate == 1) { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_updatehide'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote, $this->build_linkformat()); } else { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_update'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote); } } else { if ($type == 'online') { if ($this->rate == 1) { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_readonlinehide'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote, $this->onlinelink); } else { $post['pagetext'] = construct_phrase($vbphrase['yrms_postformat_readonline'], $post['title'], $vbphrase['yrms_fansub_note'] . ": " . $this->fansubnote, $this->onlinelink); } } } return $post; }