Example #1
0
        $_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');
$gBitSystem->display('bitpackage:articles/edit_article.tpl', tra("Articles"), array('display_mode' => 'edit'));
Example #2
0
<?php

// $Header$
require_once '../../kernel/setup_inc.php';
require_once ARTICLES_PKG_PATH . 'BitArticle.php';
require_once ARTICLES_PKG_PATH . 'BitArticleType.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('articles');
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_articles_admin');
$artTypes = array('use_ratings' => array('name' => tra('Rate'), 'desc' => tra('Allow ratings by the author')), 'show_pre_publ' => array('name' => tra('Show before publish date'), 'desc' => tra('non-admins can view before the publish date')), 'show_post_expire' => array('name' => tra('Show after expire date'), 'desc' => tra('non-admins can view after the expire date')), 'heading_only' => array('name' => tra('Heading only'), 'desc' => tra('No article body, heading only')), 'allow_comments' => array('name' => tra('Comments'), 'desc' => tra('Allow comments for this type')), 'show_image' => array('name' => tra('Show image'), 'desc' => tra('Show topic or image')), 'show_avatar' => array('name' => tra('Show avatar'), 'desc' => tra('Show author\'s avatar')), 'show_author' => array('name' => tra('Show author'), 'desc' => tra('Show author\'s name')), 'show_pubdate' => array('name' => tra('Show publish date'), 'desc' => tra('Show publication date')), 'show_expdate' => array('name' => tra('Show expiration date'), 'desc' => tra('Show expiration date')), 'show_reads' => array('name' => tra('Show reads'), 'desc' => tra('Show the number of times an article has been read')), 'show_size' => array('name' => tra('Show size'), 'desc' => tra('Show the size of the article')), 'creator_edit' => array('name' => tra('Creator can edit'), 'desc' => tra('The person who submits an article of this type can edit it')));
$gBitSmarty->assign('artTypes', $artTypes);
$gContent = new BitArticleType(!empty($_REQUEST['article_type_id']) ? $_REQUEST['article_type_id'] : NULL);
if (isset($_REQUEST["add_type"])) {
    $gContent->storeType($_REQUEST);
} elseif (isset($_REQUEST["remove_type"])) {
    $gContent->removeType($_REQUEST['remove_type']);
} elseif (isset($_REQUEST["update_type"])) {
    foreach (array_keys($_REQUEST["type_array"]) as $this_type) {
        $storeHash['article_type_id'] = $this_type;
        foreach (array_keys($artTypes) as $option) {
            $storeHash[$option] = !empty($_REQUEST[$option][$this_type]) ? 'y' : 'n';
        }
        $storeHash['type_name'] = $_REQUEST['type_name'][$this_type];
        $gContent->storeType($storeHash);
    }
}
$types = BitArticleType::getTypeList();
$gBitSmarty->assign('types', $types);
// Display the template
$gBitSystem->display('bitpackage:articles/admin_types.tpl', tra('Edit Article Types'), array('display_mode' => 'admin'));