X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Fvier%2Ftheme.php;h=65612623d2d9200e7693e0d9f130db9641e45dbe;hb=3546f5b189891e9fc0f0338f8b691b991fa7a549;hp=d28c8a325a278c364f17f935454cf7df6ca8b7c9;hpb=5a87ccf0261733096f634cb03314604891e5f48a;p=friendica.git diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index d28c8a325a..65612623d2 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -1,5 +1,22 @@ . + * * Name: Vier * Version: 1.2 * Author: Fabio @@ -19,15 +36,22 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Util\Strings; +/* + * This script can be included even when the app is in maintenance mode which requires us to avoid any config call + */ + function vier_init(App $a) { - $a->setThemeInfoValue('events_in_profile', false); - Renderer::setActiveTemplateEngine('smarty3'); $args = DI::args(); - if ($args->get(0) === 'profile' && $args->get(1) === ($a->user['nickname'] ?? '') || $args->get(0) === 'network' && local_user() + if ( + DI::mode()->has(App\Mode::MAINTENANCEDISABLED) + && ( + $args->get(0) === 'profile' && $args->get(1) === ($a->getLoggedInUserNickname() ?? '') + || $args->get(0) === 'network' && DI::userSession()->getLocalUserId() + ) ) { vier_community_info(); @@ -80,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'] .= ""; } @@ -88,8 +112,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; } @@ -118,7 +142,7 @@ function vier_community_info() // comunity_profiles if ($show_profiles) { - $contacts = Contact\Relation::getSuggestions(local_user(), 0, 9); + $contacts = Contact\Relation::getCachedSuggestions(DI::userSession()->getLocalUserId(), 0, 9); $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl'); if (DBA::isResult($contacts)) { @@ -128,7 +152,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'], ]); @@ -165,7 +189,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'); @@ -184,8 +208,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 @@ -285,7 +309,7 @@ function vier_community_info() $r[] = ["photo" => "images/wordpress.png", "name" => "Wordpress"]; } - if (function_exists("imap_open") && !DI::config()->get("system", "imap_disabled") && !DI::config()->get("system", "dfrn_only")) { + if (function_exists("imap_open") && !DI::config()->get("system", "imap_disabled")) { $r[] = ["photo" => "images/mail.png", "name" => "E-Mail"]; }