Example #1
0
    /* May be show some comments :) */
    $comments = articles_get_comments($catid, $id, $work_dir);
    if (!empty($comments)) {
        $system->showModuleWindow($lang['articles']['comments'], rcms_parse_module_template('comment.tpl', $comments), 'center');
    }
    /* If comments are enabled in this article, show form */
    if ($article['comments'] == 'yes') {
        $system->showModuleWindow($lang['articles']['postcomment'], rcms_parse_module_template('comment-post.tpl', $comments), 'center');
    }
} elseif (!empty($catid) && !empty($id)) {
    $system->registerModule('', $lang['results']['articles'][10], 'center');
} elseif (!empty($id)) {
    /*********************************************************************************
    * List of articles in category                                                   *
    *********************************************************************************/
    $contents = articles_get_articles_list($id, true, 1, $work_dir);
    if ($contents !== false) {
        $result = '';
        $cat_data = articles_get_category($id, true, $work_dir);
        $system->config['pagename'] = $lang['articles']['categ'] . ' ' . $cat_data['title'];
        if (!empty($contents)) {
            $contents = array_reverse($contents);
            if (!empty($system->config['perpage'])) {
                $pages = ceil(count($contents) / $system->config['perpage']);
                if (!empty($_GET['page']) && (int) $_GET['page'] > 0) {
                    $page = (int) $_GET['page'] - 1;
                } else {
                    $page = 0;
                }
                $start = $page * $system->config['perpage'];
                $total = $system->config['perpage'];
if (!empty($article) && !empty($category)) {
    $article_data = articles_get($category, $article, false, 2, $work_dir);
    $frm = new InputForm('', 'post', $lang['general']['submit'], '', 'multipart/form-data', 'arted');
    $frm->addbreak($lang['admincp']['articles']['manage']['edit'] . ': ' . $article_data['title']);
    $frm->addrow($lang['articles']['categ'], $frm->select_tag('a_category', $categories_list, $article_data['catid']), 'top');
    $frm->addrow($lang['articles']['subj'], $frm->text_box('a_title', $article_data['title']), 'top');
    $frm->addrow($lang['articles']['author'], $frm->text_box('a_src', $article_data['src']), 'top');
    $frm->addrow('', rcms_show_bbcode_panel('document.arted.a_description'));
    $frm->addrow($lang['articles']['desc'], $frm->textarea('a_description', str_replace('<br />', '', $article_data['desc']), 70, 5), 'top');
    $frm->addrow('', rcms_show_bbcode_panel('document.arted.a_text'));
    $frm->addrow($lang['articles']['text'], $frm->textarea('a_text', str_replace('<br />', '', $article_data['text']), 70, 25), 'top');
    $frm->addrow($lang['articles']['mode'], $frm->radio_button('a_mode', $lang['articles']['modes'], $article_data['mode']), 'top');
    $frm->addrow($lang['articles']['allowcomments'], $frm->radio_button('a_comments', array('yes' => $lang['admincp']['allow'], 'no' => $lang['admincp']['disallow']), $article_data['comments']), 'top');
    $frm->hidden('editflag', '1');
    $frm->hidden('edit', $article);
    $frm->hidden('category', $category);
    $frm->show();
} elseif (!empty($category)) {
    $category_name = $categories_list[$category];
    $articles = articles_get_articles_list($category, false, 0, $work_dir);
    $frm = new InputForm('', 'post', $lang['general']['submit'], '', 'multipart/form-data');
    $frm->resetButton($lang['general']['reset']);
    $frm->addbreak($lang['admincp']['articles']['manage']['full'] . ': ' . $category_name);
    if (!empty($articles)) {
        foreach ($articles as $id => $article) {
            $frm->addrow($article['title'] . ' [' . ($article['author_name'] != 'guest' ? '<a href="../index.php?module=user.list&user='******'author_name'] . '">' . $article['author_nick'] . '</a>' : $article['author_nick']) . '] [' . rcms_format_time('d F Y H:i:s', $article['time']) . ']', $frm->checkbox('delete[' . $article['id'] . ']', '1', $lang['articles']['delete']) . '<br />' . $frm->radio_button('edit', array($article['id'] => $lang['articles']['edit'])));
        }
    }
    $frm->hidden('category', $category);
    $frm->show();
}