diff options
Diffstat (limited to 'mod/connedit.php')
-rw-r--r-- | mod/connedit.php | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/mod/connedit.php b/mod/connedit.php index f628fb9d3..78d06c243 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,7 +397,7 @@ 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) + info((intval($orig_record[0]['abook_blocked']) ? t('Channel has been unblocked') : t('Channel has been blocked')) . EOL ); connedit_clone($a); @@ -409,7 +409,7 @@ 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) + info((intval($orig_record[0]['abook_ignored']) ? t('Channel has been unignored') : t('Channel has been ignored')) . EOL ); connedit_clone($a); @@ -421,7 +421,7 @@ 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) + info((intval($orig_record[0]['abook_archived']) ? t('Channel has been unarchived') : t('Channel has been archived')) . EOL ); connedit_clone($a); @@ -433,7 +433,7 @@ 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) + info((intval($orig_record[0]['abook_hidden']) ? t('Channel has been unhidden') : t('Channel has been hidden')) . EOL ); connedit_clone($a); @@ -447,9 +447,9 @@ 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) + info((intval($orig_record[0]['abook_pending']) ? t('Channel has been approved') : t('Channel has been unapproved')) . EOL ); connedit_clone($a); @@ -516,30 +516,30 @@ 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'), ), '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'), ), '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'), ), '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'), ), @@ -554,7 +554,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'); @@ -682,7 +682,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'), |