Location: PHPKode > projects > Buzzword > buzzword-0.8.12/planet/editsubscription.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();

$subscription = new planet_subscription(import_planet_subscription_key());
if (!$subscription->exists())
    display_error('subscription does not exist');

if (get_request_var('subscription-submit')) {
    $subscription->title = ($title = get_request_var('title')) ? $title : 'subscription';
    $subscription->body = get_request_var('body');
    $subscription->url = get_request_var('url');
    $subscription->feed_url = get_request_var('feed_url');
    $subscription->icon = new gallery_image(get_request_var('highlight'));

    $subscription->update();
    $subscription->fetch_feed(true);

    header('Location: subscription.php?s='.$subscription->subscription_key);
    exit;
}

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

?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td id="content">
<h1>edit subscription</h1>
<div class="content-container">
<?php
if (class_exists('gallery_image')) {
?>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="gallery-highlight">
<a href="#" onClick="gallery_filebrowser_popup('subscription', ''); return false;">
<?php 

$icon = $subscription->icon;
if ($icon->exists()) {

?>
<img name="highlight" src="../gallery/thumb.php?i=<?php echo $icon->image_key; ?>" <?php echo $icon->get_alt(); ?> 
 border="0" <?php echo $icon->get_thumb_size(); ?>></a>
<?php

} else {

?>
<img name="highlight" src="../gallery/images/spacer.gif" width=<?php echo
 get_pref('gallery_thumb_width'); ?> height=<?php echo
 round(get_pref('gallery_thumb_width') * 3 / 4); ?> alt=""></a>
<?php

}

?>
</td>
<td class="gallery-description">
Click on the image to choose a new icon for this subscription.
</td>
</tr>
</table>
<?php 

}

?>
<form name="subscription" method="post" action="editsubscription.php">
<input type="hidden" name="highlight" value="<?php echo $subscription->icon->image_key; ?>">
<input type="hidden" name="subscription-submit" value="1">
<input type="hidden" name="s" value="<?php echo $subscription->subscription_key; ?>">
<p>subscription title:<br>
<input type="text" name="title" class="input" value="<?php echo htmlspecialchars($subscription->title); ?>"></p>
<p>subscription url:<br>
<input type="text" name="url" class="input" value="<?php echo htmlspecialchars($subscription->url); ?>"></p>
<p>subscription feed url:<br>
<input type="text" name="feed_url" class="input" value="<?php echo htmlspecialchars($subscription->feed_url); ?>"></p>
<p><input type="submit" value="save" class="submit"></p>
</form>
</div>
</td>
</tr>
</table>
<?php

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

?>
Return current item: Buzzword