function display($format = 'html', $template = 'comments') { $data['comments'][0] = array('comment_id' => $this->comment_id, 'user_id' => $this->user_id, 'epobject_id' => $this->epobject_id, 'body' => $this->body, 'posted' => $this->posted, 'modflagged' => $this->modflagged, 'url' => $this->url, 'firstname' => $this->firstname, 'lastname' => $this->lastname, 'visible' => $this->visible); // Use the same renderer as the COMMENTLIST class. $COMMENTLIST = new COMMENTLIST(); $COMMENTLIST->render($data, $format, $template); }
$URL->insert(array('id' => get_http_var('gid'), 'c' => $success)); header("Location: http://" . DOMAIN . $URL->generate('none') . "#c" . $success); exit; } else { // Else, $COMMENT will have printed an error message. $PAGE->page_end(); } } else { // We're previewing a comment. $PAGE->page_start(); $PAGE->stripe_start(); if (is_numeric(get_http_var('epobject_id'))) { //remove any unwanted tags $body = get_http_var('body'); $body = filter_user_input($body, 'comment'); // In init.php // Preview the comment. // Mock up a data array for the comment listing template. $data['comments'][0] = array('body' => $body, 'firstname' => $THEUSER->firstname(), 'lastname' => $THEUSER->lastname(), 'user_id' => $THEUSER->user_id(), 'posted' => date('Y-m-d H:i:s', time()), 'modflagged' => NULL, 'visible' => 1, 'preview' => true); $COMMENTLIST = new COMMENTLIST(); $COMMENTLIST->render($data, 'html'); // Show the populated comment form. $commendata = array('epobject_id' => get_http_var('epobject_id'), 'gid' => get_http_var('gid'), 'body' => get_http_var('body'), 'return_page' => get_http_var('return_page')); $PAGE->comment_form($commendata); // Show all comments for this epobject. $args = array('epobject_id' => get_http_var('epobject_id')); $COMMENTLIST->display('ep', $args); } $PAGE->stripe_end(); $PAGE->page_end(); }