]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Profile.php
Remove deprecated App::cmd - replace with DI::args()->getCommand()
[friendica.git] / src / Model / Profile.php
index b69860edfff73038d4f6438f4ab2e865be765c2c..a08cdade126493efa1f716a129019ef0e2998317 100644 (file)
@@ -23,6 +23,8 @@ 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;
 use Friendica\Util\Network;
@@ -142,7 +144,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;
                }
 
@@ -163,7 +165,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;
                }
 
@@ -335,7 +337,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;
@@ -569,7 +571,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;
                }
 
@@ -666,7 +668,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;
                }
 
@@ -692,7 +694,7 @@ class Profile
 
                        while ($rr = DBA::fetch($s)) {
                                $condition = ['parent-uri' => $rr['uri'], 'uid' => $rr['uid'], 'author-id' => public_contact(),
-                                       'activity' => [Item::activityToIndex(ACTIVITY_ATTEND), Item::activityToIndex(ACTIVITY_ATTENDMAYBE)],
+                                       'activity' => [Item::activityToIndex( Activity::ATTEND), Item::activityToIndex(Activity::ATTENDMAYBE)],
                                        'visible' => true, 'deleted' => false];
                                if (!Item::exists($condition)) {
                                        continue;
@@ -823,51 +825,51 @@ class Profile
                                $profile['religion'] = [L10n::t('Religion:'), $a->profile['religion']];
                        }
 
-                       if ($txt = prepare_text($a->profile['about'])) {
+                       if ($txt = BBCode::convert($a->profile['about'])) {
                                $profile['about'] = [L10n::t('About:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['interest'])) {
+                       if ($txt = BBCode::convert($a->profile['interest'])) {
                                $profile['interest'] = [L10n::t('Hobbies/Interests:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['likes'])) {
+                       if ($txt = BBCode::convert($a->profile['likes'])) {
                                $profile['likes'] = [L10n::t('Likes:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['dislikes'])) {
+                       if ($txt = BBCode::convert($a->profile['dislikes'])) {
                                $profile['dislikes'] = [L10n::t('Dislikes:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['contact'])) {
+                       if ($txt = BBCode::convert($a->profile['contact'])) {
                                $profile['contact'] = [L10n::t('Contact information and Social Networks:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['music'])) {
+                       if ($txt = BBCode::convert($a->profile['music'])) {
                                $profile['music'] = [L10n::t('Musical interests:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['book'])) {
+                       if ($txt = BBCode::convert($a->profile['book'])) {
                                $profile['book'] = [L10n::t('Books, literature:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['tv'])) {
+                       if ($txt = BBCode::convert($a->profile['tv'])) {
                                $profile['tv'] = [L10n::t('Television:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['film'])) {
+                       if ($txt = BBCode::convert($a->profile['film'])) {
                                $profile['film'] = [L10n::t('Film/dance/culture/entertainment:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['romance'])) {
+                       if ($txt = BBCode::convert($a->profile['romance'])) {
                                $profile['romance'] = [L10n::t('Love/Romance:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['work'])) {
+                       if ($txt = BBCode::convert($a->profile['work'])) {
                                $profile['work'] = [L10n::t('Work/employment:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['education'])) {
+                       if ($txt = BBCode::convert($a->profile['education'])) {
                                $profile['education'] = [L10n::t('School/education:'), $txt];
                        }
 
@@ -1045,7 +1047,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.
@@ -1073,20 +1075,18 @@ class Profile
 
                Logger::log('Not authenticated. Invoking reverse magic-auth for ' . $my_url, Logger::DEBUG);
 
-               Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
-
                // 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
@@ -1164,7 +1164,7 @@ class Profile
 
                $arr = [
                        'visitor' => $visitor,
-                       'url' => $a->query_string
+                       'url' => DI::args()->getQueryString()
                ];
                /**
                 * @hooks magic_auth_success
@@ -1176,7 +1176,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);
        }