diff --git a/controllers/feed.php b/controllers/feed.php
index dfe3ae0..315ffa7 100644
--- a/controllers/feed.php
+++ b/controllers/feed.php
@@ -32,18 +32,18 @@ Router\get_action('edit-feed', function() {
Router\post_action('edit-feed', function() {
$values = Request\values();
+ $values += array('enabled' => 0, 'download_content' => 0, 'rtl' => 0, 'cloak_referrer' => 0);
+
list($valid, $errors) = Model\Feed\validate_modification($values);
if ($valid) {
-
if (Model\Feed\update($values)) {
Session\flash(t('Your subscription has been updated.'));
+ Response\redirect('?action=feeds');
}
else {
Session\flash_error(t('Unable to edit your subscription.'));
}
-
- Response\redirect('?action=feeds');
}
Response\html(Template\layout('edit_feed', array(
diff --git a/models/feed.php b/models/feed.php
index d361694..4db8e4b 100644
--- a/models/feed.php
+++ b/models/feed.php
@@ -100,10 +100,10 @@ function update(array $values)
'title' => $values['title'],
'site_url' => $values['site_url'],
'feed_url' => $values['feed_url'],
- 'enabled' => empty($values['enabled']) ? 0 : $values['enabled'],
- 'rtl' => empty($values['rtl']) ? 0 : $values['rtl'],
- 'download_content' => empty($values['download_content']) ? 0 : $values['download_content'],
- 'cloak_referrer' => empty($values['cloak_referrer']) ? 0 : $values['cloak_referrer'],
+ 'enabled' => $values['enabled'],
+ 'rtl' => $values['rtl'],
+ 'download_content' => $values['download_content'],
+ 'cloak_referrer' => $values['cloak_referrer'],
));
}
diff --git a/templates/edit_feed.php b/templates/edit_feed.php
index 4467427..723a663 100644
--- a/templates/edit_feed.php
+++ b/templates/edit_feed.php
@@ -21,13 +21,13 @@
= Helper\form_label(t('Feed URL'), 'feed_url') ?>
= Helper\form_text('feed_url', $values, $errors, array('required', 'placeholder="http://..."')) ?>
- = Helper\form_checkbox('rtl', t('Force RTL mode (Right-to-left language)'), 1, isset($values['rtl']) ? $values['rtl'] : false) ?>
+ = Helper\form_checkbox('rtl', t('Force RTL mode (Right-to-left language)'), 1, $values['rtl']) ?>
- = Helper\form_checkbox('download_content', t('Download full content'), 1, isset($values['download_content']) ? $values['download_content'] : false) ?>
+ = Helper\form_checkbox('download_content', t('Download full content'), 1, $values['download_content']) ?>
- = Helper\form_checkbox('cloak_referrer', t('Cloak the image referrer'), 1, isset($values['cloak_referrer']) ? $values['cloak_referrer'] : false) ?>
+ = Helper\form_checkbox('cloak_referrer', t('Cloak the image referrer'), 1, $values['cloak_referrer']) ?>
- = Helper\form_checkbox('enabled', t('Activated'), 1, isset($values['enabled']) ? $values['enabled'] : false) ?>
+ = Helper\form_checkbox('enabled', t('Activated'), 1, $values['enabled']) ?>