// if a content_type has been requested the user just wants a list of that if (isset($moduleParams['content_type_guid'])) { $contentListHash['content_type_guid'] = $moduleParams['content_type_guid']; if (isset($allowedContentTypes[$moduleParams['content_type_guid']])) { $gBitSmarty->assign("reqContentType", $allowedContentTypes[$moduleParams['content_type_guid']]); } } $contentList = $gContent->getContentList($contentListHash); $gBitSmarty->assign_by_ref("contentList", $contentList); // topics from related board $listHash = array("connect_group_content_id" => $gContent->mContentId, "content_type_guid" => "bitboard", "sort_mode" => "created_asc"); $list = $gContent->getContentList($listHash); if ($listHash['cant']) { $gBitSmarty->assign('board_id', $list[0]['board_id']); // if a content_type has been requested the user just wants a list of that - no discussion topics if (empty($moduleParams['content_type_guid'])) { /* boards package dependancy * we're only expecting one board to be associated with the group. * if more than one is to be allowed then maybe some support for handling * that would need to be added here. for now we get only the discussion * topics of the oldest board, which is automagically created when the group * is created. */ require_once BOARDS_PKG_PATH . 'BitBoardTopic.php'; $topicsHash = array("content_id" => $list[0]['content_id']); $topic = new BitBoardTopic(); $topics = $topic->getList($topicsHash); $gBitSmarty->assign_by_ref('topics', $topics); } } }
} $rss->title = $title; $rss->description = $description; $rss->link = $gContent->getDisplayUri(); // get all topics of a board or all recent topics in general switch ($gContent->getField('content_type_guid')) { case 'bitcomment': // need to use post class to get list of comments $gComment = new BitBoardPost($_REQUEST['t']); // pass in a reference to the root object so that we can do proper permissions checks $gComment->mRootObj = $gContent; $feeds = $gComment->getComments($gContent->mContentId, $gBitSystem->getConfig('boards_rss_max_records', 10), 0, 'commentDate_desc', 'flat'); break; case 'bitboard': default: $topic = new BitBoardTopic(); $pParamHash = array(); if (!empty($_REQUEST['b'])) { $pParamHash['b'] = $_REQUEST['b']; } $pParamHash['find'] = ''; $pParamHash['sort_mode'] = "llc_last_modified_desc"; $pParamHash['max_records'] = $gBitSystem->getConfig('boards_rss_max_records', 10); $pParamHash['offset'] = 0; $feeds = $topic->getList($pParamHash); break; } // get all the data ready for the feed creator foreach ($feeds as $feed) { /* echo "<pre>";
function isLockedMsg($parent_id) { // $parentComment = new LibertyComment(NULL,$parent_id); // $topicId = $parentComment->mInfo['thread_forward_sequence']; if (!empty($parent_id)) { return BitBoardTopic::isLocked($parent_id); } return false; }
$gBitSmarty->assign_by_ref('comments', $commentsTree); $gBitSmarty->assign('maxComments', $maxComments); $numCommentPages = ceil($numComments / $maxComments); $comments_return_url = $comments_return_url . (!strpos($comments_return_url, '?') ? '?' : ''); // libertypagination smarty function setup $commentsPgnHash = array('numPages' => $numCommentPages, 'pgnName' => 'comment_page', 'page' => $currentPage, 'comment_page' => $currentPage, 'url' => $comments_return_url, 'comments_page' => empty($comments_on_separate_page) ? FALSE : $comments_on_separate_page, 'ianchor' => 'editcomments'); $gBitSmarty->assign_by_ref('commentsPgnHash', $commentsPgnHash); $gBitSmarty->assign_by_ref('postComment', $postComment); $gBitSmarty->assign_by_ref('gComment', $gComment); $gBitSmarty->assign('currentTimestamp', time()); $gBitSmarty->assign('comments_return_url', $comments_return_url); $gBitSmarty->assign('comments_at_top_of_page', isset($comments_at_top_of_page) && $gBitSystem->getConfig('comments_reorganise_page_layout', 'n') == 'y' ? $comments_at_top_of_page : NULL); $gBitSmarty->assign('comments_style', $comments_display_style); $gBitSmarty->assign('comments_sort_mode', $comments_sort_mode); $gBitSmarty->assign('textarea_id', 'commentpost'); $gBitSmarty->assign('comments_count', $numComments); // @TODO get this shit out of here - boards and any other package ridding on comments should make use of services if ($gBitSystem->isPackageActive('boards')) { require_once BOARDS_PKG_PATH . 'BitBoardTopic.php'; } // @TODO get this shit out of here - boards and any other package ridding on comments should make use of services // this clearly can go in an edit service, but need to be careful since comments currently does not call edit service - have to check what doing so might trigger. if (!empty($_REQUEST['post_comment_request'])) { if ($gBitSystem->isPackageActive('boards') && BitBoardTopic::isLockedMsg(@BitBase::verifyId($storeComment->mInfo['parent_id']) ? $storeComment->mInfo['parent_id'] : (!@BitBase::verifyId($_REQUEST['post_comment_reply_id']) ? $commentsParentId : $_REQUEST['post_comment_reply_id']))) { unset($_REQUEST['post_comment_request']); unset($_GET['post_comment_request']); unset($_POST['post_comment_request']); $formfeedback['warning'] = "The selected Topic is Locked posting is disabled"; } } }
* A mass remove topics request might be made, handle it, perms are checked in the include, it does not require board edit perms necessarily. * Code is moved to edit_topic_inc to try to make this all a little more sane. * * @TODO perhaps move this into the action process above */ require_once BOARDS_PKG_PATH . 'edit_topic_inc.php'; // Ok finally we can get on with viewing our board // liberty display services $displayHash = array('perm_name' => 'p_boards_read'); $gContent->invokeServices('content_display_function', $displayHash); // set some comment values since topics are comments $commentsParentId = $gContent->mContentId; $comments_return_url = BOARDS_PKG_URL . "index.php?b=" . urlencode($gContent->mBitBoardId); // @TODO not clear why we load up comments and topics after this when its likely to get both. If someone figures it out please clarify. require_once BOARDS_PKG_PATH . 'boards_comments_inc.php'; // get the topics for this board require_once BOARDS_PKG_PATH . 'BitBoardTopic.php'; $threads = new BitBoardTopic($gContent->mContentId); // lets pass in a ref to the root obj so we can fully mimic comments $threads->mRootObj = $gContent; $threadsListHash = $_REQUEST; $threadList = $threads->getList($threadsListHash); $gBitSmarty->assignByRef('threadList', $threadList); // getList() has now placed all the pagination information in $_REQUEST['listInfo'] $gBitSmarty->assignByRef('listInfo', $threadsListHash['listInfo']); $gBitSmarty->assignByRef('board', $gContent); $gBitSmarty->assign('cat_url', BOARDS_PKG_URL . "index.php"); //?ct=".urlencode($gContent->mInfo['content_type_guid'])); $gBitThemes->loadAjax('mochikit'); // Display the template $gBitSystem->display('bitpackage:boards/list_topics.tpl', tra('Message Board Threads: ' . $gContent->getField('title')), array('display_mode' => 'display'));
function migrate_phpbb_forum($pForumId, $pForumContentId) { global $db, $gBitDb; $sql = "SELECT * FROM " . TOPICS_TABLE . " bbt \n\t\t\t\tINNER JOIN " . POSTS_TABLE . " bbp ON(bbt.topic_first_post_id=bbp.post_id) \n\t\t\t\tINNER JOIN " . POSTS_TEXT_TABLE . " bbpt ON(bbpt.post_id=bbp.post_id) \n\t\t\tWHERE bbt.forum_id={$pForumId}\n\t\t\tORDER BY bbt.topic_id"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not obtain topic/post information.", '', __LINE__, __FILE__, $sql); } $gBitDb->StartTrans(); while ($row = $db->sql_fetchrow($result)) { $commentHash = array(); $commentHash['root_id'] = $pForumContentId; $commentHash['parent_id'] = $pForumContentId; $commentHash['anon_name'] = $row['post_username']; $commentHash['title'] = $row['post_subject']; $commentHash['edit'] = $row['post_text']; $commentHash['format_guid'] = 'bbcode'; $commentHash['created'] = $row['post_time']; $commentHash['last_modified'] = !empty($row['post_edit_time']) ? $row['post_edit_time'] : $row['post_time']; $commentHash['user_id'] = $row['poster_id']; $commentHash['modifier_user_id'] = $row['poster_id']; $commentHash['ip'] = decode_ip($row['poster_ip']); $rootComment = new LibertyComment(); print "Migrating Topic {$row['topic_id']}<br/>\n"; if ($rootComment->storeComment($commentHash)) { print "Migrating Post {$row['post_id']}<br/>\n"; flush(); $topicHash['root_id'] = $rootComment->mContentId; $topicHash['is_moved'] = $row['topic_moved_id']; $topicHash['is_sticky'] = !empty($row['topic_type']) ? '1' : NULL; $topicHash['is_moved'] = $row['topic_status'] == 2 ? '1' : NULL; $topicHash['migrate_topic_id'] = $row['topic_id']; $rootTopic = new BitBoardTopic($rootComment->mContentId); $rootTopic->store($topicHash); migrate_phpbb_topic($row['topic_id'], $rootComment); } else { vd($row); vd($commentHash); vd($rootComment->mErrors); die; } } $gBitDb->CompleteTrans(); $db->sql_freeresult($result); }
/** * Generates the URL to the bitboard page * @return the link to display the page. */ public static function getDisplayUrlFromHash(&$pParamHash) { global $gBitSystem; $ret = NULL; if (!empty($pParamHash['comment']) && !empty($pParamHash['comment']['thread_forward_sequence'])) { // look up base of comment sequece which is BitBoardTopic $seq = explode(".", $pParamHash['comment']['thread_forward_sequence']); $topicRootId = (int) $seq[0]; if (BitBase::verifyId($topicRootId)) { require_once BOARDS_PKG_PATH . 'BitBoardTopic.php'; $hash = array('topic_id' => $topicRootId); $ret = BitBoardTopic::getDisplayUrlFromHash($hash); // we're out of here with our topic url return $ret; } } if (BitBase::verifyId($pParamHash['board_id'])) { if ($gBitSystem->isFeatureActive('pretty_urls') || $gBitSystem->isFeatureActive('pretty_urls_extended')) { $rewrite_tag = $gBitSystem->isFeatureActive('pretty_urls_extended') ? 'view/' : ''; $ret = BOARDS_PKG_URL . $rewrite_tag . 'board/' . $pParamHash['board_id']; } else { $ret = BOARDS_PKG_URL . "index.php?b=" . $pParamHash['board_id']; } } else { $ret = parent::getDisplayUrlFromHash($pParamHash); } return $ret; }
$comment->modApprove(); break; case 2: // Reject $comment->modReject(); break; case 3: //Moderate $comment->loadMetaData(); $comment->modWarn($_REQUEST['warning_message']); default: break; } } // Finally - load up our topic $thread = new BitBoardTopic($_REQUEST['t']); $thread->load(); if (!$thread->isValid()) { $gBitSystem->fatalError(tra("Unknown discussion"), NULL, NULL, HttpStatusCodes::HTTP_GONE); } $thread->verifyViewPermission(); // load up the root board we need it $gBoard = new BitBoard(null, $thread->mInfo['board_content_id']); $gBoard->load(); $gBitSmarty->assignByRef('board', $gBoard); // force root board to be gContent $gContent =& $gBoard; $gBitSmarty->assignByRef('gContent', $gContent); // if you know what this is please comment it if (empty($thread->mInfo['th_root_id'])) { if ($_REQUEST['action'] == 3) {