Location: PHPKode > projects > Buzzword > buzzword-0.8.12/blog/editentry.php
<?php

/*
 * buzzword
 * Copyright (c) 2003 Jon Tai
 *
 * $Id: editentry.php 267 2004-03-31 03:14:55Z 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';
force_admin_login();

$entry = new blog_entry(import_blog_entry_key());
if (!$entry->exists())
    display_error('entry does not exist');

if (get_request_var('entry-submit')) {
    $entry->modified = time();
    $entry->is_private = get_request_var('is_private');
    $entry->is_hidden = get_request_var('is_hidden');
    $entry->title = ($title = get_request_var('title')) ? $title : 'entry';
    $entry->body = get_request_var('body');
    $entry->allow_comments = get_request_var('allow_comments');
    $entry->update();

    header('Location: entry.php?e='.$entry->entry_key);
    exit;
}

include '../includes/header.inc';

?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td id="content">
<h1>edit entry</h1>
<div class="content-container">
<form name="entry" method="post" action="editentry.php">
<input type="hidden" name="entry-submit" value="1">
<input type="hidden" name="e" value="<?php echo $entry->entry_key; ?>">
<p>entry title:<br>
<input type="text" name="title" class="input" value="<?php echo htmlspecialchars($entry->title); ?>"></p>
<p>entry text:<br>
<?php echo toolbar_hook('entry', 'body'); ?>
<textarea name="body" rows="40" cols="10" class="input"><?php echo htmlspecialchars($entry->body); ?></textarea></p>
<p>entry is private:
<input type="checkbox" name="is_private"<?php if ($entry->is_private) echo ' checked'; ?>></p>
<p>entry is hidden:
<input type="checkbox" name="is_hidden"<?php if ($entry->is_hidden) echo ' checked'; ?>></p>
<p>allow comments:
<input type="checkbox" name="allow_comments"<?php if ($entry->allow_comments) echo ' checked'; ?>></p>
<p><input type="submit" value="save" class="submit"></p>
</form>
</div>
</td>
</tr>
</table>
<?php

include '../includes/footer.inc';

?>
Return current item: Buzzword