<?php
/*
* buzzword
* Copyright (c) 2003 Jon Tai
*
* $Id: newcomment.php 273 2004-04-05 21:16:38Z bradt $
*
* This file is part of buzzword.
*
* buzzword is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* buzzword 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with buzzword; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once './config.inc';
$entry = new blog_entry(import_blog_entry_key());
if (!$entry->exists())
display_error('entry does not exist');
$comment = new blog_entry_comment($entry, mysql_unique_key(DB_PREFIX.'blog_entries_comments', 'comment_key'));
$comment->created = time();
$comment->is_private = get_request_var('is_private');
$comment->title = ($title = get_request_var('title')) ? $title : 're: '.strip_tags($entry->title);
$comment->body = get_request_var('body');
$comment->author = ($author = get_request_var('author')) ? $author : 'anonymous';
$comment->email = get_request_var('email');
$comment->email_is_private = get_request_var('email_is_private');
$comment->create();
send_admin_email($comment->author, $comment->email, $comment->title,
$comment->body, "http://{$_SERVER['SERVER_NAME']}"
.current(pathinfo($_SERVER['PHP_SELF']))
."/entry.php?e={$entry->entry_key}");
header('Location: entry.php?e='.$entry->entry_key);
exit;
?>