aboutsummaryrefslogtreecommitdiffstats
path: root/mod/connedit.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/connedit.php')
-rw-r--r--mod/connedit.php154
1 files changed, 54 insertions, 100 deletions
diff --git a/mod/connedit.php b/mod/connedit.php
index 46546caa1..866f83615 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -130,7 +130,6 @@ function connedit_post(&$a) {
}
}
- $abook_flags = $orig_record[0]['abook_flags'];
$new_friend = false;
if(! $is_self) {
@@ -144,7 +143,6 @@ function connedit_post(&$a) {
dbesc($orig_record[0]['abook_xchan'])
);
-
if($z) {
$record = $z[0]['xlink_id'];
$w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s'
@@ -192,6 +190,7 @@ function connedit_post(&$a) {
}
}
+ $abook_pending = $new_friend ? 0 : $orig_record[0]['abook_pending'];
$r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_pending = %d,
abook_incl = '%s', abook_excl = '%s'
@@ -199,7 +198,7 @@ function connedit_post(&$a) {
dbesc($profile_id),
intval($abook_my_perms),
intval($closeness),
- intval(1 - intval($new_friend)),
+ intval($abook_pending),
dbesc($abook_incl),
dbesc($abook_excl),
intval($contact_id),
@@ -398,9 +397,6 @@ function connedit_content(&$a) {
if($cmd === 'block') {
if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED)) {
- info((intval($orig_record[0]['abook_blocked'])
- ? t('Channel has been unblocked')
- : t('Channel has been blocked')) . EOL );
connedit_clone($a);
}
else
@@ -410,9 +406,6 @@ function connedit_content(&$a) {
if($cmd === 'ignore') {
if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED)) {
- info((intval($orig_record[0]['abook_ignored'])
- ? t('Channel has been unignored')
- : t('Channel has been ignored')) . EOL );
connedit_clone($a);
}
else
@@ -422,9 +415,6 @@ function connedit_content(&$a) {
if($cmd === 'archive') {
if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED)) {
- info((intval($orig_record[0]['abook_archived'])
- ? t('Channel has been unarchived')
- : t('Channel has been archived')) . EOL );
connedit_clone($a);
}
else
@@ -434,9 +424,6 @@ function connedit_content(&$a) {
if($cmd === 'hide') {
if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN)) {
- info((intval($orig_record[0]['abook_hidden'])
- ? t('Channel has been unhidden')
- : t('Channel has been hidden')) . EOL );
connedit_clone($a);
}
else
@@ -450,9 +437,6 @@ function connedit_content(&$a) {
if($cmd === 'approve') {
if(intval($orig_record[0]['abook_pending'])) {
if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_PENDING)) {
- info((intval($orig_record[0]['abook_pending'])
- ? t('Channel has been approved')
- : t('Channel has been unapproved')) . EOL );
connedit_clone($a);
}
else
@@ -493,59 +477,62 @@ function connedit_content(&$a) {
$contact_id = $a->poi['abook_id'];
$contact = $a->poi;
+ $buttons = array(
- $tabs = array(
-
- array(
+ 'view' => array(
'label' => t('View Profile'),
'url' => chanlink_cid($contact['abook_id']),
'sel' => '',
'title' => sprintf( t('View %s\'s profile'), $contact['xchan_name']),
),
- array(
+ 'refresh' => array(
'label' => t('Refresh Permissions'),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/refresh',
'sel' => '',
'title' => t('Fetch updated permissions'),
),
- array(
+ 'recent' => array(
'label' => t('Recent Activity'),
'url' => $a->get_baseurl(true) . '/network/?f=&cid=' . $contact['abook_id'],
'sel' => '',
'title' => t('View recent posts and comments'),
- )
- );
+ ),
- $buttons = array(
- array(
+ 'block' => array(
'label' => (intval($contact['abook_blocked']) ? t('Unblock') : t('Block')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/block',
'sel' => (intval($contact['abook_blocked']) ? 'active' : ''),
'title' => t('Block (or Unblock) all communications with this connection'),
+ 'info' => (intval($contact['abook_blocked']) ? t('This connection is blocked!') : ''),
),
- array(
+ 'ignore' => array(
'label' => (intval($contact['abook_ignored']) ? t('Unignore') : t('Ignore')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/ignore',
'sel' => (intval($contact['abook_ignored']) ? 'active' : ''),
'title' => t('Ignore (or Unignore) all inbound communications from this connection'),
+ 'info' => (intval($contact['abook_ignored']) ? t('This connection is ignored!') : ''),
),
- array(
+
+ 'archive' => array(
'label' => (intval($contact['abook_archived']) ? t('Unarchive') : t('Archive')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/archive',
'sel' => (intval($contact['abook_archived']) ? 'active' : ''),
'title' => t('Archive (or Unarchive) this connection - mark channel dead but keep content'),
+ 'info' => (intval($contact['abook_archived']) ? t('This connection is archived!') : ''),
),
- array(
+
+ 'hide' => array(
'label' => (intval($contact['abook_hidden']) ? t('Unhide') : t('Hide')),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/hide',
'sel' => (intval($contact['abook_hidden']) ? 'active' : ''),
'title' => t('Hide or Unhide this connection from your other connections'),
+ 'info' => (intval($contact['abook_hidden']) ? t('This connection is hidden!') : ''),
),
- array(
+ 'delete' => array(
'label' => t('Delete'),
'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/drop',
'sel' => '',
@@ -556,18 +543,9 @@ function connedit_content(&$a) {
$self = false;
- if(! intval($contact['abook_self'])) {
- $tab_tpl = get_markup_template('common_tabs.tpl');
- $t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
- }
- else
+ if(intval($contact['abook_self']))
$self = true;
- $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
- '$baseurl' => $a->get_baseurl(true),
- '$editselect' => $editselect
- ));
-
require_once('include/contact_selectors.php');
$tpl = get_markup_template("abook_edit.tpl");
@@ -616,7 +594,6 @@ function connedit_content(&$a) {
$rating_text = $xl[0]['xlink_rating_text'];
}
-
$poco_rating = get_config('system','poco_rating_enable');
// if unset default to enabled
@@ -640,101 +617,78 @@ function connedit_content(&$a) {
$global_perms = get_perms();
$existing = get_all_perms(local_channel(),$contact['abook_xchan']);
- $unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication'));
-
+ $unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication'), array(t('No'),('Yes')));
+
+ $multiprofs = ((feature_enabled(local_channel(),'multi_profiles')) ? true : false);
+
+ if($slide && !$multiprofs)
+ $affinity = t('Set Affinity');
+
+ if(!$slide && $multiprofs)
+ $affinity = t('Set Profile');
+
+ if($slide && $multiprofs)
+ $affinity = t('Set Affinity & Profile');
+
foreach($global_perms as $k => $v) {
$thisperm = (($contact['abook_my_perms'] & $v[1]) ? "1" : '');
+ $checkinherited = ((($channel[$v[0]]) && ($channel[$v[0]] != PERMS_SPECIFIC)) ? "1" : '');
// For auto permissions (when $self is true) we don't want to look at existing
// permissions because they are enabled for the channel owner
-
if((! $self) && ($existing[$k]))
$thisperm = "1";
- $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC || $self) ? '' : '1'), $v[4]);
+ $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4], $checkinherited);
}
$o .= replace_macros($tpl,array(
- '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connections: settings for %s'),$contact['xchan_name'])),
- '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), ''),
+ '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])),
+ '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), 'Connection requests will be approved without your interaction', array(t('No'),('Yes'))),
'$addr' => $contact['xchan_addr'],
+ '$addr_text' => t('This connection\'s address is'),
'$notself' => (($self) ? '' : '1'),
'$self' => (($self) ? '1' : ''),
- '$autolbl' => t('Apply the permissions indicated on this page to all new connections.'),
+ '$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'),
'$buttons' => (($self) ? '' : $buttons),
- '$viewprof' => t('View Profile'),
- '$clickme' => t('Click to open/close'),
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
- '$lbl_rating' => t('Rating (this information is public)'),
- '$lbl_rating_txt' => t('Optionally explain your rating (this information is public)'),
+ '$lbl_rating' => t('Rating'),
+ '$lbl_rating_label' => t('Slide to adjust your rating'),
+ '$lbl_rating_txt' => t('Optionally explain your rating'),
'$connfilter' => feature_enabled(local_channel(),'connfilter'),
+ '$connfilter_label' => t('Custom Filter'),
'$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
'$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
- '$rating_text' => array('rating_text', t('Optionally explain your rating (this information is public)'),$rating_text,''),
+ '$rating_text' => array('rating_text', t('Optionally explain your rating'),$rating_text,''),
+ '$rating_info' => t('This information is public!'),
'$rating' => $rating,
'$rating_val' => $rating_val,
'$slide' => $slide,
- '$tabs' => $t,
- '$tab_str' => $tab_str,
- '$perms_step1' => t('Default permissions for your channel type have (just) been applied. They have not yet been submitted. Please review the permissions on this page and make any desired changes at this time. This new connection may <em>not</em> be able to communicate with you until you submit this page, which will install and apply the selected permissions.'),
+ '$affinity' => $affinity,
+ '$pending_label' => t('Connection Pending Approval'),
+ '$pending_modal_title' => t('Connection Request'),
+ '$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' => (intval($contact['abook_pending']) ? 1 : ''),
'$unapproved' => $unapproved,
'$inherited' => t('inherited'),
- '$approve' => t('Approve this connection'),
- '$noperms' => (($contact['abook_my_perms']) ? false : true),
- '$no_perms' => (((! $self) && (! $contact['abook_my_perms'])) ? t('Connection has no individual permissions!') : ''),
- '$noperm_desc' => (((! $self) && (! $contact['abook_my_perms'])) ? t('This may be appropriate based on your <a href="settings">privacy settings</a>, though you may wish to review the "Advanced Permissions".') : ''),
'$submit' => t('Submit'),
- '$lbl_vis1' => t('Profile Visibility'),
'$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['xchan_name']),
- '$lbl_info1' => t('Contact Information / Notes'),
- '$infedit' => t('Edit contact notes'),
'$close' => $contact['abook_closeness'],
'$them' => t('Their Settings'),
'$me' => t('My Settings'),
'$perms' => $perms,
- '$perms_new' => t('Default permissions for this channel type have (just) been applied. They have <em>not</em> been saved and there are currently no stored default permissions. Please review/edit the applied settings and click [Submit] to finalize.'),
- '$clear' => t('Clear/Disable Automatic Permissions'),
- '$forum' => t('Forum Members'),
- '$soapbox' => t('Soapbox'),
- '$full' => t('Full Sharing (typical social network permissions)'),
- '$cautious' => t('Cautious Sharing '),
- '$follow' => t('Follow Only'),
'$permlbl' => t('Individual Permissions'),
- '$permnote' => t('Some permissions may be inherited from your channel <a href="settings">privacy settings</a>, which have higher priority than individual settings. Changing those inherited settings on this page will have no effect.'),
- '$advanced' => t('Advanced Permissions'),
- '$quick' => t('Simple Permissions (select one and submit)'),
- '$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_channel() . '/' . $contact['id'],
- '$all_friends' => $all_friends,
- '$relation_text' => $relation_text,
- '$visit' => sprintf( t('Visit %s\'s profile - %s'),$contact['xchan_name'],$contact['xchan_url']),
- '$blockunblock' => t('Block/Unblock contact'),
- '$ignorecont' => t('Ignore contact'),
- '$lblcrepair' => t("Repair URL settings"),
- '$lblrecent' => t('View conversations'),
- '$lblsuggest' => $lblsuggest,
- '$delete' => t('Delete contact'),
-
- '$poll_interval' => contact_poll_interval($contact['priority'],(! $poll_enabled)),
- '$poll_enabled' => $poll_enabled,
+ '$permnote' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can <strong>not</strong> change those settings here.'),
+ '$permnote_self' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can change those settings here but they wont have any impact unless the inherited setting changes.'),
'$lastupdtext' => t('Last update:'),
- '$lost_contact' => $lost_contact,
- '$updpub' => t('Update public posts'),
'$last_update' => relative_date($contact['abook_connected']),
- '$udnow' => t('Update now'),
'$profile_select' => contact_profile_assign($contact['abook_profile']),
- '$multiprofs' => feature_enabled(local_channel(),'multi_profiles'),
+ '$multiprofs' => $multiprofs,
'$contact_id' => $contact['abook_id'],
- '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
- '$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
- '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''),
- '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
- '$archived' => (($contact['archive']) ? t('Currently archived') : ''),
- '$pending' => (($contact['archive']) ? t('Currently pending') : ''),
- '$name' => $contact['name'],
- '$alt_text' => $alt_text,
- '$url' => $url
+ '$name' => $contact['xchan_name'],
));