aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 4750f4558..81c54f161 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -39,7 +39,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
* @throws FreshRSS_Feed_Exception
* @throws Minz_FileNotExistException
*/
- public static function addFeed($url, $title = '', $cat_id = 0, $new_cat_name = '', $http_auth = '') {
+ public static function addFeed($url, $title = '', $cat_id = 0, $new_cat_name = '', $http_auth = '', $attributes = array()) {
FreshRSS_UserDAO::touch();
@set_time_limit(300);
@@ -67,6 +67,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$cat_id = $cat == null ? FreshRSS_CategoryDAO::DEFAULTCATEGORYID : $cat->id();
$feed = new FreshRSS_Feed($url); //Throws FreshRSS_BadUrl_Exception
+ $feed->_attributes('', $attributes);
$feed->_httpAuth($http_auth);
$feed->load(true); //Throws FreshRSS_Feed_Exception, Minz_FileNotExistException
$feed->_category($cat_id);
@@ -90,7 +91,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
'description' => $feed->description(),
'lastUpdate' => time(),
'httpAuth' => $feed->httpAuth(),
- 'attributes' => array(),
+ 'attributes' => $feed->attributes(),
);
$id = $feedDAO->addFeed($values);
@@ -141,7 +142,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$feedDAO = FreshRSS_Factory::createFeedDao();
$url_redirect = array(
'c' => 'subscription',
- 'a' => 'index',
+ 'a' => 'add',
'params' => array(),
);
@@ -154,13 +155,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
if (Minz_Request::isPost()) {
$cat = Minz_Request::param('category');
- $new_cat_name = '';
- if ($cat === 'nc') {
- // User want to create a new category, new_category parameter
- // must exist
- $new_cat = Minz_Request::param('new_category');
- $new_cat_name = isset($new_cat['name']) ? trim($new_cat['name']) : '';
- }
// HTTP information are useful if feed is protected behind a
// HTTP authentication
@@ -171,8 +165,18 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$http_auth = $user . ':' . $pass;
}
+ $attributes = array(
+ 'ssl_verify' => null,
+ 'timeout' => null,
+ );
+ if (FreshRSS_Auth::hasAccess('admin')) {
+ $attributes['ssl_verify'] = Minz_Request::paramTernary('ssl_verify');
+ $timeout = intval(Minz_Request::param('timeout', 0));
+ $attributes['timeout'] = $timeout > 0 ? $timeout : null;
+ }
+
try {
- $feed = self::addFeed($url, '', $cat, $new_cat_name, $http_auth);
+ $feed = self::addFeed($url, '', $cat, null, $http_auth, $attributes);
} catch (FreshRSS_BadUrl_Exception $e) {
// Given url was not a valid url!
Minz_Log::warning($e->getMessage());
@@ -192,6 +196,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
// Entries are in DB, we redirect to feed configuration page.
+ $url_redirect['a'] = 'index';
$url_redirect['params']['id'] = $feed->id();
Minz_Request::good(_t('feedback.sub.feed.added', $feed->name()), $url_redirect);
} else {
@@ -212,6 +217,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$feed = $feedDAO->searchByUrl($this->view->feed->url());
if ($feed) {
// Already subscribe so we redirect to the feed configuration page.
+ $url_redirect['a'] = 'index';
$url_redirect['params']['id'] = $feed->id();
Minz_Request::good(_t('feedback.sub.feed.already_subscribed', $feed->name()), $url_redirect);
}