diff options
Diffstat (limited to 'mod/connedit.php')
-rw-r--r-- | mod/connedit.php | 69 |
1 files changed, 27 insertions, 42 deletions
diff --git a/mod/connedit.php b/mod/connedit.php index bc8ae5e2e..a23e89d4c 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -79,7 +79,7 @@ function connedit_post(&$a) { call_hooks('contact_edit_post', $_POST); - if($orig_record[0]['abook_flags'] & ABOOK_FLAG_SELF) { + if(intval($orig_record[0]['abook_self'])) { $autoperms = intval($_POST['autoperms']); $is_self = true; } @@ -176,8 +176,7 @@ function connedit_post(&$a) { } } - if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) { - $abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING ); + if(($_REQUEST['pending']) && intval($orig_record[0]['abook_pending'])) { $new_friend = true; if(! $abook_my_perms) { @@ -192,13 +191,14 @@ function connedit_post(&$a) { } } - $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d, + + $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_pending = %d, abook_incl = '%s', abook_excl = '%s' where abook_id = %d AND abook_channel = %d", dbesc($profile_id), intval($abook_my_perms), intval($closeness), - intval($abook_flags), + intval(1 - intval($new_friend)), dbesc($abook_incl), dbesc($abook_excl), intval($contact_id), @@ -221,7 +221,7 @@ function connedit_post(&$a) { notice( t('Failed to update connection record.') . EOL); if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms - && (! ($a->poi['abook_flags'] & ABOOK_FLAG_SELF))) { + && (! intval($a->poi['abook_self']))) { proc_run('php', 'include/notifier.php', 'permission_update', $contact_id); } @@ -241,11 +241,12 @@ function connedit_post(&$a) { $pr = q("select * from profile where uid = %d and is_default = 1 and hide_friends = 0", intval($channel['channel_id']) ); - if(($pr) && (! ($abook_flags & ABOOK_FLAG_HIDDEN)) - && (intval(get_pconfig($channel['channel_id'],'system','post_newfriend')))) { + if(($pr) && (! intval($orig_record[0]['abook_hidden'])) && (intval(get_pconfig($channel['channel_id'],'system','post_newfriend')))) { $xarr = array(); $xarr['verb'] = ACTIVITY_FRIEND; - $xarr['item_flags'] = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; + $xarr['item_wall'] = 1; + $xarr['item_origin'] = 1; + $xarr['item_thread_top'] = 1; $xarr['owner_xchan'] = $xarr['author_xchan'] = $channel['channel_hash']; $xarr['allow_cid'] = $channel['channel_allow_cid']; $xarr['allow_gid'] = $channel['channel_allow_gid']; @@ -370,10 +371,9 @@ function connedit_content(&$a) { $cmd = argv(2); $orig_record = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_id = %d AND abook_channel = %d AND NOT ( abook_flags & %d )>0 LIMIT 1", + WHERE abook_id = %d AND abook_channel = %d AND abook_self = 0 LIMIT 1", intval($contact_id), - intval(local_channel()), - intval(ABOOK_FLAG_SELF) + intval(local_channel()) ); if(! count($orig_record)) { @@ -397,9 +397,6 @@ function connedit_content(&$a) { if($cmd === 'block') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED)) { - // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_BLOCKED) - // ? t('Channel has been unblocked') - // : t('Channel has been blocked')) . EOL ); connedit_clone($a); } else @@ -409,9 +406,6 @@ function connedit_content(&$a) { if($cmd === 'ignore') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED)) { - // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_IGNORED) - // ? t('Channel has been unignored') - // : t('Channel has been ignored')) . EOL ); connedit_clone($a); } else @@ -421,9 +415,6 @@ function connedit_content(&$a) { if($cmd === 'archive') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED)) { - // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_ARCHIVED) - // ? t('Channel has been unarchived') - // : t('Channel has been archived')) . EOL ); connedit_clone($a); } else @@ -433,9 +424,6 @@ function connedit_content(&$a) { if($cmd === 'hide') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN)) { - // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_HIDDEN) - // ? t('Channel has been unhidden') - // : t('Channel has been hidden')) . EOL ); connedit_clone($a); } else @@ -447,11 +435,8 @@ function connedit_content(&$a) { // Though maybe somebody will want this eventually (??) if($cmd === 'approve') { - if($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) { + if(intval($orig_record[0]['abook_pending'])) { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_PENDING)) { - // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) - // ? t('Channel has been approved') - // : t('Channel has been unapproved')) . EOL ); connedit_clone($a); } else @@ -516,35 +501,35 @@ function connedit_content(&$a) { ), 'block' => array( - 'label' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? t('Unblock') : t('Block')), + 'label' => (intval($contact['abook_blocked']) ? t('Unblock') : t('Block')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/block', - 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? 'active' : ''), + 'sel' => (intval($contact['abook_blocked']) ? 'active' : ''), 'title' => t('Block (or Unblock) all communications with this connection'), - 'info' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? t('This connection is blocked!') : ''), + 'info' => (intval($contact['abook_blocked']) ? t('This connection is blocked!') : ''), ), 'ignore' => array( - 'label' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? t('Unignore') : t('Ignore')), + 'label' => (intval($contact['abook_ignored']) ? t('Unignore') : t('Ignore')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/ignore', - 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? 'active' : ''), + 'sel' => (intval($contact['abook_ignored']) ? 'active' : ''), 'title' => t('Ignore (or Unignore) all inbound communications from this connection'), - 'info' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? t('This connection is ignored!') : ''), + 'info' => (intval($contact['abook_ignored']) ? t('This connection is ignored!') : ''), ), 'archive' => array( - 'label' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? t('Unarchive') : t('Archive')), + 'label' => (intval($contact['abook_archived']) ? t('Unarchive') : t('Archive')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/archive', - 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? 'active' : ''), + 'sel' => (intval($contact['abook_archived']) ? 'active' : ''), 'title' => t('Archive (or Unarchive) this connection - mark channel dead but keep content'), - 'info' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? t('This connection is archived!') : ''), + 'info' => (intval($contact['abook_archived']) ? t('This connection is archived!') : ''), ), 'hide' => array( - 'label' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? t('Unhide') : t('Hide')), + 'label' => (intval($contact['abook_hidden']) ? t('Unhide') : t('Hide')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/hide', - 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? 'active' : ''), + 'sel' => (intval($contact['abook_hidden']) ? 'active' : ''), 'title' => t('Hide or Unhide this connection from your other connections'), - 'info' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? t('This connection is hidden!') : ''), + 'info' => (intval($contact['abook_hidden']) ? t('This connection is hidden!') : ''), ), 'delete' => array( @@ -558,7 +543,7 @@ function connedit_content(&$a) { $self = false; - if(($contact['abook_flags'] & ABOOK_FLAG_SELF)) + if(intval($contact['abook_self'])) $self = true; require_once('include/contact_selectors.php'); @@ -686,7 +671,7 @@ function connedit_content(&$a) { '$pending_modal_body' => sprintf(t('(%s) would like to connect with you. Please approve this connection to allow communication.'), $contact['xchan_addr']), '$pending_modal_approve' => t('Approve'), '$pending_modal_dismiss' => t('Approve Later'), - '$is_pending' => (($contact['abook_flags'] & ABOOK_FLAG_PENDING) ? 1 : ''), + '$is_pending' => (intval($contact['abook_pending']) ? 1 : ''), '$unapproved' => $unapproved, '$inherited' => t('inherited'), '$submit' => t('Submit'), |