• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_thread函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_thread函数的典型用法代码示例。如果您正苦于以下问题:PHP get_thread函数的具体用法?PHP get_thread怎么用?PHP get_thread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_thread函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_thread_by_unread_func

function get_thread_by_unread_func($xmlrpc_params)
{
    global $db, $mybb;
    $input = Tapatalk_Input::filterXmlInput(array('topic_id' => Tapatalk_Input::STRING, 'posts_per_request' => 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);
    }
    $thread = get_thread($input['topic_id']);
    if (!empty($thread['closed'])) {
        $moved = explode("|", $thread['closed']);
        if ($moved[0] == "moved") {
            $thread = get_thread($moved[1]);
        }
    }
    if (is_moderator($thread['fid'])) {
        $visible = "AND (p.visible='0' OR p.visible='1')";
    } else {
        $visible = "AND p.visible='1'";
    }
    $cutoff = 0;
    if ($mybb->settings['threadreadcut'] > 0) {
        $cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
    }
    $query = $db->query("select min(p.pid) as pid from " . TABLE_PREFIX . "posts p\n        LEFT JOIN " . TABLE_PREFIX . "threadsread tr on p.tid = tr.tid and tr.uid = '{$mybb->user['uid']}'\n        where p.tid='{$thread['tid']}' and p.uid != '{$mybb->user['uid']}' and (p.dateline > tr.dateline or tr.dateline is null) and p.dateline > {$cutoff} {$visible}\n        ");
    $pid = $db->fetch_field($query, 'pid');
    if (!$pid) {
        $query = $db->query("select p.pid from " . TABLE_PREFIX . "posts p\n                             where p.tid='{$thread['tid']}' {$visible}\n                             order by p.dateline desc\n                             limit 1");
        $pid = $db->fetch_field($query, 'pid');
    }
    return get_thread_by_post_func(new xmlrpcval(array(new xmlrpcval($pid, "string"), new xmlrpcval($input['posts_per_request'], 'int'), new xmlrpcval(!!$input['return_html'], 'boolean')), 'array'));
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:32,代码来源:get_thread_by_unread.php


示例2: rebuild_thread_counters

/**
 * Completely rebuild the counters for a particular thread (useful if they become out of sync)
 * 
 * @param int The thread ID 
 * @param array Optional thread array so we don't have to query it 
 */
function rebuild_thread_counters($tid)
{
    global $db;
    if (!$thread['tid']) {
        $thread = get_thread($tid);
    }
    $query = $db->simple_select("posts", "COUNT(*) AS replies", "tid='{$tid}' AND pid!='{$thread['firstpost']}' AND visible='1'");
    $count['replies'] = $db->fetch_field($query, "replies");
    if ($count['replies'] < 0) {
        $count['replies'] = 0;
    }
    // Unapproved posts
    $query = $db->simple_select("posts", "COUNT(pid) AS totunposts", "tid='{$tid}' AND pid != '{$thread['firstpost']}' AND visible='0'");
    $count['unapprovedposts'] = $db->fetch_field($query, "totunposts");
    if (!$count['unapprovedposts']) {
        $count['unapprovedposts'] = 0;
    }
    // Attachment count
    $query = $db->query("\n\t\t\tSELECT COUNT(aid) AS attachment_count\n\t\t\tFROM " . TABLE_PREFIX . "attachments a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (a.pid=p.pid)\n\t\t\tWHERE p.tid='{$tid}'\n\t");
    $count['attachmentcount'] = $db->fetch_field($query, "attachment_count");
    if (!$count['attachmentcount']) {
        $count['attachmentcount'] = 0;
    }
    update_thread_counters($tid, $count);
}
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:functions_rebuild.php


示例3: remove_attachment_func

function remove_attachment_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    chdir("../");
    $lang->load("member");
    $parser = new postParser();
    $input = Tapatalk_Input::filterXmlInput(array('attachment_id' => Tapatalk_Input::INT, 'forum_id' => Tapatalk_Input::INT, 'group_id' => Tapatalk_Input::STRING, 'post_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $fid = $input['forum_id'];
    $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();
    }
    tt_check_forum_password($forum['fid']);
    $posthash = $input['group_id'];
    $mybb->input['posthash'] = $posthash;
    // If we're removing an attachment that belongs to an existing post, some security checks...
    $query = $db->simple_select("attachments", "pid", "aid='{$input['attachment_id']}'");
    $attachment = $db->fetch_array($query);
    $pid = $attachment['pid'];
    if ($pid > 0) {
        if ($pid != $input['post_id']) {
            return xmlrespfalse("The attachment you are trying to remove does not belong to this post");
        }
        $query = $db->simple_select("posts", "*", "pid='{$pid}'");
        $post = $db->fetch_array($query);
        if (!$post['pid']) {
            return xmlrespfalse($lang->error_invalidpost);
        }
        // Get thread info
        $tid = $post['tid'];
        $thread = get_thread($tid);
        if (!$thread['tid']) {
            return xmlrespfalse($lang->error_invalidthread);
        }
        if (!is_moderator($fid, "caneditposts")) {
            if ($thread['closed'] == 1) {
                return xmlrespfalse($lang->redirect_threadclosed);
            }
            if ($forumpermissions['caneditposts'] == 0) {
                return tt_no_permission();
            }
            if ($mybb->user['uid'] != $post['uid']) {
                return tt_no_permission();
            }
        }
    } else {
        $pid = 0;
    }
    require_once MYBB_ROOT . "inc/functions_upload.php";
    remove_attachment($pid, $mybb->input['posthash'], $input['attachment_id']);
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:59,代码来源:remove_attachment.php


示例4: unsubscribe_topic_func

function unsubscribe_topic_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("usercp");
    $input = Tapatalk_Input::filterXmlInput(array('topic_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $thread = get_thread($input['topic_id']);
    if (!$thread['tid']) {
        return xmlrespfalse($lang->error_invalidthread);
    }
    remove_subscribed_thread($thread['tid']);
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:12,代码来源:unsubscribe_topic.php


示例5: subscribe_topic_func

function subscribe_topic_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("usercp");
    $input = Tapatalk_Input::filterXmlInput(array('topic_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $thread = get_thread($input['topic_id']);
    if (!$thread['tid']) {
        return xmlrespfalse($lang->error_invalidthread);
    }
    $forumpermissions = forum_permissions($thread['fid']);
    if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
        return tt_no_permission();
    }
    add_subscribed_thread($thread['tid'], 0);
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:16,代码来源:subscribe_topic.php


示例6: rebuild_thread_counters

/**
 * Completely rebuild the counters for a particular thread (useful if they become out of sync)
 *
 * @param int The thread ID
 */
function rebuild_thread_counters($tid)
{
    global $db;
    $thread = get_thread($tid);
    $count = array();
    $query = $db->simple_select("posts", "COUNT(pid) AS replies", "tid='{$tid}' AND pid!='{$thread['firstpost']}' AND visible='1'");
    $count['replies'] = $db->fetch_field($query, "replies");
    // Unapproved posts
    $query = $db->simple_select("posts", "COUNT(pid) AS unapprovedposts", "tid='{$tid}' AND pid != '{$thread['firstpost']}' AND visible='0'");
    $count['unapprovedposts'] = $db->fetch_field($query, "unapprovedposts");
    // Soft deleted posts
    $query = $db->simple_select("posts", "COUNT(pid) AS deletedposts", "tid='{$tid}' AND pid != '{$thread['firstpost']}' AND visible='-1'");
    $count['deletedposts'] = $db->fetch_field($query, "deletedposts");
    // Attachment count
    $query = $db->query("\n\t\t\tSELECT COUNT(aid) AS attachment_count\n\t\t\tFROM " . TABLE_PREFIX . "attachments a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (a.pid=p.pid)\n\t\t\tWHERE p.tid='{$tid}' AND a.visible=1\n\t");
    $count['attachmentcount'] = $db->fetch_field($query, "attachment_count");
    update_thread_counters($tid, $count);
    update_thread_data($tid);
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:24,代码来源:functions_rebuild.php


示例7: reportthread_dopost

function reportthread_dopost()
{
    require_once MYBB_ROOT . "inc/datahandlers/post.php";
    global $db, $mybb;
    if (intval($mybb->settings['rtt_enabled']) == 1 || preg_replace("/[^a-z]/i", "", $mybb->settings['rtt_enabled']) == "yes") {
        if ($mybb->input['type'] == 'post') {
            $title = "Reported Post By ";
            $post = get_post($mybb->input['pid']);
            $thread = get_thread($post['tid']);
            $forum = get_forum($thread['fid']);
            $tlink = get_thread_link($thread['tid']);
            $flink = get_forum_link($thread['fid']);
            $reason = $mybb->input['reason'];
            if ($reason === 'other') {
                $reason = $mybb->input['comment'];
            }
            $post_data = $mybb->user['username'] . " has reported a post.\r\n\r\nOriginal Thread: [url=" . $mybb->settings['bburl'] . "/{$tlink}]" . $thread['subject'] . "[/url]\r\nForum: [url=" . $mybb->settings['bburl'] . "/{$flink}]" . $forum['name'] . "[/url]\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nPost Content:\r\n[quote=\"" . $post['username'] . "\" pid=\"" . $post['pid'] . "\" dateline=\"" . $post['dateline'] . "\"]" . $post['message'] . "[/quote]";
        } else {
            if ($mybb->input['type'] == 'reputation') {
                $title = "Reported Reputation By ";
                $rep = get_reputation_point($mybb->input['pid']);
                $giver = get_user($rep['adduid']);
                $reason = $mybb->input['reason'];
                if ($reason === 'other') {
                    $reason = $mybb->input['comment'];
                }
                $post_data = $mybb->user['username'] . " has reported a reputation point.\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nReputation comment:\r\n[quote=\"" . $giver['username'] . "\" dateline=\"" . $rep['dateline'] . "\"]" . $rep['comments'] . "[/quote]";
            }
        }
        $new_thread = array("fid" => $mybb->settings['rtt_fid'], "prefix" => 0, "subject" => $title . $mybb->user['username'], "icon" => 0, "uid" => $mybb->user['uid'], "username" => $mybb->user['username'], "message" => $post_data, "ipaddress" => get_ip(), "posthash" => md5($mybb->user['uid'] . random_str()));
        $posthandler = new PostDataHandler("insert");
        $posthandler->action = "thread";
        $posthandler->set_data($new_thread);
        if ($posthandler->validate_thread()) {
            $thread_info = $posthandler->insert_thread();
        }
    }
}
开发者ID:ateista-pl,项目名称:forum,代码行数:38,代码来源:reportthread.php


示例8: elseif

} elseif ($mybb->get_input('action') == "removesubscription") {
    if ($mybb->get_input('type') == "forum") {
        $forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
        if (!$forum) {
            error($lang->error_invalidforum);
        }
        $plugins->run_hooks("usercp2_removesubscription_forum");
        remove_subscribed_forum($forum['fid']);
        if ($server_http_referer) {
            $url = $server_http_referer;
        } else {
            $url = "usercp.php?action=forumsubscriptions";
        }
        redirect($url, $lang->redirect_forumsubscriptionremoved);
    } else {
        $thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
        if (!$thread) {
            error($lang->error_invalidthread);
        }
        // Is the currently logged in user a moderator of this forum?
        if (is_moderator($thread['fid'])) {
            $ismod = true;
        } else {
            $ismod = false;
        }
        // Make sure we are looking at a real thread here.
        if ($thread['visible'] != 1 && $ismod == false || $thread['visible'] > 1 && $ismod == true) {
            error($lang->error_invalidthread);
        }
        $plugins->run_hooks("usercp2_removesubscription_thread");
        remove_subscribed_thread($thread['tid']);
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:usercp2.php


示例9: bb_getPosts

 /**
  * Returns details of the posts in a given topic
  *
  * @since 1.0
  * @return array|object The posts when successfully executed or an IXR_Error object on failure
  * @param array $args Arguments passed by the XML-RPC call
  * @param string $args[0] The username for authentication
  * @param string $args[1] The password for authentication
  * @param integer|string $args[2] The topic id or slug
  * @param integer $args[3] The number of posts to return (optional)
  * @param integer $args[4] The number of the page to return (optional)
  *
  * XML-RPC request to get all posts in the topic with id number 53
  * <methodCall>
  *     <methodName>bb.getPosts</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><int>53</int></value></param>
  *     </params>
  * </methodCall>
  *
  * XML-RPC request to get the latest 5 posts in the topic with id number 341
  * <methodCall>
  *     <methodName>bb.getPosts</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><int>341</int></value></param>
  *         <param><value><int>5</int></value></param>
  *     </params>
  * </methodCall>
  *
  * XML-RPC request to get posts 11 to 20 in the topic with slug "long-topic"
  * <methodCall>
  *     <methodName>bb.getPosts</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><string>long-topic</string></value></param>
  *         <param><value><int>10</int></value></param>
  *         <param><value><int>2</int></value></param>
  *     </params>
  * </methodCall>
  */
 function bb_getPosts($args)
 {
     do_action('bb_xmlrpc_call', 'bb.getPosts');
     // Escape args
     $this->escape($args);
     // Get the login credentials
     $username = $args[0];
     $password = (string) $args[1];
     // Check the user is valid
     if ($this->auth_readonly) {
         $user = $this->authenticate($username, $password);
     }
     do_action('bb_xmlrpc_call_authenticated', 'bb.getPosts');
     // If an error was raised by authentication or by an action then return it
     if ($this->error) {
         return $this->error;
     }
     // Can be numeric id or slug
     $topic_id = isset($args[2]) ? $args[2] : false;
     // Check for bad data
     if (!$topic_id || !is_string($topic_id) && !is_integer($topic_id)) {
         $this->error = new IXR_Error(400, __('The topic id is invalid.'));
         return $this->error;
     }
     // Check the requested topic exists
     if (!($topic = get_topic($topic_id))) {
         $this->error = new IXR_Error(400, __('No topic found.'));
         return $this->error;
     }
     // The topic id may have been a slug, so make sure it's an integer here
     $topic_id = (int) $topic->topic_id;
     // Setup an array to store arguments to pass to get_thread() function
     $get_thread_args = array();
     // Can only be an integer
     if (isset($args[3]) && ($per_page = (int) $args[3])) {
         $get_thread_args['per_page'] = $per_page;
     }
     // Can only be an integer
     if (isset($args[4]) && ($page = (int) $args[4])) {
         $get_thread_args['page'] = $page;
     }
     // Get the posts
     if (!($posts = get_thread($topic_id, $get_thread_args))) {
         $this->error = new IXR_Error(500, __('No posts found.'));
         return $this->error;
     }
     // Only include "safe" data in the array
     $_posts = array();
     foreach ($posts as $post) {
         $_posts[] = $this->prepare_post($post);
     }
     do_action('bb_xmlrpc_call_return', 'bb.getPosts');
     // Return the posts
     return $_posts;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:100,代码来源:xmlrpc.php


示例10: ougc_showinportal_myalerts_output

function ougc_showinportal_myalerts_output(&$args)
{
    global $mybb;
    if ($args['alert_type'] != 'ougc_showinportal' || !$mybb->user['myalerts_settings']['ougc_showinportal']) {
        return;
    }
    global $showinportal, $lang;
    $showinportal->lang_load();
    $lang_var = 'ougc_showinportal_myalerts_showinportal';
    if (!$args['content'][0]) {
        $lang_var = 'ougc_showinportal_myalerts_unshowinportal';
    }
    $thread = get_thread($args['tid']);
    if (!$thread) {
        return;
    }
    $args['threadLink'] = $mybb->settings['bburl'] . '/' . get_thread_link($thread['tid']);
    $args['message'] = $lang->sprintf($lang->{$lang_var}, $args['user'], $args['threadLink'], htmlspecialchars_uni($thread['subject']), $args['dateline']);
    $args['rowType'] = 'showinportal';
}
开发者ID:OldDuck,项目名称:OUGC-Show-in-Portal,代码行数:20,代码来源:ougc_showinportal.php


示例11: get_thread

 function get_thread($topic_id, $page = 1, $reverse = 0)
 {
     bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'get_thread');
     return get_thread($topic_id, $page, $reverse);
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:5,代码来源:functions.bb-deprecated.php


示例12: 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'] . '&nbsp;';
            $thread['displayprefix'] = $threadprefix['displaystyle'] . '&nbsp;';
        }
    }
    $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
//.........这里部分代码省略.........
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:101,代码来源:get_thread.php


示例13: get_special_locations

 /**
  * Find out the special locations.
  *
  * @return array Special locations array.
  */
 function get_special_locations()
 {
     global $mybb;
     $array = array('1' => '', '2' => '');
     if (preg_match("#forumdisplay.php#", $_SERVER['PHP_SELF']) && $mybb->get_input('fid', MyBB::INPUT_INT) > 0) {
         $array[1] = $mybb->get_input('fid', MyBB::INPUT_INT);
         $array[2] = '';
     } elseif (preg_match("#showthread.php#", $_SERVER['PHP_SELF'])) {
         global $db;
         if ($mybb->get_input('tid', MyBB::INPUT_INT) > 0) {
             $array[2] = $mybb->get_input('tid', MyBB::INPUT_INT);
         } elseif (isset($mybb->input['pid']) && !empty($mybb->input['pid'])) {
             $options = array("limit" => 1);
             $query = $db->simple_select("posts", "tid", "pid=" . $mybb->get_input('pid', MyBB::INPUT_INT), $options);
             $post = $db->fetch_array($query);
             $array[2] = $post['tid'];
         }
         $thread = get_thread($array[2]);
         $array[1] = $thread['fid'];
     }
     return $array;
 }
开发者ID:olada,项目名称:mybbintegrator,代码行数:27,代码来源:class_session.php


示例14: get_thread_post_ids

function get_thread_post_ids($topic_id)
{
    $return = array('post' => array(), 'poster' => array());
    foreach (get_thread($topic_id, array('per_page' => -1)) as $post) {
        $return['post'][] = $post->post_id;
        $return['poster'][] = $post->poster_id;
    }
    return $return;
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:9,代码来源:functions.bb-topics.php


示例15: get_thread

<?php

// Update the tags for a thread
include 'init.php';
$thread_id = (int) $_POST['thread_id'];
$thread = get_thread($thread_id);
if (!$thread) {
    die('Thread not found.');
}
$tags = $_POST['tags'];
update_tags($thread_id, $tags);
header('Location: thread.php?updated=tags&t=' . $thread_id);
开发者ID:bi0xid,项目名称:bach,代码行数:12,代码来源:thread-tags.php


示例16: preprocess

} else {
    /* form submitted via edit (step 2) */
    preprocess($nmsg, $_POST);
    $offtopic = isset($_POST['OffTopic']);
    $expose_email = isset($_POST['ExposeEmail']);
    $send_email = isset($_POST['EmailFollowup']);
    /* automatically track thread if user requested email notification */
    $track_thread = isset($_POST['TrackThread']) || $send_email;
}
if (!isset($forum['option']['PostEdit'])) {
    $tpl->set_var(array("edit_locked" => "", "error" => "", "preview" => "", "form" => "", "accept" => ""));
    print generate_page('Edit Message Denied', $tpl->parse("CONTENT", "disabled"));
    exit;
}
$tpl->set_var("disabled", "");
$thread = get_thread($msg['tid']);
if (isset($thread['flag']['Locked']) && !$user->capable($forum['fid'], 'Lock')) {
    $tpl->set_var(array("error" => "", "preview" => "", "form" => "", "accept" => ""));
    print generate_page('Edit Message Denied', $tpl->parse("CONTENT", "edit_locked"));
    exit;
}
$tpl->set_var("edit_locked", "");
/* Sanitize the strings */
$nmsg['name'] = stripcrap($user->name);
if ($expose_email) {
    $nmsg['email'] = stripcrap($user->email);
} else {
    $nmsg['email'] = "";
}
/* update offtopic status */
if ($msg['state'] == 'Active' && $offtopic) {
开发者ID:kawf,项目名称:kawf,代码行数:31,代码来源:edit.php


示例17: define

 * License: http://mybb.com/about/license
 *
 * $Id$
 */
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'sendthread.php');
$templatelist = "sendthread,forumdisplay_password_wrongpass,forumdisplay_password";
require_once "./global.php";
require_once MYBB_ROOT . "inc/functions_post.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
// Load global language phrases
$lang->load("sendthread");
// Get thread info
$tid = intval($mybb->input['tid']);
$thread = get_thread($tid);
// Get thread prefix
$breadcrumbprefix = '';
if ($thread['prefix']) {
    $threadprefix = build_prefixes($thread['prefix']);
    if (isset($threadprefix['displaystyle'])) {
        $breadcrumbprefix = $threadprefix['displaystyle'] . '&nbsp;';
    }
}
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
// Invalid thread
if (!$thread['tid']) {
    error($lang->error_invalidthread);
}
// Guests cannot use this feature
if (!$mybb->user['uid']) {
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:sendthread.php


示例18: save_raw_post_func

function save_raw_post_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("editpost");
    $input = Tapatalk_Input::filterXmlInput(array('post_id' => Tapatalk_Input::INT, 'post_title' => Tapatalk_Input::STRING, 'post_content' => Tapatalk_Input::STRING, 'return_html' => Tapatalk_Input::INT, 'attachment_id_array' => Tapatalk_Input::RAW, 'group_id' => Tapatalk_Input::STRING, 'editreason' => Tapatalk_Input::STRING), $xmlrpc_params);
    $parser = new postParser();
    // No permission for guests
    if (!$mybb->user['uid']) {
        return tt_no_permission();
    }
    // Get post info
    $pid = $input['post_id'];
    $query = $db->simple_select("posts", "*", "pid='{$pid}'");
    $post = $db->fetch_array($query);
    if (empty($input['post_title'])) {
        $input['post_title'] = $post['subject'];
    }
    if (!$post['pid']) {
        return xmlrespfalse($lang->error_invalidpost);
    }
    // Get thread info
    $tid = $post['tid'];
    $thread = get_thread($tid);
    if (!$thread['tid']) {
        return xmlrespfalse($lang->error_invalidthread);
    }
    $thread['subject'] = htmlspecialchars_uni($thread['subject']);
    // Get forum info
    $fid = $post['fid'];
    $forum = get_forum($fid);
    if (!$forum || $forum['type'] != "f") {
        return xmlrespfalse($lang->error_closedinvalidforum);
    }
    if ($forum['open'] == 0 || $mybb->user['suspendposting'] == 1) {
        return tt_no_permission();
    }
    $forumpermissions = forum_permissions($fid);
    if (!is_moderator($fid, "caneditposts")) {
        if ($thread['closed'] == 1) {
            return xmlrespfalse($lang->redirect_threadclosed);
        }
        if ($forumpermissions['caneditposts'] == 0) {
            return tt_no_permission();
        }
        if ($mybb->user['uid'] != $post['uid']) {
            return tt_no_permission();
        }
        // Edit time limit
        $time = TIME_NOW;
        if ($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < $time - $mybb->settings['edittimelimit'] * 60) {
            $lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
            return xmlrespfalse($lang->edit_time_limit);
        }
    }
    // Check if this forum is password protected and we have a valid password
    tt_check_forum_password($forum['fid']);
    // Set up posthandler.
    require_once MYBB_ROOT . "inc/datahandlers/post.php";
    $posthandler = new PostDataHandler("update");
    $posthandler->action = "post";
    // Set the post data that came from the input to the $post array.
    $post = array("pid" => $pid, "subject" => $input['post_title'], "uid" => $mybb->user['uid'], "username" => $mybb->user['username'], "edit_uid" => $mybb->user['uid'], "message" => $input['post_content']);
    if (version_compare($mybb->version, '1.8.0', '>=') && !empty($input['editreason'])) {
        $post["editreason"] = $input['editreason'];
    }
    // get subscription status
    $query = $db->simple_select("threadsubscriptions", 'notification', "uid='" . intval($mybb->user['uid']) . "' AND tid='" . intval($tid) . "'");
    $substatus = $db->fetch_array($query);
    // Set up the post options from the input.
    $post['options'] = array("signature" => 1, "subscriptionmethod" => isset($substatus['notification']) ? $substatus['notification'] == 1 ? 'instant' : 'none' : '', "disablesmilies" => 0);
    $posthandler->set_data($post);
    // Now let the post handler do all the hard work.
    if (!$posthandler->validate_post()) {
        $post_errors = $posthandler->get_friendly_errors();
        return xmlrespfalse(implode(" :: ", $post_errors));
    } else {
        $postinfo = $posthandler->update_post();
        $visible = $postinfo['visible'];
        $first_post = $postinfo['first_post'];
        // Help keep our attachments table clean.
        $db->delete_query("attachments", "filename='' OR filesize<1");
        if ($visible == 0 && $first_post && !is_moderator($fid, "", $mybb->user['uid'])) {
            $state = 1;
        } else {
            if ($visible == 0 && !is_moderator($fid, "", $mybb->user['uid'])) {
                $state = 1;
            } else {
                $state = 0;
            }
        }
    }
    $pid = intval($pid);
    if (!empty($input['group_id_esc'])) {
        $db->update_query("attachments", array("pid" => $pid), "posthash='{$input['group_id_esc']}'");
    }
    // update thread attachment account
    if (count($input['attachment_id_array']) > 0) {
        update_thread_counters($tid, array("attachmentcount" => "+" . count($input['attachment_id_array'])));
    }
    $post = get_post($pid);
//.........这里部分代码省略.........
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:101,代码来源:save_raw_post.php


示例19: verify_post_check

}
if ($mybb->input['action'] == "do_undovote") {
    verify_post_check($mybb->get_input('my_post_key'));
    if ($mybb->usergroup['canundovotes'] != 1) {
        error_no_permission();
    }
    $query = $db->simple_select("polls", "*", "pid='" . $mybb->get_input('pid', MyBB::INPUT_INT) . "'");
    $poll = $db->fetch_array($query);
    if (!$poll['pid']) {
        error($lang->error_invalidpoll);
    }
    $plugins->run_hooks("polls_do_undovote_start");
    $poll['numvotes'] = (int) $poll['numvotes'];
    // We do not have $forum_cache available here since no forums permissions are checked in undo vote
    // Get thread ID and then get forum info
    $thread = get_thread($poll['tid']);
    if (!$thread || $thread['visible'] == 0) {
        error($lang->error_invalidthread);
    }
    $fid = $thread['fid'];
    // Get forum info
    $forum = get_forum($fid);
    if (!$forum) {
        error($lang->error_invalidforum);
    } else {
        // Is our forum closed?
        if ($forum['open'] == 0) {
            // Doesn't look like it is
            error($lang->error_closedinvalidforum);
        }
    }
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:polls.php


示例20: xthreads_upload_attachments_global

function xthreads_upload_attachments_global()
{
    //if($mybb->request_method == 'post' && ($current_page == 'newthread.php' || ($current_page == 'editpost.php' && $mybb->input['action'] != 'deletepost'))
    // the above line is always checked and true
    global $mybb, $current_page, $thread;
    if ($current_page == 'editpost.php') {
        // check if first post
        $pid = (int) $mybb->input['pid'];
        if (!$thread) {
            $post = get_post($pid);
            if (!empty($post)) {
                $thread = get_thread($post['tid']);
            }
            if (empty($thread)) {
                return;
            }
            $pid = $post['pid'];
        }
        if ($thread['firstpost'] != $pid) {
            return;
        }
    } elseif ($mybb->input['tid']) {
        /* ($mybb->input['action'] == 'editdraft' || $mybb->input['action'] == 'savedraft') && */
        $thread = get_thread((int) $mybb->input['tid']);
        if ($thread['visible'] != -2 || $thread['uid'] != $mybb->user['uid']) {
            // ensure that this is, indeed, a draft
            unset($GLOBALS['thread']);
        }
    }
    // permissions check - ideally, should get MyBB to do this, but I see no easy way to implement it unfortunately
    if ($mybb->user['suspendposting'] == 1) {
        return;
    }
    if ($thread['fid']) {
        $fid = $thread['fid'];
    } else {
        $fid = (int) $mybb->input['fid'];
    }
    $forum = get_forum($fid);
    if (!$forum['fid'] || $forum['open'] == 0 || $forum['type'] != 'f') {
        return;
    }
    $forumpermissions = forum_permissions($fid);
    if ($forumpermissions['canview'] == 0) {
        return;
    }
    if ($current_page == 'newthread.php' && $forumpermissions['canpostthreads'] ==  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_thread_by_tid函数代码示例发布时间:2022-05-15
下一篇:
PHP get_themes函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap