]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
Merge pull request #5949 from rthees/develop
[friendica.git] / mod / profile.php
index e20836a0598cd55d2fb07f3b59fdff477a0abecc..6f0ab9e077af456aa9b7eec2fa4af27923450536 100644 (file)
@@ -20,6 +20,7 @@ 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)
@@ -33,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);
@@ -53,7 +54,7 @@ function profile_init(App $a)
        if (ActivityPub::isRequest()) {
                $user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]);
                if (DBA::isResult($user)) {
-                       $data = ActivityPub::profile($user['uid']);
+                       $data = ActivityPub\Transmitter::getProfile($user['uid']);
                        echo json_encode($data);
                        header('Content-Type: application/activity+json');
                        exit();
@@ -91,7 +92,7 @@ function profile_init(App $a)
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\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'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
        header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
 
@@ -130,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';
 
@@ -210,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'],
@@ -234,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) {
@@ -307,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']));