<?php //////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2004 ReloadCMS Development Team // // http://reloadcms.sf.net // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY, without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// $system->showModuleWindow('', file_get_contents(DATA_PATH . 'intro.html'), 'left'); $articles = articles_parse_list(1, true, NEWS_PATH); $result = ''; if (!empty($articles)) { foreach ($articles as $article) { $cat_data = articles_get_category($article['catid'], false, NEWS_PATH); if (!empty($article)) { $cat_data = articles_get_category($article['catid'], false, NEWS_PATH); $result .= rcms_parse_module_template('article.tpl', $article + array('showdesc' => true, 'showtitle' => true, 'linktext' => ($article['text_nonempty'] ? $lang['articles']['readmore'] : $lang['articles']['comments']) . ' (' . $article['comcnt'] . '/' . $article['views'] . ')', 'linkurl' => './index.php?module=articles&catid=' . $article['catid'] . '&id=' . $article['id'] . '&work_dir=news', 'cat_data' => $cat_data)); } } } $system->showModuleWindow($lang['articles']['latestnews'], $result, 'center'); $system->config['pagename'] = $lang['pages']['index'];
$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']; } else { $pages = 1; $page = 0;
function articles_get_categories_list($short = true, $parse = true, $dir = ARTICLES_PATH) { if ($categories = rcms_scandir($dir, '', 'dir')) { for ($i = 0; $i < count($categories); $i++) { if ($data = articles_get_category($categories[$i], $parse, $dir)) { if (!$short) { $return[$i] = $data; } else { $return[$data['id']] = $data['title']; } } } } if (!empty($return)) { return $return; } else { return false; } }