aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-12-28 14:06:30 -0800
committerzotlabs <mike@macgirvin.com>2017-12-28 14:06:30 -0800
commit38646fe0e1302b3be932a4d59e9431c7afe5c847 (patch)
treecffb8a44949aef6c34d8a501ebd3c2db59bbdce0 /Zotlabs
parent5a8efc10d8ebaf5e81009eaaff8b0c5524a04aa3 (diff)
downloadvolse-hubzilla-38646fe0e1302b3be932a4d59e9431c7afe5c847.tar.gz
volse-hubzilla-38646fe0e1302b3be932a4d59e9431c7afe5c847.tar.bz2
volse-hubzilla-38646fe0e1302b3be932a4d59e9431c7afe5c847.zip
Make affinity widget settings work. It's entirely possible they never did work correctly. I'm not comfortable over-riding the network_page_default config in this way but this is the way I've always set the affinity and it has worked just fine for me for several years and there haven't been any other requests to extend the network page default options.
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Settings/Featured.php20
-rw-r--r--Zotlabs/Widget/Affinity.php12
2 files changed, 16 insertions, 16 deletions
diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php
index ebe2996d3..6a8d10b2d 100644
--- a/Zotlabs/Module/Settings/Featured.php
+++ b/Zotlabs/Module/Settings/Featured.php
@@ -11,15 +11,21 @@ class Featured {
call_hooks('feature_settings_post', $_POST);
if($_POST['affinity_slider-submit']) {
- if(intval($_POST['affinity_cmax'])) {
- set_pconfig(local_channel(),'affinity','cmax',intval($_POST['affinity_cmax']));
+ $cmax = intval($_POST['affinity_cmax']);
+ if($cmax < 0 || $cmax > 99)
+ $cmax = 99;
+ $cmin = intval($_POST['affinity_cmin']);
+ if($cmin < 0 || $cmin > 99)
+ $cmin = 0;
+ if($cmin !== 0 || $cmax !== 99) {
+ set_pconfig(local_channel(),'system','network_page_default','cmin=' . $cmin . '&cmax=' . $cmax);
}
- if(intval($_POST['affinity_cmin'])) {
- set_pconfig(local_channel(),'affinity','cmin',intval($_POST['affinity_cmin']));
- }
- if(intval($_POST['affinity_cmax']) || intval($_POST['affinity_cmin'])) {
- info( t('Affinity Slider settings updated.') . EOL);
+ else {
+ set_pconfig(local_channel(),'system','network_page_default','');
}
+
+ info( t('Affinity Slider settings updated.') . EOL);
+
}
build_sync_packet();
diff --git a/Zotlabs/Widget/Affinity.php b/Zotlabs/Widget/Affinity.php
index 439ba1f33..a3e5b5c07 100644
--- a/Zotlabs/Widget/Affinity.php
+++ b/Zotlabs/Widget/Affinity.php
@@ -9,15 +9,9 @@ class Affinity {
if(! local_channel())
return '';
- // Get default cmin value from pconfig, but allow GET parameter to override
- $cmin = intval(get_pconfig(local_channel(),'affinity','cmin'));
- $cmin = (($cmin) ? $cmin : 0);
- $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $cmin);
-
- // Get default cmax value from pconfig, but allow GET parameter to override
- $cmax = intval(get_pconfig(local_channel(),'affinity','cmax'));
- $cmax = (($cmax) ? $cmax : 99);
- $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $cmax);
+
+ $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : 0);
+ $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : 99);
if(feature_enabled(local_channel(),'affinity')) {