<?php /** * @version $Header$ * @package articles * @subpackage functions */ /** * Initialization */ require_once ARTICLES_PKG_PATH . 'BitArticle.php'; require_once LIBERTY_PKG_PATH . 'lookup_content_inc.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 (@BitBase::verifyId($_REQUEST['article_id'])) { $gContent = new BitArticle($_REQUEST['article_id']); } elseif (@BitBase::verifyId($_REQUEST['content_id'])) { $gContent = new BitArticle(NULL, $_REQUEST['content_id']); } else { $gContent = new BitArticle(); $gContent->mInfo['expire_date'] = strtotime("+1 year"); } if (empty($gContent->mArticleId) && empty($gContent->mContentId)) { //handle legacy forms that use plain 'article' form variable name } else { $gContent->load(); } $gBitSmarty->clear_assign('gContent'); $gBitSmarty->assign('gContent', $gContent); }
<?php // $Header$ // Copyright( c )2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // All Rights Reserved. See below for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. // Initialization require_once '../kernel/setup_inc.php'; // Is package installed and enabled $gBitSystem->verifyPackage('articles'); require_once ARTICLES_PKG_PATH . 'BitArticle.php'; // Now check permissions to access this page $gBitSystem->verifyPermission('p_articles_read'); if (!empty($_REQUEST['article_id'])) { $param = array('article_id' => (int) $_REQUEST['article_id']); bit_redirect(BitArticle::getDisplayUrlFromHash($param)); } // Display the template $gDefaultCenter = 'bitpackage:articles/center_display_articles.tpl'; $gBitSmarty->assignByRef('gDefaultCenter', $gDefaultCenter); // Display the template $gBitSystem->display('bitpackage:kernel/dynamic.tpl', tra('Articles'), array('display_mode' => 'display'));
public function getTopicArticles() { if (!$this->mTopicId) { return NULL; } $sql = "SELECT `article_id` FROM `" . BIT_DB_PREFIX . "articles` WHERE `topic_id` = ?"; $rs = $this->mDb->query($sql, array($this->mTopicId)); $ret = array(); while ($row = $rs->fetchRow()) { $tmpArticle = new BitArticle($row['article_id']); $tmpArticle->load(); $ret[] = $tmpArticle; } }
if ($tmpArt->expunge()) { bit_redirect(ARTICLES_PKG_URL . 'list.php?status_id=' . (!empty($_REQUEST['status_id']) ? $_REQUEST['status_id'] : '')); } else { $feedback['error'] = $tmpArt->mErrors; } } $gBitSystem->setBrowserTitle(tra('Confirm removal of') . ' ' . $tmpArt->mInfo['title']); $formHash['remove'] = TRUE; $formHash['action'] = 'remove'; $formHash['status_id'] = !empty($_REQUEST['status_id']) ? $_REQUEST['status_id'] : ''; $formHash['remove_article_id'] = $_REQUEST['remove_article_id']; $msgHash = array('label' => tra('Remove Article'), 'confirm_item' => $tmpArt->mInfo['title'], 'warning' => tra('Remove the above article.'), 'error' => tra('This cannot be undone!')); $gBitSystem->confirmDialog($formHash, $msgHash); } } $article = new BitArticle(); // change the status of an article first if (!empty($_REQUEST['action'])) { if (!empty($_REQUEST['article_id']) && !empty($_REQUEST['set_status_id']) && $gBitUser->hasPermission('p_articles_approve_submission')) { $article->setStatus($_REQUEST['set_status_id'], $_REQUEST['article_id'], $_REQUEST['content_id']); } } if (empty($_REQUEST['status_id']) || !($gBitSystem->isFeatureActive('articles_auto_approve') && $gBitUser->isRegistered() || $gBitUser->hasPermission('p_articles_update_submission') || $gBitUser->hasPermission('p_articles_admin'))) { $_REQUEST['status_id'] = ARTICLE_STATUS_APPROVED; } $listArticles = $article->getList($_REQUEST); $topics = BitArticleTopic::getTopicList(); $gBitSmarty->assign('topics', $topics); $types = BitArticleType::getTypeList(); $gBitSmarty->assign('types', $types); $gBitSmarty->assign('listInfo', $_REQUEST['listInfo']);
<?php /** * @version $Header$ * @package articles * @subpackage functions */ if ($gBitSystem->isFeatureActive('articles_display_filter_bar') && ($gBitUser->isAdmin() || $gBitUser->hasPermission('p_articles_admin'))) { $filter['topic'][] = ''; $filter['type'][] = ''; $filter['status'][] = ''; $_topics = BitArticleTopic::getTopicList(); foreach ($_topics as $topic) { $filter['topic'][$topic['topic_id']] = $topic['topic_name']; } $_types = BitArticleType::getTypeList(); foreach ($_types as $type) { $filter['type'][$type['article_type_id']] = $type['type_name']; } $_statuses = BitArticle::getStatusList(); foreach ($_statuses as $status) { $filter['status'][$status['status_id']] = $status['status_name']; } $gBitSmarty->assign('filter', $filter); }
<?php /** * @version $Header$ * @package articles * @subpackage modules */ /** * Initialization */ include_once ARTICLES_PKG_PATH . 'BitArticle.php'; extract($moduleParams); $articles = new BitArticle(); $stati = array('pending', 'approved'); if (!empty($module_params['status']) && in_array($module_params['status'], $stati)) { $status_id = constant('ARTICLE_STATUS_' . strtoupper($module_params['status'])); } else { $status_id = ARTICLE_STATUS_APPROVED; } $sortOptions = array("last_modified_asc", "last_modified_desc", "created_asc", "created_desc", "publish_date_desc", "publish_date_asc", "expire_date_desc", "expire_date_asc"); if (!empty($module_params['sort_mode']) && in_array($module_params['sort_mode'], $sortOptions)) { $sort_mode = $module_params['sort_mode']; } else { $sort_mode = 'last_modified_desc'; } $getHash['status_id'] = $status_id; $getHash['sort_mode'] = $sort_mode; $getHash['max_records'] = !empty($module_rows) ? $module_rows : $gBitSystem->getConfig('articles_max_list'); $getHash['topic_name'] = !empty($module_params['topic_name']) ? $module_params['topic_name'] : NULL; $getHash['topic_id'] = !empty($module_params['topic_id']) ? $module_params['topic_id'] : NULL; $articlelist = $articles->getList($getHash);
require_once '../kernel/setup_inc.php'; $gBitSystem->verifyPackage('articles'); $gBitSystem->verifyPackage('rss'); $gBitSystem->verifyFeature('articles_rss'); require_once ARTICLES_PKG_PATH . "BitArticle.php"; require_once RSS_PKG_PATH . "rss_inc.php"; $rss->title = $gBitSystem->getConfig('articles_rss_title', $gBitSystem->getConfig('site_title') . ' - ' . tra('Articles')); $rss->description = $gBitSystem->getConfig('articles_rss_description', $gBitSystem->getConfig('site_title') . ' - ' . tra('RSS Feed')); // check permission to view articles if (!$gBitUser->hasPermission('p_articles_read')) { require_once RSS_PKG_PATH . "rss_error.php"; } else { // check if we want to use the cache file $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . ARTICLES_PKG_NAME . '/' . $cacheFileTail; $rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time')); $articles = new BitArticle(); $listHash = array('status_id' => ARTICLE_STATUS_APPROVED, 'sort_mode' => 'publish_date_desc', 'max_records' => $gBitSystem->getConfig('articles_rss_max_records', 10)); $feeds = $articles->getList($listHash); // set the rss link $rss->link = ARTICLES_PKG_URI; // get all the data ready for the feed creator foreach ($feeds as $feed) { $item = new FeedItem(); $item->title = $feed['title']; $item->link = $articles->getDisplayUrlFromHash($feed); // show the full article in the feed $parseHash['content_id'] = $feed['content_id']; $parseHash['format_guid'] = $feed['format_guid']; $parseHash['data'] = preg_replace(LIBERTY_SPLIT_REGEX, "", $feed['data']); $item->description = $articles->parseData($parseHash); $item->date = (int) $feed['publish_date'];
function data_articles($data, $params) { // No change in the parameters with Clyde global $gLibertySystem, $gBitSmarty, $gBitSystem; if ($gBitSystem->isPackageActive('articles')) { // Do not include this Plugin if the Package is not active // The next 2 lines allow access to the $pluginParams given above and may be removed when no longer needed $pluginParams = $gLibertySystem->mPlugins[PLUGIN_GUID_DATAARTICLES]; require_once ARTICLES_PKG_PATH . 'BitArticle.php'; require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php'; $module_params = $params; $articlesObject = new BitArticle(); $stati = array('pending', 'approved'); if (!empty($module_params['status']) && in_array($module_params['status'], $stati)) { $status_id = constant('ARTICLE_STATUS_' . strtoupper($module_params['status'])); } else { $status_id = ARTICLE_STATUS_APPROVED; } $sortOptions = array("last_modified_asc", "last_modified_desc", "created_asc", "created_desc", "random"); if (!empty($module_params['sort_mode']) && in_array($module_params['sort_mode'], $sortOptions)) { $sort_mode = $module_params['sort_mode']; } else { $sort_mode = 'last_modified_desc'; } $getHash = array(); $getHash['status_id'] = $status_id; $getHash['sort_mode'] = $sort_mode; $getHash['max_records'] = empty($module_params['max']) ? 1 : $module_params['max']; if (isset($module_params['topic'])) { $getHash['topic'] = !empty($module_params['topic']) ? $module_params['topic'] : NULL; } if (isset($module_params['topic_id'])) { $getHash['topic_id'] = $module_params['topic_id']; } $articles_results = $articlesObject->getList($getHash); $display_format = empty($module_params['format']) ? 'simple_title_list' : $module_params['format']; $display_result = ""; switch ($display_format) { case 'full': $display_result = '<div class="articles">'; $gBitSmarty->assign('showDescriptionsOnly', TRUE); foreach ($articles_results as $article) { $gBitSmarty->assign('article', $article); $gBitSmarty->assign('gContent', $articlesObject); $display_result .= $gBitSmarty->fetch('bitpackage:articles/article_display.tpl'); } $display_result .= '</div>'; $display_result = eregi_replace("\n", "", $display_result); break; case 'list': default: $display_result = "<ul>"; foreach ($articles_results as $article) { $link = $articlesObject->getdisplaylink($article['title'], $article); $display_result .= "<li>{$link}</li>\n"; } $display_result .= "</ul>\n"; break; } return $display_result; } else { return "<div class=error>The articles package is not active.</div>"; } }