From 5cfb63da50f21f0f9591599cde476b575cb1266e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 28 Dec 2017 15:12:20 -0800 Subject: a different (hopefully better) implementation of affinity presets, but not for 3.0 because strings have changed. --- Zotlabs/Module/Network.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Network.php') diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 4deb7c9e8..d54220e75 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -106,6 +106,8 @@ class Network extends \Zotlabs\Web\Controller { $o = ''; + $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0); + $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99); // if no tabs are selected, defaults to comments @@ -115,8 +117,8 @@ class Network extends \Zotlabs\Web\Controller { $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); $spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0); - $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : 0); - $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99); + $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : $default_cmin); + $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : $default_cmax); $file = ((x($_GET,'file')) ? $_GET['file'] : ''); $xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : ''); $net = ((x($_GET,'net')) ? $_GET['net'] : ''); -- cgit v1.2.3 From 1fcf59ff94200a542bfc99c592a924236de1d3c7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 28 Dec 2017 15:16:50 -0800 Subject: cleanup --- Zotlabs/Module/Network.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Network.php') diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index d54220e75..0da2a5676 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -35,9 +35,12 @@ class Network extends \Zotlabs\Web\Controller { return login(false); } - if($load) + $o = ''; + + if($load) { $_SESSION['loadtime'] = datetime_convert(); - + } + $arr = array('query' => \App::$query_string); call_hooks('network_content_init', $arr); @@ -104,7 +107,6 @@ class Network extends \Zotlabs\Web\Controller { $def_acl = array('allow_gid' => '<' . $r[0]['hash'] . '>'); } - $o = ''; $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0); $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99); -- cgit v1.2.3 From 3fadedcc54e9f937dbc461da7e99a851c044b6bf Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 30 Dec 2017 22:48:06 -0800 Subject: test of new affinity preset code (post 3.0) --- Zotlabs/Module/Network.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module/Network.php') diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 0da2a5676..551303984 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -110,6 +110,7 @@ class Network extends \Zotlabs\Web\Controller { $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0); $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99); + // if no tabs are selected, defaults to comments @@ -119,8 +120,8 @@ class Network extends \Zotlabs\Web\Controller { $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); $spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0); - $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : $default_cmin); - $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : $default_cmax); + $cmin = ((array_key_exists('cmin',$_GET)) ? intval($_GET['cmin']) : $default_cmin); + $cmax = ((array_key_exists('cmax',$_GET)) ? intval($_GET['cmax']) : $default_cmax); $file = ((x($_GET,'file')) ? $_GET['file'] : ''); $xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : ''); $net = ((x($_GET,'net')) ? $_GET['net'] : ''); @@ -408,7 +409,6 @@ class Network extends \Zotlabs\Web\Controller { if($cmax == 99) $sql_nets .= " OR abook.abook_closeness IS NULL ) "; - } $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); @@ -477,7 +477,6 @@ class Network extends \Zotlabs\Web\Controller { if($load) { // Fetch a page full of parent items for this page - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) $net_query @@ -488,7 +487,6 @@ class Network extends \Zotlabs\Web\Controller { $net_query2 ORDER BY $ordering DESC $pager_sql " ); - } else { -- cgit v1.2.3