diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 857f6c82d..0bcf13785 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -83,14 +83,12 @@ function dfrn_confirm_post(App $a, $handsfree = null) $duplex = $handsfree['duplex']; $cid = 0; $hidden = intval(defaults($handsfree, 'hidden' , 0)); - $activity = intval(defaults($handsfree, 'activity', 0)); } else { $dfrn_id = notags(trim(defaults($_POST, 'dfrn_id' , ''))); $intro_id = intval(defaults($_POST, 'intro_id' , 0)); $duplex = intval(defaults($_POST, 'duplex' , 0)); $cid = intval(defaults($_POST, 'contact_id', 0)); $hidden = intval(defaults($_POST, 'hidden' , 0)); - $activity = intval(defaults($_POST, 'activity' , 0)); } /* @@ -401,50 +399,6 @@ function dfrn_confirm_post(App $a, $handsfree = null) $ret = Diaspora::sendShare($user, $contact); logger('share returns: ' . $ret); } - - // Send a new friend post if we are allowed to... - $profile = dba::selectFirst('profile', ['hide-friends'], ['is-default' => true, 'uid' => $uid]); - if (x($profile, 'hide-friends') === 0 && $activity && !$hidden) { - $self = dba::selectFirst('contact', [], ['self' => true, 'uid' => $uid]); - if (DBM::is_result($self)) { - $arr = []; - $arr['guid'] = get_guid(32); - $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid); - $arr['uid'] = $uid; - $arr['contact-id'] = $self['id']; - $arr['wall'] = 1; - $arr['type'] = 'wall'; - $arr['gravity'] = 0; - $arr['origin'] = 1; - $arr['author-name'] = $arr['owner-name'] = $self['name']; - $arr['author-link'] = $arr['owner-link'] = $self['url']; - $arr['author-avatar'] = $arr['owner-avatar'] = $self['thumb']; - - $A = '[url=' . $self['url'] . ']' . $self['name'] . '[/url]'; - $B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; - $BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]'; - - $arr['verb'] = ACTIVITY_FRIEND; - $arr['object-type'] = ACTIVITY_OBJ_PERSON; - $arr['body'] = L10n::t('%1$s is now friends with %2$s', $A, $B) . "\n\n\n" . $BPhoto; - - $arr['object'] = '' . "\n"; - - $arr['allow_cid'] = $user['allow_cid']; - $arr['allow_gid'] = $user['allow_gid']; - $arr['deny_cid'] = $user['deny_cid']; - $arr['deny_gid'] = $user['deny_gid']; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } - } - } } Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']); @@ -665,49 +619,6 @@ function dfrn_confirm_post(App $a, $handsfree = null) } } - // Send a new friend post if we are allowed to... - if ($page && intval(PConfig::get($local_uid, 'system', 'post_joingroup'))) { - $profile = dba::selectFirst('profile', ['hide-friends'], ['is-default' => true, 'uid' => $local_uid]); - if (x($profile, 'hide-friends') === 0) { - $self = dba::selectFirst('contact', [], ['self' => true, 'uid' => $local_uid]); - if (DBM::is_result($self)) { - $arr = []; - $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $local_uid); - $arr['uid'] = $local_uid; - $arr['contact-id'] = $self['id']; - $arr['wall'] = 1; - $arr['type'] = 'wall'; - $arr['gravity'] = 0; - $arr['origin'] = 1; - $arr['author-name'] = $arr['owner-name'] = $self['name']; - $arr['author-link'] = $arr['owner-link'] = $self['url']; - $arr['author-avatar'] = $arr['owner-avatar'] = $self['thumb']; - - $A = '[url=' . $self['url'] . ']' . $self['name'] . '[/url]'; - $B = '[url=' . $combined['url'] . ']' . $combined['name'] . '[/url]'; - $BPhoto = '[url=' . $combined['url'] . ']' . '[img]' . $combined['thumb'] . '[/img][/url]'; - - $arr['verb'] = ACTIVITY_JOIN; - $arr['object-type'] = ACTIVITY_OBJ_GROUP; - $arr['body'] = L10n::t('%1$s has joined %2$s', $A, $B) . "\n\n\n" . $BPhoto; - $arr['object'] = '' . "\n"; - - $arr['allow_cid'] = $user['allow_cid']; - $arr['allow_gid'] = $user['allow_gid']; - $arr['deny_cid'] = $user['deny_cid']; - $arr['deny_gid'] = $user['deny_gid']; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } - } - } - } System::xmlExit(0); // Success return; // NOTREACHED ////////////////////// End of this scenario /////////////////////////////////////////////// diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index dae2d8852..ae6017d14 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -577,7 +577,6 @@ function dfrn_request_content(App $a) 'dfrn_id' => $r[0]['issued-id'], 'intro_id' => $intro[0]['id'], 'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0), - 'activity' => intval(PConfig::get($r[0]['uid'], 'system', 'post_newfriend')) ]; dfrn_confirm_post($a, $handsfree); } diff --git a/mod/notifications.php b/mod/notifications.php index 46519075b..f7f40d1d2 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -173,7 +173,6 @@ function notifications_content(App $a) { '$fullname' => $it['name'], '$url' => $it['url'], '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''], - '$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')], '$knowyou' => $it['knowyou'], '$approve' => L10n::t('Approve'), @@ -252,7 +251,6 @@ function notifications_content(App $a) { '$gender' => $it['gender'], '$lbl_gender' => L10n::t('Gender:'), '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''], - '$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')], '$url' => $it['url'], '$zrl' => $it['zrl'], '$lbl_url' => L10n::t('Profile URL'), diff --git a/mod/profiles.php b/mod/profiles.php index 8bb09aa6d..9c925924f 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -403,9 +403,6 @@ function profiles_post(App $a) { $comma2 = (($region && $country_name) ? ', ' : ''); $value = $locality . $comma1 . $region . $comma2 . $country_name; } - - profile_activity($changes,$value); - } $r = q("UPDATE `profile` @@ -510,96 +507,6 @@ function profiles_post(App $a) { } } - -function profile_activity($changed, $value) { - $a = get_app(); - - if (! local_user() || ! is_array($changed) || ! count($changed)) { - return; - } - - if ($a->user['hidewall'] || Config::get('system', 'block_public')) { - return; - } - - if (! PConfig::get(local_user(), 'system', 'post_profilechange')) { - return; - } - - require_once 'include/items.php'; - - $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", - intval(local_user()) - ); - - if (! DBM::is_result($self)) { - return; - } - - $arr = []; - - $arr['guid'] = get_guid(32); - $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user()); - $arr['uid'] = local_user(); - $arr['contact-id'] = $self[0]['id']; - $arr['wall'] = 1; - $arr['type'] = 'wall'; - $arr['gravity'] = 0; - $arr['origin'] = 1; - $arr['author-name'] = $arr['owner-name'] = $self[0]['name']; - $arr['author-link'] = $arr['owner-link'] = $self[0]['url']; - $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb']; - $arr['verb'] = ACTIVITY_UPDATE; - $arr['object-type'] = ACTIVITY_OBJ_PROFILE; - - $A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]'; - - - $changes = ''; - $t = count($changed); - $z = 0; - foreach ($changed as $ch) { - if (strlen($changes)) { - if ($z == ($t - 1)) { - $changes .= L10n::t(' and '); - } else { - $changes .= ', '; - } - } - $z ++; - $changes .= $ch; - } - - $prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . L10n::t('public profile') . '[/url]'; - - if ($t == 1 && strlen($value)) { - $message = L10n::t('%1$s changed %2$s to “%3$s”', $A, $changes, $value); - $message .= "\n\n" . L10n::t(' - Visit %1$s\'s %2$s', $A, $prof); - } else { - $message = L10n::t('%1$s has an updated %2$s, changing %3$s.', $A, $prof, $changes); - } - - - $arr['body'] = $message; - - $arr['object'] = '' . "\n"; - - $arr['allow_cid'] = $a->user['allow_cid']; - $arr['allow_gid'] = $a->user['allow_gid']; - $arr['deny_cid'] = $a->user['deny_cid']; - $arr['deny_gid'] = $a->user['deny_gid']; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } -} - - function profiles_content(App $a) { if (! local_user()) { diff --git a/mod/settings.php b/mod/settings.php index 23869913a..48c217bc4 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -442,9 +442,6 @@ function settings_post(App $a) $suggestme = ((x($_POST, 'suggestme')) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); - $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0); - $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0); - $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); $email_textonly = (($_POST['email_textonly'] == 1) ? 1 : 0); $detailed_notif = (($_POST['detailed_notif'] == 1) ? 1 : 0); @@ -558,9 +555,6 @@ function settings_post(App $a) PConfig::set(local_user(), 'expire', 'network_only', $expire_network_only); PConfig::set(local_user(), 'system', 'suggestme', $suggestme); - PConfig::set(local_user(), 'system', 'post_newfriend', $post_newfriend); - PConfig::set(local_user(), 'system', 'post_joingroup', $post_joingroup); - PConfig::set(local_user(), 'system', 'post_profilechange', $post_profilechange); PConfig::set(local_user(), 'system', 'email_textonly', $email_textonly); PConfig::set(local_user(), 'system', 'detailed_notif', $detailed_notif); @@ -1020,9 +1014,6 @@ function settings_content(App $a) $expire_photos = PConfig::get(local_user(), 'expire', 'photos', false); $expire_network_only = PConfig::get(local_user(), 'expire', 'network_only', false); $suggestme = PConfig::get(local_user(), 'system', 'suggestme', false); - $post_newfriend = PConfig::get(local_user(), 'system', 'post_newfriend', false); - $post_joingroup = PConfig::get(local_user(), 'system', 'post_joingroup', false); - $post_profilechange = PConfig::get(local_user(), 'system', 'post_profilechange', false); // nowarn_insecure @@ -1247,10 +1238,6 @@ function settings_content(App $a) '$h_not' => L10n::t('Notification Settings'), - '$activity_options' => L10n::t('By default post a status message when:'), - '$post_newfriend' => ['post_newfriend', L10n::t('accepting a friend request'), $post_newfriend, ''], - '$post_joingroup' => ['post_joingroup', L10n::t('joining a forum/community'), $post_joingroup, ''], - '$post_profilechange' => ['post_profilechange', L10n::t('making an interesting profile change'), $post_profilechange, ''], '$lbl_not' => L10n::t('Send a notification email when:'), '$notify1' => ['notify1', L10n::t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''], '$notify2' => ['notify2', L10n::t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''], diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index bae2eb6a2..d2a7995d8 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -2386,78 +2386,6 @@ class Diaspora ['id' => $contact["id"], 'uid' => $importer["uid"]] ); } - // send notification - - $r = q( - "SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", - intval($importer["uid"]) - ); - - if ($r && !$r[0]["hide-friends"] && !$contact["hidden"] && intval(PConfig::get($importer["uid"], "system", "post_newfriend"))) { - $self = q( - "SELECT * FROM `contact` WHERE `self` AND `uid` = %d LIMIT 1", - intval($importer["uid"]) - ); - - // they are not CONTACT_IS_FOLLOWER anymore but that's what we have in the array - - if ($self && $contact["rel"] == CONTACT_IS_FOLLOWER) { - $arr = []; - $arr["protocol"] = PROTOCOL_DIASPORA; - $arr["uri"] = $arr["parent-uri"] = item_new_uri($a->get_hostname(), $importer["uid"]); - $arr["uid"] = $importer["uid"]; - $arr["contact-id"] = $self[0]["id"]; - $arr["wall"] = 1; - $arr["type"] = 'wall'; - $arr["gravity"] = 0; - $arr["origin"] = 1; - $arr["author-name"] = $arr["owner-name"] = $self[0]["name"]; - $arr["author-link"] = $arr["owner-link"] = $self[0]["url"]; - $arr["author-avatar"] = $arr["owner-avatar"] = $self[0]["thumb"]; - $arr["verb"] = ACTIVITY_FRIEND; - $arr["object-type"] = ACTIVITY_OBJ_PERSON; - - $A = "[url=".$self[0]["url"]."]".$self[0]["name"]."[/url]"; - $B = "[url=".$contact["url"]."]".$contact["name"]."[/url]"; - $BPhoto = "[url=".$contact["url"]."][img]".$contact["thumb"]."[/img][/url]"; - $arr["body"] = L10n::t('%1$s is now friends with %2$s', $A, $B)."\n\n\n".$BPhoto; - - $arr["object"] = self::constructNewFriendObject($contact); - - $user = dba::selectFirst('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]); - - $arr["allow_cid"] = $user["allow_cid"]; - $arr["allow_gid"] = $user["allow_gid"]; - $arr["deny_cid"] = $user["deny_cid"]; - $arr["deny_gid"] = $user["deny_gid"]; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } - } - } - } - - /** - * @brief Creates a XML object for a "new friend" message - * - * @param array $contact Array of the contact - * - * @return string The XML - */ - private static function constructNewFriendObject($contact) - { - $objtype = ACTIVITY_OBJ_PERSON; - $link = ''."\n". - ''."\n"; - - $xmldata = ["object" => ["type" => $objtype, - "title" => $contact["name"], - "id" => $contact["url"]."/".$contact["name"], - "link" => $link]]; - - return XML::fromArray($xmldata, $xml, true); } /** diff --git a/view/templates/intros.tpl b/view/templates/intros.tpl index 2d0bf9bd0..9ebd256db 100644 --- a/view/templates/intros.tpl +++ b/view/templates/intros.tpl @@ -20,7 +20,6 @@