本文整理汇总了PHP中mark_thread_read函数的典型用法代码示例。如果您正苦于以下问题:PHP mark_thread_read函数的具体用法?PHP mark_thread_read怎么用?PHP mark_thread_read使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mark_thread_read函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eval
}
eval("\$pollbox = \"" . $templates->get("showthread_poll") . "\";");
$plugins->run_hooks("showthread_poll");
}
} else {
$pollbox = "";
}
// Create the forum jump dropdown box.
if ($mybb->settings['enableforumjump'] != 0) {
$forumjump = build_forum_jump("", $fid, 1);
}
// Fetch some links
$next_oldest_link = get_thread_link($tid, 0, "nextoldest");
$next_newest_link = get_thread_link($tid, 0, "nextnewest");
// Mark this thread as read
mark_thread_read($tid, $fid);
// If the forum is not open, show closed newreply button unless the user is a moderator of this forum.
if ($forum['open'] != 0) {
eval("\$newthread = \"" . $templates->get("showthread_newthread") . "\";");
// Show the appropriate reply button if this thread is open or closed
if ($thread['closed'] == 1) {
eval("\$newreply = \"" . $templates->get("showthread_newreply_closed") . "\";");
} else {
eval("\$newreply = \"" . $templates->get("showthread_newreply") . "\";");
}
}
// Create the admin tools dropdown box.
if ($ismod == true) {
$adminpolloptions = $closelinkch = $stickch = '';
if ($pollbox) {
$adminpolloptions = "<option value=\"deletepoll\">" . $lang->delete_poll . "</option>";
示例2: post_save_each
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;
}
示例3: do_get_thread
//.........这里部分代码省略.........
$saveparsed .= "({$post['postid']}, " . intval($thread['lastpost']) . ', ' . intval($postbit_obj->post_cache['has_images']) . ", '" . $db->escape_string($postbit_obj->post_cache['text']) . "'," . intval(STYLEID) . ", " . intval(LANGUAGEID) . ")";
}
if (!empty($postbit_obj->sig_cache) and $post['userid']) {
if (!empty($save_parsed_sigs)) {
$save_parsed_sigs .= ',';
}
$save_parsed_sigs .= "({$post['userid']}, " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ", '" . $db->escape_string($postbit_obj->sig_cache['text']) . "', " . intval($postbit_obj->sig_cache['has_images']) . ")";
}
if ($post['dateline'] > $displayed_dateline) {
$displayed_dateline = $post['dateline'];
if ($displayed_dateline <= $threadview) {
$updatethreadcookie = true;
}
}
}
// end while ($post)
$db->free_result($cacheposts);
if ($threadedmode == 1) {
$postbits = $curpostbit;
}
$templater = vB_Template::create('showthread_list');
$templater->register('curpostid', $curpostid);
$templater->register('highlightwords', $highlightwords);
$templater->register('jspostbits', $jspostbits);
$templater->register('links', $links);
$templater->register('navjs', $navjs);
$templater->register('threadedmode', $threadedmode);
$templater->register('userjs', $userjs);
$threadlist = $templater->render();
unset($curpostbit, $post, $cacheposts, $parsed_postcache, $postbit);
}
################################################################################
########################## END LINEAR / THREADED ###############################
################################################################################
$effective_lastpost = max($displayed_dateline, $thread['lastpost']);
// *********************************************************************************
//set thread last view
if ($thread['pollid'] and $vbulletin->options['updatelastpost'] and ($displayed_dateline == $thread['lastpost'] or $threadview == $thread['lastpost']) and $pollinfo['lastvote'] > $thread['lastpost']) {
$displayed_dateline = $pollinfo['lastvote'];
}
if ((!$vbulletin->GPC['posted'] or $updatethreadcookie) and $displayed_dateline and $displayed_dateline > $threadview) {
mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo['userid'], $displayed_dateline);
}
// FRNR Below
fr_update_subsent($threadinfo['threadid'], $displayed_dateline);
if (!is_array($posts_out)) {
$posts_out = array();
}
// Figure out if we can post
$canpost = true;
if ($threadinfo['isdeleted'] or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
$canpost = false;
}
if (!$foruminfo['allowposting'] or $foruminfo['link'] or !$foruminfo['cancontainthreads']) {
$canpost = false;
}
if (!$threadinfo['open']) {
if (!can_moderate($threadinfo['forumid'], 'canopenclose')) {
$canpost = false;
}
}
if (($vbulletin->userinfo['userid'] != $threadinfo['postuserid'] or !$vbulletin->userinfo['userid']) and (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyothers']))) {
$canpost = false;
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyown']) and $vbulletin->userinfo['userid'] == $threadinfo['postuserid']) {
$canpost = false;
}
$mod = 0;
if (can_moderate($threadinfo['forumid'], 'candeleteposts') or can_moderate($threadinfo['forumid'], 'canremoveposts')) {
$mod |= MOD_DELETEPOST;
}
if (can_moderate($threadinfo['forumid'], 'canmanagethreads')) {
if ($threadinfo['sticky']) {
$mod |= MOD_UNSTICK;
} else {
$mod |= MOD_STICK;
}
}
if ($threadinfo['visible'] != 2 and can_moderate($threadinfo['forumid'], 'candeleteposts') or can_moderate($threadinfo['forumid'], 'canremoveposts') or $forumperms & $vbulletin->bf_ugp_forumpermissions['candeletepost'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['candeletethread'] and $vbulletin->userinfo['userid'] == $threadinfo['postuserid'] and ($vbulletin->options['edittimelimit'] == 0 or $threadinfo['dateline'] > TIMENOW - $vbulletin->options['edittimelimit'] * 60)) {
$mod |= MOD_DELETETHREAD;
}
if (can_moderate($threadinfo['forumid'], 'canopenclose') or $forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose'] and $threadinfo['postuserid'] == $vbulletin->userinfo['userid']) {
if ($threadinfo['open']) {
$mod |= MOD_CLOSE;
} else {
$mod |= MOD_OPEN;
}
}
if (can_moderate($threadinfo['forumid'], 'canmanagethreads') or $forumperms & $vbulletin->bf_ugp_forumpermissions['canmove'] and $threadinfo['postuserid'] == $vbulletin->userinfo['userid']) {
$mod |= MOD_MOVETHREAD;
}
if ($show['spamctrls']) {
$mod |= MOD_SPAM_CONTROLS;
}
$out = array('posts' => $posts_out, 'total_posts' => $totalposts, 'page' => $vbulletin->GPC['pagenumber'], 'canpost' => $canpost ? 1 : 0, 'mod' => $mod, 'pollid' => $thread['pollid'], 'subscribed' => $threadinfo['issubscribed'] ? 1 : 0, 'title' => prepare_utf8_string($thread['title']), 'canattach' => $forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] and $vbulletin->userinfo['userid']);
if ($postid) {
$out['gotopostid'] = $postid;
}
return $out;
}
示例4: unset
$templater->register('threadedmode', $threadedmode);
$templater->register('userjs', $userjs);
$threadlist = $templater->render();
unset($curpostbit, $post, $cacheposts, $parsed_postcache, $postbit);
}
################################################################################
########################## END LINEAR / THREADED ###############################
################################################################################
$effective_lastpost = max($displayed_dateline, $thread['lastpost']);
// *********************************************************************************
//set thread last view
if ($thread['pollid'] and $vbulletin->options['updatelastpost'] and ($displayed_dateline == $thread['lastpost'] or $threadview == $thread['lastpost']) and $pollinfo['lastvote'] > $thread['lastpost']) {
$displayed_dateline = $pollinfo['lastvote'];
}
if ((!$vbulletin->GPC['posted'] or $updatethreadcookie) and $displayed_dateline and $displayed_dateline > $threadview) {
mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo['userid'], $displayed_dateline);
}
if ($db->explain) {
$aftertime = microtime(true) - TIMESTART;
echo "Time after parsing all posts: {$aftertime}\n";
if (function_exists('memory_get_usage')) {
echo "Memory After: " . number_format(memory_get_usage() / 1024) . 'KB' . " \n";
}
echo "\n<hr />\n\n";
}
// *********************************************************************************
// save parsed post HTML
if (!empty($saveparsed)) {
$db->shutdown_query("\n\t\tREPLACE INTO " . TABLE_PREFIX . "postparsed (postid, dateline, hasimages, pagetext_html, styleid, languageid)\n\t\tVALUES {$saveparsed}\n\t");
unset($saveparsed);
}
示例5: get_article_comments
//.........这里部分代码省略.........
}
}
if ($tachyuser) {
$fetchtype = 'post_global_ignore';
} else {
if ($ignore["{$post['userid']}"]) {
$fetchtype = 'post_ignore';
} else {
if ($post['visible'] == 2) {
$fetchtype = 'post_deleted';
} else {
$fetchtype = 'post';
}
}
}
if (vB::$vbulletin->GPC['viewfull'] and $post['postid'] == $postinfo['postid'] and $fetchtype != 'post' and (can_moderate($threadinfo['forumid']) or !$post['isdeleted'])) {
$fetchtype = 'post';
}
if (!$firstpostid) {
$firstpostid = $post['postid'];
}
$post['islastshown'] = $post['postid'] == $lastpostid;
$post['isfirstshown'] = ($counter == 1 and $fetchtype == 'post' and $post['visible'] == 1);
$post['islastshown'] = $post['postid'] == $lastpostid;
$post['attachments'] = $postattach["{$post['postid']}"];
$canedit = false;
if (!$threadinfo['isdeleted'] and !$post['isdeleted'] and (can_moderate($threadinfo['forumid'], 'caneditposts') or $threadinfo['open'] and $post['userid'] == vB::$vbulletin->userinfo['userid'] and $forumperms & vB::$vbulletin->bf_ugp_forumpermissions['caneditpost'] and ($post['dateline'] >= TIMENOW - vB::$vbulletin->options['edittimelimit'] * 60 or vB::$vbulletin->options['edittimelimit'] == 0))) {
$canedit = true;
}
// Get post date/time
$postdate = vbdate(vB::$vbulletin->options['dateformat'], $post['dateline'], 1);
$posttime = vbdate(vB::$vbulletin->options['timeformat'], $post['dateline']);
$attachments = array();
$fr_images = array();
// Attachments (images).
if (count($post['attachments']) > 0) {
foreach ($post['attachments'] as $attachment) {
$lfilename = strtolower($attachment['filename']);
if (strpos($lfilename, '.jpe') !== false || strpos($lfilename, '.png') !== false || strpos($lfilename, '.gif') !== false || strpos($lfilename, '.jpg') !== false || strpos($lfilename, '.jpeg') !== false) {
$fr_images[] = array('img' => vB::$vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'], 'tmb' => vB::$vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'] . '&stc=1&thumb=1');
}
}
}
// Parse the post for quotes and inline images
list($text, $nuked_quotes, $images) = parse_post($post['pagetext'], false);
if (count($fr_images) > 0) {
$text .= "<br/>";
foreach ($fr_images as $attachment) {
$text .= "<img src=\"{$attachment['img']}\"/>";
}
}
foreach ($images as $image) {
$fr_images[] = array('img' => $image);
}
$avatarurl = '';
// Avatar work
if (vB::$vbulletin->options['avatarenabled']) {
require_once DIR . '/includes/functions_user.php';
$userinfo = fetch_userinfo($post['userid'], FETCH_USERINFO_AVATAR);
fetch_avatar_from_userinfo($userinfo);
if ($userinfo['avatarurl']) {
$avatarurl = process_avatarurl($userinfo['avatarurl']);
}
}
$tmp = array('post_id' => $post['postid'], 'thread_id' => $post['threadid'], 'forum_id' => $foruminfo['forumid'], 'username' => prepare_utf8_string(strip_tags($post['username'])), 'joindate' => prepare_utf8_string($post['joindate']), 'usertitle' => prepare_utf8_string(strip_tags($post['usertitle'])), 'numposts' => $post['posts'], 'userid' => $post['userid'], 'title' => prepare_utf8_string($post['title']), 'post_timestamp' => prepare_utf8_string(date_trunc($postdate) . ' ' . $posttime), 'fr_images' => $fr_images, 'image_thumbs' => array());
// Soft Deleted
if ($post['visible'] == 2) {
$tmp['deleted'] = true;
$tmp['del_username'] = prepare_utf8_string($post['del_username']);
if ($post['del_reason']) {
$tmp['del_reason'] = prepare_utf8_string($post['del_reason']);
}
} else {
$tmp['text'] = $text;
$tmp['quotable'] = $nuked_quotes;
if ($canedit) {
$tmp['canedit'] = true;
$tmp['edittext'] = prepare_utf8_string($post['pagetext']);
}
}
if ($avatarurl != '') {
$tmp['avatarurl'] = $avatarurl;
}
$posts_out[] = $tmp;
}
if ($LASTPOST['dateline'] > $displayed_dateline) {
$displayed_dateline = $LASTPOST['dateline'];
if ($displayed_dateline <= $threadview) {
$updatethreadcookie = true;
}
}
// Set thread last view
if ($displayed_dateline and $displayed_dateline > $threadview) {
mark_thread_read($threadinfo, $foruminfo, vB::$vbulletin->userinfo['userid'], $displayed_dateline);
}
vB::$vbulletin->db->free_result($posts);
unset($post);
$total = $record_count;
return $posts_out;
}
示例6: renderResult
//.........这里部分代码省略.........
{
$fetchtype = 'post_deleted';
}
else
{
$fetchtype = 'post';
}
if (
( vB::$vbulletin->GPC['viewfull'] AND $post['postid'] == $postinfo['postid'] AND $fetchtype != 'post')
AND
(can_moderate($threadinfo['forumid']) OR !$post['isdeleted'])
)
{
$fetchtype = 'post';
}
($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false;
$postbit_obj = $postbit_factory->fetch_postbit($fetchtype);
$postbit_obj->set_template_prefix('vbcms_');
if ($fetchtype == 'post')
{
$postbit_obj->highlight = $replacewords;
}
if (!$firstpostid)
{
$firstpostid = $post['postid'];
}
$post['islastshown'] = ($post['postid'] == $lastpostid);
$post['isfirstshown'] = ($counter == 1 AND $fetchtype == 'post' AND $post['visible'] == 1);
$post['islastshown'] = ($post['postid'] == $lastpostid);
$post['attachments'] = $postattach["$post[postid]"];
$parsed_postcache = array('text' => '', 'images' => 1, 'skip' => false);
$this_postbit = $postbit_obj->construct_postbit($post);
$this_template = vB_Template::create('vbcms_comments_detail');
$this_template->register('postid', $post['postid'] );
$this_template->register('postbit', $this_postbit);
$this_template->register('indent', $post_array[$this_key]['level'] * $pixel_indent);
$postbits .= $this_template->render();
$LASTPOST = $post;
// Only show after the first post, counter isn't incremented for deleted/moderated posts
if ($post_cachable AND $post['pagetext_html'] == '')
{
if (!empty($saveparsed))
{
$saveparsed .= ',';
}
$saveparsed .= "($post[postid], " . intval($thread['lastpost']) . ', ' . intval($postbit_obj->post_cache['has_images']) . ", '" . vB::$vbulletin->db->escape_string($postbit_obj->post_cache['text']) . "', " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ")";
}
if (!empty($postbit_obj->sig_cache) AND $post['userid'])
{
if (!empty($save_parsed_sigs))
{
$save_parsed_sigs .= ',';
}
$save_parsed_sigs .= "($post[userid], " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ", '" . vB::$vbulletin->db->escape_string($postbit_obj->sig_cache['text']) . "', " . intval($postbit_obj->sig_cache['has_images']) . ")";
}
}
if ($LASTPOST['dateline'] > $displayed_dateline)
{
$displayed_dateline = $LASTPOST['dateline'];
if ($displayed_dateline <= $threadview)
{
$updatethreadcookie = true;
}
}
if ($firstpostid)
{
$this_template->register('FIRSTPOSTID', $firstpostid );
}
if ($lastpostid)
{
$this_template->register('LASTPOSTID', $lastpostid);
}
// Set thread last view
if ($displayed_dateline AND $displayed_dateline > $threadview)
{
mark_thread_read($threadinfo, $foruminfo, vB::$vbulletin->userinfo['userid'], $displayed_dateline);
}
vB::$vbulletin->db->free_result($posts);
unset($post);
return $postbits;
}
示例7: process_post_preview
}
// ### 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'));
} else {
$vbulletin->url = fetch_seo_url('forum', $foruminfo);
示例8: get_thread_func
function get_thread_func($xmlrpc_params)
{
global $db, $lang, $mybb, $position, $plugins, $pids;
global $pforumcache, $currentitem, $forum_cache, $navbits, $base_url, $archiveurl;
$input = Tapatalk_Input::filterXmlInput(array('topic_id' => Tapatalk_Input::STRING, 'start_num' => Tapatalk_Input::INT, 'last_num' => Tapatalk_Input::INT, 'return_html' => Tapatalk_Input::INT), $xmlrpc_params);
if (preg_match('/^ann_/', $input['topic_id'])) {
$_GET["aid"] = intval(str_replace('ann_', '', $input['topic_id']));
return get_announcement_func($xmlrpc_params);
}
$lang->load("showthread");
global $parser;
$parser = new Tapatalk_Parser();
// Get the thread details from the database.
$thread = get_thread($input['topic_id']);
if (!empty($thread['closed'])) {
$moved = explode("|", $thread['closed']);
if ($moved[0] == "moved") {
$thread = get_thread($moved[1]);
}
}
// Get thread prefix if there is one.
$thread['threadprefix'] = '';
$thread['displayprefix'] = '';
if ($thread['prefix'] != 0) {
$threadprefix = build_prefixes($thread['prefix']);
if ($threadprefix['prefix']) {
$thread['threadprefix'] = $threadprefix['prefix'] . ' ';
$thread['displayprefix'] = $threadprefix['displaystyle'] . ' ';
}
}
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$tid = $thread['tid'];
$fid = $thread['fid'];
if (!$thread['username']) {
$thread['username'] = $lang->guest;
}
$visibleonly = "AND visible='1'";
// Is the currently logged in user a moderator of this forum?
if (is_moderator($fid)) {
$visibleonly = " AND (visible='1' OR visible='0')";
$ismod = true;
} else {
$ismod = false;
}
$forumpermissions = forum_permissions($thread['fid']);
// Does the user have permission to view this thread?
if ($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1) {
error_no_permission();
}
if ($forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) {
error_no_permission();
}
// Make sure we are looking at a real thread here.
if (!$thread['tid'] || $thread['visible'] == 0 && $ismod == false || $thread['visible'] > 1 && $ismod == true) {
return xmlrespfalse($lang->error_invalidthread);
}
// Does the thread belong to a valid forum?
$forum = get_forum($fid);
if (!$forum || $forum['type'] != "f") {
return xmlrespfalse($lang->error_invalidforum);
}
tt_check_forum_password($forum['fid']);
if ($thread['firstpost'] == 0) {
update_first_post($tid);
}
// Mark this thread as read
mark_thread_read($tid, $fid);
// Increment the thread view.
if ($mybb->settings['delayedthreadviews'] == 1) {
$db->shutdown_query("INSERT INTO " . TABLE_PREFIX . "threadviews (tid) VALUES('{$tid}')");
} else {
$db->shutdown_query("UPDATE " . TABLE_PREFIX . "threads SET views=views+1 WHERE tid='{$tid}'");
}
++$thread['views'];
// Work out if we are showing unapproved posts as well (if the user is a moderator etc.)
if ($ismod) {
$visible = "AND (p.visible='0' OR p.visible='1')";
} else {
$visible = "AND p.visible='1'";
}
// Fetch the ignore list for the current user if they have one
$ignored_users = array();
if ($mybb->user['uid'] > 0 && $mybb->user['ignorelist'] != "") {
$ignore_list = explode(',', $mybb->user['ignorelist']);
foreach ($ignore_list as $uid) {
$ignored_users[$uid] = 1;
}
}
list($start, $limit) = process_page($input['start_num'], $input['last_num']);
// Recount replies if user is a moderator to take into account unapproved posts.
if ($ismod) {
$query = $db->simple_select("posts p", "COUNT(*) AS replies", "p.tid='{$tid}' {$visible}");
$thread['replies'] = $db->fetch_field($query, 'replies') - 1;
}
$postcount = intval($thread['replies']) + 1;
$pids = "";
$comma = '';
$query = $db->simple_select("posts p", "p.pid", "p.tid='{$tid}' {$visible}", array('order_by' => 'p.dateline', 'limit_start' => $start, 'limit' => $limit));
while ($getid = $db->fetch_array($query)) {
// Set the ID of the first post on page to $pid if it doesn't hold any value
//.........这里部分代码省略.........
示例9: newThreadOrReplyMark
/**
* Insert plugin read data for new reply / new thread action.
*
*/
public function newThreadOrReplyMark()
{
global $fid, $tid;
if (isset($fid) && isset($tid)) {
$this->readTime = TIME_NOW;
mark_thread_read($tid, $fid, TIME_NOW);
$this->already_marked = true;
}
}
示例10: fetch_message
$msg = fetch_message($user, $mid);
$iid = mid_to_iid($mid);
$sql = "update f_messages{$iid} set views = views + 1 where mid = ?";
db_exec($sql, array($mid));
if (!empty($msg['flags'])) {
$flagexp = explode(",", $msg['flags']);
while (list(, $flag) = each($flagexp)) {
$flags[$flag] = true;
}
}
$uuser = new ForumUser($msg['aid']);
/* Grab some information about the parent (if there is one) */
if ($msg['pmid'] != 0) {
$pmsg = fetch_message($user, $msg['pmid'], 'mid,subject,name');
}
mark_thread_read($forum['fid'], $msg, $user);
/* generate message subjects in the thread this message is a part of */
$thread = get_thread($msg['tid']);
/* UGLY hack, kludge, etc to workaround nasty ordering problem */
$_page = $tpl->get_var("PAGE");
unset($tpl->varkeys["PAGE"]);
unset($tpl->varvals["PAGE"]);
$tpl->set_var("PAGE", $_page);
$_domain = $tpl->get_var("DOMAIN");
unset($tpl->varkeys["DOMAIN"]);
unset($tpl->varvals["DOMAIN"]);
$tpl->set_var("DOMAIN", $_domain);
if (isset($pmsg)) {
$tpl->set_var(array("PMSG_MID" => $pmsg['mid'], "PMSG_SUBJECT" => $pmsg['subject'], "PMSG_NAME" => $pmsg['name'], "PMSG_DATE" => $pmsg['date']));
} else {
$tpl->set_var("parent", "");
示例11: new_topic_func
function new_topic_func($xmlrpc_params)
{
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $thread_info, $pid, $tid, $visible, $fid, $new_thread;
$lang->load("newthread");
$input = Tapatalk_Input::filterXmlInput(array('forum_id' => Tapatalk_Input::INT, 'subject' => Tapatalk_Input::STRING, 'message' => Tapatalk_Input::STRING, 'prefix_id' => Tapatalk_Input::STRING, 'attachment_id_array' => Tapatalk_Input::RAW, 'group_id' => Tapatalk_Input::STRING), $xmlrpc_params);
$fid = $input['forum_id'];
// Fetch forum information.
$forum = get_forum($fid);
if (!$forum) {
return xmlrespfalse($lang->error_invalidforum);
}
$forumpermissions = forum_permissions($fid);
if ($forum['open'] == 0 || $forum['type'] != "f") {
return xmlrespfalse($lang->error_closedinvalidforum);
}
if ($mybb->user['uid'] < 1 || $forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1) {
return tt_no_permission();
}
// Check if this forum is password protected and we have a valid password
tt_check_forum_password($forum['fid']);
// Check the maximum posts per day for this user
if ($mybb->settings['maxposts'] > 0 && $mybb->usergroup['cancp'] != 1) {
$daycut = TIME_NOW - 60 * 60 * 24;
$query = $db->simple_select("posts", "COUNT(*) AS posts_today", "uid='{$mybb->user['uid']}' AND visible='1' AND dateline>{$daycut}");
$post_count = $db->fetch_field($query, "posts_today");
if ($post_count >= $mybb->settings['maxposts']) {
$lang->error_maxposts = $lang->sprintf($lang->error_maxposts, $mybb->settings['maxposts']);
return xmlrespfalse($lang->error_maxposts);
}
}
$username = $mybb->user['username'];
$uid = $mybb->user['uid'];
// Attempt to see if this post is a duplicate or not
if ($uid > 0) {
$user_check = "p.uid='{$uid}'";
} else {
$user_check = "p.ipaddress='" . $db->escape_string($session->ipaddress) . "'";
}
if (!$mybb->input['savedraft'] && !$pid) {
$query = $db->simple_select("posts p", "p.pid", "{$user_check} AND p.fid='{$forum['fid']}' AND p.subject='{$input['subject_esc']}' AND p.message='{$input['message_esc']}'");
$duplicate_check = $db->fetch_field($query, "pid");
if ($duplicate_check) {
return xmlrespfalse($lang->error_post_already_submitted);
}
}
// Set up posthandler.
require_once MYBB_ROOT . "inc/datahandlers/post.php";
$posthandler = new PostDataHandler("insert");
$posthandler->action = "thread";
// Set the thread data that came from the input to the $thread array.
$new_thread = array("fid" => $forum['fid'], "subject" => $input['subject'], "prefix" => $input['prefix_id'], "icon" => 0, "uid" => $uid, "username" => $username, "message" => $input['message'], "ipaddress" => get_ip(), "posthash" => $input['group_id_esc']);
$new_thread['savedraft'] = 0;
// Set up the thread options from the input.
$new_thread['options'] = array("signature" => 1, "subscriptionmethod" => $mybb->user['subscriptionmethod'] == 0 ? '' : $mybb->user['subscriptionmethod'], "disablesmilies" => 0);
$posthandler->set_data($new_thread);
// Now let the post handler do all the hard work.
$valid_thread = $posthandler->validate_thread();
$post_errors = array();
// Fetch friendly error messages if this is an invalid thread
if (!$valid_thread) {
$post_errors = $posthandler->get_friendly_errors();
return xmlrespfalse(implode(" :: ", $post_errors));
}
$thread_info = $posthandler->insert_thread();
$tid = $thread_info['tid'];
$pid = $thread_info['pid'];
$visible = $thread_info['visible'];
if ($pid != '') {
if (!empty($input['group_id_esc'])) {
$db->update_query("attachments", array("pid" => intval($pid)), "posthash='{$input['group_id_esc']}'");
}
}
tapatalk_push_newtopic();
tapatalk_push_quote();
tapatalk_push_tag();
// Mark thread as read
require_once MYBB_ROOT . "inc/functions_indicators.php";
mark_thread_read($tid, $fid);
$result = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'topic_id' => new xmlrpcval($tid, 'string'), 'state' => new xmlrpcval($visible ? 0 : 1, 'int')), 'struct');
return new xmlrpcresp($result);
}
示例12: reply_post_func
function reply_post_func($xmlrpc_params)
{
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $tid, $pid, $visible, $thread, $post;
$input = Tapatalk_Input::filterXmlInput(array('forum_id' => Tapatalk_Input::INT, 'topic_id' => Tapatalk_Input::INT, 'subject' => Tapatalk_Input::STRING, 'text_body' => Tapatalk_Input::STRING, 'attachment_id_array' => Tapatalk_Input::RAW, 'group_id' => Tapatalk_Input::STRING, 'return_html' => Tapatalk_Input::INT), $xmlrpc_params);
$lang->load("newreply");
$parser = new Tapatalk_Parser();
$tid = $input['topic_id'];
$options = array("limit" => 1);
$query = $db->simple_select("threads", "*", "tid='" . $tid . "'");
if ($db->num_rows($query) == 0) {
return xmlrespfalse($lang->error_invalidthread);
}
$thread = $db->fetch_array($query);
$fid = $thread['fid'];
// Get forum info
$forum = get_forum($fid);
if (!$forum) {
return xmlrespfalse($lang->error_invalidforum);
}
$forumpermissions = forum_permissions($fid);
if ($thread['visible'] == 0 && !is_moderator($fid) || $thread['visible'] < 0) {
return xmlrespfalse($lang->error_invalidthread);
}
if ($forum['open'] == 0 || $forum['type'] != "f") {
return xmlrespfalse($lang->error_closedinvalidforum);
}
if ($mybb->user['uid'] < 1 || $forumpermissions['canview'] == 0 || $forumpermissions['canpostreplys'] == 0 || $mybb->user['suspendposting'] == 1) {
return tt_no_permission();
}
if ($forumpermissions['canonlyviewthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) {
return tt_no_permission();
}
tt_check_forum_password($forum['fid']);
// Check to see if the thread is closed, and if the user is a mod.
if (!is_moderator($fid, "caneditposts")) {
if ($thread['closed'] == 1) {
return xmlrespfalse($lang->redirect_threadclosed);
}
}
// Is the currently logged in user a moderator of this forum?
if (is_moderator($fid)) {
$ismod = true;
} else {
$ismod = false;
}
if (!empty($input['group_id'])) {
$posthash = $input['group_id'];
} else {
$posthash = md5($thread['tid'] . $mybb->user['uid'] . random_str());
}
if ($mybb->settings['maxposts'] > 0 && $mybb->usergroup['cancp'] != 1) {
$daycut = TIME_NOW - 60 * 60 * 24;
$query = $db->simple_select("posts", "COUNT(*) AS posts_today", "uid='{$mybb->user['uid']}' AND visible='1' AND dateline>{$daycut}");
$post_count = $db->fetch_field($query, "posts_today");
if ($post_count >= $mybb->settings['maxposts']) {
$lang->error_maxposts = $lang->sprintf($lang->error_maxposts, $mybb->settings['maxposts']);
return xmlrespfalse($lang->error_maxposts);
}
}
$username = $mybb->user['username'];
$uid = $mybb->user['uid'];
$user_check = "p.uid='{$uid}'";
if (version_compare($mybb->version, '1.8.0', '<')) {
$query = $db->simple_select("posts p", "p.pid, p.visible", "{$user_check} AND p.tid='{$thread['tid']}' AND p.subject='" . $db->escape_string($mybb->input['subject']) . "' AND p.message='" . $db->escape_string($mybb->input['message']) . "' AND p.posthash='" . $db->escape_string($mybb->input['posthash']) . "' AND p.visible != '-2'");
} else {
$query = $db->simple_select("posts p", "p.pid, p.visible", "{$user_check} AND p.tid='{$thread['tid']}' AND p.subject='" . $db->escape_string($mybb->get_input('subject')) . "' AND p.message='" . $db->escape_string($mybb->get_input('message')) . "' AND p.visible != '-2' AND p.dateline>" . (TIME_NOW - 600));
}
$duplicate_check = $db->fetch_field($query, "pid");
if ($duplicate_check) {
return xmlrespfalse($lang->error_post_already_submitted);
}
require_once MYBB_ROOT . "inc/datahandlers/post.php";
$posthandler = new PostDataHandler("insert");
$post = array("tid" => $input['topic_id'], "replyto" => 0, "fid" => $thread['fid'], "subject" => $input['subject'], "icon" => 0, "uid" => $uid, "username" => $username, "message" => $input['text_body'], "ipaddress" => get_ip(), "posthash" => $posthash);
if ($mybb->input['pid']) {
$post['pid'] = $mybb->input['pid'];
}
$post['savedraft'] = 0;
// Set up the post options from the input.
$post['options'] = array("signature" => 1, "subscriptionmethod" => $mybb->user['subscriptionmethod'] == 0 ? '' : $mybb->user['subscriptionmethod'], "disablesmilies" => 0);
$post['modoptions']['stickthread'] = $thread['sticky'];
$post['modoptions']['closethread'] = $thread['closed'];
$posthandler->set_data($post);
// Now let the post handler do all the hard work.
$valid_post = $posthandler->validate_post();
$post_errors = array();
// Fetch friendly error messages if this is an invalid post
if (!$valid_post) {
$post_errors = $posthandler->get_friendly_errors();
}
// Mark thread as read
require_once MYBB_ROOT . "inc/functions_indicators.php";
mark_thread_read($tid, $fid);
// One or more errors returned, fetch error list and throw to newreply page
if (count($post_errors) > 0) {
return xmlrespfalse(implode(" :: ", $post_errors));
} else {
$postinfo = $posthandler->insert_post();
$pid = $postinfo['pid'];
$visible = $postinfo['visible'];
//.........这里部分代码省略.........
示例13: PostReply
function PostReply($who, $threadid, $pagetext, $quotepostid = 0)
{
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);
$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
$postdm->set_info('skip_maximagescheck', true);
$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $threadid);
$postdm->set('userid', $vbulletin->userinfo['userid']);
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', TIMENOW);
if ($quotepostid > 0) {
$quote_postids[] = $quotepostid;
$quotetxt = fetch_quotable_posts($quote_postids, $threadinfo['threadid'], $unquoted_post_count, $quoted_post_ids, 'only');
$pagetext = "{$quotetxt}{$pagetext}";
}
$postdm->set('pagetext', "{$pagetext}");
$postdm->pre_save();
$postid = 0;
if (count($postdm->errors) > 0) {
// pre_save failed
return ErrorResult('pre_save_failed_thread_reply');
} else {
$postid = $postdm->save();
require_once './includes/functions_databuild.php';
build_thread_counters($threadinfo['threadid']);
build_forum_counters($foruminfo['forumid']);
correct_forum_counters($threadinfo['threadid'], $foruminfo['forumid']);
mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo['userid'], TIMENOW);
}
$retval['PostID'] = $postid;
$result['Code'] = 1;
$result['Text'] = "QuotePostID: {$quotepostid}";
$result['RemoteUser'] = ConsumeArray($vbulletin->userinfo, $structtypes['RemoteUser']);
$retval['Result'] = $result;
return $retval;
}