]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/vier/theme.php
Update remote_friends_common.tpl
[friendica.git] / view / theme / vier / theme.php
index ec82cf428ddafaa72a41fc79abe9009447d381a3..e264251624eab708b72b37988fc9cc497c5ddb09 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
  */
 
 use Friendica\App;
-use Friendica\Content\ForumManager;
+use Friendica\Content\GroupManager;
 use Friendica\Core\Addon;
 use Friendica\Core\Renderer;
 use Friendica\Core\Search;
-use Friendica\Core\Session;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
@@ -43,8 +42,6 @@ use Friendica\Util\Strings;
 
 function vier_init(App $a)
 {
-       $a->setThemeInfoValue('events_in_profile', false);
-
        Renderer::setActiveTemplateEngine('smarty3');
 
        $args = DI::args();
@@ -53,7 +50,7 @@ function vier_init(App $a)
                DI::mode()->has(App\Mode::MAINTENANCEDISABLED)
                && (
                        $args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '')
-                       || $args->get(0) === 'network' && Session::getLocalUser()
+                       || $args->get(0) === 'network' && DI::userSession()->getLocalUserId()
                )
        ) {
                vier_community_info();
@@ -107,7 +104,7 @@ EOT;
 
        // Hide the left menu bar
        /// @TODO maybe move this static array out where it should belong?
-       if (empty(DI::page()['aside']) && in_array($args->get(0), ["community", "events", "help", "delegation", "notifications",
+       if (empty(DI::page()['aside']) && in_array($args->get(0), ["community", "calendar", "help", "delegation", "notifications",
                        "probe", "webfinger", "login", "invite", "credits"])) {
                DI::page()['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
        }
@@ -115,8 +112,8 @@ EOT;
 
 function get_vier_config($key, $default = false, $admin = false)
 {
-       if (Session::getLocalUser() && !$admin) {
-               $result = DI::pConfig()->get(Session::getLocalUser(), "vier", $key);
+       if (DI::userSession()->getLocalUserId() && !$admin) {
+               $result = DI::pConfig()->get(DI::userSession()->getLocalUserId(), "vier", $key);
                if (!is_null($result)) {
                        return $result;
                }
@@ -140,26 +137,25 @@ function vier_community_info()
        $show_lastusers  = get_vier_config("show_lastusers", 1);
 
        // get_baseurl
-       $url = DI::baseUrl();
-       $aside['$url'] = $url;
+       $aside['$url'] = $url = (string)DI::baseUrl();
 
-       // comunity_profiles
+       // community_profiles
        if ($show_profiles) {
-               $contacts = Contact\Relation::getSuggestions(Session::getLocalUser(), 0, 9);
+               $contacts = Contact\Relation::getCachedSuggestions(DI::userSession()->getLocalUserId(), 0, 9);
 
                $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl');
                if (DBA::isResult($contacts)) {
-                       $aside['$comunity_profiles_title'] = DI::l10n()->t('Community Profiles');
-                       $aside['$comunity_profiles_items'] = [];
+                       $aside['$community_profiles_title'] = DI::l10n()->t('Community Profiles');
+                       $aside['$community_profiles_items'] = [];
 
                        foreach ($contacts as $contact) {
                                $entry = Renderer::replaceMacros($tpl, [
                                        '$id' => $contact['id'],
-                                       '$profile_link' => 'follow/?url='.urlencode($contact['url']),
+                                       '$profile_link' => 'contact/follow?url=' . urlencode($contact['url']),
                                        '$photo' => Contact::getMicro($contact),
                                        '$alt_text' => $contact['name'],
                                ]);
-                               $aside['$comunity_profiles_items'][] = $entry;
+                               $aside['$community_profiles_items'][] = $entry;
                        }
                }
        }
@@ -192,7 +188,7 @@ function vier_community_info()
        }
 
        //right_aside FIND FRIENDS
-       if ($show_friends && Session::getLocalUser()) {
+       if ($show_friends && DI::userSession()->getLocalUserId()) {
                $nv = [];
                $nv['findpeople'] = DI::l10n()->t('Find People');
                $nv['desc'] = DI::l10n()->t('Enter name or interest');
@@ -211,8 +207,8 @@ function vier_community_info()
        }
 
        //Community_Pages at right_aside
-       if ($show_pages && Session::getLocalUser()) {
-               $aside['$page'] = ForumManager::widget('network/forum', Session::getLocalUser());;
+       if ($show_pages && DI::userSession()->getLocalUserId()) {
+               $aside['$page'] = GroupManager::widget('network/group', DI::userSession()->getLocalUserId());;
        }
        // END Community Page