diff options
Diffstat (limited to 'mod/connections.php')
-rw-r--r-- | mod/connections.php | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/mod/connections.php b/mod/connections.php index dbdcbdc93..3c3a704b2 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -212,6 +212,28 @@ function connections_content(&$a) { $pending = true; nav_set_selected('intros'); break; + case 'ifpending': + $r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) and not ((abook_flags & %d) or (xchan_flags & %d))", + intval(local_user()), + intval(ABOOK_FLAG_PENDING), + intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), + intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) + ); + if($r && $r[0]['total']) { + $search_flags = ABOOK_FLAG_PENDING; + $head = t('New'); + $pending = true; + nav_set_selected('intros'); + $a->argv[1] = 'pending'; + } + else { + $head = t('All'); + $search_flags = 0; + $all = true; + $a->argc = 1; + unset($a->argv[1]); + } + break; case 'unconnected': $search_flags = ABOOK_FLAG_UNCONNECTED; $head = t('Unconnected'); @@ -319,9 +341,9 @@ function connections_content(&$a) { where abook_channel = %d and not (abook_flags & %d) and not (xchan_flags & %d ) $sql_extra $sql_extra2 ", intval(local_user()), intval(ABOOK_FLAG_SELF), - intval(XCHAN_FLAGS_DELETED) + intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) ); - if(count($r)) { + if($r) { $a->set_pager_total($r[0]['total']); $total = $r[0]['total']; } @@ -330,7 +352,7 @@ function connections_content(&$a) { WHERE abook_channel = %d and not (abook_flags & %d) and not ( xchan_flags & %d) $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d , %d ", intval(local_user()), intval(ABOOK_FLAG_SELF), - intval(XCHAN_FLAGS_DELETED), + intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN), intval($a->pager['start']), intval($a->pager['itemspage']) ); @@ -350,18 +372,16 @@ function connections_content(&$a) { 'thumb' => $rr['xchan_photo_m'], 'name' => $rr['xchan_name'], 'username' => $rr['xchan_name'], - 'sparkle' => $sparkle, + 'classes' => (($rr['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? 'archived' : ''), 'link' => z_root() . '/connedit/' . $rr['abook_id'], - 'url' => $rr['xchan_url'], + 'url' => chanlink_url($rr['xchan_url']), 'network' => network_to_name($rr['network']), ); } } } - - $tpl = get_markup_template("contacts-template.tpl"); - $o .= replace_macros($tpl,array( + $o .= replace_macros(get_markup_template('connections.tpl'),array( '$header' => t('Connections') . (($head) ? ' - ' . $head : ''), '$tabs' => $t, '$total' => $total, @@ -369,6 +389,7 @@ function connections_content(&$a) { '$desc' => t('Search your connections'), '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""), '$submit' => t('Find'), + '$edit' => t('Edit'), '$cmd' => $a->cmd, '$contacts' => $contacts, '$paginate' => paginate($a), |