'submit' => [
'catavatar-usecat' => DI::l10n()->t('Use Cat as Avatar'),
'catavatar-morecat' => DI::l10n()->t('Another random Cat!'),
- 'catavatar-emailcat' => DI::pConfig()->get(local_user(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
+ 'catavatar-emailcat' => DI::pConfig()->get(Session::getLocalUser(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
],
];
```
}
}
-$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => local_user()]);
+$intros = \Friendica\Database\DBA::selectToArray('intros', [], ['uid' => Session::getLocalUser()]);
doSomething($intros);
```
}
/** @var $intros \Friendica\Contact\Introductions\Collection\Introductions */
-$intros = \Friendica\DI::intro()->selecForUser(local_user());
+$intros = \Friendica\DI::intro()->selecForUser(Session::getLocalUser());
doSomething($intros);
```
function theme_post(App $a){
// non local users shall not pass
- if (! local_user()) {
+ if (! Session::getLocalUser()) {
return;
}
// if the one specific submit button was pressed then proceed
if (isset($_POST['duepuntozero-settings-submit'])){
// and save the selection key into the personal config of the user
- DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
+ DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
}
For this, have a look at the theme.php file of the *duepunto zero*.
There you'll find somethink alike
- $colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
+ $colorset = DI::pConfig()->get( Session::getLocalUser(), 'duepuntozero','colorset');
if (!$colorset)
$colorset = DI::config()->get('duepuntozero', 'colorset');
if ($colorset) {
use Friendica\BaseFactory;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\Model\Contact;
use Friendica\Navigation\Notifications\Entity;
use Friendica\Navigation\Notifications\Exception\NoMessageException;
*/
public function createFromParams(array $contact, string $message, \DateTime $date, Uri $href, bool $seen = false): ValueObject\FormattedNavNotification
{
- $contact['photo'] = Contact::getAvatarUrlForUrl($contact['url'], local_user(), Proxy::SIZE_MICRO);
+ $contact['photo'] = Contact::getAvatarUrlForUrl($contact['url'], Session::getLocalUser(), Proxy::SIZE_MICRO);
$dateMySQL = $date->format(DateTimeFormat::MYSQL);
use Friendica\Content\Text\BBCode;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
+use Friendica\Core\Session;
use Friendica\Database\Database;
use Friendica\Model\Contact;
use Friendica\Model\Item;
$formattedNotifications = new FormattedNotifies();
try {
- $Notifies = $this->notify->selectForUser(local_user(), $conditions, $params);
+ $Notifies = $this->notify->selectForUser(Session::getLocalUser(), $conditions, $params);
foreach ($Notifies as $Notify) {
$formattedNotifications[] = new ValueObject\FormattedNotify(
*/
public function getNetworkList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
{
- $condition = ['wall' => false, 'uid' => local_user()];
+ $condition = ['wall' => false, 'uid' => Session::getLocalUser()];
if (!$seen) {
$condition['unseen'] = true;
$formattedNotifications = new FormattedNotifies();
try {
- $userPosts = Post::selectForUser(local_user(), $fields, $condition, $params);
+ $userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
while ($userPost = $this->dba->fetch($userPosts)) {
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
}
*/
public function getPersonalList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
{
- $condition = ['wall' => false, 'uid' => local_user(), 'author-id' => public_contact()];
+ $condition = ['wall' => false, 'uid' => Session::getLocalUser(), 'author-id' => Session::getPublicContact()];
if (!$seen) {
$condition['unseen'] = true;
$formattedNotifications = new FormattedNotifies();
try {
- $userPosts = Post::selectForUser(local_user(), $fields, $condition, $params);
+ $userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
while ($userPost = $this->dba->fetch($userPosts)) {
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
}
*/
public function getHomeList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
{
- $condition = ['wall' => true, 'uid' => local_user()];
+ $condition = ['wall' => true, 'uid' => Session::getLocalUser()];
if (!$seen) {
$condition['unseen'] = true;
$formattedNotifications = new FormattedNotifies();
try {
- $userPosts = Post::selectForUser(local_user(), $fields, $condition, $params);
+ $userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
while ($userPost = $this->dba->fetch($userPosts)) {
$formattedItem = $this->formatItem($userPost);
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Protocol;
+use Friendica\Core\Session;
use Friendica\Core\Session\Capability\IHandleSessions;
use Friendica\Database\Database;
use Friendica\Model\Contact;
'url' => $intro['furl'],
'zrl' => Contact::magicLink($intro['furl']),
'hidden' => $intro['hidden'] == 1,
- 'post_newfriend' => (intval($this->pConfig->get(local_user(), 'system', 'post_newfriend')) ? '1' : 0),
+ 'post_newfriend' => (intval($this->pConfig->get(Session::getLocalUser(), 'system', 'post_newfriend')) ? '1' : 0),
'note' => $intro['note'],
'request' => $intro['frequest'] . '?addr=' . $return_addr]);
'about' => BBCode::convert($intro['about'], false),
'keywords' => $intro['keywords'],
'hidden' => $intro['hidden'] == 1,
- 'post_newfriend' => (intval($this->pConfig->get(local_user(), 'system', 'post_newfriend')) ? '1' : 0),
+ 'post_newfriend' => (intval($this->pConfig->get(Session::getLocalUser(), 'system', 'post_newfriend')) ? '1' : 0),
'url' => $intro['url'],
'zrl' => Contact::magicLink($intro['url']),
'addr' => $intro['addr'],
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
+use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
}
if ($uid == -1) {
- $uid = local_user();
+ $uid = Session::getLocalUser();
}
if (empty($network) || ($network == Protocol::ACTIVITYPUB)) {
if (!empty($data['children'])) {
foreach ($data['children'] as $item) {
// Only add will be displayed
- if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
+ if ($item['network'] === Protocol::MAIL && Session::getLocalUser() != $item['uid']) {
continue;
} elseif (!DI::contentItem()->isVisibleActivity($item)) {
continue;
}
// You can always comment on Diaspora and OStatus items
- if (in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA]) && (local_user() == $item['uid'])) {
+ if (in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA]) && (Session::getLocalUser() == $item['uid'])) {
$item['writable'] = true;
}
$lock = ($item['private'] == Item::PRIVATE) ? $privacy : false;
$connector = !in_array($item['network'], Protocol::NATIVE_SUPPORT) ? DI::l10n()->t('Connector Message') : false;
- $shareable = in_array($conv->getProfileOwner(), [0, local_user()]) && $item['private'] != Item::PRIVATE;
+ $shareable = in_array($conv->getProfileOwner(), [0, Session::getLocalUser()]) && $item['private'] != Item::PRIVATE;
$announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER]);
// On Diaspora only toplevel posts can be reshared
$edpost = false;
- if (local_user()) {
+ if (Session::getLocalUser()) {
if (Strings::compareLink(DI::session()->get('my_url'), $item['author-link'])) {
if ($item['event-id'] != 0) {
$edpost = ['events/event/' . $item['event-id'], DI::l10n()->t('Edit')];
$edpost = ['editpost/' . $item['id'], DI::l10n()->t('Edit')];
}
}
- $dropping = in_array($item['uid'], [0, local_user()]);
+ $dropping = in_array($item['uid'], [0, Session::getLocalUser()]);
}
// Editing on items of not subscribed users isn't currently possible
$edpost = false;
}
- if (($this->getDataValue('uid') == local_user()) || $this->isVisiting()) {
+ if (($this->getDataValue('uid') == Session::getLocalUser()) || $this->isVisiting()) {
$dropping = true;
}
$drop = false;
$block = false;
- if (local_user()) {
+ if (Session::getLocalUser()) {
$drop = [
'dropping' => $dropping,
'pagedrop' => $item['pagedrop'],
];
}
- if (!$item['self'] && local_user()) {
+ if (!$item['self'] && Session::getLocalUser()) {
$block = [
'blocking' => true,
'block' => DI::l10n()->t('Block %s', $item['author-name']),
];
}
- $filer = local_user() ? DI::l10n()->t('Save to folder') : false;
+ $filer = Session::getLocalUser() ? DI::l10n()->t('Save to folder') : false;
$profile_name = $item['author-name'];
if (!empty($item['author-link']) && empty($item['author-name'])) {
$tagger = '';
if ($this->isToplevel()) {
- if (local_user()) {
- $ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], local_user());
+ if (Session::getLocalUser()) {
+ $ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], Session::getLocalUser());
if ($item['mention'] || $ignored) {
$ignore = [
'do' => DI::l10n()->t('Ignore thread'),
'starred' => DI::l10n()->t('Starred'),
];
- if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
+ if ($conv->getProfileOwner() == Session::getLocalUser() && ($item['uid'] != 0)) {
if ($origin && in_array($item['private'], [Item::PUBLIC, Item::UNLISTED])) {
$ispinned = ($item['featured'] ? 'pinned' : 'unpinned');
$body_html = Item::prepareBody($item, true);
- list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item, local_user());
+ list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item, Session::getLocalUser());
if (!empty($item['title'])) {
$title = $item['title'];
- } elseif (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) {
+ } elseif (!empty($item['content-warning']) && DI::pConfig()->get(Session::getLocalUser(), 'system', 'disable_cw', false)) {
$title = ucfirst($item['content-warning']);
} else {
$title = '';
}
- if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+ if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'hide_dislike')) {
$buttons['dislike'] = false;
}
}
// Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments
- if (!local_user() && ($item['network'] != Protocol::DIASPORA) && !empty(DI::session()->get('remote_comment'))) {
+ if (!Session::getLocalUser() && ($item['network'] != Protocol::DIASPORA) && !empty(DI::session()->get('remote_comment'))) {
$remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('Remote comment'),
str_replace('{uri}', urlencode($item['uri']), DI::session()->get('remote_comment'))];
/*
* Only add what will be displayed
*/
- if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
+ if ($item->getDataValue('network') === Protocol::MAIL && Session::getLocalUser() != $item->getDataValue('uid')) {
return false;
} elseif ($activity->match($item->getDataValue('verb'), Activity::LIKE) ||
$activity->match($item->getDataValue('verb'), Activity::DISLIKE)) {
// This will allow us to comment on wall-to-wall items owned by our friends
// and community forums even if somebody else wrote the post.
// bug #517 - this fixes for conversation owner
- if ($conv->getMode() == 'profile' && $conv->getProfileOwner() == local_user()) {
+ if ($conv->getMode() == 'profile' && $conv->getProfileOwner() == Session::getLocalUser()) {
return true;
}
{
$a = DI::app();
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return '';
}
$owner = User::getOwnerDataById($a->getLoggedInUserId());
$item = $this->getData();
- if (!empty($item['content-warning']) && Feature::isEnabled(local_user(), 'add_abstract')) {
+ if (!empty($item['content-warning']) && Feature::isEnabled(Session::getLocalUser(), 'add_abstract')) {
$text = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $item['content-warning'] . "[/abstract]\n";
} else {
$text = '';
}
- if (!Feature::isEnabled(local_user(), 'explicit_mentions')) {
+ if (!Feature::isEnabled(Session::getLocalUser(), 'explicit_mentions')) {
return $text;
}
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
- $words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
+ $words = DI::pConfig()->get(Session::getLocalUser(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
+use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Protocol\Activity;
use Friendica\Security\Security;
switch ($mode) {
case 'network':
case 'notes':
- $this->profile_owner = local_user();
+ $this->profile_owner = Session::getLocalUser();
$this->writable = true;
break;
case 'profile':
/*
* Only add will be displayed
*/
- if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
+ if ($item->getDataValue('network') === Protocol::MAIL && Session::getLocalUser() != $item->getDataValue('uid')) {
Logger::info('[WARN] Conversation::addThread : Thread is a mail ('. $item->getId() .').');
return false;
}
$result = [];
foreach ($this->parents as $item) {
- if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
+ if ($item->getDataValue('network') === Protocol::MAIL && Session::getLocalUser() != $item->getDataValue('uid')) {
continue;
}
Hook::callAll('logged_in', $record);
- self::$current_user_id = local_user();
+ self::$current_user_id = Session::getLocalUser();
return self::$current_user_id;
}
return false;
}
- $uid = local_user();
+ $uid = Session::getLocalUser();
if ($uid == $owner) {
return true;
}
- if (local_user() && ($owner == 0)) {
+ if (Session::getLocalUser() && ($owner == 0)) {
return true;
}
*/
public static function getPermissionsSQLByUserId(int $owner_id, bool $accessible = false)
{
- $local_user = local_user();
+ $local_user = Session::getLocalUser();
$remote_contact = Session::getRemoteContactID($owner_id);
$acc_sql = '';
use DateTime;
use DateTimeZone;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
bool $required = false): string
{
// First day of the week (0 = Sunday)
- $firstDay = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
+ $firstDay = DI::pConfig()->get(Session::getLocalUser(), 'system', 'first_day_of_week', 0);
$lang = substr(DI::l10n()->getCurrentLang(), 0, 2);
<?php
/**
- * Theme settings
+ * @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/>.
+ *
*/
use Friendica\App;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
function theme_content(App $a)
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return;
}
- $colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
+ $colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
$user = true;
return clean_form($a, $colorset, $user);
function theme_post(App $a)
{
- if (! local_user()) {
+ if (! Session::getLocalUser()) {
return;
}
if (isset($_POST['duepuntozero-settings-submit'])) {
- DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
+ DI::pConfig()->set(Session::getLocalUser(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
}
];
if ($user) {
- $color = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
+ $color = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
} else {
$color = DI::config()->get('duepuntozero', 'colorset');
}
use Friendica\App;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
/*
$colorset = null;
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
- $colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
+ $colorset = DI::pConfig()->get(Session::getLocalUser(), 'duepuntozero', 'colorset');
if (!$colorset)
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings
}
use Friendica\App;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
require_once 'view/theme/frio/php/Image.php';
function theme_post(App $a)
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return;
}
'always_open_compose',
] as $field) {
if (isset($_POST['frio_' . $field])) {
- DI::pConfig()->set(local_user(), 'frio', $field, $_POST['frio_' . $field]);
+ DI::pConfig()->set(Session::getLocalUser(), 'frio', $field, $_POST['frio_' . $field]);
}
}
- DI::pConfig()->set(local_user(), 'frio', 'css_modified', time());
+ DI::pConfig()->set(Session::getLocalUser(), 'frio', 'css_modified', time());
}
}
function theme_content(): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return '';
}
$arr = [
- 'scheme' => DI::pConfig()->get(local_user(), 'frio', 'scheme',
- DI::pConfig()->get(local_user(), 'frio', 'schema',
+ 'scheme' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme',
+ DI::pConfig()->get(Session::getLocalUser(), 'frio', 'schema',
DI::config()->get('frio', 'scheme',
DI::config()->get('frio', 'schema')
)
),
'share_string' => '',
- 'scheme_accent' => DI::pConfig()->get(local_user(), 'frio', 'scheme_accent' , DI::config()->get('frio', 'scheme_accent')),
- 'nav_bg' => DI::pConfig()->get(local_user(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg')),
- 'nav_icon_color' => DI::pConfig()->get(local_user(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color')),
- 'link_color' => DI::pConfig()->get(local_user(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color')),
- 'background_color' => DI::pConfig()->get(local_user(), 'frio', 'background_color' , DI::config()->get('frio', 'background_color')),
- 'contentbg_transp' => DI::pConfig()->get(local_user(), 'frio', 'contentbg_transp' , DI::config()->get('frio', 'contentbg_transp')),
- 'background_image' => DI::pConfig()->get(local_user(), 'frio', 'background_image' , DI::config()->get('frio', 'background_image')),
- 'bg_image_option' => DI::pConfig()->get(local_user(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option')),
- 'always_open_compose' => DI::pConfig()->get(local_user(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)),
+ 'scheme_accent' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme_accent' , DI::config()->get('frio', 'scheme_accent')),
+ 'nav_bg' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_bg' , DI::config()->get('frio', 'nav_bg')),
+ 'nav_icon_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'nav_icon_color' , DI::config()->get('frio', 'nav_icon_color')),
+ 'link_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'link_color' , DI::config()->get('frio', 'link_color')),
+ 'background_color' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_color' , DI::config()->get('frio', 'background_color')),
+ 'contentbg_transp' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'contentbg_transp' , DI::config()->get('frio', 'contentbg_transp')),
+ 'background_image' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'background_image' , DI::config()->get('frio', 'background_image')),
+ 'bg_image_option' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'bg_image_option' , DI::config()->get('frio', 'bg_image_option')),
+ 'always_open_compose' => DI::pConfig()->get(Session::getLocalUser(), 'frio', 'always_open_compose', DI::config()->get('frio', 'always_open_compose', false)),
];
return frio_form($arr);
function theme_admin(): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return '';
}
* 'overwrites' => Variables which overwriting custom settings
*/
+use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Util\Strings;
$theme = DI::app()->getCurrentTheme();
$themepath = 'view/theme/' . $theme . '/';
if (empty($scheme)) {
- $scheme = DI::pConfig()->get(local_user(), 'frio', 'scheme', DI::pConfig()->get(local_user(), 'frio', 'schema', '---'));
+ $scheme = DI::pConfig()->get(Session::getLocalUser(), 'frio', 'scheme', DI::pConfig()->get(Session::getLocalUser(), 'frio', 'schema', '---'));
}
$scheme = Strings::sanitizeFilePathItem($scheme);
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
if ($a->isLoggedIn()) {
$remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
- } elseif (!local_user() && remote_user()) {
- $remoteUser = Contact::getById(remote_user(), $fields);
+ } elseif (!Session::getLocalUser() && Session::getRemoteUser()) {
+ $remoteUser = Contact::getById(Session::getRemoteUser(), $fields);
$nav_info['nav']['remote'] = DI::l10n()->t('Guest');
} elseif (Profile::getMyURL()) {
$remoteUser = Contact::getByURL($homelink, null, $fields);
$server_url = $remoteUser['baseurl'];
}
- if (!local_user() && !empty($server_url) && !is_null($remoteUser)) {
+ if (!Session::getLocalUser() && !empty($server_url) && !is_null($remoteUser)) {
// user menu
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
// Add follow to the item menu
$followThread = [];
if (
- local_user()
- && in_array($arr['item']['uid'], [0, local_user()])
+ Session::getLocalUser()
+ && in_array($arr['item']['uid'], [0, Session::getLocalUser()])
&& $arr['item']['gravity'] == Item::GRAVITY_PARENT
&& !$arr['item']['self']
&& !$arr['item']['mention']
<?php
/**
- * Theme settings
+ * @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/>.
+ *
*/
use Friendica\App;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
function theme_content(App $a) {
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return;
}
- $align = DI::pConfig()->get(local_user(), 'quattro', 'align' );
- $color = DI::pConfig()->get(local_user(), 'quattro', 'color' );
- $tfs = DI::pConfig()->get(local_user(),"quattro","tfs");
- $pfs = DI::pConfig()->get(local_user(),"quattro","pfs");
+ $align = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'align' );
+ $color = DI::pConfig()->get(Session::getLocalUser(), 'quattro', 'color' );
+ $tfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","tfs");
+ $pfs = DI::pConfig()->get(Session::getLocalUser(),"quattro","pfs");
return quattro_form($a,$align, $color, $tfs, $pfs);
}
function theme_post(App $a) {
- if (! local_user()) {
+ if (! Session::getLocalUser()) {
return;
}
if (isset($_POST['quattro-settings-submit'])){
- DI::pConfig()->set(local_user(), 'quattro', 'align', $_POST['quattro_align']);
- DI::pConfig()->set(local_user(), 'quattro', 'color', $_POST['quattro_color']);
- DI::pConfig()->set(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
- DI::pConfig()->set(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
+ DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'align', $_POST['quattro_align']);
+ DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'color', $_POST['quattro_color']);
+ DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'tfs', $_POST['quattro_tfs']);
+ DI::pConfig()->set(Session::getLocalUser(), 'quattro', 'pfs', $_POST['quattro_pfs']);
}
}
<?php
/**
- * Theme settings
+ * @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/>.
+ *
*/
use Friendica\App;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
require_once __DIR__ . '/theme.php';
function theme_content(App $a)
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return;
}
return;
}
- $style = DI::pConfig()->get(local_user(), 'vier', 'style');
+ $style = DI::pConfig()->get(Session::getLocalUser(), 'vier', 'style');
if ($style == "") {
$style = DI::config()->get('vier', 'style');
function theme_post(App $a)
{
- if (! local_user()) {
+ if (! Session::getLocalUser()) {
return;
}
if (isset($_POST['vier-settings-submit'])) {
- DI::pConfig()->set(local_user(), 'vier', 'style', $_POST['vier_style']);
- DI::pConfig()->set(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
- DI::pConfig()->set(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
- DI::pConfig()->set(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
- DI::pConfig()->set(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
- DI::pConfig()->set(local_user(), 'vier', 'show_friends', $_POST['vier_show_friends']);
- DI::pConfig()->set(local_user(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'style', $_POST['vier_style']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_pages', $_POST['vier_show_pages']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_services', $_POST['vier_show_services']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_friends', $_POST['vier_show_friends']);
+ DI::pConfig()->set(Session::getLocalUser(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
}
}
<?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>
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;
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' && Session::getLocalUser()
)
) {
vier_community_info();
function get_vier_config($key, $default = false, $admin = false)
{
- if (local_user() && !$admin) {
- $result = DI::pConfig()->get(local_user(), "vier", $key);
+ if (Session::getLocalUser() && !$admin) {
+ $result = DI::pConfig()->get(Session::getLocalUser(), "vier", $key);
if (!is_null($result)) {
return $result;
}
// comunity_profiles
if ($show_profiles) {
- $contacts = Contact\Relation::getSuggestions(local_user(), 0, 9);
+ $contacts = Contact\Relation::getSuggestions(Session::getLocalUser(), 0, 9);
$tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl');
if (DBA::isResult($contacts)) {
}
//right_aside FIND FRIENDS
- if ($show_friends && local_user()) {
+ if ($show_friends && Session::getLocalUser()) {
$nv = [];
$nv['findpeople'] = DI::l10n()->t('Find People');
$nv['desc'] = DI::l10n()->t('Enter name or interest');
}
//Community_Pages at right_aside
- if ($show_pages && local_user()) {
- $aside['$page'] = ForumManager::widget('network/forum', local_user());;
+ if ($show_pages && Session::getLocalUser()) {
+ $aside['$page'] = ForumManager::widget('network/forum', Session::getLocalUser());;
}
// END Community Page