<? $pagekey = 'news'; $prefix = 'news.'; $this_page['menuitem'] = get_string('menu.' . $pagekey, 'setting', 'numeric'); $this_page[$pagekey] = array(); // Algemene waarden $nid = get_string('nid', 'get', 'numeric'); $cid = get_string('cid', 'get', 'numeric'); $tid = get_string('tid', 'get', 'numeric'); $dossier = get_string('dossier', 'get', 'numeric'); $member = get_string('member', 'get', 'numeric'); // Weblogfunctie if (!isset($weblog)) $weblog = get_string('weblog', 'get', 'numeric'); if ($weblog <> 1) $weblog = 0; $limit = (get_string('limit', 'get', 'numeric') > 0) ? get_string('limit', 'get', 'numeric') : ((get_string(($weblog == 1 ? 'weblog.' : $prefix) . 'limit', 'setting', 'numeric') > 0) ? get_string(($weblog == 1 ? 'weblog.' : $prefix) . 'limit', 'setting', 'numeric') : 15); // Paginanummer altijd corrigeren $page = get_string('page', 'get', 'numeric'); if ($page < 0) $page = 0; // Previewfunctie $preview = get_string('preview', 'get', 'numeric'); if ($preview <> 1) $preview = 0; if ($nid > 0) { // Artikel weergeven $article = get_article($nid); if ($article === false) { // Geen artikel aangetroffen $this_page[$pagekey]['error'] = 'no_article'; $this_page[$pagekey]['show'] = 'error'; } elseif ($article['rights']['right_read'] || ($article['rights']['right_preview'] && $preview == 1)) { // Artikel weergeven $this_page[$pagekey]['article'] = &$article; if (!isset($_SESSION["news$nid"]) && $user['google'] == 0 && $user['rank'] != $mod_rank && $user['id'] != $article['member_id']) { // Unieke bezoeker tellen $article['article_hits'] ++; query("UPDATE NewsArticles SET Hits = Hits + 1 WHERE Id = $nid"); $_SESSION["news$nid"] = 0; } elseif ($user['google'] == 1 && $article['article_google'] == 0) { // Google heeft deze pagina gearchiveerd $article['article_google'] = 1; query("UPDATE NewsArticles SET Google = 1 WHERE Id = $nid"); } if (!$article['rights']['right_hits']) $article['article_hits'] = 0; if ($article['article_replies'] == 1 && action != '' && $preview == 0) { // Reactiefuncties uitvoeren en/of weergeven $forumid = 0; $topicid = $article['reply_id']; $replyid = get_string('reply', 'get', 'numeric'); $moveto = 0; $citeid = get_string('cite', 'get', 'numeric'); // Forumfuncties uitvoeren $action = strtolower(get_string('action', 'get', 'string')); if ($action == 'new') $action = 'reply'; $action = ($action == 'reply' && $topicid == 0) ? 'new' : ((!in_array($action, array('new', 'reply', 'modify', 'delete'))) ? '' : $action); if ($action == 'new') { // Eerste reactie $_POST['title'] = strtoupper($pagekey) . ': ' . $article['article_title']; forum_topic_action($host . 'news.php?nid=' . $nid); // Kijken of er nu een nieuw onderwerp is aangemaakt, zo ja, opslaan if ($topicid > 0) { query("UPDATE NewsArticles SET Topic = $topicid , ReplyCount = 1 WHERE Id = $nid"); } } elseif ($action != '') { // Overige reacties if ($action == 'delete') $topicid = 0; forum_topic_action($host . 'news.php?nid=' . $nid); // Reactieteller bijwerken $forum = get_replies($article['reply_id'], false, true); if ($forum === false) { query("UPDATE NewsArticles SET ReplyCount = 0 , Topic = 0 WHERE Id = " . $nid); } elseif ($forum['topic']['reply_count'] != $article['reply_count']) { query("UPDATE NewsArticles SET ReplyCount = " . $forum['topic']['reply_count'] . " WHERE Id = " . $nid); } } if ($this_page[$pagekey]['show'] == 'form') { if (in_array($action, array('new','reply'))) { // Formulier aanpassen if (isset($this_page[$pagekey]['form']['objects']['title'])) { unset($this_page[$pagekey]['form']['objects']['title']); } $this_page[$pagekey]['form']['form']['title'] = 'reactie plaatsen op bericht'; $this_page['title'] = $this_page[$pagekey]['form']['form']['title']; $this_page[$pagekey]['form']['form']['label'] = 'Vul onderstaand formulier in om een reactie te geven op dit bericht. ' . 'Alle reacties dienen te voldoen aan de algemene regels, die ook rechts van dit formulier zijn te vinden.'; $this_page[$pagekey]['form']['objects']['ins_smilies']['label'] = 'Voeg smilies (emoticons) toe aan jouw reactie'; $this_page[$pagekey]['form']['objects']['textfield']['label'] = 'Jouw reactie op het bericht'; $this_page[$pagekey]['form']['objects']['submit_this']['label'] = 'Plaats reactie'; $this_page[$pagekey]['form']['objects']['back']['label'] = 'Terug naar bericht'; $this_page[$pagekey]['form']['objects']['back']['link'] = 'news.php?nid=' . $nid; } elseif ($action == 'modify') { // Formulier aanpassen $this_page[$pagekey]['form']['form']['title'] = 'reactie wijzigen'; } } elseif ($this_page[$pagekey]['show'] == 'status') { // Status wijzigen bij nieuwe reacties if (in_array($this_page[$pagekey]['status'], array('newtopic', 'newreply'))) $this_page[$pagekey]['status'] = 'newsreply'; } } if (!isset($this_page[$pagekey]['show'])) { // Artikel converteren naar HTML $this_page['title'] = $article['article_title']; if ($weblog == 0) { // Artikel, instellingen bepalen $this_page[$pagekey]['newslist'] = list_articles(0, $article['category_id'], 0, 0, $limit); $bbcode_settings = array('pages' => true, 'page' => $page + 1, 'no-language' => true, 'bbcode' => true, 'cites' => true, 'images' => true, 'image_max_width' => 470); // BBcode converteren $article['html'] = bbcode($article['article_text'], &$bbcode_settings); $this_page['title'] = 'Nieuws: ' . $this_page['title']; $this_page[$pagekey]['page'] = isset($bbcode_settings['page']) ? $bbcode_settings['page'] - 1 : 0; $this_page[$pagekey]['pagecount'] = isset($bbcode_settings['lastpage']) ? $bbcode_settings['lastpage'] : 1; $this_page[$pagekey]['show'] = 'article'; } else { // Weblog $article['html'] = weblog2html($article['article_text']); $this_page['title'] = 'Weblog: ' . $this_page['title']; $this_page[$pagekey]['weblogs'] = list_articles(1, 0, 0, $article['member'], $limit, $page); $this_page[$pagekey]['show'] = 'weblog'; } // Reacties weergeven if ($article['reply_count'] > 0) { $user['replies_per_page'] = $article['reply_count']; $forum = get_replies($article['reply_id'], true, false, 0); $forum['url'] = $host . 'news.php?nid=' . $nid . '&'; } } } else { // Geen rechten $this_page[$pagekey]['error'] = 'no_rights'; $this_page[$pagekey]['show'] = 'error'; } } elseif (($cid > 0 || $tid > 0 || $member > 0) && $weblog == 0) { // Overzicht categoriën/atikeltypen weergeven $count_articles = count(list_articles(0, $cid, $tid, $member)); if ($count_articles == 0) { // Geen artikelen $this_page[$pagekey]['error'] = 'no_articles'; $this_page[$pagekey]['show'] = 'error'; } else { // Lijst weergeven $this_page[$pagekey]['pagecount'] = ceil($count_articles / $limit); if ($page >= $this_page[$pagekey]['pagecount']) $page = $this_page[$pagekey]['pagecount'] - 1; $this_page[$pagekey]['page'] = $page; $this_page[$pagekey]['newslist'] = list_articles(0, $cid, $tid, $member, $limit, $page); $this_page[$pagekey]['show'] = 'newslist'; } } elseif ($weblog == 1 && $member > 0) { // Weblogoverzicht van een member weergeven $count_weblogs = query("SELECT COUNT(1) count FROM NewsArticles WHERE Member = $member AND Weblog = 1"); $count = mysql_result($count_weblogs, 0, 'count'); if ($count == 0) { // Geen weblog $this_page[$pagekey]['error'] = 'no_weblogs'; $this_page[$pagekey]['show'] = 'error'; } else { // Lijst weergeven $this_page[$pagekey]['pagecount'] = ceil($count / $limit); if ($page >= $this_page[$pagekey]['pagecount']) $page = $this_page[$pagekey]['pagecount'] - 1; $this_page[$pagekey]['page'] = $page; $this_page[$pagekey]['weblogs'] = list_articles(1, 0, 0, $member, $limit, $page); $this_page['title'] = 'Weblogoverzicht van ' . $this_page[$pagekey]['weblogs'][0]['member_username']; foreach ($this_page[$pagekey]['weblogs'] as $key => $item) { $this_page[$pagekey]['weblogs'][$key]['html'] = weblog2html($item['article_text']); } $this_page[$pagekey]['show'] = 'weblogs'; } } elseif ($dossier > 0) { // Overzicht van een dossier weergeven // -- } elseif ($weblog == 1) { // Overzicht van alle webloggers weergeven xml_page('weblog'); } else { // Algemeen XML-overzicht weergeven xml_page('news'); } function weblog2html ($article) { // Artikel overzetten naar HTML return bbcode($article, array('no-language' => true, 'bbcode' => true, 'images' => true, 'smilies' => true, 'image_max_width' => 300)); } function get_article ($id) { // Artikel opvragen $article_query = query("
SELECT
Article.Id article_id,
Article.Hits article_hits,
Article.Google article_google,
Article.Visible article_visible,
Article.Concept article_concept,
Article.Weblog article_weblog,