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 @@ -
+
-
+
-
+
- +