Esempio n. 1
0
 * Params: 
 * - title : if is "title", show the title of the post, else show the date of creation
 * - b : numeric id of board to show posts from
 * - all_boards : display posts from all boards. Default behavior is to auto-track to board you are in.
 *
 * @version $Header$
 * @package boards
 * @subpackage modules
 */
/**
 * required setup
 */
include_once BOARDS_PKG_PATH . 'BitBoardPost.php';
global $gBitSmarty, $gQueryUserId, $gBitSystem, $moduleParams;
if (!empty($moduleParams)) {
    extract($moduleParams);
}
$listHash = array('user_id' => $gQueryUserId, 'sort_mode' => 'created_desc', 'max_records' => $module_rows);
if (!empty($module_params['b'])) {
    $listHash['board_id'] = $module_params['b'];
} elseif (!empty($_REQUEST['b']) && empty($module_params['all_boards'])) {
    $listHash['board_id'] = $_REQUEST['b'];
}
$_template->tpl_vars['modRecentPostsBoardId'] = new Smarty_variable(!empty($listHash['board_id']));
if (BitBase::verifyId($gQueryUserId)) {
    $listHash['user_id'] = $gQueryUserId;
}
$post = new BitBoardPost();
if ($postList = $post->getList($listHash)) {
    $_template->tpl_vars['modLastBoardPosts'] = new Smarty_variable($postList);
}
Esempio n. 2
0
$rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time'));
$title = tra("Recent Discussions");
$description = tra("All recent forum discussions on " . $gBitSystem->getConfig('site_title'));
if ($gContent->isValid()) {
    $gContent->parseData();
    $title = $gContent->getField('title') . " Feed";
    $description = $gContent->getField('parsed_data');
}
$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;
Esempio n. 3
0
    }
}
// Load up the board
require_once BOARDS_PKG_PATH . 'lookup_inc.php';
if (!$gContent->isValid()) {
    $gBitSystem->fatalError("The board you requested could not be found. <a href='" . BOARDS_PKG_URL . "'>View all boards</a>", NULL, NULL, HttpStatusCodes::HTTP_GONE);
}
// approve or reject ananymous comments
if (!empty($_REQUEST['action'])) {
    // Check edit perms on the group
    $gContent->verifyUpdatePermission();
    // Check the ticket
    $gBitUser->verifyTicket();
    // Load up the comment as a board post
    require_once BOARDS_PKG_PATH . 'BitBoardPost.php';
    $comment = new BitBoardPost($_REQUEST['comment_id']);
    $comment->loadComment();
    if (!$comment->isValid()) {
        $gBitSystem->fatalError("Invalid Comment Id");
    }
    // Take action
    switch ($_REQUEST['action']) {
        case 1:
            // Aprove
            $comment->modApprove();
            break;
        case 2:
            // Reject
            $comment->modReject();
            break;
        default:
Esempio n. 4
0
function group_comment_store(&$pObject, &$pParamHash)
{
    global $gBitSystem, $gLibertySystem, $gBitUser;
    $errors = NULL;
    if ($gBitSystem->isPackageActive('group') && $gBitSystem->isPackageActive('switchboard')) {
        if ($pObject->isValid() && $pObject->isContentType(BITCOMMENT_CONTENT_TYPE_GUID) && $pObject->loadComment() && $pObject->mInfo['content_status_id'] == 50) {
            // load up the root, we need to know a few things
            $root = LibertyBase::getLibertyObject($pParamHash['root_id']);
            // if its a board and it does not have a mailing list in effect then we can send an email
            if ($root->mType['content_type_guid'] == 'bitboard' && !$root->getPreference('boards_mailing_list')) {
                // Get the groups the root is in
                $listHash['mapped_content_id'] = $pParamHash['root_id'];
                $listHash['offset'] = 0;
                $group = new BitGroup();
                $groups = $group->getList($listHash);
                // Get the link
                require_once BOARDS_PKG_PATH . 'BitBoardPost.php';
                $post = new BitBoardPost($pObject->mCommentId);
                $post->load();
                $link = BIT_BASE_URI . $post->getDisplayUrl();
                // some text we need
                $permaLink = BIT_BASE_URI . $pObject->getDisplayUrlFromHash(array('parent_id' => $pParamHash['root_id'], 'content_id' => $pParamHash['content_id']));
                $parseHash = $pParamHash['content_store'];
                $parseHash['uri_mode'] = TRUE;
                $parsedData = $pObject->parseData($parseHash);
                if (!empty($groups)) {
                    foreach ($groups as $group) {
                        // Draft the message body:
                        $body = tra('A new message was posted to the group') . ' ' . $group['title'] . '<br/><br/>' . tra('The message was posted here:') . ' ' . $link . '<br/><br/><br/>' . '/----- ' . tra('Here is the posted text') . ' -----/<br/><br/>' . $parsedData;
                        global $gSwitchboardSystem;
                        $gSwitchboardSystem->sendEvent('group', 'message', $group['content_id'], array('subject' => tra('Group') . ': ' . $group['title'] . ' : ' . $pParamHash['title'], 'message' => $body));
                    }
                }
            }
        }
    }
}
Esempio n. 5
0
function migrate_phpbb_topic($pTopicId, &$pRootComment)
{
    global $db;
    $sql = "SELECT bbp.*, bbpt.* FROM " . POSTS_TABLE . " bbp\n\t\t\t\tINNER JOIN " . POSTS_TEXT_TABLE . " bbpt ON(bbpt.post_id=bbp.post_id)  \n\t\t\t\tINNER JOIN " . TOPICS_TABLE . " bbt ON(bbt.topic_id=bbp.topic_id)  \n\t\t\tWHERE bbp.topic_id={$pTopicId} AND bbp.post_id != bbt.topic_first_post_id\n\t\t\tORDER BY bbp.post_time ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, "Could not obtain topic/post information.", '', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result)) {
        print "Migrating Post {$row['post_id']}<br/>\n";
        $commentHash = array();
        $commentHash['root_id'] = $pRootComment->getField('root_id');
        $commentHash['parent_id'] = $pRootComment->getField('content_id');
        $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'] = $row['post_edit_time'];
        $commentHash['user_id'] = $row['poster_id'];
        $commentHash['modifier_user_id'] = $row['poster_id'];
        $commentHash['ip'] = decode_ip($row['poster_ip']);
        $newComment = new LibertyComment();
        if ($newComment->storeComment($commentHash)) {
            $postHash['migrate_post_id'] = $row['post_id'];
            $newPost = new BitBoardPost($newComment->mCommentId);
            $newPost->store($postHash);
        } else {
            vd($row);
            vd($commentHash);
            vd($newComment->mErrors);
            die;
        }
    }
}
Esempio n. 6
0
        }
        static $sent = false;
        if (!$sent) {
            header("HTTP/1.0 500 Internal Server Error");
            echo "<h1>PHP Exception</h1>";
            $sent = true;
        }
        $str = "<br />\n<b>{$errortype[$errno]['desc']}</b>: {$errstr} in <b>{$errfile}</b> on line <b>{$errline}</b>\n<br />\n";
        echo $str;
        //. "<pre>". htmlspecialchars(var_export($vars,true))."</pre>";
        if ($l > 0) {
            ob_start();
            echo $body;
        }
    }
}
set_error_handler("ajax_nice_error");
switch ($_GET['req']) {
    case 10:
        require_once BOARDS_PKG_PATH . 'BitBoardPost.php';
        $comment = new BitBoardPost($_GET['comment_id']);
        $comment->loadMetaData();
        if (@$comment->verifyId($comment->mCommentId)) {
            print $comment->mInfo['warned_message'];
        } else {
            trigger_error(var_export($comment->mErrors, true));
        }
        break;
    default:
        break;
}
Esempio n. 7
0
// if we're getting a migrate id then lets move on right away
if (@BitBase::verifyId($_REQUEST['migrate_topic_id'])) {
    if ($_REQUEST['t'] = BitBoardTopic::lookupByMigrateTopic($_REQUEST['migrate_topic_id'])) {
        bit_redirect(BOARDS_PKG_URL . 'index.php?t=' . $_REQUEST['t']);
    }
} elseif (@BitBase::verifyId($_REQUEST['migrate_post_id'])) {
    if ($_REQUEST['t'] = BitBoardTopic::lookupByMigratePost($_REQUEST['migrate_post_id'])) {
        bit_redirect(BOARDS_PKG_URL . 'index.php?t=' . $_REQUEST['t']);
    }
}
// @TODO move this to edit_post
if (!empty($_REQUEST['action'])) {
    // Now check permissions to access this page
    // @TODO load up the parent board and call verifyUpdatePermission
    $gBitSystem->verifyPermission('p_boards_update');
    $comment = new BitBoardPost($_REQUEST['comment_id']);
    $comment->loadComment();
    if (!$comment->isValid()) {
        $gBitSystem->fatalError(tra("Invalid Comment"), NULL, NULL, HttpStatusCodes::HTTP_GONE);
    }
    switch ($_REQUEST['action']) {
        case 1:
            // Aprove
            $comment->modApprove();
            break;
        case 2:
            // Reject
            $comment->modReject();
            break;
        case 3:
            //Moderate