示例#1
0
 /**
  * Generate a valid display link for the Blog
  *
  * @param	object	PostId of the item to use
  * @param	array	Not used
  * @return	object	Fully formatted html link for use by Liberty
  */
 function getDisplayLink($pTitle = NULL, $pMixed = NULL, $pAnchor = NULL)
 {
     global $gBitSystem;
     if (empty($pTitle) && !empty($this)) {
         $pTitle = $this->getField('title', $this->getContentTypeName());
     }
     if (empty($pMixed) && !empty($this)) {
         $pMixed = $this->mInfo;
     }
     $ret = $pTitle;
     if ($gBitSystem->isPackageActive('blogs')) {
         $ret = '<a title="' . htmlspecialchars(BitBlogPost::getTitle($pMixed)) . '" href="' . BitBlogPost::getDisplayUrlFromHash($pMixed) . '">' . htmlspecialchars(BitBlogPost::getTitle($pMixed)) . '</a>';
     }
     return $ret;
 }
示例#2
0
$listHash['max_records'] = $gContent->getField('max_posts');
$listHash['load_num_comments'] = TRUE;
$blogPosts = $blogPost->getList($listHash);
if (count($blogPosts)) {
    // If there're more records then assign next_offset
    $gBitSmarty->assignByRef('blogPosts', $blogPosts);
    $gBitSmarty->assign('listInfo', $listHash);
} elseif ($gContent->hasPostPermission()) {
    bit_redirect(BLOGS_PKG_URL . 'post.php?blog_id=' . $gContent->getField('blog_id'));
}
if ($gBitSystem->isFeatureActive('users_watches')) {
    if ($gBitUser->isValid() && isset($_REQUEST['watch_event'])) {
        if ($_REQUEST['watch_action'] == 'add') {
            $blogPost = new BitBlogPost($_REQUEST['watch_object']);
            if ($blogPost->load()) {
                $gBitUser->storeWatch($_REQUEST['watch_event'], $_REQUEST['watch_object'], tra('blog'), $blogPost->getTitle(), $blogPost->getDisplayUrl());
            }
        } else {
            $gBitUser->expungeWatch($_REQUEST['watch_event'], $_REQUEST['watch_object']);
        }
    }
    $gBitSmarty->assign('user_watching_blog', 'n');
    if ($watch = $gBitUser->getEventWatches('blog_post', $listHash['blog_id'])) {
        $gBitSmarty->assign('user_watching_blog', 'y');
    }
}
$gBitSmarty->assign('descriptionLength', $gBitSystem->getConfig('blog_posts_description_length', 500));
$gBitSmarty->assign('showDescriptionsOnly', TRUE);
if ($gBitSystem->isFeatureActive('blog_ajax_more') && $gBitThemes->isJavascriptEnabled()) {
    $gBitSmarty->assign('ajax_more', TRUE);
    $gBitThemes->loadAjax('mochikit', array('Iter.js', 'DOM.js', 'Style.js', 'Color.js', 'Position.js', 'Visual.js'));