Location: PHPKode > projects > Buzzword > buzzword-0.8.12/links/editlink.php
<?php

/*
 * buzzword
 * Copyright (c) 2003 Jon Tai
 *
 * $Id: editlink.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();

$link = new links_link(import_links_link_key());
if (!$link->exists())
    display_error('link does not exist');

if (get_request_var('link-submit')) {
    $link->modified = time();
    $link->is_private = get_request_var('is_private');
    $link->is_hidden = get_request_var('is_hidden');
    $link->title = ($title = get_request_var('title')) ? $title : 'link';
    $link->url = ($url = get_request_var('url')) ? $url : '';
    $link->description = get_request_var('description');
    $link->parent = new links_category(import_links_category_key());
    $link->update();

    header('Location: link.php?l='.$link->link_key);
    exit;
}

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

?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td id="content">
<h1>edit link</h1>
<div class="content-container">
<form name="link" method="post" action="editlink.php">
<input type="hidden" name="link-submit" value="1">
<input type="hidden" name="l" value="<?php echo $link->link_key; ?>">
<p>link title:<br>
<input type="text" name="title" class="input" value="<?php echo htmlspecialchars($link->title); ?>"></p>
<p>link url:<br>
<input type="text" name="url" class="input" value="<?php echo htmlspecialchars($link->url); ?>"></p>
<p>link description:<br>
<?php echo toolbar_hook('link', 'description'); ?>
<textarea name="description" rows="10" cols="10" class="input"><?php echo htmlspecialchars($link->description); ?></textarea></p>
<p>link is private:
<input type="checkbox" name="is_private"<?php if ($link->is_private) echo ' checked'; ?>></p>
<p>link is hidden:
<input type="checkbox" name="is_hidden"<?php if ($link->is_hidden) echo ' checked'; ?>></p>

<p>link belongs to category:<br>
<select name="c">
<?php

$categories = get_links_categories();
foreach ($categories as $category) {
    echo "<option value=\"{$category->category_key}\"";
    if ($category->category_key == $link->parent->category_key)
        echo ' selected';
    echo ">".$category->get_display_title()."</option>\n";
}

?>
</select>
</p>

<p><input type="submit" value="save" class="submit"></p>
</form>
</div>
</td>
</tr>
</table>
<?php

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

?>
Return current item: Buzzword