当前位置: 首页>>代码示例>>PHP>>正文


PHP Forum::getPosts方法代码示例

本文整理汇总了PHP中Forum::getPosts方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::getPosts方法的具体用法?PHP Forum::getPosts怎么用?PHP Forum::getPosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Forum的用法示例。


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

示例1: Forum

<?php

if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$id = $_GET["id"] + 0;
$forum = new Forum();
if ($page->isPostBack()) {
    $forum->add($id, $page->users->currentUserId(), "", $_POST["addReply"]);
    header("Location:" . WWW_TOP . "/forumpost/" . $id . "#last");
    die;
}
$results = $forum->getPosts($id);
if (count($results) == 0) {
    header("Location:" . WWW_TOP . "/forum");
    die;
}
$page->meta_title = "Forum Post";
$page->meta_keywords = "view,forum,post,thread";
$page->meta_description = "View forum post";
$page->smarty->assign('results', $results);
$page->smarty->assign('privateprofiles', $page->settings->getSetting('privateprofiles') == 1 ? true : false);
$page->content = $page->smarty->fetch('forumpost.tpl');
$page->render();
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:24,代码来源:forumpost.php

示例2: httpResponse

     httpResponse($forum->getTopic($params[3]));
     break;
 case validateRoute('DELETE', 'forums/\\d+/topics/\\d+'):
     $forum = new Forum($db, $user);
     $user->updateLastForumAccess();
     httpResponse($forum->deleteTopic($params[1], $params[3]));
     break;
 case validateRoute('PATCH', 'forums/\\d+/topics/\\d+'):
     $forum = new Forum($db, $user);
     $user->updateLastForumAccess();
     httpResponse($forum->updateTopic($params[3], $postdata));
     break;
 case validateRoute('GET', 'forums/\\d+/topics/\\d+/posts'):
     $forum = new Forum($db, $user);
     $user->updateLastForumAccess();
     list($result, $totalCount) = $forum->getPosts((int) $params[3], (int) $_GET["limit"] ?: 10, (int) $_GET["index"] ?: 0);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('POST', 'forums/\\d+/topics'):
     $forum = new Forum($db, $user);
     $user->updateLastForumAccess();
     $topicId = $forum->addTopic((int) $params[1], $postdata["subject"], $postdata["sub"] ?: '', $postdata["body"]);
     httpResponse(array("topicId" => $topicId));
     break;
 case validateRoute('POST', 'forums/\\d+/topics/\\d+/posts'):
     $mailbox = new Mailbox($db, $user);
     $forum = new Forum($db, $user, $mailbox);
     $user->updateLastForumAccess();
     $forum->addPost((int) $params[3], $postdata);
     httpResponse($result, $totalCount);
     break;
开发者ID:lordgabber,项目名称:rartracker,代码行数:31,代码来源:api-v1.php

示例3: array

        } else {
            Redirect::to('/forum/view_topic/?tid=' . $tid . '#post-' . $_GET['pid']);
            die;
        }
    } else {
        Redirect::to('/forum/error/?error=not_exist');
        die;
    }
}
// Get the topic information
$topic = $queries->getWhere("topics", array("id", "=", $tid));
$topic = $topic[0];
// Assign author + title to Smarty variables
$smarty->assign(array('TOPIC_TITLE' => htmlspecialchars($topic->topic_title), 'TOPIC_AUTHOR_USERNAME' => htmlspecialchars($user->idToName($topic->topic_creator)), 'TOPIC_AUTHOR_MCNAME' => htmlspecialchars($user->idToMCName($topic->topic_creator))));
// Get all posts in the topic
$posts = $forum->getPosts($tid);
// Can the user post a reply in this topic?
$can_reply = $forum->canPostReply($topic->forum_id, $user->data()->group_id);
// Quick reply
if (Input::exists()) {
    if (!$user->isLoggedIn() && !$can_reply) {
        Redirect::to('/forum');
        die;
    }
    if (Token::check(Input::get('token'))) {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('content' => array('required' => true, 'min' => 2, 'max' => 20480)));
        if ($validation->passed()) {
            try {
                $queries->create("posts", array('forum_id' => $topic->forum_id, 'topic_id' => $tid, 'post_creator' => $user->data()->id, 'post_content' => htmlspecialchars(Input::get('content')), 'post_date' => date('Y-m-d H:i:s')));
                // Get last post ID
开发者ID:NamelessMC,项目名称:Nameless,代码行数:31,代码来源:view_topic.php


注:本文中的Forum::getPosts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。