Exemplo n.º 1
0
                $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']);
$gBitSmarty->assign('listpages', $listArticles);
// Display the template
$gBitSystem->display('bitpackage:articles/list_articles.tpl', tra("Articles"), array('display_mode' => 'list'));
Exemplo n.º 2
0
$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'];
        $item->source = BIT_ROOT_URI;
        $item->author = $feed['author_name'];
Exemplo n.º 3
0
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);
if ((!empty($module_params['topic_id']) || !empty($module_params['topic_name'])) && empty($moduleParams['title']) && !empty($articles)) {
    $_template->tpl_vars['moduleTitle'] = new Smarty_variable($articles[0]['topic_name']);
} elseif (!empty($moduleParams['title'])) {
    $_template->tpl_vars['moduleTitle'] = new Smarty_variable($moduleParams['title']);
} else {
    $_template->tpl_vars['moduleTitle'] = new Smarty_variable("Articles");
}
$_template->tpl_vars['params'] = new Smarty_variable(!empty($moduleParams['params']));
$_template->tpl_vars['listtype'] = new Smarty_variable(isset($module_params['list_type']) && strncasecmp($module_params['list_type'], 'u', 1) == 0 ? 'ul' : 'ol');
$_template->tpl_vars['modArticles'] = new Smarty_variable($articlelist);
Exemplo n.º 4
0
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>";
    }
}