Merge pull request #12024 from annando/no-boot-src-1
old boot.php functions replaced in varous placed under /src
This commit is contained in:
commit
ba9f145ef7
15
src/App.php
15
src/App.php
|
@ -33,6 +33,7 @@ use Friendica\Core\Config\ValueObject\Cache;
|
|||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Database\Database;
|
||||
|
@ -157,7 +158,7 @@ class App
|
|||
|
||||
public function isLoggedIn(): bool
|
||||
{
|
||||
return local_user() && $this->user_id && ($this->user_id == local_user());
|
||||
return Session::getLocalUser() && $this->user_id && ($this->user_id == Session::getLocalUser());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +172,7 @@ class App
|
|||
|
||||
$adminlist = explode(',', str_replace(' ', '', $admin_email));
|
||||
|
||||
return local_user() && $admin_email && $this->database->exists('user', ['uid' => $this->getLoggedInUserId(), 'email' => $adminlist]);
|
||||
return Session::getLocalUser() && $admin_email && $this->database->exists('user', ['uid' => $this->getLoggedInUserId(), 'email' => $adminlist]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -495,11 +496,11 @@ class App
|
|||
|
||||
$page_theme = null;
|
||||
// Find the theme that belongs to the user whose stuff we are looking at
|
||||
if (!empty($this->profile_owner) && ($this->profile_owner != local_user())) {
|
||||
if (!empty($this->profile_owner) && ($this->profile_owner != Session::getLocalUser())) {
|
||||
// Allow folks to override user themes and always use their own on their own site.
|
||||
// This works only if the user is on the same server
|
||||
$user = $this->database->selectFirst('user', ['theme'], ['uid' => $this->profile_owner]);
|
||||
if ($this->database->isResult($user) && !local_user()) {
|
||||
if ($this->database->isResult($user) && !Session::getLocalUser()) {
|
||||
$page_theme = $user['theme'];
|
||||
}
|
||||
}
|
||||
|
@ -528,10 +529,10 @@ class App
|
|||
|
||||
$page_mobile_theme = null;
|
||||
// Find the theme that belongs to the user whose stuff we are looking at
|
||||
if (!empty($this->profile_owner) && ($this->profile_owner != local_user())) {
|
||||
if (!empty($this->profile_owner) && ($this->profile_owner != Session::getLocalUser())) {
|
||||
// Allow folks to override user themes and always use their own on their own site.
|
||||
// This works only if the user is on the same server
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
$page_mobile_theme = $this->pConfig->get($this->profile_owner, 'system', 'mobile-theme');
|
||||
}
|
||||
}
|
||||
|
@ -628,7 +629,7 @@ class App
|
|||
}
|
||||
|
||||
// ZRL
|
||||
if (!empty($_GET['zrl']) && $this->mode->isNormal() && !$this->mode->isBackend() && !local_user()) {
|
||||
if (!empty($_GET['zrl']) && $this->mode->isNormal() && !$this->mode->isBackend() && !Session::getLocalUser()) {
|
||||
// Only continue when the given profile link seems valid
|
||||
// Valid profile links contain a path with "/profile/" and no query parameters
|
||||
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == '') &&
|
||||
|
|
|
@ -32,6 +32,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -231,7 +232,7 @@ class Page implements ArrayAccess
|
|||
*/
|
||||
private function initHead(App $app, Arguments $args, L10n $l10n, IManageConfigValues $config, IManagePersonalConfigValues $pConfig)
|
||||
{
|
||||
$interval = ((local_user()) ? $pConfig->get(local_user(), 'system', 'update_interval') : 40000);
|
||||
$interval = ((Session::getLocalUser()) ? $pConfig->get(Session::getLocalUser(), 'system', 'update_interval') : 40000);
|
||||
|
||||
// If the update is 'deactivated' set it to the highest integer number (~24 days)
|
||||
if ($interval < 0) {
|
||||
|
@ -276,7 +277,7 @@ class Page implements ArrayAccess
|
|||
* being first
|
||||
*/
|
||||
$this->page['htmlhead'] = Renderer::replaceMacros($tpl, [
|
||||
'$local_user' => local_user(),
|
||||
'$local_user' => Session::getLocalUser(),
|
||||
'$generator' => 'Friendica' . ' ' . App::VERSION,
|
||||
'$delitem' => $l10n->t('Delete this item?'),
|
||||
'$blockAuthor' => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
|
||||
|
|
|
@ -34,6 +34,7 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Lock\Capability\ICanLock;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\LegacyModule;
|
||||
use Friendica\Module\HTTPException\MethodNotAllowed;
|
||||
use Friendica\Module\HTTPException\PageNotFound;
|
||||
|
@ -308,7 +309,7 @@ class Router
|
|||
if (Addon::isEnabled($moduleName) && file_exists("addon/{$moduleName}/{$moduleName}.php")) {
|
||||
//Check if module is an app and if public access to apps is allowed or not
|
||||
$privateapps = $this->config->get('config', 'private_addons', false);
|
||||
if ((!local_user()) && Hook::isAddonApp($moduleName) && $privateapps) {
|
||||
if (!Session::getLocalUser() && Hook::isAddonApp($moduleName) && $privateapps) {
|
||||
throw new MethodNotAllowedException($this->l10n->t("You must be logged in to use addons. "));
|
||||
} else {
|
||||
include_once "addon/{$moduleName}/{$moduleName}.php";
|
||||
|
|
|
@ -171,7 +171,7 @@ class Conversation
|
|||
continue;
|
||||
}
|
||||
|
||||
if (public_contact() == $activity['author-id']) {
|
||||
if (Session::getPublicContact() == $activity['author-id']) {
|
||||
$conv_responses[$mode][$activity['thr-parent-id']]['self'] = 1;
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ class Conversation
|
|||
$x['bang'] = $x['bang'] ?? '';
|
||||
$x['visitor'] = $x['visitor'] ?? 'block';
|
||||
$x['is_owner'] = $x['is_owner'] ?? true;
|
||||
$x['profile_uid'] = $x['profile_uid'] ?? local_user();
|
||||
$x['profile_uid'] = $x['profile_uid'] ?? Session::getLocalUser();
|
||||
|
||||
|
||||
$geotag = !empty($x['allow_location']) ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
|
||||
|
@ -359,7 +359,7 @@ class Conversation
|
|||
'$title' => $x['title'] ?? '',
|
||||
'$placeholdertitle' => $this->l10n->t('Set title'),
|
||||
'$category' => $x['category'] ?? '',
|
||||
'$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? $this->l10n->t("Categories \x28comma-separated list\x29") : '',
|
||||
'$placeholdercategory' => Feature::isEnabled(Session::getLocalUser(), 'categories') ? $this->l10n->t("Categories \x28comma-separated list\x29") : '',
|
||||
'$scheduled_at' => Temporal::getDateTimeField(
|
||||
new \DateTime(),
|
||||
new \DateTime('now + 6 months'),
|
||||
|
@ -397,7 +397,7 @@ class Conversation
|
|||
'$browser' => $this->l10n->t('Browser'),
|
||||
|
||||
'$compose_link_title' => $this->l10n->t('Open Compose page'),
|
||||
'$always_open_compose' => $this->pConfig->get(local_user(), 'frio', 'always_open_compose', false),
|
||||
'$always_open_compose' => $this->pConfig->get(Session::getLocalUser(), 'frio', 'always_open_compose', false),
|
||||
]);
|
||||
|
||||
|
||||
|
@ -436,7 +436,7 @@ class Conversation
|
|||
$this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
|
||||
$this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
|
||||
|
||||
$ssl_state = (local_user() ? true : false);
|
||||
$ssl_state = (bool)Session::getLocalUser();
|
||||
|
||||
$live_update_div = '';
|
||||
|
||||
|
@ -488,11 +488,11 @@ class Conversation
|
|||
}
|
||||
}
|
||||
} elseif ($mode === 'notes') {
|
||||
$items = $this->addChildren($items, false, $order, local_user(), $mode);
|
||||
$items = $this->addChildren($items, false, $order, Session::getLocalUser(), $mode);
|
||||
|
||||
if (!$update) {
|
||||
$live_update_div = '<div id="live-notes"></div>' . "\r\n"
|
||||
. "<script> var profile_uid = " . local_user()
|
||||
. "<script> var profile_uid = " . Session::getLocalUser()
|
||||
. "; var netargs = '/?f='; </script>\r\n";
|
||||
}
|
||||
} elseif ($mode === 'display') {
|
||||
|
@ -526,7 +526,7 @@ class Conversation
|
|||
$live_update_div = '<div id="live-search"></div>' . "\r\n";
|
||||
}
|
||||
|
||||
$page_dropping = ((local_user() && local_user() == $uid) ? true : false);
|
||||
$page_dropping = Session::getLocalUser() && Session::getLocalUser() == $uid;
|
||||
|
||||
if (!$update) {
|
||||
$_SESSION['return_path'] = $this->args->getQueryString();
|
||||
|
@ -546,7 +546,7 @@ class Conversation
|
|||
'announce' => [],
|
||||
];
|
||||
|
||||
if ($this->pConfig->get(local_user(), 'system', 'hide_dislike')) {
|
||||
if ($this->pConfig->get(Session::getLocalUser(), 'system', 'hide_dislike')) {
|
||||
unset($conv_responses['dislike']);
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ class Conversation
|
|||
$writable = $items[0]['writable'] || ($items[0]['uid'] == 0) && in_array($items[0]['network'], Protocol::FEDERATED);
|
||||
}
|
||||
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
$writable = false;
|
||||
}
|
||||
|
||||
|
@ -597,7 +597,7 @@ class Conversation
|
|||
$threadsid++;
|
||||
|
||||
// prevent private email from leaking.
|
||||
if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
|
||||
if ($item['network'] === Protocol::MAIL && Session::getLocalUser() != $item['uid']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -641,17 +641,17 @@ class Conversation
|
|||
'announce' => null,
|
||||
];
|
||||
|
||||
if ($this->pConfig->get(local_user(), 'system', 'hide_dislike')) {
|
||||
if ($this->pConfig->get(Session::getLocalUser(), 'system', 'hide_dislike')) {
|
||||
unset($likebuttons['dislike']);
|
||||
}
|
||||
|
||||
$body_html = ItemModel::prepareBody($item, true, $preview);
|
||||
|
||||
[$categories, $folders] = $this->item->determineCategoriesTerms($item, local_user());
|
||||
[$categories, $folders] = $this->item->determineCategoriesTerms($item, Session::getLocalUser());
|
||||
|
||||
if (!empty($item['title'])) {
|
||||
$title = $item['title'];
|
||||
} elseif (!empty($item['content-warning']) && $this->pConfig->get(local_user(), 'system', 'disable_cw', false)) {
|
||||
} elseif (!empty($item['content-warning']) && $this->pConfig->get(Session::getLocalUser(), 'system', 'disable_cw', false)) {
|
||||
$title = ucfirst($item['content-warning']);
|
||||
} else {
|
||||
$title = '';
|
||||
|
@ -745,7 +745,7 @@ class Conversation
|
|||
$this->builtinActivityPuller($item, $conv_responses);
|
||||
|
||||
// Only add what is visible
|
||||
if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
|
||||
if ($item['network'] === Protocol::MAIL && Session::getLocalUser() != $item['uid']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -790,11 +790,11 @@ class Conversation
|
|||
|
||||
private function getBlocklist(): array
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get(local_user(), 'system', 'blocked'));
|
||||
$str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get(Session::getLocalUser(), 'system', 'blocked'));
|
||||
if (empty($str_blocked)) {
|
||||
return [];
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ class Conversation
|
|||
$row['direction'] = ['direction' => 4, 'title' => $this->l10n->t('You subscribed to one or more tags in this post.')];
|
||||
break;
|
||||
case ItemModel::PR_ANNOUNCEMENT:
|
||||
if (!empty($row['causer-id']) && $this->pConfig->get(local_user(), 'system', 'display_resharer')) {
|
||||
if (!empty($row['causer-id']) && $this->pConfig->get(Session::getLocalUser(), 'system', 'display_resharer')) {
|
||||
$row['owner-id'] = $row['causer-id'];
|
||||
$row['owner-link'] = $row['causer-link'];
|
||||
$row['owner-avatar'] = $row['causer-avatar'];
|
||||
|
@ -1216,7 +1216,7 @@ class Conversation
|
|||
$parents[$i]['children'] = $this->sortItemChildren($parents[$i]['children']);
|
||||
}
|
||||
|
||||
if (!$this->pConfig->get(local_user(), 'system', 'no_smart_threading', 0)) {
|
||||
if (!$this->pConfig->get(Session::getLocalUser(), 'system', 'no_smart_threading', 0)) {
|
||||
foreach ($parents as $i => $parent) {
|
||||
$parents[$i] = $this->smartFlattenConversation($parent);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace Friendica\Content;
|
|||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -223,7 +224,7 @@ class ForumManager
|
|||
AND NOT `contact`.`pending` AND NOT `contact`.`archive`
|
||||
AND `contact`.`uid` = ?
|
||||
GROUP BY `contact`.`id`",
|
||||
local_user(), Protocol::DFRN, Protocol::ACTIVITYPUB, Contact::TYPE_COMMUNITY, local_user()
|
||||
Session::getLocalUser(), Protocol::DFRN, Protocol::ACTIVITYPUB, Contact::TYPE_COMMUNITY, Session::getLocalUser()
|
||||
);
|
||||
|
||||
return DBA::toArray($stmtContacts);
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -109,7 +110,7 @@ class Item
|
|||
$categories[] = [
|
||||
'name' => $savedFolderName,
|
||||
'url' => $url,
|
||||
'removeurl' => local_user() == $uid ? 'filerm/' . $item['id'] . '?cat=' . rawurlencode($savedFolderName) : '',
|
||||
'removeurl' => Session::getLocalUser() == $uid ? 'filerm/' . $item['id'] . '?cat=' . rawurlencode($savedFolderName) : '',
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
|
@ -120,12 +121,12 @@ class Item
|
|||
$categories[count($categories) - 1]['last'] = true;
|
||||
}
|
||||
|
||||
if (local_user() == $uid) {
|
||||
if (Session::getLocalUser() == $uid) {
|
||||
foreach (Post\Category::getArrayByURIId($item['uri-id'], $uid, Post\Category::FILE) as $savedFolderName) {
|
||||
$folders[] = [
|
||||
'name' => $savedFolderName,
|
||||
'url' => "#",
|
||||
'removeurl' => local_user() == $uid ? 'filerm/' . $item['id'] . '?term=' . rawurlencode($savedFolderName) : '',
|
||||
'removeurl' => Session::getLocalUser() == $uid ? 'filerm/' . $item['id'] . '?term=' . rawurlencode($savedFolderName) : '',
|
||||
'first' => $first,
|
||||
'last' => false
|
||||
];
|
||||
|
@ -331,7 +332,7 @@ class Item
|
|||
$sub_link = $contact_url = $pm_url = $status_link = '';
|
||||
$photos_link = $posts_link = $block_link = $ignore_link = '';
|
||||
|
||||
if (local_user() && local_user() == $item['uid'] && $item['gravity'] == ItemModel::GRAVITY_PARENT && !$item['self'] && !$item['mention']) {
|
||||
if (Session::getLocalUser() && Session::getLocalUser() == $item['uid'] && $item['gravity'] == ItemModel::GRAVITY_PARENT && !$item['self'] && !$item['mention']) {
|
||||
$sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;';
|
||||
}
|
||||
|
||||
|
@ -348,7 +349,7 @@ class Item
|
|||
$pcid = $item['author-id'];
|
||||
$network = '';
|
||||
$rel = 0;
|
||||
$condition = ['uid' => local_user(), 'uri-id' => $item['author-uri-id']];
|
||||
$condition = ['uid' => Session::getLocalUser(), 'uri-id' => $item['author-uri-id']];
|
||||
$contact = DBA::selectFirst('contact', ['id', 'network', 'rel'], $condition);
|
||||
if (DBA::isResult($contact)) {
|
||||
$cid = $contact['id'];
|
||||
|
@ -378,7 +379,7 @@ class Item
|
|||
}
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
if (Session::getLocalUser()) {
|
||||
$menu = [
|
||||
$this->l10n->t('Follow Thread') => $sub_link,
|
||||
$this->l10n->t('View Status') => $status_link,
|
||||
|
@ -439,7 +440,7 @@ class Item
|
|||
return (!($this->activity->match($item['verb'], Activity::FOLLOW) &&
|
||||
$item['object-type'] === Activity\ObjectType::NOTE &&
|
||||
empty($item['self']) &&
|
||||
$item['uid'] == local_user())
|
||||
$item['uid'] == Session::getLocalUser())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class Nav
|
|||
|
||||
//Don't populate apps_menu if apps are private
|
||||
$privateapps = DI::config()->get('config', 'private_addons', false);
|
||||
if (local_user() || !$privateapps) {
|
||||
if (Session::getLocalUser() || !$privateapps) {
|
||||
$arr = ['app_menu' => self::$app_menu];
|
||||
|
||||
Hook::callAll('app_menu', $arr);
|
||||
|
@ -149,7 +149,7 @@ class Nav
|
|||
*/
|
||||
private static function getInfo(App $a): array
|
||||
{
|
||||
$ssl_state = (bool) local_user();
|
||||
$ssl_state = (bool) Session::getLocalUser();
|
||||
|
||||
/*
|
||||
* Our network is distributed, and as you visit friends some of the
|
||||
|
@ -211,7 +211,7 @@ class Nav
|
|||
$homelink = DI::session()->get('visitor_home', '');
|
||||
}
|
||||
|
||||
if ((DI::args()->getModuleName() != 'home') && (! (local_user()))) {
|
||||
if ((DI::args()->getModuleName() != 'home') && (! (Session::getLocalUser()))) {
|
||||
$nav['home'] = [$homelink, DI::l10n()->t('Home'), '', DI::l10n()->t('Home Page')];
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ class Nav
|
|||
$nav['apps'] = ['apps', DI::l10n()->t('Apps'), '', DI::l10n()->t('Addon applications, utilities, games')];
|
||||
}
|
||||
|
||||
if (local_user() || !DI::config()->get('system', 'local_search')) {
|
||||
if (Session::getLocalUser() || !DI::config()->get('system', 'local_search')) {
|
||||
$nav['search'] = ['search', DI::l10n()->t('Search'), '', DI::l10n()->t('Search site content')];
|
||||
|
||||
$nav['searchoption'] = [
|
||||
|
@ -252,12 +252,12 @@ class Nav
|
|||
}
|
||||
}
|
||||
|
||||
if ((local_user() || DI::config()->get('system', 'community_page_style') != Community::DISABLED_VISITOR) &&
|
||||
if ((Session::getLocalUser() || DI::config()->get('system', 'community_page_style') != Community::DISABLED_VISITOR) &&
|
||||
!(DI::config()->get('system', 'community_page_style') == Community::DISABLED)) {
|
||||
$nav['community'] = ['community', DI::l10n()->t('Community'), '', DI::l10n()->t('Conversations on this and other servers')];
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
if (Session::getLocalUser()) {
|
||||
$nav['events'] = ['events', DI::l10n()->t('Events'), '', DI::l10n()->t('Events and Calendar')];
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ class Nav
|
|||
}
|
||||
|
||||
// The following nav links are only show to logged in users
|
||||
if (local_user() && !empty($a->getLoggedInUserNickname())) {
|
||||
if (Session::getLocalUser() && !empty($a->getLoggedInUserNickname())) {
|
||||
$nav['network'] = ['network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')];
|
||||
|
||||
$nav['home'] = ['profile/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')];
|
||||
|
@ -288,7 +288,7 @@ class Nav
|
|||
$nav['messages']['outbox'] = ['message/sent', DI::l10n()->t('Outbox'), '', DI::l10n()->t('Outbox')];
|
||||
$nav['messages']['new'] = ['message/new', DI::l10n()->t('New Message'), '', DI::l10n()->t('New Message')];
|
||||
|
||||
if (User::hasIdentities(DI::session()->get('submanage') ?: local_user())) {
|
||||
if (User::hasIdentities(DI::session()->get('submanage') ?: Session::getLocalUser())) {
|
||||
$nav['delegation'] = ['delegation', DI::l10n()->t('Accounts'), '', DI::l10n()->t('Manage other pages')];
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
namespace Friendica\Content;
|
||||
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -213,7 +214,7 @@ class Smilies
|
|||
public static function replaceFromArray(string $text, array $smilies, bool $no_images = false): string
|
||||
{
|
||||
if (intval(DI::config()->get('system', 'no_smilies'))
|
||||
|| (local_user() && intval(DI::pConfig()->get(local_user(), 'system', 'no_smilies')))
|
||||
|| (Session::getLocalUser() && intval(DI::pConfig()->get(Session::getLocalUser(), 'system', 'no_smilies')))
|
||||
) {
|
||||
return $text;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\Core\Cache\Enum\Duration;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -66,7 +67,7 @@ class Widget
|
|||
$global_dir = Search::getGlobalDirectory();
|
||||
|
||||
if (DI::config()->get('system', 'invitation_only')) {
|
||||
$x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
|
||||
$x = intval(DI::pConfig()->get(Session::getLocalUser(), 'system', 'invites_remaining'));
|
||||
if ($x || DI::app()->isSiteAdmin()) {
|
||||
DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
|
||||
. DI::l10n()->tt('%d invitation available', '%d invitations available', $x)
|
||||
|
@ -195,7 +196,7 @@ class Widget
|
|||
*/
|
||||
public static function groups(string $baseurl, string $selected = ''): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -204,7 +205,7 @@ class Widget
|
|||
'ref' => $group['id'],
|
||||
'name' => $group['name']
|
||||
];
|
||||
}, Group::getByUserId(local_user()));
|
||||
}, Group::getByUserId(Session::getLocalUser()));
|
||||
|
||||
return self::filter(
|
||||
'group',
|
||||
|
@ -227,7 +228,7 @@ class Widget
|
|||
*/
|
||||
public static function contactRels(string $baseurl, string $selected = ''): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -258,13 +259,13 @@ class Widget
|
|||
*/
|
||||
public static function networks(string $baseurl, string $selected = ''): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$networks = self::unavailableNetworks();
|
||||
$query = "`uid` = ? AND NOT `deleted` AND `network` != '' AND NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")";
|
||||
$condition = array_merge([$query], array_merge([local_user()], $networks));
|
||||
$condition = array_merge([$query], array_merge([Session::getLocalUser()], $networks));
|
||||
|
||||
$r = DBA::select('contact', ['network'], $condition, ['group_by' => ['network'], 'order' => ['network']]);
|
||||
|
||||
|
@ -299,12 +300,12 @@ class Widget
|
|||
*/
|
||||
public static function fileAs(string $baseurl, string $selected = ''): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$terms = [];
|
||||
foreach (Post\Category::getArray(local_user(), Post\Category::FILE) as $savedFolderName) {
|
||||
foreach (Post\Category::getArray(Session::getLocalUser(), Post\Category::FILE) as $savedFolderName) {
|
||||
$terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName];
|
||||
}
|
||||
|
||||
|
@ -361,11 +362,11 @@ class Widget
|
|||
*/
|
||||
public static function commonFriendsVisitor(int $uid, string $nickname): string
|
||||
{
|
||||
if (local_user() == $uid) {
|
||||
if (Session::getLocalUser() == $uid) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$visitorPCid = local_user() ? Contact::getPublicIdByUserId(local_user()) : remote_user();
|
||||
$visitorPCid = Session::getLocalUser() ? Contact::getPublicIdByUserId(Session::getLocalUser()) : Session::getRemoteUser();
|
||||
if (!$visitorPCid) {
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Content\Widget;
|
|||
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
|
@ -37,7 +38,7 @@ class SavedSearches
|
|||
public static function getHTML($return_url, $search = '')
|
||||
{
|
||||
$saved = [];
|
||||
$saved_searches = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||
$saved_searches = DBA::select('search', ['id', 'term'], ['uid' => Session::getLocalUser()]);
|
||||
while ($saved_search = DBA::fetch($saved_searches)) {
|
||||
$saved[] = [
|
||||
'id' => $saved_search['id'],
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -64,13 +65,13 @@ class VCard
|
|||
|
||||
$photo = Contact::getPhoto($contact);
|
||||
|
||||
if (local_user()) {
|
||||
if (Session::getLocalUser()) {
|
||||
if ($contact['uid']) {
|
||||
$id = $contact['id'];
|
||||
$rel = $contact['rel'];
|
||||
$pending = $contact['pending'];
|
||||
} else {
|
||||
$pcontact = Contact::selectFirst([], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]);
|
||||
$pcontact = Contact::selectFirst([], ['uid' => Session::getLocalUser(), 'uri-id' => $contact['uri-id']]);
|
||||
|
||||
$id = $pcontact['id'] ?? 0;
|
||||
$rel = $pcontact['rel'] ?? Contact::NOTHING;
|
||||
|
|
|
@ -62,7 +62,7 @@ class ACL
|
|||
$page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
|
||||
$page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
|
||||
|
||||
$contacts = self::getValidMessageRecipientsForUser(local_user());
|
||||
$contacts = self::getValidMessageRecipientsForUser(Session::getLocalUser());
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('acl/message_recipient.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
|
|
|
@ -70,7 +70,7 @@ class Search
|
|||
return $emptyResultList;
|
||||
}
|
||||
|
||||
$contactDetails = Contact::getByURLForUser($user_data['url'] ?? '', local_user());
|
||||
$contactDetails = Contact::getByURLForUser($user_data['url'] ?? '', Session::getLocalUser());
|
||||
|
||||
$result = new ContactResult(
|
||||
$user_data['name'] ?? '',
|
||||
|
@ -136,7 +136,7 @@ class Search
|
|||
|
||||
foreach ($profiles as $profile) {
|
||||
$profile_url = $profile['profile_url'] ?? '';
|
||||
$contactDetails = Contact::getByURLForUser($profile_url, local_user());
|
||||
$contactDetails = Contact::getByURLForUser($profile_url, Session::getLocalUser());
|
||||
|
||||
$result = new ContactResult(
|
||||
$profile['name'] ?? '',
|
||||
|
|
|
@ -1103,7 +1103,7 @@ class Contact
|
|||
$photos_link = '';
|
||||
|
||||
if ($uid == 0) {
|
||||
$uid = local_user();
|
||||
$uid = Session::getLocalUser();
|
||||
}
|
||||
|
||||
if (empty($contact['uid']) || ($contact['uid'] != $uid)) {
|
||||
|
@ -1506,10 +1506,10 @@ class Contact
|
|||
|
||||
if ($thread_mode) {
|
||||
$condition = ["((`$contact_field` = ? AND `gravity` = ?) OR (`author-id` = ? AND `gravity` = ? AND `vid` = ? AND `thr-parent-id` = `parent-uri-id`)) AND " . $sql,
|
||||
$cid, Item::GRAVITY_PARENT, $cid, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), local_user()];
|
||||
$cid, Item::GRAVITY_PARENT, $cid, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Session::getLocalUser()];
|
||||
} else {
|
||||
$condition = ["`$contact_field` = ? AND `gravity` IN (?, ?) AND " . $sql,
|
||||
$cid, Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, local_user()];
|
||||
$cid, Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, Session::getLocalUser()];
|
||||
}
|
||||
|
||||
if (!empty($parent)) {
|
||||
|
@ -1527,10 +1527,10 @@ class Contact
|
|||
}
|
||||
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
$itemsPerPage = DI::pConfig()->get(Session::getLocalUser(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
$itemsPerPage = DI::pConfig()->get(Session::getLocalUser(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1538,7 @@ class Contact
|
|||
|
||||
$params = ['order' => ['received' => true], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'infinite_scroll')) {
|
||||
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, ['$reload_uri' => DI::args()->getQueryString()]);
|
||||
} else {
|
||||
|
@ -1547,27 +1547,27 @@ class Contact
|
|||
|
||||
if ($thread_mode) {
|
||||
$fields = ['uri-id', 'thr-parent-id', 'gravity', 'author-id', 'commented'];
|
||||
$items = Post::toArray(Post::selectForUser(local_user(), $fields, $condition, $params));
|
||||
$items = Post::toArray(Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params));
|
||||
|
||||
if ($pager->getStart() == 0) {
|
||||
$cdata = self::getPublicAndUserContactID($cid, local_user());
|
||||
$cdata = self::getPublicAndUserContactID($cid, Session::getLocalUser());
|
||||
if (!empty($cdata['public'])) {
|
||||
$pinned = Post\Collection::selectToArrayForContact($cdata['public'], Post\Collection::FEATURED, $fields);
|
||||
$items = array_merge($items, $pinned);
|
||||
}
|
||||
}
|
||||
|
||||
$o .= DI::conversation()->create($items, 'contacts', $update, false, 'pinned_commented', local_user());
|
||||
$o .= DI::conversation()->create($items, 'contacts', $update, false, 'pinned_commented', Session::getLocalUser());
|
||||
} else {
|
||||
$fields = array_merge(Item::DISPLAY_FIELDLIST, ['featured']);
|
||||
$items = Post::toArray(Post::selectForUser(local_user(), $fields, $condition, $params));
|
||||
$items = Post::toArray(Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params));
|
||||
|
||||
if ($pager->getStart() == 0) {
|
||||
$cdata = self::getPublicAndUserContactID($cid, local_user());
|
||||
$cdata = self::getPublicAndUserContactID($cid, Session::getLocalUser());
|
||||
if (!empty($cdata['public'])) {
|
||||
$condition = ["`uri-id` IN (SELECT `uri-id` FROM `collection-view` WHERE `cid` = ? AND `type` = ?)",
|
||||
$cdata['public'], Post\Collection::FEATURED];
|
||||
$pinned = Post::toArray(Post::selectForUser(local_user(), $fields, $condition, $params));
|
||||
$pinned = Post::toArray(Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params));
|
||||
$items = array_merge($pinned, $items);
|
||||
}
|
||||
}
|
||||
|
@ -1576,7 +1576,7 @@ class Contact
|
|||
}
|
||||
|
||||
if (!$update) {
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'infinite_scroll')) {
|
||||
$o .= HTML::scrollLoader();
|
||||
} else {
|
||||
$o .= $pager->renderMinimal(count($items));
|
||||
|
@ -3286,7 +3286,7 @@ class Contact
|
|||
return $url;
|
||||
}
|
||||
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'stay_local') && ($url == '')) {
|
||||
if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'stay_local') && ($url == '')) {
|
||||
return 'contact/' . $contact['id'] . '/conversations';
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Model\Contact;
|
||||
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
|
@ -53,7 +54,7 @@ class Group
|
|||
AND NOT `contact`.`pending`
|
||||
ORDER BY `contact`.`name` ASC',
|
||||
$gid,
|
||||
local_user()
|
||||
Session::getLocalUser()
|
||||
);
|
||||
|
||||
if (DBA::isResult($stmt)) {
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -410,7 +411,7 @@ class Event
|
|||
public static function getStrings(): array
|
||||
{
|
||||
// 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);
|
||||
|
||||
$i18n = [
|
||||
"firstDay" => $firstDay,
|
||||
|
@ -608,7 +609,7 @@ class Event
|
|||
$edit = null;
|
||||
$copy = null;
|
||||
$drop = null;
|
||||
if (local_user() && local_user() == $event['uid'] && $event['type'] == 'event') {
|
||||
if (Session::getLocalUser() && Session::getLocalUser() == $event['uid'] && $event['type'] == 'event') {
|
||||
$edit = !$event['cid'] ? [DI::baseUrl() . '/events/event/' . $event['id'], DI::l10n()->t('Edit event') , '', ''] : null;
|
||||
$copy = !$event['cid'] ? [DI::baseUrl() . '/events/copy/' . $event['id'] , DI::l10n()->t('Duplicate event'), '', ''] : null;
|
||||
$drop = [DI::baseUrl() . '/events/drop/' . $event['id'] , DI::l10n()->t('Delete event') , '', ''];
|
||||
|
@ -775,7 +776,7 @@ class Event
|
|||
// Does the user who requests happen to be the owner of the events
|
||||
// requested? then show all of your events, otherwise only those that
|
||||
// don't have limitations set in allow_cid and allow_gid.
|
||||
if (local_user() != $uid) {
|
||||
if (Session::getLocalUser() != $uid) {
|
||||
$conditions += ['allow_cid' => '', 'allow_gid' => ''];
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -187,8 +188,8 @@ class Group
|
|||
) AS `count`
|
||||
FROM `group`
|
||||
WHERE `group`.`uid` = ?;",
|
||||
local_user(),
|
||||
local_user()
|
||||
Session::getLocalUser(),
|
||||
Session::getLocalUser()
|
||||
);
|
||||
|
||||
return DBA::toArray($stmt);
|
||||
|
@ -526,7 +527,7 @@ class Group
|
|||
*/
|
||||
public static function sidebarWidget(string $every = 'contact', string $each = 'group', string $editmode = 'standard', $group_id = '', int $cid = 0)
|
||||
{
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -544,7 +545,7 @@ class Group
|
|||
$member_of = self::getIdsByContactId($cid);
|
||||
}
|
||||
|
||||
$stmt = DBA::select('group', [], ['deleted' => false, 'uid' => local_user(), 'cid' => null], ['order' => ['name']]);
|
||||
$stmt = DBA::select('group', [], ['deleted' => false, 'uid' => Session::getLocalUser(), 'cid' => null], ['order' => ['name']]);
|
||||
while ($group = DBA::fetch($stmt)) {
|
||||
$selected = (($group_id == $group['id']) ? ' group-selected' : '');
|
||||
|
||||
|
|
|
@ -1066,7 +1066,7 @@ class Item
|
|||
}
|
||||
|
||||
// We have to tell the hooks who we are - this really should be improved
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
$_SESSION['authenticated'] = true;
|
||||
$_SESSION['uid'] = $uid;
|
||||
$dummy_session = true;
|
||||
|
@ -2775,7 +2775,7 @@ class Item
|
|||
*/
|
||||
public static function getPermissionsConditionArrayByUserId(int $owner_id): array
|
||||
{
|
||||
$local_user = local_user();
|
||||
$local_user = Session::getLocalUser();
|
||||
$remote_user = Session::getRemoteContactID($owner_id);
|
||||
|
||||
// default permissions - anonymous user
|
||||
|
@ -2807,7 +2807,7 @@ class Item
|
|||
*/
|
||||
public static function getPermissionsSQLByUserId(int $owner_id, string $table = ''): string
|
||||
{
|
||||
$local_user = local_user();
|
||||
$local_user = Session::getLocalUser();
|
||||
$remote_user = Session::getRemoteContactID($owner_id);
|
||||
|
||||
if (!empty($table)) {
|
||||
|
@ -3006,8 +3006,8 @@ class Item
|
|||
|
||||
// Compile eventual content filter reasons
|
||||
$filter_reasons = [];
|
||||
if (!$is_preview && public_contact() != $item['author-id']) {
|
||||
if (!empty($item['content-warning']) && (!local_user() || !DI::pConfig()->get(local_user(), 'system', 'disable_cw', false))) {
|
||||
if (!$is_preview && Session::getPublicContact() != $item['author-id']) {
|
||||
if (!empty($item['content-warning']) && (!Session::getLocalUser() || !DI::pConfig()->get(Session::getLocalUser(), 'system', 'disable_cw', false))) {
|
||||
$filter_reasons[] = DI::l10n()->t('Content warning: %s', $item['content-warning']);
|
||||
}
|
||||
|
||||
|
@ -3443,7 +3443,7 @@ class Item
|
|||
$plink = $item['uri'];
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
if (Session::getLocalUser()) {
|
||||
$ret = [
|
||||
'href' => "display/" . $item['guid'],
|
||||
'orig' => "display/" . $item['guid'],
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -137,12 +138,12 @@ class Mail
|
|||
$subject = DI::l10n()->t('[no subject]');
|
||||
}
|
||||
|
||||
$me = DBA::selectFirst('contact', [], ['uid' => local_user(), 'self' => true]);
|
||||
$me = DBA::selectFirst('contact', [], ['uid' => Session::getLocalUser(), 'self' => true]);
|
||||
if (!DBA::isResult($me)) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
$contacts = ACL::getValidMessageRecipientsForUser(local_user());
|
||||
$contacts = ACL::getValidMessageRecipientsForUser(Session::getLocalUser());
|
||||
|
||||
$contactIndex = array_search($recipient, array_column($contacts, 'id'));
|
||||
if ($contactIndex === false) {
|
||||
|
@ -151,7 +152,7 @@ class Mail
|
|||
|
||||
$contact = $contacts[$contactIndex];
|
||||
|
||||
Photo::setPermissionFromBody($body, local_user(), $me['id'], '<' . $contact['id'] . '>', '', '', '');
|
||||
Photo::setPermissionFromBody($body, Session::getLocalUser(), $me['id'], '<' . $contact['id'] . '>', '', '', '');
|
||||
|
||||
$guid = System::createUUID();
|
||||
$uri = Item::newURI($guid);
|
||||
|
@ -164,7 +165,7 @@ class Mail
|
|||
if (strlen($replyto)) {
|
||||
$reply = true;
|
||||
$condition = ["`uid` = ? AND (`uri` = ? OR `parent-uri` = ?)",
|
||||
local_user(), $replyto, $replyto];
|
||||
Session::getLocalUser(), $replyto, $replyto];
|
||||
$mail = DBA::selectFirst('mail', ['convid'], $condition);
|
||||
if (DBA::isResult($mail)) {
|
||||
$convid = $mail['convid'];
|
||||
|
@ -177,7 +178,7 @@ class Mail
|
|||
$conv_guid = System::createUUID();
|
||||
$convuri = $contact['addr'] . ':' . $conv_guid;
|
||||
|
||||
$fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $me['addr'],
|
||||
$fields = ['uid' => Session::getLocalUser(), 'guid' => $conv_guid, 'creator' => $me['addr'],
|
||||
'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(),
|
||||
'subject' => $subject, 'recips' => $contact['addr'] . ';' . $me['addr']];
|
||||
if (DBA::insert('conv', $fields)) {
|
||||
|
@ -196,7 +197,7 @@ class Mail
|
|||
|
||||
$post_id = self::insert(
|
||||
[
|
||||
'uid' => local_user(),
|
||||
'uid' => Session::getLocalUser(),
|
||||
'guid' => $guid,
|
||||
'convid' => $convid,
|
||||
'from-name' => $me['name'],
|
||||
|
@ -232,7 +233,7 @@ class Mail
|
|||
foreach ($images as $image) {
|
||||
$image_rid = Photo::ridFromURI($image);
|
||||
if (!empty($image_rid)) {
|
||||
Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_rid, 'album' => 'Wall Photos', 'uid' => local_user()]);
|
||||
Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_rid, 'album' => 'Wall Photos', 'uid' => Session::getLocalUser()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Core\Cache\Enum\Duration;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Core\Storage\Type\ExternalResource;
|
||||
use Friendica\Core\Storage\Exception\InvalidClassStorageException;
|
||||
|
@ -639,10 +639,10 @@ class Photo
|
|||
{
|
||||
$sql_extra = Security::getPermissionsSQLByUserId($uid);
|
||||
|
||||
$avatar_type = (local_user() && (local_user() == $uid)) ? self::USER_AVATAR : self::DEFAULT;
|
||||
$banner_type = (local_user() && (local_user() == $uid)) ? self::USER_BANNER : self::DEFAULT;
|
||||
$avatar_type = (Session::getLocalUser() && (Session::getLocalUser() == $uid)) ? self::USER_AVATAR : self::DEFAULT;
|
||||
$banner_type = (Session::getLocalUser() && (Session::getLocalUser() == $uid)) ? self::USER_BANNER : self::DEFAULT;
|
||||
|
||||
$key = 'photo_albums:' . $uid . ':' . local_user() . ':' . remote_user();
|
||||
$key = 'photo_albums:' . $uid . ':' . Session::getLocalUser() . ':' . Session::getRemoteUser();
|
||||
$albums = DI::cache()->get($key);
|
||||
|
||||
if (is_null($albums) || $update) {
|
||||
|
@ -681,7 +681,7 @@ class Photo
|
|||
*/
|
||||
public static function clearAlbumCache(int $uid)
|
||||
{
|
||||
$key = 'photo_albums:' . $uid . ':' . local_user() . ':' . remote_user();
|
||||
$key = 'photo_albums:' . $uid . ':' . Session::getLocalUser() . ':' . Session::getRemoteUser();
|
||||
DI::cache()->set($key, null, Duration::DAY);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Model;
|
|||
|
||||
use BadMethodCallException;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -508,7 +509,7 @@ class Post
|
|||
{
|
||||
$affected = 0;
|
||||
|
||||
Logger::info('Start Update', ['fields' => $fields, 'condition' => $condition, 'uid' => local_user(),'callstack' => System::callstack(10)]);
|
||||
Logger::info('Start Update', ['fields' => $fields, 'condition' => $condition, 'uid' => Session::getLocalUser(),'callstack' => System::callstack(10)]);
|
||||
|
||||
// Don't allow changes to fields that are responsible for the relation between the records
|
||||
unset($fields['id']);
|
||||
|
|
|
@ -239,7 +239,7 @@ class Profile
|
|||
|
||||
DI::page()['title'] = $profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
|
||||
|
||||
if (!local_user()) {
|
||||
if (!Session::getLocalUser()) {
|
||||
$a->setCurrentTheme($profile['theme']);
|
||||
$a->setCurrentMobileTheme(DI::pConfig()->get($a->getProfileOwner(), 'system', 'mobile_theme') ?? '');
|
||||
}
|
||||
|
@ -295,8 +295,8 @@ class Profile
|
|||
|
||||
$profile_contact = [];
|
||||
|
||||
if (local_user() && ($profile['uid'] ?? 0) != local_user()) {
|
||||
$profile_contact = Contact::getByURL($profile['nurl'], null, [], local_user());
|
||||
if (Session::getLocalUser() && ($profile['uid'] ?? 0) != Session::getLocalUser()) {
|
||||
$profile_contact = Contact::getByURL($profile['nurl'], null, [], Session::getLocalUser());
|
||||
}
|
||||
if (!empty($profile['cid']) && self::getMyURL()) {
|
||||
$profile_contact = Contact::selectFirst([], ['id' => $profile['cid']]);
|
||||
|
@ -413,7 +413,7 @@ class Profile
|
|||
}
|
||||
|
||||
if (!$block && $show_contacts) {
|
||||
$contact_block = ContactBlock::getHTML($profile, local_user());
|
||||
$contact_block = ContactBlock::getHTML($profile, Session::getLocalUser());
|
||||
|
||||
if (is_array($profile) && !$profile['hide-friends']) {
|
||||
$contact_count = DBA::count('contact', [
|
||||
|
@ -493,7 +493,7 @@ class Profile
|
|||
*/
|
||||
public static function getBirthdays(): string
|
||||
{
|
||||
if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
|
||||
if (!Session::getLocalUser() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ class Profile
|
|||
|
||||
$bd_short = DI::l10n()->t('F d');
|
||||
|
||||
$cacheKey = 'get_birthdays:' . local_user();
|
||||
$cacheKey = 'get_birthdays:' . Session::getLocalUser();
|
||||
$events = DI::cache()->get($cacheKey);
|
||||
if (is_null($events)) {
|
||||
$result = DBA::p(
|
||||
|
@ -523,7 +523,7 @@ class Profile
|
|||
ORDER BY `start`",
|
||||
Contact::SHARING,
|
||||
Contact::FRIEND,
|
||||
local_user(),
|
||||
Session::getLocalUser(),
|
||||
DateTimeFormat::utc('now + 6 days'),
|
||||
DateTimeFormat::utcNow()
|
||||
);
|
||||
|
@ -595,7 +595,7 @@ class Profile
|
|||
$a = DI::app();
|
||||
$o = '';
|
||||
|
||||
if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
|
||||
if (!Session::getLocalUser() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ class Profile
|
|||
$classtoday = '';
|
||||
|
||||
$condition = ["`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?",
|
||||
local_user(), DateTimeFormat::utc('now + 7 days'), DateTimeFormat::utc('now - 1 days')];
|
||||
Session::getLocalUser(), DateTimeFormat::utc('now + 7 days'), DateTimeFormat::utc('now - 1 days')];
|
||||
$s = DBA::select('event', [], $condition, ['order' => ['start']]);
|
||||
|
||||
$r = [];
|
||||
|
@ -620,7 +620,7 @@ class Profile
|
|||
$total = 0;
|
||||
|
||||
while ($rr = DBA::fetch($s)) {
|
||||
$condition = ['parent-uri' => $rr['uri'], 'uid' => $rr['uid'], 'author-id' => public_contact(),
|
||||
$condition = ['parent-uri' => $rr['uri'], 'uid' => $rr['uid'], 'author-id' => Session::getPublicContact(),
|
||||
'vid' => [Verb::getID(Activity::ATTEND), Verb::getID(Activity::ATTENDMAYBE)],
|
||||
'visible' => true, 'deleted' => false];
|
||||
if (!Post::exists($condition)) {
|
||||
|
@ -712,7 +712,7 @@ class Profile
|
|||
$my_url = self::getMyURL();
|
||||
$my_url = Network::isUrlValid($my_url);
|
||||
|
||||
if (empty($my_url) || local_user()) {
|
||||
if (empty($my_url) || Session::getLocalUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -730,7 +730,7 @@ class Profile
|
|||
|
||||
$contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
|
||||
|
||||
if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
|
||||
if (DBA::isResult($contact) && Session::getRemoteUser() && Session::getRemoteUser() == $contact['id']) {
|
||||
Logger::info('The visitor ' . $my_url . ' is already authenticated');
|
||||
return;
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ class Profile
|
|||
*/
|
||||
public static function getThemeUid(App $a): int
|
||||
{
|
||||
return local_user() ?: $a->getProfileOwner();
|
||||
return Session::getLocalUser() ?: $a->getProfileOwner();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user