aboutsummaryrefslogtreecommitdiffstats
path: root/mod/connections.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/connections.php')
-rw-r--r--mod/connections.php45
1 files changed, 19 insertions, 26 deletions
diff --git a/mod/connections.php b/mod/connections.php
index 8b95cbf2a..2060ca85e 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -42,46 +42,43 @@ function connections_content(&$a) {
if(! $_REQUEST['aj'])
$_SESSION['return_url'] = $a->query_string;
- $search_flags = 0;
+ $search_flags = '';
$head = '';
if(argc() == 2) {
switch(argv(1)) {
case 'blocked':
- $search_flags = ABOOK_FLAG_BLOCKED;
+ $search_flags = " and abook_blocked = 1 ";
$head = t('Blocked');
$blocked = true;
break;
case 'ignored':
- $search_flags = ABOOK_FLAG_IGNORED;
+ $search_flags = " and abook_ignored = 1 ";
$head = t('Ignored');
$ignored = true;
break;
case 'hidden':
- $search_flags = ABOOK_FLAG_HIDDEN;
+ $search_flags = " and abook_hidden = 1 ";
$head = t('Hidden');
$hidden = true;
break;
case 'archived':
- $search_flags = ABOOK_FLAG_ARCHIVED;
+ $search_flags = " and abook_archived = 1 ";
$head = t('Archived');
$archived = true;
break;
case 'pending':
- $search_flags = ABOOK_FLAG_PENDING;
+ $search_flags = " and abook_pending = 1 ";
$head = t('New');
$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)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)",
- intval(local_channel()),
- intval(ABOOK_FLAG_PENDING),
- intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
- intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN)
+ $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_pending = 1 and abook_self = 0 and abook_ignored = 0 and xchan_deleted = 0 and xchan_orphan = 0 ",
+ intval(local_channel())
);
if($r && $r[0]['total']) {
- $search_flags = ABOOK_FLAG_PENDING;
+ $search_flags = " and abook_pending = 1 ";
$head = t('New');
$pending = true;
nav_set_selected('intros');
@@ -89,7 +86,7 @@ function connections_content(&$a) {
}
else {
$head = t('All');
- $search_flags = 0;
+ $search_flags = '';
$all = true;
$a->argc = 1;
unset($a->argv[1]);
@@ -97,7 +94,7 @@ function connections_content(&$a) {
nav_set_selected('intros');
break;
// case 'unconnected':
-// $search_flags = ABOOK_FLAG_UNCONNECTED;
+// $search_flags = " and abook_unconnected = 1 ";
// $head = t('Unconnected');
// $unconnected = true;
// break;
@@ -105,19 +102,19 @@ function connections_content(&$a) {
case 'all':
$head = t('All');
default:
- $search_flags = 0;
+ $search_flags = '';
$all = true;
break;
}
- $sql_extra = (($search_flags) ? " and ( abook_flags & " . $search_flags . " )>0 " : "");
+ $sql_extra = $search_flags;
if(argv(1) === 'pending')
- $sql_extra .= " and not ( abook_flags & " . ABOOK_FLAG_IGNORED . " )>0 ";
+ $sql_extra .= " and abook_ignored = 0 ";
}
else {
- $sql_extra = " and not ( abook_flags & " . ABOOK_FLAG_BLOCKED . " )>0 ";
+ $sql_extra = " and abook_blocked = 0 ";
$unblocked = true;
}
@@ -203,10 +200,8 @@ function connections_content(&$a) {
}
$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 not (abook_flags & %d)>0 and not (xchan_flags & %d )>0 $sql_extra $sql_extra2 ",
- intval(local_channel()),
- intval(ABOOK_FLAG_SELF),
- intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN)
+ where abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ",
+ intval(local_channel())
);
if($r) {
$a->set_pager_total($r[0]['total']);
@@ -214,10 +209,8 @@ function connections_content(&$a) {
}
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
- WHERE abook_channel = %d and not (abook_flags & %d)>0 and not ( xchan_flags & %d)>0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ",
+ WHERE abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ",
intval(local_channel()),
- intval(ABOOK_FLAG_SELF),
- intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN),
intval($a->pager['itemspage']),
intval($a->pager['start'])
);
@@ -237,7 +230,7 @@ function connections_content(&$a) {
'thumb' => $rr['xchan_photo_m'],
'name' => $rr['xchan_name'],
'username' => $rr['xchan_name'],
- 'classes' => (($rr['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? 'archived' : ''),
+ 'classes' => (intval($rr['abook_archived']) ? 'archived' : ''),
'link' => z_root() . '/connedit/' . $rr['abook_id'],
'edit' => t('Edit'),
'url' => chanlink_url($rr['xchan_url']),