X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FProfile.php;h=765fed791a35f6afaf7698fafa58dfc8452ec160;hb=b9dba631aadf6c25a97b679808c684276b3dd76a;hp=8659506cb1581506ee924c3b21eecca74d27667d;hpb=01205f7d41d8b9e180f7dc00e22c7cb18bdf7d5c;p=friendica.git diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 8659506cb1..765fed791a 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -20,9 +20,8 @@ use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\Core\System; -use Friendica\Core\Theme; -use Friendica\Core\Worker; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Protocol\Activity; use Friendica\Protocol\Diaspora; use Friendica\Util\DateTimeFormat; @@ -143,7 +142,7 @@ class Profile $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]); if (!DBA::isResult($user) && empty($profiledata)) { - Logger::log('profile error: ' . $a->query_string, Logger::DEBUG); + Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG); return; } @@ -154,7 +153,7 @@ class Profile } // Add profile data to sidebar - $a->page['aside'] .= self::sidebar($a, $profiledata, true, $show_connect); + DI::page()['aside'] .= self::sidebar($a, $profiledata, true, $show_connect); if (!DBA::isResult($user)) { return; @@ -164,7 +163,7 @@ class Profile $pdata = self::getByNickname($nickname, $user['uid'], $profile); if (empty($pdata) && empty($profiledata)) { - Logger::log('profile error: ' . $a->query_string, Logger::DEBUG); + Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG); return; } @@ -188,7 +187,7 @@ class Profile $a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['network'] = Protocol::DFRN; - $a->page['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename'); + DI::page()['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename'); if (!$profiledata && !PConfig::get(local_user(), 'system', 'always_my_theme')) { $a->setCurrentTheme($a->profile['theme']); @@ -207,7 +206,7 @@ class Profile } if (local_user() && local_user() == $a->profile['uid'] && $profiledata) { - $a->page['aside'] .= Renderer::replaceMacros( + DI::page()['aside'] .= Renderer::replaceMacros( Renderer::getMarkupTemplate('profile_edlink.tpl'), [ '$editprofile' => L10n::t('Edit profile'), @@ -224,7 +223,7 @@ class Profile * But: When this profile was on the same server, then we could display the contacts */ if (!$profiledata) { - $a->page['aside'] .= self::sidebar($a, $a->profile, $block, $show_connect); + DI::page()['aside'] .= self::sidebar($a, $a->profile, $block, $show_connect); } return; @@ -336,7 +335,7 @@ class Profile if (isset($profile['url'])) { $profile_url = $profile['url']; } else { - $profile_url = $a->getBaseURL() . '/profile/' . $profile['nickname']; + $profile_url = DI::baseUrl()->get() . '/profile/' . $profile['nickname']; } $follow_link = null; @@ -395,7 +394,7 @@ class Profile // show edit profile to yourself if (!$is_contact && $local_user_is_self) { if (Feature::isEnabled(local_user(), 'multi_profiles')) { - $profile['edit'] = [System::baseUrl() . '/profiles', L10n::t('Profiles'), '', L10n::t('Manage/edit profiles')]; + $profile['edit'] = [DI::baseUrl() . '/profiles', L10n::t('Profiles'), '', L10n::t('Manage/edit profiles')]; $r = q( "SELECT * FROM `profile` WHERE `uid` = %d", local_user() @@ -421,7 +420,7 @@ class Profile } } } else { - $profile['edit'] = [System::baseUrl() . '/profiles/' . $profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')]; + $profile['edit'] = [DI::baseUrl() . '/profiles/' . $profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')]; $profile['menu'] = [ 'chg_photo' => L10n::t('Change profile photo'), 'cr_new' => null, @@ -460,7 +459,7 @@ class Profile if (!empty($profile['guid'])) { $diaspora = [ 'guid' => $profile['guid'], - 'podloc' => System::baseUrl(), + 'podloc' => DI::baseUrl(), 'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'), 'nickname' => $profile['nickname'], 'fullname' => $profile['name'], @@ -570,7 +569,7 @@ class Profile $a = \get_app(); $o = ''; - if (!local_user() || $a->is_mobile || $a->is_tablet) { + if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) { return $o; } @@ -667,7 +666,7 @@ class Profile $a = \get_app(); $o = ''; - if (!local_user() || $a->is_mobile || $a->is_tablet) { + if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) { return $o; } @@ -878,7 +877,7 @@ class Profile } if ($a->profile['uid'] == local_user()) { - $profile['edit'] = [System::baseUrl() . '/profiles/' . $a->profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')]; + $profile['edit'] = [DI::baseUrl() . '/profiles/' . $a->profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')]; } return Renderer::replaceMacros($tpl, [ @@ -906,7 +905,7 @@ class Profile $nickname = $a->user['nickname']; } - $baseProfileUrl = System::baseUrl() . '/profile/' . $nickname; + $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname; $tabs = [ [ @@ -927,7 +926,7 @@ class Profile ], [ 'label' => L10n::t('Photos'), - 'url' => System::baseUrl() . '/photos/' . $nickname, + 'url' => DI::baseUrl() . '/photos/' . $nickname, 'sel' => $current == 'photos' ? 'active' : '', 'title' => L10n::t('Photo Albums'), 'id' => 'photo-tab', @@ -935,7 +934,7 @@ class Profile ], [ 'label' => L10n::t('Videos'), - 'url' => System::baseUrl() . '/videos/' . $nickname, + 'url' => DI::baseUrl() . '/videos/' . $nickname, 'sel' => $current == 'videos' ? 'active' : '', 'title' => L10n::t('Videos'), 'id' => 'video-tab', @@ -947,7 +946,7 @@ class Profile if ($is_owner && $a->theme_events_in_profile) { $tabs[] = [ 'label' => L10n::t('Events'), - 'url' => System::baseUrl() . '/events', + 'url' => DI::baseUrl() . '/events', 'sel' => $current == 'events' ? 'active' : '', 'title' => L10n::t('Events and Calendar'), 'id' => 'events-tab', @@ -958,7 +957,7 @@ class Profile } elseif (!$is_owner) { $tabs[] = [ 'label' => L10n::t('Events'), - 'url' => System::baseUrl() . '/cal/' . $nickname, + 'url' => DI::baseUrl() . '/cal/' . $nickname, 'sel' => $current == 'cal' ? 'active' : '', 'title' => L10n::t('Events and Calendar'), 'id' => 'events-tab', @@ -969,7 +968,7 @@ class Profile if ($is_owner) { $tabs[] = [ 'label' => L10n::t('Personal Notes'), - 'url' => System::baseUrl() . '/notes', + 'url' => DI::baseUrl() . '/notes', 'sel' => $current == 'notes' ? 'active' : '', 'title' => L10n::t('Only You Can See This'), 'id' => 'notes-tab', @@ -980,7 +979,7 @@ class Profile if (!empty($_SESSION['new_member']) && $is_owner) { $tabs[] = [ 'label' => L10n::t('Tips for New Members'), - 'url' => System::baseUrl() . '/newmember', + 'url' => DI::baseUrl() . '/newmember', 'sel' => false, 'title' => L10n::t('Tips for New Members'), 'id' => 'newmember-tab', @@ -1046,7 +1045,7 @@ class Profile $addr = $_GET['addr'] ?? $my_url; - $arr = ['zrl' => $my_url, 'url' => $a->cmd]; + $arr = ['zrl' => $my_url, 'url' => DI::args()->getCommand()]; Hook::callAll('zrl_init', $arr); // Try to find the public contact entry of the visitor. @@ -1076,16 +1075,16 @@ class Profile // Remove the "addr" parameter from the destination. It is later added as separate parameter again. $addr_request = 'addr=' . urlencode($addr); - $query = rtrim(str_replace($addr_request, '', $a->query_string), '?&'); + $query = rtrim(str_replace($addr_request, '', DI::args()->getQueryString()), '?&'); // The other instance needs to know where to redirect. - $dest = urlencode($a->getBaseURL() . '/' . $query); + $dest = urlencode(DI::baseUrl()->get() . '/' . $query); // We need to extract the basebath from the profile url // to redirect the visitors '/magic' module. $basepath = Contact::getBasepath($contact['url']); - if ($basepath != $a->getBaseURL() && !strstr($dest, '/magic')) { + if ($basepath != DI::baseUrl()->get() && !strstr($dest, '/magic')) { $magic_path = $basepath . '/magic' . '?owa=1&dest=' . $dest . '&' . $addr_request; // We have to check if the remote server does understand /magic without invoking something @@ -1163,7 +1162,7 @@ class Profile $arr = [ 'visitor' => $visitor, - 'url' => $a->query_string + 'url' => DI::args()->getQueryString() ]; /** * @hooks magic_auth_success @@ -1175,7 +1174,7 @@ class Profile $a->contact = $arr['visitor']; - info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', $a->getHostName(), $visitor['name'])); + info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name'])); Logger::log('OpenWebAuth: auth success from ' . $visitor['addr'], Logger::DEBUG); }