X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget.php;h=93dc5b71759eeb62daa065aafc9fa4e47e6a377f;hb=739b6d6533fb54b1d7e6a641242c0103d73c487e;hp=fba027680c7f84f169edf330464273446438413e;hpb=8b7cb5d9efeab580c2592e0fbe301f7142b73a3d;p=friendica.git
diff --git a/src/Content/Widget.php b/src/Content/Widget.php
index fba027680c..93dc5b7175 100644
--- a/src/Content/Widget.php
+++ b/src/Content/Widget.php
@@ -1,6 +1,6 @@
get('system', 'invitation_only')) {
- $x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
+ $x = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'invites_remaining'));
if ($x || DI::app()->isSiteAdmin()) {
DI::page()['aside'] .= '
'
. DI::l10n()->tt('%d invitation available', '%d invitations available', $x)
@@ -120,6 +120,10 @@ class Widget
$networks[] = Protocol::TWITTER;
}
+ if (!Addon::isEnabled("tumblr")) {
+ $networks[] = Protocol::TUMBLR;
+ }
+
if (DI::config()->get("system", "ostatus_disabled")) {
$networks[] = Protocol::OSTATUS;
}
@@ -195,7 +199,7 @@ class Widget
*/
public static function groups(string $baseurl, string $selected = ''): string
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return '';
}
@@ -204,7 +208,7 @@ class Widget
'ref' => $group['id'],
'name' => $group['name']
];
- }, Group::getByUserId(local_user()));
+ }, Group::getByUserId(DI::userSession()->getLocalUserId()));
return self::filter(
'group',
@@ -227,7 +231,7 @@ class Widget
*/
public static function contactRels(string $baseurl, string $selected = ''): string
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return '';
}
@@ -258,17 +262,17 @@ class Widget
*/
public static function networks(string $baseurl, string $selected = ''): string
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
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([DI::userSession()->getLocalUserId()], $networks));
$r = DBA::select('contact', ['network'], $condition, ['group_by' => ['network'], 'order' => ['network']]);
- $nets = array();
+ $nets = [];
while ($rr = DBA::fetch($r)) {
$nets[] = ['ref' => $rr['network'], 'name' => ContactSelector::networkToName($rr['network'])];
}
@@ -299,12 +303,12 @@ class Widget
*/
public static function fileAs(string $baseurl, string $selected = ''): string
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return '';
}
$terms = [];
- foreach (Post\Category::getArray(local_user(), Post\Category::FILE) as $savedFolderName) {
+ foreach (Post\Category::getArray(DI::userSession()->getLocalUserId(), Post\Category::FILE) as $savedFolderName) {
$terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName];
}
@@ -334,7 +338,7 @@ class Widget
return '';
}
- $terms = array();
+ $terms = [];
foreach (Post\Category::getArray($uid, Post\Category::CATEGORY) as $savedFolderName) {
$terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName];
}
@@ -361,11 +365,11 @@ class Widget
*/
public static function commonFriendsVisitor(int $uid, string $nickname): string
{
- if (local_user() == $uid) {
+ if (DI::userSession()->getLocalUserId() == $uid) {
return '';
}
- $visitorPCid = local_user() ? Contact::getPublicIdByUserId(local_user()) : remote_user();
+ $visitorPCid = DI::userSession()->getPublicContactId() ?: DI::userSession()->getRemoteUserId();
if (!$visitorPCid) {
return '';
}