本文整理汇总了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();
示例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;
示例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