aboutsummaryrefslogtreecommitdiff
path: root/app/Models/ConfigurationSetter.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-12-16 15:24:13 +0100
committerGravatar GitHub <noreply@github.com> 2017-12-16 15:24:13 +0100
commitfdc9e0d75a786101a14f64bc418b48fdd1cb4890 (patch)
tree9a7a1d523ab1279e2efce84d2d0c73dd0ad47c70 /app/Models/ConfigurationSetter.php
parentf7560c585f211be41b093906e3a8fb5a6071c660 (diff)
parentccb829418d25af49d129ac227b0cbd09c085b8a3 (diff)
Merge branch 'dev' into hebrew-i18n
Diffstat (limited to 'app/Models/ConfigurationSetter.php')
-rw-r--r--app/Models/ConfigurationSetter.php58
1 files changed, 33 insertions, 25 deletions
diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php
index eeb1f2f4c..ca4709903 100644
--- a/app/Models/ConfigurationSetter.php
+++ b/app/Models/ConfigurationSetter.php
@@ -56,8 +56,7 @@ class FreshRSS_ConfigurationSetter {
switch ($value) {
case 'all':
$data['default_view'] = $value;
- $data['default_state'] = (FreshRSS_Entry::STATE_READ +
- FreshRSS_Entry::STATE_NOT_READ);
+ $data['default_state'] = (FreshRSS_Entry::STATE_READ + FreshRSS_Entry::STATE_NOT_READ);
break;
case 'adaptive':
case 'unread':
@@ -95,11 +94,6 @@ class FreshRSS_ConfigurationSetter {
$data['language'] = $value;
}
- private function _mail_login(&$data, $value) {
- $value = filter_var($value, FILTER_VALIDATE_EMAIL);
- $data['mail_login'] = $value ? $value : '';
- }
-
private function _old_entries(&$data, $value) {
$value = intval($value);
$data['old_entries'] = $value > 0 ? $value : 3;
@@ -117,12 +111,11 @@ class FreshRSS_ConfigurationSetter {
private function _queries(&$data, $values) {
$data['queries'] = array();
foreach ($values as $value) {
- $value = array_filter($value);
- $params = $value;
- unset($params['name']);
- unset($params['url']);
- $value['url'] = Minz_Url::display(array('params' => $params));
- $data['queries'][] = $value;
+ if ($value instanceof FreshRSS_UserQuery) {
+ $data['queries'][] = $value->toArray();
+ } elseif (is_array($value)) {
+ $data['queries'][] = $value;
+ }
}
}
@@ -135,12 +128,7 @@ class FreshRSS_ConfigurationSetter {
// Verify URL and add default value when needed
if (isset($value['url'])) {
- $is_url = (
- filter_var($value['url'], FILTER_VALIDATE_URL) ||
- (version_compare(PHP_VERSION, '5.3.3', '<') &&
- (strpos($value, '-') > 0) &&
- ($value === filter_var($value, FILTER_SANITIZE_URL)))
- ); //PHP bug #51192
+ $is_url = filter_var($value['url'], FILTER_VALIDATE_URL);
if (!$is_url) {
continue;
}
@@ -174,7 +162,7 @@ class FreshRSS_ConfigurationSetter {
if (!in_array($value, array('global', 'normal', 'reader'))) {
$value = 'normal';
}
- $data['view_mode'] = $value;
+ $data['view_mode'] = $value;
}
/**
@@ -192,6 +180,10 @@ class FreshRSS_ConfigurationSetter {
$data['auto_remove_article'] = $this->handleBool($value);
}
+ private function _mark_updated_article_unread(&$data, $value) {
+ $data['mark_updated_article_unread'] = $this->handleBool($value);
+ }
+
private function _display_categories(&$data, $value) {
$data['display_categories'] = $this->handleBool($value);
}
@@ -204,6 +196,10 @@ class FreshRSS_ConfigurationSetter {
$data['hide_read_feeds'] = $this->handleBool($value);
}
+ private function _sides_close_article(&$data, $value) {
+ $data['sides_close_article'] = $this->handleBool($value);
+ }
+
private function _lazyload(&$data, $value) {
$data['lazyload'] = $this->handleBool($value);
}
@@ -275,7 +271,7 @@ class FreshRSS_ConfigurationSetter {
private function _auth_type(&$data, $value) {
$value = strtolower($value);
- if (!in_array($value, array('form', 'http_auth', 'persona', 'none'))) {
+ if (!in_array($value, array('form', 'http_auth', 'none'))) {
$value = 'none';
}
$data['auth_type'] = $value;
@@ -289,6 +285,7 @@ class FreshRSS_ConfigurationSetter {
switch ($value['type']) {
case 'mysql':
+ case 'pgsql':
if (empty($value['host']) ||
empty($value['user']) ||
empty($value['base']) ||
@@ -328,7 +325,7 @@ class FreshRSS_ConfigurationSetter {
if (!in_array($value, array('silent', 'development', 'production'))) {
$value = 'production';
}
- $data['environment'] = $value;
+ $data['environment'] = $value;
}
private function _limits(&$data, $values) {
@@ -351,6 +348,9 @@ class FreshRSS_ConfigurationSetter {
'min' => 0,
'max' => $max_small_int,
),
+ 'max_registrations' => array(
+ 'min' => 0,
+ ),
);
foreach ($values as $key => $value) {
@@ -358,10 +358,10 @@ class FreshRSS_ConfigurationSetter {
continue;
}
+ $value = intval($value);
$limits = $limits_keys[$key];
- if (
- (!isset($limits['min']) || $value > $limits['min']) &&
- (!isset($limits['max']) || $value < $limits['max'])
+ if ((!isset($limits['min']) || $value >= $limits['min']) &&
+ (!isset($limits['max']) || $value <= $limits['max'])
) {
$data['limits'][$key] = $value;
}
@@ -371,4 +371,12 @@ class FreshRSS_ConfigurationSetter {
private function _unsafe_autologin_enabled(&$data, $value) {
$data['unsafe_autologin_enabled'] = $this->handleBool($value);
}
+
+ private function _auto_update_url(&$data, $value) {
+ if (!$value) {
+ return;
+ }
+
+ $data['auto_update_url'] = $value;
+ }
}