X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fprofile.php;h=6f0ab9e077af456aa9b7eec2fa4af27923450536;hb=cbc898d90296fba04b01772cef6f553eee7616cd;hp=2e3ccd28c52a8769f57c36df7160c841f96c5e45;hpb=91a3bf5610910da8709f0fe9aa3de2201efb124e;p=friendica.git
diff --git a/mod/profile.php b/mod/profile.php
index 2e3ccd28c5..6f0ab9e077 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -20,6 +20,8 @@ use Friendica\Model\Profile;
use Friendica\Module\Login;
use Friendica\Protocol\DFRN;
use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Security;
+use Friendica\Protocol\ActivityPub;
function profile_init(App $a)
{
@@ -32,7 +34,7 @@ function profile_init(App $a)
} else {
$r = q("SELECT `nickname` FROM `user` WHERE `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 ORDER BY RAND() LIMIT 1");
if (DBA::isResult($r)) {
- goaway(System::baseUrl() . '/profile/' . $r[0]['nickname']);
+ $a->internalRedirect('profile/' . $r[0]['nickname']);
} else {
logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
notice(L10n::t('Requested profile is not available.') . EOL);
@@ -49,6 +51,16 @@ function profile_init(App $a)
DFRN::autoRedir($a, $which);
}
+ if (ActivityPub::isRequest()) {
+ $user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]);
+ if (DBA::isResult($user)) {
+ $data = ActivityPub\Transmitter::getProfile($user['uid']);
+ echo json_encode($data);
+ header('Content-Type: application/activity+json');
+ exit();
+ }
+ }
+
Profile::load($a, $which, $profile);
$blocked = !local_user() && !remote_user() && Config::get('system', 'block_public');
@@ -80,7 +92,7 @@ function profile_init(App $a)
$a->page['htmlhead'] .= '' . "\r\n";
$a->page['htmlhead'] .= '' . "\r\n";
$a->page['htmlhead'] .= '' . "\r\n";
- $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : ''));
+ $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''));
$a->page['htmlhead'] .= '' . "\r\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
@@ -119,7 +131,6 @@ function profile_content(App $a, $update = 0)
return Login::form();
}
- require_once 'include/security.php';
require_once 'include/conversation.php';
require_once 'include/items.php';
@@ -199,7 +210,7 @@ function profile_content(App $a, $update = 0)
$a->page['aside'] .= Widget::categories(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], (!empty($category) ? xmlify($category) : ''));
$a->page['aside'] .= Widget::tagCloud();
- if (can_write_wall($a->profile['profile_uid'])) {
+ if (Security::canWriteToUserWall($a->profile['profile_uid'])) {
$x = [
'is_owner' => $is_owner,
'allow_location' => ($is_owner || $commvisitor) && $a->profile['allow_location'],
@@ -223,7 +234,7 @@ function profile_content(App $a, $update = 0)
// Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
- $sql_extra = item_permissions_sql($a->profile['profile_uid'], $remote_contact, $groups);
+ $sql_extra = Item::getPermissionsSQLByUserId($a->profile['profile_uid'], $remote_contact, $groups);
$sql_extra2 = '';
if ($update) {
@@ -296,7 +307,7 @@ function profile_content(App $a, $update = 0)
$itemspage_network = $a->force_max_items;
}
- $a->set_pager_itemspage($itemspage_network);
+ $a->setPagerItemsPage($itemspage_network);
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));