diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-08-24 05:10:31 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-08-24 05:10:31 -0700 |
commit | b085a3243c8369a817f828d1064bec1b98ae18f0 (patch) | |
tree | 31c2c87d270a2c1b27bcfa63bc45cb344963d7cb | |
parent | d256e8e9f28aa3efcd0a5ac7f7326ba24367ea31 (diff) | |
parent | 250d286f1dd8ee9ca244df25946e56b09ee5ff18 (diff) | |
download | volse-hubzilla-b085a3243c8369a817f828d1064bec1b98ae18f0.tar.gz volse-hubzilla-b085a3243c8369a817f828d1064bec1b98ae18f0.tar.bz2 volse-hubzilla-b085a3243c8369a817f828d1064bec1b98ae18f0.zip |
Merge https://github.com/redmatrix/redmatrix into pending_merge
Conflicts:
mod/connections.php
mod/connedit.php
-rw-r--r-- | mod/connections.php | 137 | ||||
-rw-r--r-- | version.inc | 2 |
2 files changed, 1 insertions, 138 deletions
diff --git a/mod/connections.php b/mod/connections.php index 2f1a1fdf5..2060ca85e 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -19,143 +19,6 @@ function connections_init(&$a) { } -function connections_post(&$a) { - - if(! local_channel()) - return; - - $contact_id = intval(argv(1)); - if(! $contact_id) - return; - - $orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", - intval($contact_id), - intval(local_channel()) - ); - - if(! $orig_record) { - notice( t('Could not access contact record.') . EOL); - goaway(z_root() . '/connections'); - return; // NOTREACHED - } - - call_hooks('contact_edit_post', $_POST); - - $profile_id = $_POST['profile_assign']; - if($profile_id) { - $r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1", - dbesc($profile_id), - intval(local_channel()) - ); - if(! count($r)) { - notice( t('Could not locate selected profile.') . EOL); - return; - } - } - - $hidden = intval($_POST['hidden']); - - $priority = intval($_POST['poll']); - if($priority > 5 || $priority < 0) - $priority = 0; - - $closeness = intval($_POST['closeness']); - if($closeness < 0) - $closeness = 99; - - $abook_my_perms = 0; - - foreach($_POST as $k => $v) { - if(strpos($k,'perms_') === 0) { - $abook_my_perms += $v; - } - } - - $new_friend = false; - - if(($_REQUEST['pending']) && intval($orig_record[0]['abook_pending'])) { - $new_friend = true; - } - - $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_pending = %d - where abook_id = %d AND abook_channel = %d", - dbesc($profile_id), - intval($abook_my_perms), - intval($closeness), - intval(1 - intval($new_friend)), - intval($contact_id), - intval(local_channel()) - ); - - if($r) - info( t('Connection updated.') . EOL); - else - notice( t('Failed to update connection record.') . EOL); - - if((x($a->data,'abook')) && $a->data['abook']['abook_my_perms'] != $abook_my_perms - && (! intval($a->data['abook']['abook_self']))) { - proc_run('php', 'include/notifier.php', 'permission_update', $contact_id); - } - - if($new_friend) { - $channel = $a->get_channel(); - $default_group = $channel['channel_default_group']; - if($default_group) { - require_once('include/group.php'); - $g = group_rec_byhash(local_channel(),$default_group); - if($g) - group_add_member(local_channel(),'',$a->data['abook_xchan'],$g['id']); - } - - - - // Check if settings permit ("post new friend activity" is allowed, and - // friends in general or this friend in particular aren't hidden) - // and send out a new friend activity - // TODO - - // pull in a bit of content if there is any to pull in - proc_run('php','include/onepoll.php',$contact_id); - - } - - // Refresh the structure in memory with the new data - - $r = q("SELECT abook.*, xchan.* - FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_channel = %d and abook_id = %d LIMIT 1", - intval(local_channel()), - intval($contact_id) - ); - if($r) { - $a->data['abook'] = $r[0]; - } - - if($new_friend) { - $arr = array('channel_id' => local_channel(), 'abook' => $a->data['abook']); - call_hooks('accept_follow', $arr); - } - - connections_clone($a); - - return; - -} - -function connections_clone(&$a) { - - if(! array_key_exists('abook',$a->data)) - return; - $clone = $a->data['abook']; - - unset($clone['abook_id']); - unset($clone['abook_account']); - unset($clone['abook_channel']); - - build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); -} - - function connections_content(&$a) { $sort_type = 0; diff --git a/version.inc b/version.inc index 6e33a9758..853449713 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-08-23.1133 +2015-08-24.1134 |