Пример #1
0
<?php

/**
 * @version $Header$
 * @package articles
 * @subpackage functions
 */
/**
 * Initialization
 */
$gBitSmarty->assignByRef('article', $gContent->mInfo);
// get all the services that want to display something on this page
$displayHash = array('perm_name' => 'p_articles_read');
$gContent->invokeServices('content_display_function', $displayHash);
$topics = BitArticleTopic::getTopicList();
$gBitSmarty->assignByRef('topics', $topics);
// Comments engine!
if (@$gContent->mInfo['allow_comments'] == 'y') {
    $comments_vars = array('article');
    $comments_prefix_var = 'article:';
    $comments_object_var = 'article';
    $commentsParentId = $gContent->mContentId;
    $comments_return_url = $_SERVER['SCRIPT_NAME'] . "?article_id=" . $_REQUEST['article_id'];
    include_once LIBERTY_PKG_PATH . 'comments_inc.php';
}
// Display the Index Template
$gBitSystem->display('bitpackage:articles/read_article.tpl', @$gContent->mInfo['title'], array('display_mode' => 'display'));
Пример #2
0
<?php

/**
 * @version $Header$
 * @package articles
 * @subpackage functions
 */
/**
 * Initialization
 */
global $gContent;
require_once ARTICLES_PKG_PATH . 'BitArticle.php';
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if (empty($gContent) || !is_object($gContent)) {
    if (!empty($_REQUEST['topic_id']) && is_numeric($_REQUEST['topic_id'])) {
        $gContent = new BitArticleTopic($_REQUEST['topic_id']);
    } else {
        $gContent = new BitArticleTopic();
    }
    if (empty($gContent->mTopicId)) {
        //handle legacy forms that use plain 'article' form variable name
    } else {
        $gContent->loadTopic();
    }
    $gBitSmarty->assign_by_ref('gContent', $gContent);
}
Пример #3
0
    if (empty($_REQUEST['rating'])) {
        $_REQUEST['rating'] = 0;
    }
    if (empty($_REQUEST['topic_id'])) {
        $_REQUEST['topic_id'] = 0;
    }
    if ($gContent->store($_REQUEST)) {
        if (isset($gContent->mInfo['status_id']) and $gContent->mInfo['status_id'] == ARTICLE_STATUS_PENDING) {
            bit_redirect(ARTICLES_PKG_URL . "index.php?feedback=" . urlencode(tra('Your article has been submitted and is awaiting approval.')));
        } else {
            bit_redirect(ARTICLES_PKG_URL . ($gBitSystem->isFeatureActive('pretty_urls_extended') || $gBitSystem->isFeatureActive('pretty_urls') ? $gContent->mArticleId : "read.php?article_id=" . $gContent->mArticleId));
        }
    }
}
// Get a topic list
$topics = BitArticleTopic::getTopicList(array('active_topic' => TRUE));
$gBitSmarty->assign_by_ref('topics', $topics);
if (!empty($_REQUEST['topic'])) {
    $gBitSmarty->assign('topic', $_REQUEST['topic']);
}
// get list of valid types
$types = BitArticleType::getTypeList();
$gBitSmarty->assign_by_ref('types', $types);
if (!empty($gContent->mErrors) || !empty($feedback)) {
    $article = $gContent->preparePreview($_REQUEST);
    $gBitSmarty->assign_by_ref('article', $article);
}
$gBitSmarty->assign_by_ref('errors', $gContent->mErrors);
$gBitSmarty->assign('feedback', !empty($feedback) ? $feedback : NULL);
// Display the Index Template
$gBitSmarty->assign('show_page_bar', 'n');
Пример #4
0
 /**
  * Work out the URL to the image for this article
  * @param $pArticleId id of the article we need the image path for
  * @param $pBasePathOnly bool TRUE / FALSE - specify whether you want full path or just base path
  * @return URL on success, FALSE on failure
  * @access public
  **/
 public function getArticleImageStorageUrl($pArticleId = NULL, $pBasePathOnly = FALSE, $pForceRefresh = FALSE)
 {
     global $gBitSystem;
     $url = STORAGE_PKG_URL . ARTICLES_PKG_NAME . '/';
     if ($pBasePathOnly) {
         return $url;
     }
     if (!@BitBase::verifyId($pArticleId)) {
         if ($this->isValid()) {
             $pArticleId = $this->mArticleId;
         } else {
             return NULL;
         }
     }
     if (is_file(BitArticleTopic::getArticleImageStoragePath(NULL, TRUE) . BitArticleTopic::getArticleImageStorageName($pArticleId))) {
         return $url . BitArticleTopic::getArticleImageStorageName($pArticleId) . ($pForceRefresh ? "?" . $gBitSystem->getUTCTime() : '');
     } else {
         return FALSE;
     }
 }
Пример #5
0
 /**
  * Get the URL for any given article image
  * @param $pParamHash pass in full set of data returned from article query
  * @return url to image
  * @access public
  **/
 public static function getImageThumbnails($pParamHash)
 {
     global $gBitSystem, $gThumbSizes;
     $ret = NULL;
     $thumbHash['mime_image'] = FALSE;
     if (!empty($pParamHash['image_attachment_path'])) {
         $thumbHash['source_file'] = $pParamHash['image_attachment_path'];
         $ret = liberty_fetch_thumbnails($thumbHash);
     } elseif (!empty($pParamHash['has_topic_image']) && $pParamHash['has_topic_image'] == 'y') {
         $thumbHash['source_file'] = preg_replace("#^/+#", "", BitArticleTopic::getTopicImageStorageUrl($pParamHash['topic_id']));
         $ret = liberty_fetch_thumbnails($thumbHash);
     }
     return $ret;
 }