query('DELETE FROM comments WHERE id='.$remove); } //END OF MODERATION HANDLING include('ubb.php'); //clean the variabele $id = mysql_real_escape_string($id); //fetch the names of the writers $writers = $database->query('SELECT username FROM writers', 'array'); //fetch the article $article = $database->query('SELECT * FROM articles WHERE id='.$id, 'array'); //fix up the layout of the message body $body = $article['text']; $body = nl2br($body); $body = parseubb($body); //build an array with the social networking icons $socialNetworking = $database->query('SELECT * FROM socialnetworkingicons', 'none'); if($socialNetworking && mysql_num_rows($socialNetworking) > 0) { while($icon = mysql_fetch_array($socialNetworking)) { $snIcons[$icon['name']] = array($icon['imgurl'], $icon['siteurl']); } } //set all the social networking icons for this post $iconString = ''; $linkcount = 0; foreach($snIcons AS $name => $url) { $siteUrlFixed = str_replace('{url}', urlencode('http://www.digi-online.net/do8/comments.php?id='.$article['id']), $url[1]); $siteUrlFixed = str_replace('{title}', urlencode($article['title']), $siteUrlFixed); //new line after this ammount of chars if($linkcount == 5) { $linkcount = 0; $a = '
'; } else { $a = ' :: '; $linkcount ++; } //create the icon string $iconString .= ' '.$name.''.$a; } //make sure this can't be empty if($iconString == '') $iconString = " "; //start a new template engine for this message $messageTemplate = new templateEngine; $messageTemplate->setTemplate('templates/'.$currentTemplate.'/messagetemplate.tpl'); $messageTemplate->set('socialnetworking', $iconString); //fetch the name of the category this article has been posted in $catName = $database->query('SELECT name FROM categories WHERE id='.$article['cat'], 'result'); //fill in all fields for this template $messageTemplate->set('title', $article['title']); $messageTemplate->set('date', $article['date']); $messageTemplate->set('text', $body); $messageTemplate->set('cat', ''.$catName.''); $messageTemplate->set('writer', $writers[$article['writer']-1]); $messageTemplate->set('commentslink', ' '); //display it $content .= $messageTemplate->getLayout(); //from here, comments will follow $content .= '

'; $content .= '
Reacties op "'.$article['title'].'":


'; //build a form that we can use to post comments $commentForm = new formBuilder; $commentForm->addField('Naam:', 'text', 'name', '', 55, 0, true, 18); $commentForm->addField('Website:', 'text', 'website', '', 55, 0, false, 35); $commentForm->addField('Reactie:', 'textarea', 'text', '', 41, 8, true, 1200); $commentForm->addField('', 'captcha', '', ''); $commentForm->addSubmitButton('Reageer!'); if($commentForm->isValid() == 1) { //fetch the form data $formData = $commentForm->getCleanedData(); //insert the comment in the database $database->query('INSERT INTO comments (name, text, article, website) VALUES ("'.$formData['name'].'", "'.$formData['text'].'", '.$id.', "'.$formData['website'].'")'); } //fetch the comments for this article $comments = $database->query('SELECT * FROM comments WHERE article='.$id); //check if we've received anything... if($comments && mysql_num_rows($comments) > 0) { //yes, we've got something! loop through the comments while($comment = mysql_fetch_array($comments)) { //moderation links for this message if($allRights['remove_comments'] & $rights) $modLinks .= '[Verwijder] '; $commentTemplate = new templateEngine; $commentTemplate->setTemplate('templates/'.getSettings('currentTemplate').'/commenttemplate.tpl'); //fill the template with the correct values if($comment['website'] == '') $commentTemplate->set('name', $comment['name']); else $commentTemplate->set('name', ''.$comment['name'].''); $commentTemplate->set('text', $comment['text']); $commentTemplate->set('date', $comment['date']); $commentTemplate->set('moderate', $modLinks); //return the layout $content .= $commentTemplate->getLayout(); } } else { $content .= 'Er zijn nog geen reacties op dit artikel geplaatst

'; } //display the comment form $content .= $commentForm->display('?id='.$id); $content .= $commentForm->displayErrors(); } else { $content .= 'Het opgegeven artikel bestaat niet meer

'; } //set some other layout-related stuff $template->set('pagetitle', getSettings('weblogTitle').' - Lees reacties: '.$article['title']); $template->set('content', $content); echo $template->getLayout(); ?>