2012-07-27 12:58:27 +00:00
|
|
|
<?php
|
2012-12-28 21:51:50 +00:00
|
|
|
require_once("mod/hostxrd.php");
|
2012-07-27 12:58:27 +00:00
|
|
|
|
|
|
|
function _well_known_init(&$a){
|
2015-08-09 06:31:42 +00:00
|
|
|
if ($a->argc > 1) {
|
|
|
|
switch($a->argv[1]) {
|
|
|
|
case "host-meta":
|
|
|
|
hostxrd_init($a);
|
|
|
|
break;
|
|
|
|
case "x-social-relay":
|
|
|
|
wk_social_relay($a);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
http_status_exit(404);
|
|
|
|
killme();
|
|
|
|
}
|
|
|
|
|
|
|
|
function wk_social_relay(&$a) {
|
|
|
|
|
|
|
|
define('SR_SCOPE_ALL', 'all');
|
|
|
|
define('SR_SCOPE_TAGS', 'tags');
|
|
|
|
|
|
|
|
$subscribe = (bool)true;
|
|
|
|
$scope = SR_SCOPE_ALL;
|
|
|
|
//$scope = SR_SCOPE_TAGS;
|
|
|
|
|
|
|
|
$tags = array();
|
|
|
|
|
|
|
|
if ($scope == SR_SCOPE_TAGS) {
|
|
|
|
$terms = q("SELECT DISTINCT(`term`) FROM `search`");
|
|
|
|
|
|
|
|
foreach($terms AS $term) {
|
|
|
|
$tag = trim($term["term"], "#");
|
|
|
|
$tags[] = $tag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$relay = array("subscribe" => $subscribe,
|
|
|
|
"scope" => $scope,
|
|
|
|
"tags" => array_unique($tags));
|
|
|
|
|
|
|
|
header('Content-type: application/json; charset=utf-8');
|
|
|
|
echo json_encode($relay, true);
|
|
|
|
exit;
|
2012-12-28 21:51:50 +00:00
|
|
|
}
|