namespace Friendica\Module\Admin;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Register;
$user['login_date'] = Temporal::getRelativeDate($user['login_date']);
$user['lastitem_date'] = Temporal::getRelativeDate($user['last-item']);
$user['is_admin'] = in_array($user['email'], $adminlist);
- $user['is_deletable'] = !$user['account_removed'] && intval($user['uid']) != local_user();
+ $user['is_deletable'] = !$user['account_removed'] && intval($user['uid']) != Session::getLocalUser();
$user['deleted'] = ($user['account_removed'] ? Temporal::getRelativeDate($user['account_expires_on']) : False);
return $user;
use Friendica\Content\Widget;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
+use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\Model;
use Friendica\Module\Contact;
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return Login::form($_SERVER['REQUEST_URI']);
}
// Backward compatibility: Ensure to use the public contact when the user contact is provided
// Remove by version 2022.03
- $data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), local_user());
+ $data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), Session::getLocalUser());
if (empty($data)) {
throw new NotFoundException($this->t('Contact not found.'));
}
throw new NotFoundException($this->t('Contact not found.'));
}
- $localRelationship = $this->localRelationship->getForUserContact(local_user(), $contact['id']);
+ $localRelationship = $this->localRelationship->getForUserContact(Session::getLocalUser(), $contact['id']);
if ($localRelationship->rel === Model\Contact::SELF) {
$this->baseUrl->redirect('profile/' . $contact['nick']);
}
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
protected function post(array $request = [])
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return;
}
// Backward compatibility: The update still needs a user-specific contact ID
// Change to user-contact table check by version 2022.03
- $cdata = Contact::getPublicAndUserContactID($contact_id, local_user());
+ $cdata = Contact::getPublicAndUserContactID($contact_id, Session::getLocalUser());
if (empty($cdata['user']) || !DBA::exists('contact', ['id' => $cdata['user'], 'deleted' => false])) {
return;
}
$fields['info'] = $_POST['info'];
}
- if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => local_user()])) {
+ if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => Session::getLocalUser()])) {
DI::sysmsg()->addNotice($this->t('Failed to update contact record.'));
}
}
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return Module\Security\Login::form($_SERVER['REQUEST_URI']);
}
// Backward compatibility: Ensure to use the public contact when the user contact is provided
// Remove by version 2022.03
- $data = Contact::getPublicAndUserContactID(intval($this->parameters['id']), local_user());
+ $data = Contact::getPublicAndUserContactID(intval($this->parameters['id']), Session::getLocalUser());
if (empty($data)) {
throw new HTTPException\NotFoundException($this->t('Contact not found.'));
}
throw new HTTPException\NotFoundException($this->t('Contact not found.'));
}
- $localRelationship = $this->localRelationship->getForUserContact(local_user(), $contact['id']);
+ $localRelationship = $this->localRelationship->getForUserContact(Session::getLocalUser(), $contact['id']);
if ($localRelationship->rel === Contact::SELF) {
$this->baseUrl->redirect('profile/' . $contact['nick'] . '/profile');
if ($cmd === 'block') {
if ($localRelationship->blocked) {
// @TODO Backward compatibility, replace with $localRelationship->unblock()
- Contact\User::setBlocked($contact['id'], local_user(), false);
+ Contact\User::setBlocked($contact['id'], Session::getLocalUser(), false);
$message = $this->t('Contact has been unblocked');
} else {
// @TODO Backward compatibility, replace with $localRelationship->block()
- Contact\User::setBlocked($contact['id'], local_user(), true);
+ Contact\User::setBlocked($contact['id'], Session::getLocalUser(), true);
$message = $this->t('Contact has been blocked');
}
if ($cmd === 'ignore') {
if ($localRelationship->ignored) {
// @TODO Backward compatibility, replace with $localRelationship->unblock()
- Contact\User::setIgnored($contact['id'], local_user(), false);
+ Contact\User::setIgnored($contact['id'], Session::getLocalUser(), false);
$message = $this->t('Contact has been unignored');
} else {
// @TODO Backward compatibility, replace with $localRelationship->block()
- Contact\User::setIgnored($contact['id'], local_user(), true);
+ Contact\User::setIgnored($contact['id'], Session::getLocalUser(), true);
$message = $this->t('Contact has been ignored');
}
'$baseurl' => $this->baseUrl->get(true),
]);
- $contact['blocked'] = Contact\User::isBlocked($contact['id'], local_user());
- $contact['readonly'] = Contact\User::isIgnored($contact['id'], local_user());
+ $contact['blocked'] = Contact\User::isBlocked($contact['id'], Session::getLocalUser());
+ $contact['readonly'] = Contact\User::isIgnored($contact['id'], Session::getLocalUser());
switch ($localRelationship->rel) {
case Contact::FRIEND: $relation_text = $this->t('You are mutual friends with %s', $contact['name']); break;
*/
private static function updateContactFromProbe(int $contact_id)
{
- $contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => [0, local_user()], 'deleted' => false]);
+ $contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => [0, Session::getLocalUser()], 'deleted' => false]);
if (!DBA::isResult($contact)) {
return;
}
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Model;
$this->dba = $dba;
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return;
}
- $data = Model\Contact::getPublicAndUserContactID($this->parameters['id'], local_user());
+ $data = Model\Contact::getPublicAndUserContactID($this->parameters['id'], Session::getLocalUser());
if (!$this->dba->isResult($data)) {
throw new HTTPException\NotFoundException($this->t('Unknown contact.'));
}
protected function post(array $request = [])
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new HTTPException\UnauthorizedException();
}
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return Login::form($_SERVER['REQUEST_URI']);
}
'$global_community_hint' => DI::l10n()->t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
]);
- 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()]);
}
DI::page()['aside'] .= Widget::accountTypes('community/' . self::$content, self::$accountTypeString);
- if (local_user() && DI::config()->get('system', 'community_no_sharer')) {
+ if (Session::getLocalUser() && DI::config()->get('system', 'community_no_sharer')) {
$path = self::$content;
if (!empty($this->parameters['accounttype'])) {
$path .= '/' . $this->parameters['accounttype'];
]);
}
- if (Feature::isEnabled(local_user(), 'trending_tags')) {
+ if (Feature::isEnabled(Session::getLocalUser(), 'trending_tags')) {
DI::page()['aside'] .= TrendingTags::getHTML(self::$content);
}
return $o;
}
- $o .= DI::conversation()->create($items, 'community', false, false, 'commented', local_user());
+ $o .= DI::conversation()->create($items, 'community', false, false, 'commented', Session::getLocalUser());
$pager = new BoundariesPager(
DI::l10n(),
self::$itemsPerPage
);
- 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));
}
if (DI::mode()->isMobile()) {
- self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
+ self::$itemsPerPage = DI::pConfig()->get(Session::getLocalUser(), 'system', 'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile'));
} else {
- self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
+ self::$itemsPerPage = DI::pConfig()->get(Session::getLocalUser(), 'system', 'itemspage_network',
DI::config()->get('system', 'itemspage_network'));
}
$condition[0] .= " AND `id` = ?";
$condition[] = $item_id;
} else {
- if (local_user() && !empty($_REQUEST['no_sharer'])) {
+ if (Session::getLocalUser() && !empty($_REQUEST['no_sharer'])) {
$condition[0] .= " AND NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ?)";
- $condition[] = local_user();
+ $condition[] = Session::getLocalUser();
}
if (isset($max_id)) {
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return Login::form();
}
DI::page()['aside'] .= Widget::accountTypes($module, self::$accountTypeString);
DI::page()['aside'] .= Group::sidebarWidget($module, $module . '/group', 'standard', self::$groupId);
- DI::page()['aside'] .= ForumManager::widget($module . '/forum', local_user(), self::$forumContactId);
- DI::page()['aside'] .= Widget::postedByYear($module . '/archive', local_user(), false);
+ DI::page()['aside'] .= ForumManager::widget($module . '/forum', Session::getLocalUser(), self::$forumContactId);
+ DI::page()['aside'] .= Widget::postedByYear($module . '/archive', Session::getLocalUser(), false);
DI::page()['aside'] .= Widget::networks($module, !self::$forumContactId ? self::$network : '');
DI::page()['aside'] .= Widget\SavedSearches::getHTML(DI::args()->getQueryString());
DI::page()['aside'] .= Widget::fileAs('filed', '');
$items = self::getItems($table, $params);
- if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll') && ($_GET['mode'] ?? '') != 'minimal') {
+ if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'infinite_scroll') && ($_GET['mode'] ?? '') != 'minimal') {
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
$o .= Renderer::replaceMacros($tpl, ['$reload_uri' => DI::args()->getQueryString()]);
}
$allowedCids[] = (int) self::$forumContactId;
} elseif (self::$network) {
$condition = [
- 'uid' => local_user(),
+ 'uid' => Session::getLocalUser(),
'network' => self::$network,
'self' => false,
'blocked' => false,
}
if (self::$groupId) {
- $group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => local_user()]);
+ $group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => Session::getLocalUser()]);
if (!DBA::isResult($group)) {
DI::sysmsg()->addNotice(DI::l10n()->t('No such group'));
}
$ordering = '`commented`';
}
- $o .= DI::conversation()->create($items, 'network', false, false, $ordering, local_user());
+ $o .= DI::conversation()->create($items, 'network', false, false, $ordering, Session::getLocalUser());
- if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
+ if (DI::pConfig()->get(Session::getLocalUser(), 'system', 'infinite_scroll')) {
$o .= HTML::scrollLoader();
} else {
$pager = new BoundariesPager(
self::$forumContactId = $this->parameters['contact_id'] ?? 0;
- self::$selectedTab = DI::session()->get('network-tab', DI::pConfig()->get(local_user(), 'network.view', 'selected_tab', ''));
+ self::$selectedTab = DI::session()->get('network-tab', DI::pConfig()->get(Session::getLocalUser(), 'network.view', 'selected_tab', ''));
if (!empty($get['star'])) {
self::$selectedTab = 'star';
}
DI::session()->set('network-tab', self::$selectedTab);
- DI::pConfig()->set(local_user(), 'network.view', 'selected_tab', self::$selectedTab);
+ DI::pConfig()->set(Session::getLocalUser(), 'network.view', 'selected_tab', self::$selectedTab);
self::$accountTypeString = $get['accounttype'] ?? $this->parameters['accounttype'] ?? '';
self::$accountType = User::getAccountTypeByString(self::$accountTypeString);
self::$dateTo = $this->parameters['to'] ?? '';
if (DI::mode()->isMobile()) {
- self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
+ self::$itemsPerPage = DI::pConfig()->get(Session::getLocalUser(), 'system', 'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile'));
} else {
- self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
+ self::$itemsPerPage = DI::pConfig()->get(Session::getLocalUser(), 'system', 'itemspage_network',
DI::config()->get('system', 'itemspage_network'));
}
protected static function getItems(string $table, array $params, array $conditionFields = [])
{
- $conditionFields['uid'] = local_user();
+ $conditionFields['uid'] = Session::getLocalUser();
$conditionStrings = [];
if (!is_null(self::$accountType)) {
} elseif (self::$forumContactId) {
$conditionStrings = DBA::mergeConditions($conditionStrings,
["((`contact-id` = ?) OR `uri-id` IN (SELECT `parent-uri-id` FROM `post-user-view` WHERE (`contact-id` = ? AND `gravity` = ? AND `vid` = ? AND `uid` = ?)))",
- self::$forumContactId, self::$forumContactId, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), local_user()]);
+ self::$forumContactId, self::$forumContactId, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Session::getLocalUser()]);
}
// Currently only the order modes "received" and "commented" are in use
// level which items you've seen and which you haven't. If you're looking
// at the top level network page just mark everything seen.
if (!self::$groupId && !self::$forumContactId && !self::$star && !self::$mention) {
- $condition = ['unseen' => true, 'uid' => local_user()];
+ $condition = ['unseen' => true, 'uid' => Session::getLocalUser()];
self::setItemsSeenByCondition($condition);
} elseif (!empty($parents)) {
- $condition = ['unseen' => true, 'uid' => local_user(), 'parent-uri-id' => $parents];
+ $condition = ['unseen' => true, 'uid' => Session::getLocalUser(), 'parent-uri-id' => $parents];
self::setItemsSeenByCondition($condition);
}
use Friendica\BaseModule;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Protocol\ActivityPub;
use Friendica\Util\JsonLD;
try {
$source = json_decode($_REQUEST['source'], true);
$trust_source = true;
- $uid = local_user();
+ $uid = Session::getLocalUser();
$push = false;
if (!$source) {
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Model;
use Friendica\Module\Response;
$this->httpClient = $httpClient;
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
DI::sysmsg()->addNotice($this->t('You must be logged in to use this module'));
$baseUrl->redirect();
}
if (!empty($_REQUEST['url'])) {
$url = $_REQUEST['url'];
- $contact = Model\Contact::getByURLForUser($url, local_user(), null);
+ $contact = Model\Contact::getByURLForUser($url, Session::getLocalUser(), null);
$xml = $this->httpClient->fetch($contact['poll'], HttpClientAccept::FEED_XML);
namespace Friendica\Module\Debug;
use Friendica\BaseModule;
+use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Post;
{
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.'));
}
$itemId = intval($this->parameters['item']);
- $item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]);
+ $item = Post::selectFirst(['body'], ['uid' => [0, Session::getLocalUser()], 'uri-id' => $itemId]);
if (!empty($item)) {
if (DI::mode()->isAjax()) {
use Friendica\BaseModule;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Network\HTTPException;
use Friendica\Network\Probe as NetworkProbe;
{
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
}
use Friendica\BaseModule;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Network\Probe;
{
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
}
namespace Friendica\Module\Events;
+use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
{
protected function rawContent(array $request = [])
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new HTTPException\UnauthorizedException();
}
// get events by id or by date
if ($event_params['event_id']) {
- $r = Event::getListById(local_user(), $event_params['event_id']);
+ $r = Event::getListById(Session::getLocalUser(), $event_params['event_id']);
} else {
- $r = Event::getListByDate(local_user(), $event_params);
+ $r = Event::getListByDate(Session::getLocalUser(), $event_params);
}
$links = [];
use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
+use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Post;
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new HTTPException\ForbiddenException();
}
return 404;
}
- if (!Post\Category::deleteFileByURIId($item['uri-id'], local_user(), $type, $term)) {
+ if (!Post\Category::deleteFileByURIId($item['uri-id'], Session::getLocalUser(), $type, $term)) {
$this->systemMessages->addNotice($this->l10n->t('Item was not removed'));
return 500;
}
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model;
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
DI::sysmsg()->addNotice($this->t('You must be logged in to use this module'));
$baseUrl->redirect();
}
if (!DBA::isResult($item)) {
throw new HTTPException\NotFoundException();
}
- Model\Post\Category::storeFileByURIId($item['uri-id'], local_user(), Model\Post\Category::FILE, $term);
+ Model\Post\Category::storeFileByURIId($item['uri-id'], Session::getLocalUser(), Model\Post\Category::FILE, $term);
}
// return filer dialog
- $filetags = Model\Post\Category::getArray(local_user(), Model\Post\Category::FILE);
+ $filetags = Model\Post\Category::getArray(Session::getLocalUser(), Model\Post\Category::FILE);
$tpl = Renderer::getMarkupTemplate("filer_dialog.tpl");
echo Renderer::replaceMacros($tpl, [
$itemId = $this->parameters['id'];
if (in_array($verb, ['announce', 'unannounce'])) {
- $item = Post::selectFirst(['network', 'uri-id'], ['id' => $itemId, 'uid' => [local_user(), 0]]);
+ $item = Post::selectFirst(['network', 'uri-id'], ['id' => $itemId, 'uid' => [Session::getLocalUser(), 0]]);
if ($item['network'] == Protocol::DIASPORA) {
- Diaspora::performReshare($item['uri-id'], local_user());
+ Diaspora::performReshare($item['uri-id'], Session::getLocalUser());
}
}
- if (!Item::performActivity($itemId, $verb, local_user())) {
+ if (!Item::performActivity($itemId, $verb, Session::getLocalUser())) {
throw new HTTPException\BadRequestException();
}
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
+use Friendica\Core\Session;
use Friendica\Core\Theme;
use Friendica\Database\DBA;
use Friendica\DI;
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
return Login::form('compose');
}
}
}
- $user = User::getById(local_user(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'default-location']);
+ $user = User::getById(Session::getLocalUser(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'default-location']);
$contact_allow_list = $this->ACLFormatter->expand($user['allow_cid']);
$group_allow_list = $this->ACLFormatter->expand($user['allow_gid']);
$contact = Contact::getById($a->getContactId());
- if ($this->pConfig->get(local_user(), 'system', 'set_creation_date')) {
+ if ($this->pConfig->get(Session::getLocalUser(), 'system', 'set_creation_date')) {
$created_at = Temporal::getDateTimeField(
new \DateTime(DBA::NULL_DATETIME),
new \DateTime('now'),
'location_disabled' => $this->l10n->t('Location services are disabled. Please check the website\'s permissions on your device'),
'wait' => $this->l10n->t('Please wait'),
'placeholdertitle' => $this->l10n->t('Set title'),
- 'placeholdercategory' => Feature::isEnabled(local_user(),'categories') ? $this->l10n->t('Categories (comma-separated list)') : '',
- 'always_open_compose' => $this->pConfig->get(local_user(), 'frio', 'always_open_compose',
+ 'placeholdercategory' => Feature::isEnabled(Session::getLocalUser(),'categories') ? $this->l10n->t('Categories (comma-separated list)') : '',
+ 'always_open_compose' => $this->pConfig->get(Session::getLocalUser(), 'frio', 'always_open_compose',
$this->config->get('frio', 'always_open_compose', false)) ? '' :
$this->l10n->t('You can make this page always open when you use the New Post button in the <a href="/settings/display">Theme Customization settings</a>.'),
],
$itemId = intval($this->parameters['id']);
- if (!Item::performActivity($itemId, 'follow', local_user())) {
+ if (!Item::performActivity($itemId, 'follow', Session::getLocalUser())) {
throw new HTTPException\BadRequestException($l10n->t('Unable to follow this item.'));
}
throw new HTTPException\NotFoundException();
}
- $ignored = !Post\ThreadUser::getIgnored($thread['uri-id'], local_user());
+ $ignored = !Post\ThreadUser::getIgnored($thread['uri-id'], Session::getLocalUser());
- if (in_array($thread['uid'], [0, local_user()])) {
- Post\ThreadUser::setIgnored($thread['uri-id'], local_user(), $ignored);
+ if (in_array($thread['uid'], [0, Session::getLocalUser()])) {
+ Post\ThreadUser::setIgnored($thread['uri-id'], Session::getLocalUser(), $ignored);
} else {
throw new HTTPException\BadRequestException();
}
throw new HTTPException\NotFoundException();
}
- if (!in_array($item['uid'], [0, local_user()])) {
+ if (!in_array($item['uid'], [0, Session::getLocalUser()])) {
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
$pinned = !$item['featured'];
if ($pinned) {
- Post\Collection::add($item['uri-id'], Post\Collection::FEATURED, $item['author-id'], local_user());
+ Post\Collection::add($item['uri-id'], Post\Collection::FEATURED, $item['author-id'], Session::getLocalUser());
} else {
- Post\Collection::remove($item['uri-id'], Post\Collection::FEATURED, local_user());
+ Post\Collection::remove($item['uri-id'], Post\Collection::FEATURED, Session::getLocalUser());
}
// See if we've been passed a return path to redirect to
$itemId = intval($this->parameters['id']);
- $item = Post::selectFirstForUser(local_user(), ['uid', 'uri-id', 'starred'], ['uid' => [0, local_user()], 'id' => $itemId]);
+ $item = Post::selectFirstForUser(Session::getLocalUser(), ['uid', 'uri-id', 'starred'], ['uid' => [0, Session::getLocalUser()], 'id' => $itemId]);
if (empty($item)) {
throw new HTTPException\NotFoundException();
}
if ($item['uid'] == 0) {
- $stored = Item::storeForUserByUriId($item['uri-id'], local_user(), ['post-reason' => Item::PR_ACTIVITY]);
+ $stored = Item::storeForUserByUriId($item['uri-id'], Session::getLocalUser(), ['post-reason' => Item::PR_ACTIVITY]);
if (!empty($stored)) {
$item = Post::selectFirst(['starred'], ['id' => $stored]);
if (!DBA::isResult($item)) {
use Friendica\Contact\Introduction\Repository\Introduction;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
+use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
*/
protected function post(array $request = [])
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new HTTPException\UnauthorizedException($this->l10n->t('Permission denied.'));
}
$request_id = $this->parameters['id'] ?? false;
if ($request_id) {
- $intro = $this->introductionRepo->selectOneById($request_id, local_user());
+ $intro = $this->introductionRepo->selectOneById($request_id, Session::getLocalUser());
switch ($_POST['submit']) {
case $this->l10n->t('Discard'):
*/
protected function rawContent(array $request = [])
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
throw new HTTPException\UnauthorizedException($this->l10n->t('Permission denied.'));
}
if ($this->args->get(1) === 'mark' && $this->args->get(2) === 'all') {
try {
- $this->notificationRepo->setAllSeenForUser(local_user());
- $success = $this->notifyRepo->setAllSeenForUser(local_user());
+ $this->notificationRepo->setAllSeenForUser(Session::getLocalUser());
+ $success = $this->notifyRepo->setAllSeenForUser(Session::getLocalUser());
} catch (\Exception $e) {
$this->logger->warning('set all seen failed.', ['exception' => $e]);
$success = false;
*/
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!Session::getLocalUser()) {
DI::sysmsg()->addNotice($this->l10n->t('You must be logged in to show this page.'));
return Login::form();
}
private function handleNotify(int $notifyId)
{
$Notify = $this->notifyRepo->selectOneById($notifyId);
- if ($Notify->uid !== local_user()) {
+ if ($Notify->uid !== Session::getLocalUser()) {
throw new HTTPException\ForbiddenException();
}
- if ($this->pconfig->get(local_user(), 'system', 'detailed_notif')) {
+ if ($this->pconfig->get(Session::getLocalUser(), 'system', 'detailed_notif')) {
$Notify->setSeen();
$this->notifyRepo->save($Notify);
} else {
private function handleNotification(int $notificationId)
{
$Notification = $this->notificationRepo->selectOneById($notificationId);
- if ($Notification->uid !== local_user()) {
+ if ($Notification->uid !== Session::getLocalUser()) {
throw new HTTPException\ForbiddenException();
}
- if ($this->pconfig->get(local_user(), 'system', 'detailed_notif')) {
+ if ($this->pconfig->get(Session::getLocalUser(), 'system', 'detailed_notif')) {
$Notification->setSeen();
$this->notificationRepo->save($Notification);
} else {