X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2F_well_known.php;h=622d7fd93f647e9838e29af57f3649b8f5f02828;hb=6494d05ddeb8117a27490fc8dd140c32581d722c;hp=6c33136f957a2576bf8a121404782aa23ece0f03;hpb=4d21671f75e35e7c2880467dddc0936e8c718d8c;p=friendica.git diff --git a/mod/_well_known.php b/mod/_well_known.php index 6c33136f95..622d7fd93f 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -1,70 +1,68 @@ -argc > 1) { - switch($a->argv[1]) { - case "host-meta": - hostxrd_init($a); - break; - case "x-social-relay": - wk_social_relay($a); - break; - case "nodeinfo": - nodeinfo_wellknown($a); - break; - } - } - http_status_exit(404); - killme(); -} -} - -if(! function_exists('wk_social_relay')) { -function wk_social_relay(&$a) { - - define('SR_SCOPE_ALL', 'all'); - define('SR_SCOPE_TAGS', 'tags'); - - $subscribe = (bool)get_config('system', 'relay_subscribe'); - - if ($subscribe) - $scope = get_config('system', 'relay_scope'); - else - $scope = ""; - - $tags = array(); - - if ($scope == SR_SCOPE_TAGS) { - - $server_tags = get_config('system', 'relay_server_tags'); - $tagitems = explode(",", $server_tags); - - foreach($tagitems AS $tag) - $tags[trim($tag, "# ")] = trim($tag, "# "); - - if (get_config('system', 'relay_user_tags')) { - $terms = q("SELECT DISTINCT(`term`) FROM `search`"); - - foreach($terms AS $term) { - $tag = trim($term["term"], "#"); - $tags[$tag] = $tag; - } - } - } - - $taglist = array(); - foreach($tags AS $tag) - $taglist[] = $tag; - - $relay = array("subscribe" => $subscribe, - "scope" => $scope, - "tags" => $taglist); - - header('Content-type: application/json; charset=utf-8'); - echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); - exit; -} -} +argc > 1) { + switch($a->argv[1]) { + case "host-meta": + hostxrd_init($a); + break; + case "x-social-relay": + wk_social_relay($a); + break; + case "nodeinfo": + nodeinfo_wellknown($a); + break; + } + } + http_status_exit(404); + killme(); +} + +function wk_social_relay(App $a) { + + $subscribe = (bool)Config::get('system', 'relay_subscribe', false); + + if ($subscribe) { + $scope = Config::get('system', 'relay_scope', SR_SCOPE_ALL); + } else { + $scope = SR_SCOPE_NONE; + } + + $tags = array(); + + if ($scope == SR_SCOPE_TAGS) { + $server_tags = Config::get('system', 'relay_server_tags'); + $tagitems = explode(",", $server_tags); + + foreach($tagitems AS $tag) { + $tags[trim($tag, "# ")] = trim($tag, "# "); + } + + if (Config::get('system', 'relay_user_tags')) { + $terms = q("SELECT DISTINCT(`term`) FROM `search`"); + + foreach($terms AS $term) { + $tag = trim($term["term"], "#"); + $tags[$tag] = $tag; + } + } + } + + $taglist = array(); + foreach($tags AS $tag) { + $taglist[] = $tag; + } + + $relay = array("subscribe" => $subscribe, + "scope" => $scope, + "tags" => $taglist); + + header('Content-type: application/json; charset=utf-8'); + echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); + exit; +}