diff options
Diffstat (limited to 'include/socgraph.php')
-rw-r--r-- | include/socgraph.php | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/include/socgraph.php b/include/socgraph.php index 0ad7c4034..e44a8ea9a 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -40,7 +40,7 @@ function poco_load($xchan = '', $url = null) { return; } - $url = $url . '?f=&fields=displayName,hash,urls,photos,rating' ; + $url = $url . '?f=&fields=displayName,hash,urls,photos' ; logger('poco_load: ' . $url, LOGGER_DEBUG); @@ -115,8 +115,6 @@ function poco_load($xchan = '', $url = null) { $name = $entry['displayName']; $hash = $entry['hash']; - $rating = ((array_key_exists('rating',$entry) && (! is_array($entry['rating']))) ? intval($entry['rating']) : 0); - $rating_text = ((array_key_exists('rating_text',$entry)) ? escape_tags($entry['rating_text']) :''); if(x($entry,'urls') && is_array($entry['urls'])) { foreach($entry['urls'] as $url) { @@ -214,7 +212,7 @@ function poco_load($xchan = '', $url = null) { function count_common_friends($uid,$xchan) { $r = q("SELECT count(xlink_id) as total from xlink where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in - (select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 )", + (select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_self = 0 )", dbesc($xchan), dbesc($xchan), intval($uid) @@ -235,7 +233,7 @@ function common_friends($uid,$xchan,$start = 0,$limit=100000000,$shuffle = false $sql_extra = " order by xchan_name asc "; $r = q("SELECT * from xchan left join xlink on xlink_link = xchan_hash where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in - (select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 ) $sql_extra limit %d offset %d", + (select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_self = 0 ) $sql_extra limit %d offset %d", dbesc($xchan), dbesc($xchan), intval($uid), @@ -329,15 +327,13 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) { and not xlink_link in ( select abook_xchan from abook where abook_channel = %d ) and not xlink_link in ( select xchan from xign where uid = %d ) and xlink_xchan != '' + and xchan_hidden = 0 + and xchan_deleted = 0 and xlink_static = 0 - and not ( xchan_flags & %d )>0 - and not ( xchan_flags & %d )>0 group by xchan_hash order by total desc limit %d offset %d ", intval($uid), intval($uid), intval($uid), - intval(XCHAN_FLAGS_HIDDEN), - intval(XCHAN_FLAGS_DELETED), intval($limit), intval($start) ); @@ -350,14 +346,12 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) { where xlink_xchan = '' and not xlink_link in ( select abook_xchan from abook where abook_channel = %d ) and not xlink_link in ( select xchan from xign where uid = %d ) + and xchan_hidden = 0 + and xchan_deleted = 0 and xlink_static = 0 - and not ( xchan_flags & %d )>0 - and not ( xchan_flags & %d )>0 group by xchan_hash order by total desc limit %d offset %d ", intval($uid), intval($uid), - intval(XCHAN_FLAGS_HIDDEN), - intval(XCHAN_FLAGS_DELETED), intval($limit), intval($start) ); @@ -465,16 +459,16 @@ function poco($a,$extended = false) { } if($justme) - $sql_extra = " and ( abook_flags & " . ABOOK_FLAG_SELF . " )>0 "; + $sql_extra = " and abook_self = 1 "; else - $sql_extra = " and abook_flags = 0 "; + $sql_extra = " and abook_self = 0 "; if($cid) - $sql_extra = sprintf(" and abook_id = %d and ( abook_flags & " . ABOOK_FLAG_HIDDEN . " ) = 0 ",intval($cid)); + $sql_extra = sprintf(" and abook_id = %d and abook_hidden = 0 ",intval($cid)); if($system_mode) { - $r = q("SELECT count(*) as `total` from abook where ( abook_flags & " . ABOOK_FLAG_SELF . - " )>0 and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') "); + $r = q("SELECT count(*) as `total` from abook where abook_self = 1 + and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') "); } else { $r = q("SELECT count(*) as `total` from abook where abook_channel = %d @@ -497,8 +491,9 @@ function poco($a,$extended = false) { $itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults); if($system_mode) { - $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where ( abook_flags & " . ABOOK_FLAG_SELF . - " )>0 and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') limit %d offset %d ", + $r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_self = 1 + and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') + limit %d offset %d ", intval($itemsPerPage), intval($startIndex) ); @@ -580,13 +575,6 @@ function poco($a,$extended = false) { $entry['preferredUsername'] = substr($rr['xchan_addr'],0,strpos($rr['xchan_addr'],'@')); if($fields_ret['photos']) $entry['photos'] = array(array('value' => $rr['xchan_photo_l'], 'mimetype' => $rr['xchan_photo_mimetype'], 'type' => 'profile')); - if($fields_ret['rating']) { - $entry['rating'] = ((array_key_exists('abook_rating',$rr)) ? intval($rr['abook_rating']) : 0); - $entry['rating_text'] = ((array_key_exists('abook_rating_text',$rr)) ? $rr['abook_rating_text'] : ''); - // maybe this should be a composite calculated rating in $system_mode - if($system_mode) - $entry['rating'] = 0; - } $ret['entry'][] = $entry; } } @@ -609,4 +597,4 @@ function poco($a,$extended = false) { else http_status_exit(500); -}
\ No newline at end of file +} |