]> git.mxchange.org Git - friendica.git/blobdiff - mod/common.php
Remove deprecated App::cmd - replace with DI::args()->getCommand()
[friendica.git] / mod / common.php
index b335e296dbee1ec1d3250e16b2f159812723bd12..c66da0385092912ff12461f9074673949cc31ab6 100644 (file)
@@ -9,13 +9,12 @@ use Friendica\Content\Pager;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model;
 use Friendica\Module;
 use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 
-require_once 'include/dba.php';
-
 function common_content(App $a)
 {
        $o = '';
@@ -49,13 +48,13 @@ function common_content(App $a)
                $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
 
                if (DBA::isResult($contact)) {
-                       $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("vcard-widget.tpl"), [
-                               '$name'  => htmlentities($contact['name']),
+                       $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("widget/vcard.tpl"), [
+                               '$name'  => $contact['name'],
                                '$photo' => $contact['photo'],
                                'url'    => 'contact/' . $cid
                        ]);
 
-                       if (!x($a->page, 'aside')) {
+                       if (empty($a->page['aside'])) {
                                $a->page['aside'] = '';
                        }
                        $a->page['aside'] .= $vcard_widget;
@@ -93,7 +92,7 @@ function common_content(App $a)
                return $o;
        }
 
-       $pager = new Pager($a->query_string);
+       $pager = new Pager(DI::args()->getQueryString());
 
        if ($cid) {
                $common_friends = Model\GContact::commonFriends($uid, $cid, $pager->getStart(), $pager->getItemsPerPage());
@@ -119,11 +118,11 @@ function common_content(App $a)
                $photo_menu = Model\Contact::photoMenu($common_friend);
 
                $entry = [
-                       'url'          => $common_friend['url'],
-                       'itemurl'      => defaults($contact_details, 'addr', $common_friend['url']),
+                       'url'          => Model\Contact::magicLink($common_friend['url']),
+                       'itemurl'      => ($contact_details['addr'] ?? '') ?: $common_friend['url'],
                        'name'         => $contact_details['name'],
                        'thumb'        => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
-                       'img_hover'    => htmlentities($contact_details['name']),
+                       'img_hover'    => $contact_details['name'],
                        'details'      => $contact_details['location'],
                        'tags'         => $contact_details['keywords'],
                        'about'        => $contact_details['about'],
@@ -138,7 +137,7 @@ function common_content(App $a)
        $title = '';
        $tab_str = '';
        if ($cmd === 'loc' && $cid && local_user() == $uid) {
-               $tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
+               $tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
        } else {
                $title = L10n::t('Common Friends');
        }