]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #5794 from annando/ap1
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 2 Oct 2018 15:24:04 +0000 (11:24 -0400)
committerGitHub <noreply@github.com>
Tue, 2 Oct 2018 15:24:04 +0000 (11:24 -0400)
ActivityPub support

1  2 
include/api.php
include/conversation.php
index.php
mod/admin.php
mod/contacts.php

diff --combined include/api.php
index 4cc1753c79a35c5dc0c38e8bc7da306a59c55e3f,cfc0c30564c45b4d6cfa70ad5dc594614a46ddd7..004388ac467da187007888e9971deef9470df042
@@@ -819,7 -819,7 +819,7 @@@ function api_item_get_user(App $a, $ite
        $status_user["protected"] = defaults($item, 'private', 0);
  
        if (defaults($item, 'thr-parent', '') == defaults($item, 'uri', '')) {
 -              $owner_user = api_get_user($a, defaults($item, 'author-id', null));
 +              $owner_user = api_get_user($a, defaults($item, 'owner-id', null));
        } else {
                $owner_user = $status_user;
        }
@@@ -2351,7 -2351,7 +2351,7 @@@ function api_format_messages($item, $re
        // standard meta information
        $ret = [
                'id'                    => $item['id'],
 -              'sender_id'             => $sender['id'] ,
 +              'sender_id'             => $sender['id'],
                'text'                  => "",
                'recipient_id'          => $recipient['id'],
                'created_at'            => api_date(defaults($item, 'created', DateTimeFormat::utcNow())),
@@@ -2732,7 -2732,7 +2732,7 @@@ function api_contactlink_to_array($txt
   *                    likes => int count,
   *                    dislikes => int count
   */
 -function api_format_items_activities(&$item, $type = "json")
 +function api_format_items_activities($item, $type = "json")
  {
        $a = get_app();
  
        $condition = ['uid' => $item['uid'], 'thr-parent' => $item['uri']];
        $ret = Item::selectForUser($item['uid'], ['author-id', 'verb'], $condition);
  
 -      while ($item = Item::fetch($ret)) {
 +      while ($parent_item = Item::fetch($ret)) {
                // not used as result should be structured like other user data
                //builtin_activity_puller($i, $activities);
  
                // get user data and add it to the array of the activity
 -              $user = api_get_user($a, $item['author-id']);
 -              switch ($item['verb']) {
 +              $user = api_get_user($a, $parent_item['author-id']);
 +              switch ($parent_item['verb']) {
                        case ACTIVITY_LIKE:
                                $activities['like'][] = $user;
                                break;
@@@ -2893,7 -2893,7 +2893,7 @@@ function api_format_items($r, $user_inf
                        'in_reply_to_screen_name' => $in_reply_to['screen_name'],
                        $geo => null,
                        'favorited' => $item['starred'] ? true : false,
 -                      'user' =>  $status_user ,
 +                      'user' =>  $status_user,
                        'friendica_owner' => $owner_user,
                        'friendica_private' => $item['private'] == 1,
                        //'entities' => NULL,
@@@ -3401,7 -3401,7 +3401,7 @@@ api_register_func('api/statusnet/versio
   */
  function api_ff_ids($type)
  {
 -      if (! api_user()) {
 +      if (!api_user()) {
                throw new ForbiddenException();
        }
  
@@@ -3629,84 -3629,6 +3629,84 @@@ function api_direct_messages_destroy($t
  /// @TODO move to top of file or somewhere better
  api_register_func('api/direct_messages/destroy', 'api_direct_messages_destroy', true, API_METHOD_DELETE);
  
 +/**
 + * Unfollow Contact
 + *
 + * @brief unfollow contact 
 + *
 + * @param string $type Known types are 'atom', 'rss', 'xml' and 'json'
 + * @return string|array
 + * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy.html
 + */
 +function api_friendships_destroy($type)
 +{
 +      $uid = api_user();
 +
 +      if ($uid === false) {
 +              throw new ForbiddenException();
 +      }
 +
 +      $contact_id = defaults($_REQUEST, 'user_id');
 +
 +      if (empty($contact_id)) {
 +              logger("No user_id specified", LOGGER_DEBUG);
 +              throw new BadRequestException("no user_id specified");
 +      }
 +
 +      // Get Contact by given id
 +      $contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => 0, 'self' => false]);
 +
 +      if(!DBA::isResult($contact)) {
 +              logger("No contact found for ID" . $contact_id, LOGGER_DEBUG);
 +              throw new NotFoundException("no contact found to given ID");
 +      }
 +
 +      $url = $contact["url"];
 +
 +      $condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
 +                      $uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
 +                      normalise_link($url), $url];
 +      $contact = DBA::selectFirst('contact', [], $condition);
 +
 +      if (!DBA::isResult($contact)) {
 +              logger("Not following Contact", LOGGER_DEBUG);
 +              throw new NotFoundException("Not following Contact");
 +      }
 +
 +      if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
 +              logger("Not supported", LOGGER_DEBUG);
 +              throw new ExpectationFailedException("Not supported");
 +      }
 +
 +      $dissolve = ($contact['rel'] == Contact::SHARING);
 +
 +      $owner = User::getOwnerDataById($uid);
 +      if ($owner) {
 +              Contact::terminateFriendship($owner, $contact, $dissolve);
 +      }
 +      else {
 +              logger("No owner found", LOGGER_DEBUG);
 +              throw new NotFoundException("Error Processing Request");
 +      }
 +
 +      // Sharing-only contacts get deleted as there no relationship any more
 +      if ($dissolve) {
 +              Contact::remove($contact['id']);
 +      } else {
 +              DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]);
 +      }
 +
 +      // "uid" and "self" are only needed for some internal stuff, so remove it from here
 +      unset($contact["uid"]);
 +      unset($contact["self"]);
 +
 +      // Set screen_name since Twidere requests it
 +      $contact["screen_name"] = $contact["nick"];
 +
 +      return api_format_data("friendships-destroy", $type, ['user' => $contact]);
 +}
 +api_register_func('api/friendships/destroy', 'api_friendships_destroy', true, API_METHOD_POST);
 +
  /**
   *
   * @param string $type Return type (atom, rss, xml, json)
@@@ -4505,7 -4427,7 +4505,7 @@@ function save_media_to_database($mediat
        // create Photo instance with the data of the image
        $imagedata = @file_get_contents($src);
        $Image = new Image($imagedata, $filetype);
 -      if (! $Image->isValid()) {
 +      if (!$Image->isValid()) {
                throw new InternalServerErrorException("unable to process image data");
        }
  
  
        // check max length of images on server
        $max_length = Config::get('system', 'max_image_length');
 -      if (! $max_length) {
 +      if (!$max_length) {
                $max_length = MAX_IMAGE_LENGTH;
        }
        if ($max_length > 0) {
                logger("photo upload: starting new photo upload", LOGGER_DEBUG);
  
                $r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
 -              if (! $r) {
 +              if (!$r) {
                        logger("photo upload: image upload with scale 0 (original size) failed");
                }
                if ($width > 640 || $height > 640) {
                        $Image->scaleDown(640);
                        $r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
 -                      if (! $r) {
 +                      if (!$r) {
                                logger("photo upload: image upload with scale 1 (640x640) failed");
                        }
                }
                if ($width > 320 || $height > 320) {
                        $Image->scaleDown(320);
                        $r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
 -                      if (! $r) {
 +                      if (!$r) {
                                logger("photo upload: image upload with scale 2 (320x320) failed");
                        }
                }
                if ($width > 175 || $height > 175) {
                        $Image->scaleDown(175);
                        $r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
 -                      if (! $r) {
 +                      if (!$r) {
                                logger("photo upload: profile image upload with scale 4 (175x175) failed");
                        }
                }
                if ($width > 80 || $height > 80) {
                        $Image->scaleDown(80);
                        $r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
 -                      if (! $r) {
 +                      if (!$r) {
                                logger("photo upload: profile image upload with scale 5 (80x80) failed");
                        }
                }
                if ($width > 48 || $height > 48) {
                        $Image->scaleDown(48);
                        $r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
 -                      if (! $r) {
 +                      if (!$r) {
                                logger("photo upload: profile image upload with scale 6 (48x48) failed");
                        }
                }
@@@ -4612,7 -4534,7 +4612,7 @@@ function post_photo_item($hash, $allow_
        $owner_record = DBA::selectFirst('contact', [], ['uid' => api_user(), 'self' => true]);
  
        $arr = [];
-       $arr['guid']          = System::createGUID(32);
+       $arr['guid']          = System::createUUID();
        $arr['uid']           = intval(api_user());
        $arr['uri']           = $uri;
        $arr['parent-uri']    = $uri;
@@@ -4827,18 -4749,8 +4827,18 @@@ function api_share_as_retweet(&$item
  {
        $body = trim($item["body"]);
  
 -      if (Diaspora::isReshare($body, false)===false) {
 -              return false;
 +      if (Diaspora::isReshare($body, false) === false) {
 +              if ($item['author-id'] == $item['owner-id']) {
 +                      return false;
 +              } else {
 +                      // Reshares from OStatus, ActivityPub and Twitter
 +                      $reshared_item = $item;
 +                      $reshared_item['owner-id'] = $reshared_item['author-id'];
 +                      $reshared_item['owner-link'] = $reshared_item['author-link'];
 +                      $reshared_item['owner-name'] = $reshared_item['author-name'];
 +                      $reshared_item['owner-avatar'] = $reshared_item['author-avatar'];
 +                      return $reshared_item;
 +              }
        }
  
        /// @TODO "$1" should maybe mean '$1' ?
diff --combined include/conversation.php
index 59ee5ed8248cbdd4b2b7be65c74c6b3382bc2182,dc563af4098170e56dad0eee537fe7e9121b049d..1185e9dc3b372193db2529451ec1e76f28e93b4d
@@@ -556,7 -556,7 +556,7 @@@ function conversation(App $a, array $it
                if (in_array($mode, ['community', 'contacts'])) {
                        $writable = true;
                } else {
-                       $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
+                       $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
                }
  
                if (!local_user()) {
@@@ -807,7 -807,7 +807,7 @@@ function conversation_add_children(arra
  
        foreach ($items as $index => $item) {
                if ($item['uid'] == 0) {
-                       $items[$index]['writable'] = in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
+                       $items[$index]['writable'] = in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
                }
        }
  
@@@ -877,7 -877,7 +877,7 @@@ function item_photo_menu($item) 
                }
  
                if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
-                       in_array($item['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
+                       in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
                        $menu[L10n::t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
                }
        } else {
@@@ -1091,6 -1091,21 +1091,6 @@@ function status_editor(App $a, $x, $not
                '$delitems'  => L10n::t("Delete item\x28s\x29?")
        ]);
  
 -      $tpl = get_markup_template('jot-end.tpl');
 -      $a->page['end'] .= replace_macros($tpl, [
 -              '$newpost'   => 'true',
 -              '$baseurl'   => System::baseUrl(true),
 -              '$geotag'    => $geotag,
 -              '$nickname'  => $x['nickname'],
 -              '$ispublic'  => L10n::t('Visible to <strong>everybody</strong>'),
 -              '$linkurl'   => L10n::t('Please enter a link URL:'),
 -              '$vidurl'    => L10n::t("Please enter a video link/URL:"),
 -              '$audurl'    => L10n::t("Please enter an audio link/URL:"),
 -              '$term'      => L10n::t('Tag term:'),
 -              '$fileas'    => L10n::t('Save to Folder:'),
 -              '$whereareu' => L10n::t('Where are you right now?')
 -      ]);
 -
        $jotplugins = '';
        Addon::callHooks('jot_tool', $jotplugins);
  
diff --combined index.php
index 184a195924cc8acb715dc2f7654dfb8301b847b2,46b95c75e4bfe0b0962b81f7f54cbea9ad763179..bccdebe7b05f65ab9f0999343d7355b4382bfc7a
+++ b/index.php
@@@ -91,7 -91,7 +91,7 @@@ if (!$a->is_backend()) 
   * Language was set earlier, but we can over-ride it in the session.
   * We have to do it here because the session was just now opened.
   */
 -if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
 +if (!empty($_SESSION['authenticated']) && empty($_SESSION['language'])) {
        $_SESSION['language'] = $lang;
        // we haven't loaded user data yet, but we need user language
        if (!empty($_SESSION['uid'])) {
        }
  }
  
 -if (x($_SESSION, 'language') && ($_SESSION['language'] !== $lang)) {
 +if (!empty($_SESSION['language']) && $_SESSION['language'] !== $lang) {
        $lang = $_SESSION['language'];
        L10n::loadTranslationTable($lang);
  }
@@@ -125,12 -125,12 +125,12 @@@ if (!empty($_GET['zrl']) && $a->mode =
                        logger("Invalid ZRL parameter " . $_GET['zrl'], LOGGER_DEBUG);
                        header('HTTP/1.1 403 Forbidden');
                        echo "<h1>403 Forbidden</h1>";
 -                      killme();
 +                      exit();
                }
        }
  }
  
 -if ((x($_GET,'owt')) && $a->mode == App::MODE_NORMAL) {
 +if (!empty($_GET['owt']) && $a->mode == App::MODE_NORMAL) {
        $token = $_GET['owt'];
        $a->query_string = Profile::stripQueryParam($a->query_string, 'owt');
        Profile::openWebAuthInit($token);
  
  Login::sessionAuth();
  
 -if (! x($_SESSION, 'authenticated')) {
 +if (empty($_SESSION['authenticated'])) {
        header('X-Account-Management-Status: none');
  }
  
 -/* set up page['htmlhead'] and page['end'] for the modules to use */
 -$a->page['htmlhead'] = '';
 -$a->page['end'] = '';
 -
  $_SESSION['sysmsg']       = defaults($_SESSION, 'sysmsg'      , []);
  $_SESSION['sysmsg_info']  = defaults($_SESSION, 'sysmsg_info' , []);
  $_SESSION['last_updated'] = defaults($_SESSION, 'last_updated', []);
@@@ -291,11 -295,11 +291,11 @@@ if (strlen($a->module)) 
  
        if (! $a->module_loaded) {
                // Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
 -              if ((x($_SERVER, 'QUERY_STRING')) && preg_match('/{[0-9]}/', $_SERVER['QUERY_STRING']) !== 0) {
 +              if (!empty($_SERVER['QUERY_STRING']) && preg_match('/{[0-9]}/', $_SERVER['QUERY_STRING']) !== 0) {
                        killme();
                }
  
 -              if ((x($_SERVER, 'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
 +              if (!empty($_SERVER['QUERY_STRING']) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
                        logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
                        goaway(System::baseUrl() . $_SERVER['REQUEST_URI']);
                }
                logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
                header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
                $tpl = get_markup_template("404.tpl");
 -              $a->page['content'] = replace_macros(
 -                      $tpl,
 -                      [
 -                      '$message' =>  L10n::t('Page not found.')]
 -              );
 +              $a->page['content'] = replace_macros($tpl, [
 +                      '$message' =>  L10n::t('Page not found.')
 +              ]);
        }
  }
  
@@@ -320,6 -326,10 +320,6 @@@ if (file_exists($theme_info_file)) 
  
  /* initialise content region */
  
 -if (! x($a->page, 'content')) {
 -      $a->page['content'] = '';
 -}
 -
  if ($a->mode == App::MODE_NORMAL) {
        Addon::callHooks('page_content_top', $a->page['content']);
  }
@@@ -332,15 -342,21 +332,21 @@@ if ($a->module_loaded) 
        $a->page['page_title'] = $a->module;
        $placeholder = '';
  
+       Addon::callHooks($a->module . '_mod_init', $placeholder);
        if ($a->module_class) {
-               Addon::callHooks($a->module . '_mod_init', $placeholder);
                call_user_func([$a->module_class, 'init']);
        } else if (function_exists($a->module . '_init')) {
-               Addon::callHooks($a->module . '_mod_init', $placeholder);
                $func = $a->module . '_init';
                $func($a);
        }
  
+       // "rawContent" is especially meant for technical endpoints.
+       // This endpoint doesn't need any theme initialization or other comparable stuff.
+       if (!$a->error && $a->module_class) {
+               call_user_func([$a->module_class, 'rawContent']);
+       }
        if (function_exists(str_replace('-', '_', $a->getCurrentTheme()) . '_init')) {
                $func = str_replace('-', '_', $a->getCurrentTheme()) . '_init';
                $func($a);
   * theme choices made by the modules can take effect.
   */
  
 -$a->init_pagehead();
 +$a->initHead();
  
  /*
   * Build the page ending -- this is stuff that goes right before
   * the closing </body> tag
   */
 -$a->init_page_end();
 -
 -// If you're just visiting, let javascript take you home
 -if (x($_SESSION, 'visitor_home')) {
 -      $homebase = $_SESSION['visitor_home'];
 -} elseif (local_user()) {
 -      $homebase = 'profile/' . $a->user['nickname'];
 -}
 -
 -if (isset($homebase)) {
 -      $a->page['content'] .= '<script>var homebase="' . $homebase . '" ; </script>';
 -}
 +$a->initFooter();
  
  /*
   * now that we've been through the module content, see if the page reported
@@@ -423,9 -450,36 +429,9 @@@ if ($a->module != 'install' && $a->modu
        Nav::build($a);
  }
  
 -/*
 - * Add a "toggle mobile" link if we're using a mobile device
 - */
 -if ($a->is_mobile || $a->is_tablet) {
 -      if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
 -              $link = 'toggle_mobile?address=' . curPageURL();
 -      } else {
 -              $link = 'toggle_mobile?off=1&address=' . curPageURL();
 -      }
 -      $a->page['footer'] = replace_macros(
 -              get_markup_template("toggle_mobile_footer.tpl"),
 -              [
 -                      '$toggle_link' => $link,
 -                      '$toggle_text' => L10n::t('toggle mobile')]
 -      );
 -}
 -
  /**
   * Build the page - now that we have all the components
   */
 -
 -if (!$a->theme['stylesheet']) {
 -      $stylesheet = $a->getCurrentThemeStylesheetPath();
 -} else {
 -      $stylesheet = $a->theme['stylesheet'];
 -}
 -
 -$a->page['htmlhead'] = str_replace('{{$stylesheet}}', $stylesheet, $a->page['htmlhead']);
 -//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
 -
  if (isset($_GET["mode"]) && (($_GET["mode"] == "raw") || ($_GET["mode"] == "minimal"))) {
        $doc = new DOMDocument();
  
@@@ -454,7 -508,7 +460,7 @@@ if (isset($_GET["mode"]) && ($_GET["mod
  
        echo substr($target->saveHTML(), 6, -8);
  
 -      killme();
 +      exit();
  }
  
  $page    = $a->page;
@@@ -492,3 -546,5 +498,3 @@@ if (empty($template)) 
  
  /// @TODO Looks unsafe (remote-inclusion), is maybe not but Theme::getPathForFile() uses file_exists() but does not escape anything
  require_once $template;
 -
 -killme();
diff --combined mod/admin.php
index 562845ecc80b69851f9c70ff52d6fccea4f1ed69,de7b78c08484525d8daa2445f341f8963e616ce6..77ac7eddf8ccf135a0cf6d37c3a0eead0a0f6998
@@@ -909,15 -909,6 +909,15 @@@ function admin_page_summary(App $a
        $queues = ['label' => L10n::t('Message queues'), 'queue' => $queue, 'workerq' => $workerqueue];
  
  
 +      $r = q("SHOW variables LIKE 'max_allowed_packet'");
 +      $max_allowed_packet = (($r) ? $r[0]['Value'] : 0);
 +
 +      $server_settings = ['label' => L10n::t('Server Settings'), 
 +                              'php' => ['upload_max_filesize' => ini_get('upload_max_filesize'), 
 +                                                'post_max_size' => ini_get('post_max_size'), 
 +                                                'memory_limit' => ini_get('memory_limit')], 
 +                              'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
 +
        $t = get_markup_template('admin/summary.tpl');
        return replace_macros($t, [
                '$title' => L10n::t('Administration'),
                '$codename' => FRIENDICA_CODENAME,
                '$build' => Config::get('system', 'build'),
                '$addons' => [L10n::t('Active addons'), $a->addons],
 +              '$serversettings' => $server_settings,
                '$showwarning' => $showwarning,
                '$warningtext' => $warningtext
        ]);
@@@ -1488,7 -1478,7 +1488,7 @@@ function admin_page_site(App $a
                '$community_page_style' => ['community_page_style', L10n::t("Community pages for visitors"), Config::get('system','community_page_style'), L10n::t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices],
                '$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. \x28Not valid for 'Global Community'\x29")],
                '$ostatus_disabled'     => ['ostatus_disabled', L10n::t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), L10n::t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")],
-               '$ostatus_full_threads' => ['ostatus_full_threads', L10n::t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")],
+               '$ostatus_full_threads' => ['ostatus_full_threads', L10n::t("Only import OStatus/ActivityPub threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus and ActivityPub contacts. With this option we only store threads that are started by a contact that is known on our system.")],
                '$ostatus_not_able'     => L10n::t("OStatus support can only be enabled if threading is enabled."),
                '$diaspora_able'        => $diaspora_able,
                '$diaspora_not_able'    => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
diff --combined mod/contacts.php
index 68dbbd59ddbb4e904ed5b57f087c9751be8a177b,a7c67cb910aa2964e456d967448a9040731eb34c..298c314b299fbce234f1d962cb04c3f24336b29d
@@@ -117,6 -117,12 +117,6 @@@ function contacts_init(App $a
                '$baseurl' => System::baseUrl(true),
                '$base' => $base
        ]);
 -
 -      $tpl = get_markup_template("contacts-end.tpl");
 -      $a->page['end'] .= replace_macros($tpl, [
 -              '$baseurl' => System::baseUrl(true),
 -              '$base' => $base
 -      ]);
  }
  
  function contacts_batch_actions(App $a)
@@@ -503,6 -509,9 +503,6 @@@ function contacts_content(App $a, $upda
                $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), [
                        '$baseurl' => System::baseUrl(true),
                ]);
 -              $a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), [
 -                      '$baseurl' => System::baseUrl(true),
 -              ]);
  
                $contact['blocked'] = Contact::isBlockedByUser($contact['id'], local_user());
                $contact['readonly'] = Contact::isIgnoredByUser($contact['id'], local_user());
                        $relation_text = '';
                }
  
-               if (!in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
+               if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
                        $relation_text = "";
                }
  
                }
                $lblsuggest = (($contact['network'] === Protocol::DFRN) ? L10n::t('Suggest friends') : '');
  
-               $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
+               $poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
  
                $nettype = L10n::t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"]));
  
@@@ -966,7 -975,7 +966,7 @@@ function contact_conversations(App $a, 
                $profiledata = Contact::getDetailsByURL($contact["url"]);
  
                if (local_user()) {
-                       if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+                       if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
                                $profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
                        }
                }
@@@ -990,7 -999,7 +990,7 @@@ function contact_posts(App $a, $contact
                $profiledata = Contact::getDetailsByURL($contact["url"]);
  
                if (local_user()) {
-                       if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
+                       if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
                                $profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
                        }
                }
@@@ -1071,7 -1080,7 +1071,7 @@@ function _contact_detail_for_template(a
   */
  function contact_actions($contact)
  {
-       $poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
+       $poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
        $contact_actions = [];
  
        // Provide friend suggestion only for Friendica contacts