test of new affinity preset code (post 3.0)

This commit is contained in:
zotlabs 2017-12-30 22:48:06 -08:00
parent e095cb8113
commit 3fadedcc54
2 changed files with 7 additions and 7 deletions

View File

@ -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_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); $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
// if no tabs are selected, defaults to comments // 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); $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
$spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0); $spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0);
$cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : $default_cmin); $cmin = ((array_key_exists('cmin',$_GET)) ? intval($_GET['cmin']) : $default_cmin);
$cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : $default_cmax); $cmax = ((array_key_exists('cmax',$_GET)) ? intval($_GET['cmax']) : $default_cmax);
$file = ((x($_GET,'file')) ? $_GET['file'] : ''); $file = ((x($_GET,'file')) ? $_GET['file'] : '');
$xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : ''); $xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : '');
$net = ((x($_GET,'net')) ? $_GET['net'] : ''); $net = ((x($_GET,'net')) ? $_GET['net'] : '');
@ -408,7 +409,6 @@ class Network extends \Zotlabs\Web\Controller {
if($cmax == 99) if($cmax == 99)
$sql_nets .= " OR abook.abook_closeness IS NULL ) "; $sql_nets .= " OR abook.abook_closeness IS NULL ) ";
} }
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
@ -477,7 +477,6 @@ class Network extends \Zotlabs\Web\Controller {
if($load) { if($load) {
// Fetch a page full of parent items for this page // Fetch a page full of parent items for this page
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
$net_query $net_query
@ -488,7 +487,6 @@ class Network extends \Zotlabs\Web\Controller {
$net_query2 $net_query2
ORDER BY $ordering DESC $pager_sql " ORDER BY $ordering DESC $pager_sql "
); );
} }
else { else {

View File

@ -9,9 +9,11 @@ class Affinity {
if(! local_channel()) if(! local_channel())
return ''; return '';
$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);
$cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : 0); $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $default_cmin);
$cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : 99); $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $default_cmax);
if(feature_enabled(local_channel(),'affinity')) { if(feature_enabled(local_channel(),'affinity')) {