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


PHP Forum::canPostTopic方法代码示例

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


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

示例1: count

         $subforum_topics = count($subforum_topics);
         if ($forum->forumExist($subforum->id, $user->data()->group_id)) {
             $subforum_string .= '<a href="/forum/view_forum/?fid=' . $subforum->id . '">' . htmlspecialchars($subforum->forum_title) . '</a> <span class="badge" rel="tooltip" data-trigger="hover" data-original-title="' . $subforum_topics . ' ' . $forum_language['topics'] . '">' . $subforum_topics . '</span>, ';
         }
         $subforum_string = rtrim($subforum_string, ", ");
         // remove the last comma
     }
 } else {
     $subforum_string = '';
 }
 $smarty->assign('SUBFORUMS', $subforum_string);
 $smarty->assign('SUBFORUMS_LANGUAGE', $forum_language['subforums']);
 // No topics yet
 $smarty->assign('FORUM_TITLE', htmlspecialchars($forum_query->forum_title));
 $smarty->assign('NO_TOPICS', $forum_language['no_topics']);
 if ($user->isLoggedIn() && $forum->canPostTopic($fid, $user->data()->group_id)) {
     $smarty->assign('NEW_TOPIC_BUTTON', '<a style="display: inline;" href="/forum/new_topic/?fid=' . $fid . '" class="btn btn-primary">' . $forum_language['new_topic'] . '</a>');
 } else {
     $smarty->assign('NEW_TOPIC_BUTTON', '');
 }
 $smarty->assign('FORUMS', $forum_language['forums']);
 // Forums sidebar
 $forums = $forum->listAllForums($user->data()->group_id, true);
 // second parameter states we're in latest discussions view
 $sidebar_forums = array();
 foreach ($forums as $key => $item) {
     $item = array_filter($item);
     if (!empty($item)) {
         foreach ($item as $sub_forum) {
             // Get forum ID
             $forum_id = $queries->getWhere('forums', array('forum_title', '=', $sub_forum));
开发者ID:MistriHD,项目名称:Nameless,代码行数:31,代码来源:view_forum.php

示例2: Forum

}
$forum = new Forum();
$mentionsParser = new MentionsParser();
if (!isset($_GET['fid']) || !is_numeric($_GET['fid'])) {
    Redirect::to('/forum/error/?error=not_exist');
    die;
}
$fid = (int) $_GET['fid'];
// Does the forum exist, and can the user view it?
$list = $forum->forumExist($fid, $user->data()->group_id);
if (!$list) {
    Redirect::to('/forum/error/?error=not_exist');
    die;
}
// Can the user post a topic in this forum?
$can_reply = $forum->canPostTopic($fid, $user->data()->group_id);
if (!$can_reply) {
    Redirect::to('/forum/view_forum/?fid=' . $fid);
    die;
}
// Deal with any inputted data
if (Input::exists()) {
    if (Token::check(Input::get('token'))) {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('title' => array('required' => true, 'min' => 2, 'max' => 64), 'content' => array('required' => true, 'min' => 2, 'max' => 20480)));
        if ($validation->passed()) {
            try {
                $queries->create("topics", array('forum_id' => $fid, 'topic_title' => Input::get('title'), 'topic_creator' => $user->data()->id, 'topic_last_user' => $user->data()->id, 'topic_date' => date('U'), 'topic_reply_date' => date('U'), 'label' => Input::get('topic_label')));
                $topic_id = $queries->getLastId();
                $queries->create("posts", array('forum_id' => $fid, 'topic_id' => $topic_id, '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,代码来源:new_topic.php


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