function NewsCommentEditForm() { parent::MailForm(); $this->parseSettings('inc/app/news/forms/comment/edit/settings.php'); page_title(intl_get('Editing Comment')); loader_import('news.Comment'); $c = new NewsComment(); global $cgi; $comment = $c->get($cgi->id); $this->widgets['subject']->setValue($comment->subject); $this->widgets['user_id']->setValue($comment->user_id); $this->widgets['body']->setValue($comment->body); $this->widgets['story_id']->setValue($comment->story_id); page_add_script(' function news_cancel (f) { window.location.href = "' . site_prefix() . '/index/news-app/story.' . $cgi->story_id . '"; return false; } '); $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return news_cancel (this.form)"'; }
<?php if (!session_admin() || !isset($parameters['id'])) { header('Location: ' . site_prefix() . '/index/news-app'); exit; } loader_import('news.Comment'); $c = new NewsComment(); $comment = $c->get($parameters['id']); if (!$comment) { header('Location: ' . site_prefix() . '/index/news-app'); exit; } $c->remove($parameters['id']); page_title(intl_get('Comment Deleted')); echo template_simple('comment_deleted.spt', $comment);