]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/vier/theme.php
Merge pull request #12306 from annando/api-doc
[friendica.git] / view / theme / vier / theme.php
index a548d0a7dc159aab36438d5df3fa0d8def9251d1..006450edfcfd62f2a06b94a25b43f78d19b4948b 100644 (file)
@@ -1,5 +1,22 @@
 <?php
 /**
+ * @copyright Copyright (C) 2010-2022, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  * Name: Vier
  * Version: 1.2
  * Author: Fabio <http://kirgroup.com/profile/fabrixxm>
@@ -35,7 +52,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' && local_user()
+                       || $args->get(0) === 'network' && DI::userSession()->getLocalUserId()
                )
        ) {
                vier_community_info();
@@ -89,7 +106,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' />";
        }
@@ -97,8 +114,8 @@ EOT;
 
 function get_vier_config($key, $default = false, $admin = false)
 {
-       if (local_user() && !$admin) {
-               $result = DI::pConfig()->get(local_user(), "vier", $key);
+       if (DI::userSession()->getLocalUserId() && !$admin) {
+               $result = DI::pConfig()->get(DI::userSession()->getLocalUserId(), "vier", $key);
                if (!is_null($result)) {
                        return $result;
                }
@@ -127,7 +144,7 @@ function vier_community_info()
 
        // comunity_profiles
        if ($show_profiles) {
-               $contacts = Contact\Relation::getSuggestions(local_user(), 0, 9);
+               $contacts = Contact\Relation::getSuggestions(DI::userSession()->getLocalUserId(), 0, 9);
 
                $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl');
                if (DBA::isResult($contacts)) {
@@ -137,7 +154,7 @@ function vier_community_info()
                        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'],
                                ]);
@@ -174,7 +191,7 @@ function vier_community_info()
        }
 
        //right_aside FIND FRIENDS
-       if ($show_friends && local_user()) {
+       if ($show_friends && DI::userSession()->getLocalUserId()) {
                $nv = [];
                $nv['findpeople'] = DI::l10n()->t('Find People');
                $nv['desc'] = DI::l10n()->t('Enter name or interest');
@@ -193,8 +210,8 @@ function vier_community_info()
        }
 
        //Community_Pages at right_aside
-       if ($show_pages && local_user()) {
-               $aside['$page'] = ForumManager::widget('network/forum', local_user());;
+       if ($show_pages && DI::userSession()->getLocalUserId()) {
+               $aside['$page'] = ForumManager::widget('network/forum', DI::userSession()->getLocalUserId());;
        }
        // END Community Page