summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2014-09-15 17:53:08 -0400
committerGravatar Alexis Degrugillier <github@ainw.org> 2014-09-15 18:00:17 -0400
commitce239f83c4812d1999d1be0be104e00a2ad23f90 (patch)
treea99117e44931bb0cac16fdc632b4bee7de0b9d4c /app
parent6374f9ec98a132a810efa3e651bd800bcf541340 (diff)
Add a feature to add only unique shares
Before, it was possible to have different shares of the same type with the same information. Now, even if you try to input identical shares, only the first one is kept. Of course, the verification is simple, so for instance if you input two shares to the same shaarli instance with different names, they are kept. See #614
Diffstat (limited to 'app')
-rw-r--r--app/Models/Configuration.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 3a408faa5..e4408df73 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -212,6 +212,7 @@ class FreshRSS_Configuration {
}
public function _sharing ($values) {
$this->data['sharing'] = array();
+ $unique = array();
foreach ($values as $value) {
if (!is_array($value)) {
continue;
@@ -237,7 +238,11 @@ class FreshRSS_Configuration {
$value['name'] = $value['type'];
}
- $this->data['sharing'][] = $value;
+ $json_value = json_encode($value);
+ if (!in_array($json_value, $unique)) {
+ $unique[] = $json_value;
+ $this->data['sharing'][] = $value;
+ }
}
}
public function _queries ($values) {