X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fp.php;h=f44c32b33523b9ca51dc824f8281b77368407c78;hb=3359f3f5c7ecc4b6a34c4fcfc095ab4dd5fab0f1;hp=8755464519194a5d0cfc89147a960a3f3e2652f9;hpb=c0df692f5fc4eaadb322614069b2c7ed40453fa1;p=friendica.git diff --git a/mod/p.php b/mod/p.php index 8755464519..f44c32b335 100644 --- a/mod/p.php +++ b/mod/p.php @@ -2,7 +2,11 @@ /* This file is part of the Diaspora protocol. It is used for fetching single public posts. */ -require_once("include/diaspora.php"); + +use Friendica\App; +use Friendica\Core\System; +use Friendica\Database\DBM; +use Friendica\Protocol\Diaspora; function p_init($a){ if ($a->argc != 2) { @@ -31,7 +35,7 @@ function p_init($a){ $parts = parse_url($r[0]["author-link"]); $host = $parts["scheme"]."://".$parts["host"]; - if (normalise_link($host) != normalise_link(App::get_baseurl())) { + if (normalise_link($host) != normalise_link(System::baseUrl())) { $location = $host."/p/".urlencode($guid).".xml"; header("HTTP/1.1 301 Moved Permanently"); @@ -46,16 +50,16 @@ function p_init($a){ // Fetch some data from the author (We could combine both queries - but I think this is more readable) $r = q("SELECT `user`.`prvkey`, `contact`.`addr`, `user`.`nickname`, `contact`.`nick` FROM `user` - INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` + INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self` WHERE `user`.`uid` = %d", intval($item[0]["uid"])); - if (!dbm::is_result($r)) { + if (!DBM::is_result($r)) { header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); killme(); } $user = $r[0]; - $status = Diaspora::build_status($item[0], $user); - $xml = Diaspora::build_post_xml($status["type"], $status["message"]); + $status = Diaspora::buildStatus($item[0], $user); + $xml = Diaspora::buildPostXml($status["type"], $status["message"]); header("Content-Type: application/xml; charset=utf-8"); echo $xml;