本文整理汇总了PHP中fetch_threadinfo函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_threadinfo函数的具体用法?PHP fetch_threadinfo怎么用?PHP fetch_threadinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_threadinfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group_data_change
/**
* Called on each
* - add / edit / delete post
* - thread move
* - thread soft delete
*
* Don't reindex all post on each new one. That's expensive.
* Do it only on thread soft delete. In other case - reindex
* only first post.
*/
public function group_data_change($id)
{
$thread_info = fetch_threadinfo($id);
if (!$thread_info) {
return false;
}
if ($thread_info['isdeleted']) {
// if thread is soft deleted - update all childs
return $this->delete_thread($id);
}
$first_post_info = array('contentypeid' => $this->get_contenttypeid(), 'primaryid' => $thread_info['firstpostid']);
$indexer = vBSphinxSearch_Core::get_instance()->get_core_indexer();
return $indexer->index($first_post_info);
}
示例2: editPost
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();
}
示例3: vbseo_send_notification_pingback
function vbseo_send_notification_pingback($threadid, $postid, $vbseo_linkback_uri, $title, $message, $approve = 1, $sendtocp = 1)
{
global $vbulletin;
if (!$vbulletin) {
return;
}
if (!$vbulletin->options['enableemail']) {
return;
}
@define('VBSEO_PREPROCESSED', true);
$threadinfo = fetch_threadinfo($threadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$threadinfo['title'] = unhtmlspecialchars($threadinfo['title']);
$foruminfo['title_clean'] = unhtmlspecialchars($foruminfo['title_clean']);
vbmail_start();
$evalemail = array();
if ($approve && VBSEO_PINGBACK_NOTIFY) {
$useremails = $vbulletin->db->query_read("\nSELECT user.*, subscribethread.emailupdate\nFROM " . vbseo_tbl_prefix('subscribethread') . " AS subscribethread\nINNER JOIN " . vbseo_tbl_prefix('user') . " AS user ON (subscribethread.userid = user.userid)\nLEFT JOIN " . vbseo_tbl_prefix('usergroup') . " AS usergroup ON (usergroup.usergroupid = user.usergroupid)\nLEFT JOIN " . vbseo_tbl_prefix('usertextfield') . " AS usertextfield ON (usertextfield.userid = user.userid)\nWHERE subscribethread.threadid = {$threadid} AND\nsubscribethread.emailupdate IN (1, 4) AND\nuser.usergroupid <> 3 AND\n(usergroup.genericoptions & " . ($vbulletin->bf_ugp_genericoptions['isbannedgroup'] + 0) . ") = 0\n");
while ($touser = $vbulletin->db->fetch_array($useremails)) {
if ($vbulletin->usergroupcache["{$touser['usergroupid']}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isbannedgroup'] + 0) {
continue;
}
$touser['username'] = unhtmlspecialchars($touser['username']);
$touser['languageid'] = iif($touser['languageid'] == 0, $vbulletin->options['languageid'], $touser['languageid']);
if (empty($evalemail)) {
$evalemail = vbseo_get_email_templates('vbseo_notify_linkbacks');
}
eval(iif(empty($evalemail["{$touser['languageid']}"]), $evalemail["-1"], $evalemail["{$touser['languageid']}"]));
if ($touser['emailupdate'] == 4 and !empty($touser['icq'])) {
$touser['email'] = $touser['icq'] . '@pager.icq.com';
}
vbmail($touser['email'], $subj, $msg);
}
}
$evalemail = vbseo_get_email_templates('vbseo_notify_linkbacks_mod');
$more_emails = explode(' ', VBSEO_PINGBACK_NOTIFY_BCC);
if ($sendtocp) {
foreach ($more_emails as $email) {
eval($evalemail["-1"]);
vbmail($email, $subj, $msg);
}
}
vbmail_end();
}
示例4: post_save_each
function post_save_each($doquery = true)
{
global $vbphrase;
if (!$this->condition) {
if ($postinfo =& $this->info['postinfo']) {
$dataman =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost');
$dataman->set_existing($postinfo);
$dataman->set('infraction', $this->fetch_field('points') == 0 ? 1 : 2);
$dataman->save();
unset($dataman);
$threadinfo =& $this->info['threadinfo'];
}
if ($userinfo =& $this->info['userinfo']) {
$userdata =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
$userdata->set_existing($userinfo);
if ($points = $this->fetch_field('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 ($points) {
$this->update_infraction_groups($this->fetch_field('action'), $points);
}
// Insert thread
if ($this->registry->options['uiforumid'] and $foruminfo = fetch_foruminfo($this->registry->options['uiforumid'])) {
$infractioninfo = array('title' => $this->fetch_field('customreason') ? unhtmlspecialchars($this->fetch_field('customreason')) : fetch_phrase('infractionlevel' . $this->fetch_field('infractionlevelid') . '_title', 'infractionlevel', '', false, true, 0), 'points' => $points, 'note' => unhtmlspecialchars($this->fetch_field('note')), 'message' => $this->info['message'], 'username' => unhtmlspecialchars($userinfo['username']), 'threadtitle' => unhtmlspecialchars($threadinfo['title']));
if ($threadinfo['prefixid']) {
// need prefix in correct language
$infractioninfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, 0, false) . ' ';
} else {
$infractioninfo['prefix_plain'] = '';
}
eval(fetch_email_phrases($postinfo ? 'infraction_thread_post' : 'infraction_thread_profile', 0, $points > 0 ? 'infraction_thread_infraction' : 'infraction_thread_warning'));
$dataman =& datamanager_init('Thread_FirstPost', $this->registry, ERRTYPE_SILENT, 'threadpost');
$dataman->set_info('forum', $foruminfo);
$dataman->set_info('is_automated', true);
$dataman->set_info('mark_thread_read', true);
$dataman->set('allowsmilie', true);
$dataman->setr('userid', $this->fetch_field('whoadded'));
$dataman->set('title', $subject);
$dataman->setr('pagetext', $message);
$dataman->setr('forumid', $foruminfo['forumid']);
$dataman->set('visible', true);
$threadid = $dataman->save();
// Update infraction with threadid
$infdata =& datamanager_init('Infraction', $this->registry, ERRTYPE_SILENT);
$infractioninfo = array('infractionid' => $this->fetch_field('infractionid'));
$infdata->set_existing($infractioninfo);
$infdata->set('threadid', $threadid);
$infdata->save();
unset($infdata);
}
}
} else {
if ($this->setfields['action'] and ($this->fetch_field('action') == 1 or $this->fetch_field('action') == 2)) {
$this->reset_infraction();
$this->update_infraction_groups($this->existing['action'], $this->existing['points']);
if ($this->fetch_field('action') == 2 and $threadid = $this->fetch_field('threadid') and $threadinfo = fetch_threadinfo($threadid) and $foruminfo = $this->registry->forumcache["{$threadinfo['forumid']}"] and $userid = $this->fetch_field('actionuserid')) {
// Reversed
$infractioninfo = array('reason' => unhtmlspecialchars($this->fetch_field('actionreason')));
eval(fetch_email_phrases('infraction_post', 0, $this->existing['points'] > 0 ? 'infraction_post_infraction' : 'infraction_post_warning'));
$dataman =& datamanager_init('Post', $this->registry, ERRTYPE_SILENT, 'threadpost');
$dataman->set_info('thread', $threadinfo);
$dataman->set_info('forum', $foruminfo);
$dataman->set('threadid', $threadinfo['threadid']);
$dataman->set('userid', $userid);
$dataman->set('allowsmilie', true);
$dataman->set('visible', true);
$dataman->set('title', $subject);
$dataman->set('pagetext', $message);
$dataman->save();
unset($dataman);
}
}
}
($hook = vBulletinHook::fetch_hook('infractiondata_postsave')) ? eval($hook) : false;
}
示例5: intval
$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'])));
}
}
}
$userbyuserid = array();
$unique_thread_user = array();
$posts = $db->query_read_slave("\n\t\tSELECT post.postid, post.threadid, post.visible, post.title, post.username, post.dateline, post.parentid, post.userid,\n\t\t\tthread.forumid, thread.title AS thread_title, thread.postuserid, thread.visible AS thread_visible, thread.firstpostid,\n\t\t\tthread.sticky, thread.open, thread.iconid,\n\t\t\tIF(subscribethread.emailupdate IS NULL, 0, 1) AS issubscribed, user.autosubscribe\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON (subscribethread.threadid = thread.threadid AND subscribethread.userid = post.userid AND subscribethread.canview = 1)\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)\n\t\tWHERE postid IN (" . implode(',', $postids) . ")\n\t\tORDER BY post.dateline\n\t");
while ($post = $db->fetch_array($posts)) {
if (!can_moderate($post['forumid'], 'canmanagethreads')) {
eval(standard_error(fetch_error('you_do_not_have_permission_to_manage_threads_and_posts', $post['title'], $post['thread_title'], $vbulletin->forumcache["{$post['forumid']}"]['title'])));
示例6: vB_Attach_Display_Content
$attach = new vB_Attach_Display_Content($vbulletin, 'vBForum_Post');
$postattach = $attach->fetch_postattach($posthash);
}
// ### PREVIEW POST ###
$postpreview = process_post_preview($newpost, 0, $postattach);
$_REQUEST['do'] = 'newthread';
$newpost['message'] = htmlspecialchars_uni($newpost['message']);
$podcasturl = htmlspecialchars_uni($newpost['podcasturl']);
$podcastsize = $newpost['podcastsize'] ? $newpost['podcastsize'] : '';
$podcastkeywords = htmlspecialchars_uni($newpost['podcastkeywords']);
$podcastsubtitle = htmlspecialchars_uni($newpost['podcastsubtitle']);
$podcastauthor = htmlspecialchars_uni($newpost['podcastauthor']);
$explicitchecked = $newpost['podcastexplicit'] ? 'checked="checked"' : '';
} else {
// ### NOT PREVIEW - ACTUAL POST ###
$threadinfo = fetch_threadinfo($newpost['threadid']);
// need the forumread variable from this
mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo['userid'], TIMENOW);
($hook = vBulletinHook::fetch_hook('newthread_post_complete')) ? eval($hook) : false;
if ($newpost['postpoll']) {
$vbulletin->url = 'poll.php?' . $vbulletin->session->vars['sessionurl'] . "t={$newpost['threadid']}&polloptions={$newpost['polloptions']}";
if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) {
eval(print_standard_redirect('redirect_postthanks', true, true));
} else {
eval(print_standard_redirect('redirect_postthanks_nopermission', true, true));
}
} else {
if ($newpost['visible']) {
if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) {
$vbulletin->url = fetch_seo_url('thread', $threadinfo, array('p' => $newpost['postid'] . "#post{$newpost['postid']}"));
eval(print_standard_redirect('redirect_postthanks'));
示例7: post_save_each
/**
* Updating the votecount for that thread
*
* @param boolean Do the query?
*/
function post_save_each($doquery = true)
{
// Are we handeling a multi DM
if (!$this->condition or $this->existing['vote'] != $this->fetch_field('vote')) {
if ($this->info['thread']) {
$threadinfo =& $this->info['thread'];
} else {
$threadinfo = fetch_threadinfo($this->fetch_field('threadid'));
}
if (!$this->condition) {
// Increment the vote count for the thread that has just been voted on
$threadman =& datamanager_init('Thread', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->set('votetotal', "votetotal + " . intval($this->fetch_field('vote')), false);
$threadman->set('votenum', 'votenum + 1', false);
$threadman->save();
} else {
// this is an update
$votediff = $this->fetch_field('vote') - $this->existing['vote'];
$threadman =& datamanager_init('Thread', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->set('votetotal', "votetotal + {$votediff}", false);
$threadman->save();
}
if ($this->fetch_field('userid') == $this->registry->userinfo['userid']) {
set_bbarray_cookie('thread_rate', $this->fetch_field('threadid'), $this->fetch_field('vote'), 1);
}
}
($hook = vBulletinHook::fetch_hook('threadratedata_postsave')) ? eval($hook) : false;
}
示例8: fetch_permissions
// *********************************************************************************
// check forum permissions
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
print_no_permission();
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($thread['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0)) {
print_no_permission();
}
// *********************************************************************************
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
// *********************************************************************************
// jump page if thread is actually a redirect
if ($thread['open'] == 10) {
$destthreadinfo = fetch_threadinfo($threadinfo['pollid']);
exec_header_redirect(fetch_seo_url('thread|js', $destthreadinfo, $pageinfo));
}
// *********************************************************************************
// get ignored users
$ignore = array();
if (trim($vbulletin->userinfo['ignorelist'])) {
$ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
foreach ($ignorelist as $ignoreuserid) {
$ignore["{$ignoreuserid}"] = 1;
}
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
// *********************************************************************************
// filter out deletion notices if can't be seen
if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice'] or can_moderate($threadinfo['forumid'])) {
示例9: canPostComment
private function canPostComment($threadid, $user)
{
$commentinfo = fetch_threadinfo($threadid);
// if user did not submit the article or user is guest, check reply others permission
$userid = $user->get_field('userid');
if ( empty($userid) OR ($userid != $commentinfo['postuserid']) )
{
return $user->hasForumPermission($commentinfo['forumid'], 'canreplyothers');
}
// if current user submitted article, check reply own forum permission
else
{
return $user->hasForumPermission($commentinfo['forumid'], 'canreplyown');
}
}
示例10: print_submit_row
print_submit_row($vbphrase['prune_threads'], NULL, 5);
} else {
if ($vbulletin->GPC['type'] == 'move') {
print_submit_row($vbphrase['move_threads'], NULL, 5);
}
}
}
// ###################### Start move/prune select - finish! #######################
if ($_POST['do'] == 'dothreadsselfinish') {
$vbulletin->input->clean_array_gpc('p', array('thread' => TYPE_ARRAY, 'destforumid' => TYPE_INT));
if (!empty($vbulletin->GPC['thread'])) {
require_once DIR . '/includes/functions_databuild.php';
if ($vbulletin->GPC['type'] == 'prune') {
echo '<p>' . $vbphrase['deleting_threads'];
foreach ($vbulletin->GPC['thread'] as $threadid => $confirm) {
$threadinfo = fetch_threadinfo($threadid);
if (empty($forumids["{$threadinfo['forumid']}"])) {
// make sure we have access to prune / move this thread, if not then skip it
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>';
define('CP_REDIRECT', 'index.php?do=home');
print_stop_message('pruned_threads_successfully_modcp');
} else {
示例11: fetch_thread
function fetch_thread($threadid)
{
global $vbulletin;
$threadinfo = fetch_threadinfo($threadid);
if (!$threadinfo) {
return false;
}
return array('id' => intval($threadinfo['threadid']), 'forumid' => intval($threadinfo['forumid']), 'title' => str($threadinfo['title']), 'replycount' => intval($threadinfo['replycount']), 'open' => $threadinfo['open'] == 1);
}
示例12: undelete_post
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']));
}
示例13: verify_ui_permissions
public function verify_ui_permissions()
{
global $vbulletin;
if (!$vbulletin->options['threadtagging']) {
print_no_permission();
}
global $vbphrase;
$threadinfo = $this->fetch_content_info();
// *********************************************************************************
// check for visible / deleted thread
if (!$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts') or $threadinfo['isdeleted'] and !can_moderate($threadinfo['forumid'])) {
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $this->registry->options['contactuslink'])));
}
// *********************************************************************************
// jump page if thread is actually a redirect
if ($threadinfo['open'] == 10) {
$destthreadinfo = fetch_threadinfo($threadinfo['pollid']);
exec_header_redirect('thread|js', $destthreadinfo);
}
// *********************************************************************************
// Tachy goes to coventry
if (in_coventry($threadinfo['postuserid']) and !can_moderate($threadinfo['forumid'])) {
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $this->registry->options['contactuslink'])));
}
// *********************************************************************************
// get forum info
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
// *********************************************************************************
// check forum permissions
$forumperms = fetch_permissions($threadinfo['forumid']);
if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canview']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canviewthreads'])) {
print_no_permission();
}
if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $this->registry->userinfo['userid'] or $this->registry->userinfo['userid'] == 0)) {
print_no_permission();
}
// *********************************************************************************
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
// return $show;
}
示例14: _is_forum_closed
/**
* Check forum status
*
* @return bool
*/
private function _is_forum_closed()
{
$threadinfo = fetch_threadinfo($this->item['threadid']);
$ignored_forums = explode(',', $this->registry->options['vbv_ignored_forums']);
if ($this->registry->options['vbv_ignore_forum_childs']) {
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
foreach ($ignored_forums as $ignored_forum_id) {
if (in_array(intval($ignored_forum_id), explode(',', $foruminfo['parentlist']))) {
return true;
}
}
} else {
if (in_array($threadinfo['forumid'], $ignored_forums)) {
return true;
}
}
return false;
}
示例15: SubscribeThread
function SubscribeThread($who, $threadid)
{
global $db, $vbulletin, $server, $structtypes, $lastpostarray;
$result = RegisterService($who);
if ($result['Code'] != 0) {
$retval['Result'] = $result;
return $retval;
}
$threadinfo = fetch_threadinfo($threadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid'], false);
if (!$foruminfo['forumid']) {
return ErrorResult("invalid_forumid_subscribe_thread");
}
$forumperms = fetch_permissions($foruminfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
return ErrorResult("no_forum_permission_subscribe_thread");
}
if (!$foruminfo['allowposting'] or $foruminfo['link'] or !$foruminfo['cancontainthreads']) {
return ErrorResult("forum_closed_subscribe_thread");
}
if (!verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false)) {
return ErrorResult("invalid_forum_password_subscribe_thread");
}
if ($threadinfo['threadid'] > 0) {
if (!$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts') or $threadinfo['isdeleted'] and !can_moderate($threadinfo['forumid'], 'candeleteposts')) {
return ErrorResult('cannot_view_thread_subscribe_thread');
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or ($vbulletin->userinfo['userid'] != $threadinfo['postuserid'] or !$vbulletin->userinfo['userid']) and !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) {
return ErrorResult("no_thread_permission_subscribe_thread");
}
$emailupdate = 1;
// Instant notification by email
$folderid = 0;
// Delfault folder
/*insert query*/
$db->query_write("\r\n REPLACE INTO " . TABLE_PREFIX . "subscribethread (userid, threadid, emailupdate, folderid, canview)\r\n VALUES (" . $vbulletin->userinfo['userid'] . ", {$threadinfo['threadid']}, {$emailupdate}, {$folderid}, 1)\r\n ");
// TODO: remove this HACK!
$threadinfo['threadtitle'] = $threadinfo['title'];
$retval['Thread'] = ConsumeArray($threadinfo, $structtypes['Thread']);
} else {
return ErrorResult("invalid_threadid_subscribe_thread");
}
$result['RemoteUser'] = ConsumeArray($vbulletin->userinfo, $structtypes['RemoteUser']);
$retval['Result'] = $result;
return $retval;
}