diff options
Diffstat (limited to 'mod/suggest.php')
-rw-r--r-- | mod/suggest.php | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/mod/suggest.php b/mod/suggest.php index 4aed2e61a..8a6b50b22 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -2,25 +2,23 @@ require_once('include/socgraph.php'); require_once('include/contact_widgets.php'); +require_once('include/widgets.php'); function suggest_init(&$a) { if(! local_user()) return; - if(x($_GET,'ignore') && intval($_GET['ignore'])) { - q("insert into gcign ( uid, gcid ) values ( %d, %d ) ", + if(x($_GET,'ignore')) { + q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ", intval(local_user()), - intval($_GET['ignore']) + dbesc($_GET['ignore']) ); } } - - - function suggest_content(&$a) { $o = ''; @@ -31,38 +29,37 @@ function suggest_content(&$a) { $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; - $a->page['aside'] .= follow_widget(); - $a->page['aside'] .= findpeople_widget(); - - - $o .= '<h2>' . t('Friend Suggestions') . '</h2>'; - + $r = suggestion_query(local_user(),get_observer_hash()); - $r = suggestion_query(local_user()); - - if(! count($r)) { - $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.'); - return $o; + if(! $r) { + info( t('No suggestions available. If this is a new site, please try again in 24 hours.')); + return; } - $tpl = get_markup_template('suggest_friends.tpl'); + $arr = array(); foreach($r as $rr) { - $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); - - $o .= replace_macros($tpl,array( - '$url' => zid($rr['url']), - '$name' => $rr['name'], - '$photo' => $rr['photo'], - '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], - '$conntxt' => t('Connect'), - '$connlnk' => $connlnk, - '$ignore' => t('Ignore/Hide') - )); + $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['xchan_addr']; + + $arr[] = array( + 'url' => chanlink_url($rr['xchan_url']), + 'profile' => $rr['xchan_url'], + 'name' => $rr['xchan_name'], + 'photo' => $rr['xchan_photo_m'], + 'ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['xchan_hash'], + 'conntxt' => t('Connect'), + 'connlnk' => $connlnk, + 'ignore' => t('Ignore/Hide') + ); } - $o .= cleardiv(); -// $o .= paginate($a); + + $o = replace_macros(get_markup_template('suggest_page.tpl'),array( + '$title' => t('Channel Suggestions'), + '$entries' => $arr + )); + return $o; + } |