diff --git a/boot.php b/boot.php
index b3b560a09..ecf59eb2f 100644
--- a/boot.php
+++ b/boot.php
@@ -297,13 +297,11 @@ function notice($s)
return;
}
- $a = DI::app();
if (empty($_SESSION['sysmsg'])) {
$_SESSION['sysmsg'] = [];
}
- if ($a->interactive) {
- $_SESSION['sysmsg'][] = $s;
- }
+
+ $_SESSION['sysmsg'][] = $s;
}
/**
@@ -315,14 +313,15 @@ function notice($s)
*/
function info($s)
{
- $a = DI::app();
+ if (empty($_SESSION)) {
+ return;
+ }
if (empty($_SESSION['sysmsg_info'])) {
$_SESSION['sysmsg_info'] = [];
}
- if ($a->interactive) {
- $_SESSION['sysmsg_info'][] = $s;
- }
+
+ $_SESSION['sysmsg_info'][] = $s;
}
function feed_birthday($uid, $tz)
diff --git a/include/conversation.php b/include/conversation.php
index c46aeff99..6cb6a78e6 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -599,7 +599,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'$remove' => DI::l10n()->t('remove'),
'$mode' => $mode,
'$update' => $update,
- '$user' => $a->user,
'$threads' => $threads,
'$dropping' => ($page_dropping ? DI::l10n()->t('Delete Selected Items') : False),
]);
@@ -1134,7 +1133,6 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
'$preview' => DI::l10n()->t('Preview'),
'$jotplugins' => $jotplugins,
'$notes_cid' => $notes_cid,
- '$sourceapp' => DI::l10n()->t($a->sourcename),
'$cancel' => DI::l10n()->t('Cancel'),
'$rand_num' => Crypto::randomDigits(12),
diff --git a/mod/cal.php b/mod/cal.php
index e1cf91aa6..d4830842b 100644
--- a/mod/cal.php
+++ b/mod/cal.php
@@ -25,13 +25,11 @@
use Friendica\App;
use Friendica\Content\Nav;
-use Friendica\Content\Text\BBCode;
use Friendica\Content\Widget;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model\Contact;
use Friendica\Model\Event;
use Friendica\Model\Item;
use Friendica\Model\User;
@@ -52,52 +50,34 @@ function cal_init(App $a)
Nav::setSelected('events');
- $nick = $a->argv[1];
- $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
- if (!DBA::isResult($user)) {
- throw new HTTPException\NotFoundException();
- }
-
- $a->data['user'] = $user;
- $a->profile_uid = $user['uid'];
-
// if it's a json request abort here becaus we don't
// need the widget data
if (!empty($a->argv[2]) && ($a->argv[2] === 'json')) {
return;
}
- $a->profile = User::getOwnerDataByNick($nick);
- if (empty($a->profile)) {
+ $owner = User::getOwnerDataByNick($a->argv[1]);
+ if (empty($owner)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
- $account_type = Contact::getAccountType($a->profile);
-
- $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl');
-
- $vcard_widget = Renderer::replaceMacros($tpl, [
- '$name' => $a->profile['name'],
- '$photo' => $a->profile['photo'],
- '$addr' => $a->profile['addr'] ?: '',
- '$account_type' => $account_type,
- '$about' => BBCode::convert($a->profile['about']),
- ]);
-
- $cal_widget = Widget\CalendarExport::getHTML($user['uid']);
-
if (empty(DI::page()['aside'])) {
DI::page()['aside'] = '';
}
- DI::page()['aside'] .= $vcard_widget;
- DI::page()['aside'] .= $cal_widget;
+ DI::page()['aside'] .= Widget\VCard::getHTML($owner);
+ DI::page()['aside'] .= Widget\CalendarExport::getHTML($owner['uid']);
return;
}
function cal_content(App $a)
{
+ $owner = User::getOwnerDataByNick($a->argv[1]);
+ if (empty($owner)) {
+ throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
+ }
+
Nav::setSelected('events');
// get the translation strings for the callendar
@@ -110,7 +90,7 @@ function cal_content(App $a)
$htpl = Renderer::getMarkupTemplate('event_head.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
- '$module_url' => '/cal/' . $a->data['user']['nickname'],
+ '$module_url' => '/cal/' . $owner['nickname'],
'$modparams' => 2,
'$i18n' => $i18n,
]);
@@ -127,19 +107,16 @@ function cal_content(App $a)
}
// Setup permissions structures
- $owner_uid = intval($a->data['user']['uid']);
- $nick = $a->data['user']['nickname'];
- if (empty($a->profile)) {
- throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
- }
+ $owner_uid = intval($owner['uid']);
+ $nick = $owner['nickname'];
- $contact_id = Session::getRemoteContactID($a->profile['uid']);
+ $contact_id = Session::getRemoteContactID($owner['uid']);
- $remote_contact = $contact_id && DBA::exists('contact', ['id' => $contact_id, 'uid' => $a->profile['uid']]);
+ $remote_contact = $contact_id && DBA::exists('contact', ['id' => $contact_id, 'uid' => $owner['uid']]);
- $is_owner = local_user() == $a->profile['uid'];
+ $is_owner = local_user() == $owner['uid'];
- if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) {
+ if ($owner['hidewall'] && !$is_owner && !$remote_contact) {
notice(DI::l10n()->t('Access to this profile has been restricted.'));
return;
}
@@ -150,7 +127,7 @@ function cal_content(App $a)
$sql_extra = " AND `event`.`cid` = 0 " . $sql_perms;
// get the tab navigation bar
- $tabs = BaseProfile::getTabsHTML($a, 'cal', false, $a->data['user']['nickname']);
+ $tabs = BaseProfile::getTabsHTML($a, 'cal', false, $owner);
// The view mode part is similiar to /mod/events.php
if ($mode == 'view') {
diff --git a/mod/display.php b/mod/display.php
index b51768e80..c0e72837a 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -32,6 +32,7 @@ use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Post;
+use Friendica\Model\User;
use Friendica\Module\ActivityPub\Objects;
use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub;
@@ -53,17 +54,17 @@ function display_init(App $a)
$item = null;
$item_user = local_user();
- $fields = ['uri-id', 'parent-uri-id', 'author-id', 'body', 'uid', 'guid', 'gravity'];
+ $fields = ['uri-id', 'parent-uri-id', 'author-id', 'author-link', 'body', 'uid', 'guid', 'gravity'];
// If there is only one parameter, then check if this parameter could be a guid
if ($a->argc == 2) {
- $nick = "";
+ $nick = '';
// Does the local user have this item?
if (local_user()) {
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => $a->argv[1], 'uid' => local_user()]);
if (DBA::isResult($item)) {
- $nick = $a->user["nickname"];
+ $nick = $a->user['nickname'];
}
}
@@ -109,41 +110,29 @@ function display_init(App $a)
$item = $parent ?: $item;
}
- $profiledata = display_fetchauthor($a, $item);
-
- if (strstr(Strings::normaliseLink($profiledata['url']), Strings::normaliseLink(DI::baseUrl()))) {
- $nickname = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/profile/', '', Strings::normaliseLink($profiledata['url']));
-
- if (!empty($a->user['nickname']) && $nickname != $a->user['nickname']) {
- $profile = DBA::selectFirst('owner-view', [], ['nickname' => $nickname]);
- if (DBA::isResult($profile)) {
- $profiledata = $profile;
- }
- $profiledata["network"] = Protocol::DFRN;
- } else {
- $profiledata = [];
- }
- }
+ $profiledata = display_fetchauthor($item);
DI::page()['aside'] = Widget\VCard::getHTML($profiledata);
}
-function display_fetchauthor($a, $item)
+function display_fetchauthor($item)
{
- $author = DBA::selectFirst('contact', ['name', 'nick', 'photo', 'network', 'url'], ['id' => $item['author-id']]);
-
- $profiledata = [];
- $profiledata['uid'] = -1;
- $profiledata['nickname'] = $author['nick'];
- $profiledata['name'] = $author['name'];
- $profiledata['picdate'] = '';
- $profiledata['photo'] = $author['photo'];
- $profiledata['url'] = $author['url'];
- $profiledata['network'] = $author['network'];
+ $profiledata = Contact::getByURLForUser($item['author-link'], local_user());
// Check for a repeated message
$shared = Item::getShareArray($item);
if (!empty($shared) && empty($shared['comment'])) {
+ $profiledata = [
+ 'uid' => -1,
+ 'id' => -1,
+ 'nickname' => '',
+ 'name' => '',
+ 'picdate' => '',
+ 'photo' => '',
+ 'url' => '',
+ 'network' => '',
+ ];
+
if (!empty($shared['author'])) {
$profiledata['name'] = $shared['author'];
}
@@ -156,17 +145,17 @@ function display_fetchauthor($a, $item)
$profiledata['photo'] = $shared['avatar'];
}
- $profiledata["nickname"] = $profiledata["name"];
- $profiledata["network"] = Protocol::matchByProfileUrl($profiledata["url"]);
+ $profiledata['nickname'] = $profiledata['name'];
+ $profiledata['network'] = Protocol::matchByProfileUrl($profiledata['url']);
- $profiledata["address"] = "";
- $profiledata["about"] = "";
+ $profiledata['address'] = '';
+ $profiledata['about'] = '';
+
+ $profiledata = Contact::getByURLForUser($profiledata['url'], local_user()) ?: $profiledata;
}
- $profiledata = Contact::getByURLForUser($profiledata["url"], local_user()) ?: $profiledata;
-
- if (!empty($profiledata["photo"])) {
- $profiledata["photo"] = DI::baseUrl()->remove($profiledata["photo"]);
+ if (!empty($profiledata['photo'])) {
+ $profiledata['photo'] = DI::baseUrl()->remove($profiledata['photo']);
}
return $profiledata;
@@ -189,9 +178,9 @@ function display_content(App $a, $update = false, $update_uid = 0)
$item = Post::selectFirst(['uid', 'parent-uri-id'], ['uri-id' => $uri_id, 'uid' => $update_uid]);
if (!empty($item)) {
if ($item['uid'] != 0) {
- $a->profile = ['uid' => intval($item['uid'])];
+ $a->setProfileOwner($item['uid']);
} else {
- $a->profile = ['uid' => intval($update_uid)];
+ $a->setProfileOwner($update_uid);
}
$parent_uri_id = $item['parent-uri-id'];
}
@@ -273,14 +262,13 @@ function display_content(App $a, $update = false, $update_uid = 0)
$page_uid = $item['uid'];
}
- $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $page_uid]);
- if (DBA::isResult($page_contact)) {
- $a->page_contact = $page_contact;
+ if (!empty($page_uid) && ($page_uid != local_user())) {
+ $page_user = User::getById($page_uid);
}
- $is_owner = (local_user() && (in_array($page_uid, [local_user(), 0])) ? true : false);
+ $is_owner = local_user() && (in_array($page_uid, [local_user(), 0]));
- if (!empty($a->profile['hidewall']) && !$is_owner && !$is_remote_contact) {
+ if (!empty($page_user['hidewall']) && !$is_owner && !$is_remote_contact) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
}
@@ -334,13 +322,13 @@ function display_content(App $a, $update = false, $update_uid = 0)
$o .= conversation($a, [$item], 'display', $update_uid, false, 'commented', $item_uid);
// Preparing the meta header
- $description = trim(BBCode::toPlaintext($item["body"]));
- $title = trim(BBCode::toPlaintext($item["title"]));
- $author_name = $item["author-name"];
+ $description = trim(BBCode::toPlaintext($item['body']));
+ $title = trim(BBCode::toPlaintext($item['title']));
+ $author_name = $item['author-name'];
- $image = DI::baseUrl()->remove($item["author-avatar"]);
+ $image = DI::baseUrl()->remove($item['author-avatar']);
- if ($title == "") {
+ if ($title == '') {
$title = $author_name;
}
diff --git a/mod/editpost.php b/mod/editpost.php
index 6f80bac0c..ee72b1e64 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -124,7 +124,6 @@ function editpost_content(App $a)
'$profile_uid' => $_SESSION['uid'],
'$preview' => DI::l10n()->t('Preview'),
'$jotplugins' => $jotplugins,
- '$sourceapp' => DI::l10n()->t($a->sourcename),
'$cancel' => DI::l10n()->t('Cancel'),
'$rand_num' => Crypto::randomDigits(12),
diff --git a/mod/events.php b/mod/events.php
index aabb608eb..43c79dd9b 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -280,7 +280,7 @@ function events_content(App $a)
$tabs = '';
// tabs
if ($a->theme_events_in_profile) {
- $tabs = BaseProfile::getTabsHTML($a, 'events', true);
+ $tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->user);
}
$mode = 'view';
diff --git a/mod/notes.php b/mod/notes.php
index 2b8c20783..945d0c935 100644
--- a/mod/notes.php
+++ b/mod/notes.php
@@ -45,7 +45,7 @@ function notes_content(App $a, $update = false)
return;
}
- $o = BaseProfile::getTabsHTML($a, 'notes', true);
+ $o = BaseProfile::getTabsHTML($a, 'notes', true, $a->user);
if (!$update) {
$o .= '
' . DI::l10n()->t('Personal Notes') . '
';
@@ -64,11 +64,11 @@ function notes_content(App $a, $update = false)
'acl_data' => '',
];
- $o .= status_editor($a, $x, $a->contact['id']);
+ $o .= status_editor($a, $x, $a->getContactId());
}
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
- 'contact-id'=> $a->contact['id']];
+ 'contact-id'=> $a->getContactId()];
if (DI::mode()->isMobile()) {
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
diff --git a/mod/photos.php b/mod/photos.php
index dcea99991..d55541680 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -24,6 +24,7 @@ use Friendica\Content\Feature;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
+use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
@@ -51,6 +52,7 @@ use Friendica\Security\Security;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
use Friendica\Util\XML;
+use Friendica\Network\HTTPException;
function photos_init(App $a) {
@@ -61,41 +63,18 @@ function photos_init(App $a) {
Nav::setSelected('home');
if ($a->argc > 1) {
- $nick = $a->argv[1];
- $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
+ $owner = User::getOwnerDataByNick($a->argv[1]);
- if (!DBA::isResult($user)) {
- return;
- }
+ $is_owner = (local_user() && (local_user() == $owner['uid']));
- $a->data['user'] = $user;
- $a->profile_uid = $user['uid'];
- $is_owner = (local_user() && (local_user() == $a->profile_uid));
+ $albums = Photo::getAlbums($owner['uid']);
- $profile = User::getOwnerDataByNick($nick);
-
- $account_type = Contact::getAccountType($profile);
-
- $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl');
-
- $vcard_widget = Renderer::replaceMacros($tpl, [
- '$name' => $profile['name'],
- '$photo' => $profile['photo'],
- '$addr' => $profile['addr'] ?? '',
- '$account_type' => $account_type,
- '$about' => BBCode::convert($profile['about']),
- ]);
-
- $albums = Photo::getAlbums($a->data['user']['uid']);
-
- $albums_visible = ((intval($a->data['user']['hidewall']) && !Session::isAuthenticated()) ? false : true);
+ $albums_visible = ((intval($owner['hidewall']) && !Session::isAuthenticated()) ? false : true);
// add various encodings to the array so we can just loop through and pick them out in a template
$ret = ['success' => false];
if ($albums) {
- $a->data['albums'] = $albums;
-
if ($albums_visible) {
$ret['success'] = true;
}
@@ -103,12 +82,12 @@ function photos_init(App $a) {
$ret['albums'] = [];
foreach ($albums as $k => $album) {
//hide profile photos to others
- if (!$is_owner && !Session::getRemoteContactID($a->profile_uid) && ($album['album'] == DI::l10n()->t('Profile Photos')))
+ if (!$is_owner && !Session::getRemoteContactID($owner['uid']) && ($album['album'] == DI::l10n()->t('Profile Photos')))
continue;
$entry = [
'text' => $album['album'],
'total' => $album['total'],
- 'url' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']),
+ 'url' => 'photos/' . $owner['nickname'] . '/album/' . bin2hex($album['album']),
'urlencode' => urlencode($album['album']),
'bin2hex' => bin2hex($album['album'])
];
@@ -116,7 +95,7 @@ function photos_init(App $a) {
}
}
- if (local_user() && $a->data['user']['uid'] == local_user()) {
+ if (local_user() && $owner['uid'] == local_user()) {
$can_post = true;
} else {
$can_post = false;
@@ -124,11 +103,11 @@ function photos_init(App $a) {
if ($ret['success']) {
$photo_albums_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('photo_albums.tpl'), [
- '$nick' => $a->data['user']['nickname'],
+ '$nick' => $owner['nickname'],
'$title' => DI::l10n()->t('Photo Albums'),
'$recent' => DI::l10n()->t('Recent Photos'),
'$albums' => $ret['albums'],
- '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'],
+ '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $owner['nickname'] . '/upload'],
'$can_post' => $can_post
]);
}
@@ -137,7 +116,7 @@ function photos_init(App $a) {
DI::page()['aside'] = '';
}
- DI::page()['aside'] .= $vcard_widget;
+ DI::page()['aside'] .= Widget\VCard::getHTML($owner);
if (!empty($photo_albums_widget)) {
DI::page()['aside'] .= $photo_albums_widget;
@@ -155,13 +134,18 @@ function photos_init(App $a) {
function photos_post(App $a)
{
+ $user = User::getByNickname($a->argv[1]);
+ if (!DBA::isResult($user)) {
+ throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
+ }
+
$phototypes = Images::supportedTypes();
$can_post = false;
$visitor = 0;
- $page_owner_uid = intval($a->data['user']['uid']);
- $community_page = $a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
+ $page_owner_uid = intval($user['uid']);
+ $community_page = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
if (local_user() && (local_user() == $page_owner_uid)) {
$can_post = true;
@@ -203,7 +187,7 @@ function photos_post(App $a)
if ($a->argc > 3 && $a->argv[2] === 'album') {
if (!Strings::isHex($a->argv[3])) {
- DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album');
+ DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
}
$album = hex2bin($a->argv[3]);
@@ -219,13 +203,13 @@ function photos_post(App $a)
if (!DBA::isResult($r)) {
notice(DI::l10n()->t('Album not found.'));
- DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album');
+ DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
return; // NOTREACHED
}
// Check if the user has responded to a delete confirmation query
if (!empty($_REQUEST['canceled'])) {
- DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album/' . $a->argv[3]);
+ DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album/' . $a->argv[3]);
}
// RENAME photo album
@@ -282,7 +266,7 @@ function photos_post(App $a)
}
}
- DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album');
+ DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
}
if ($a->argc > 3 && $a->argv[2] === 'image') {
@@ -419,7 +403,7 @@ function photos_post(App $a)
$arr['visible'] = $visibility;
$arr['origin'] = 1;
- $arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $photo['resource-id'] . ']'
+ $arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $user['nickname'] . '/image/' . $photo['resource-id'] . ']'
. '[img]' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $photo['scale'] . '.'. $ext . '[/img]'
. '[/url]';
@@ -523,7 +507,7 @@ function photos_post(App $a)
if (!empty($item['uri-id'])) {
Tag::store($item['uri-id'], Tag::MENTION, $newname, $profile);
- }
+ }
}
} elseif (strpos($tag, '#') === 0) {
$tagname = substr($tag, 1);
@@ -831,12 +815,17 @@ function photos_content(App $a)
// photos/name/image/xxxxx/edit
// photos/name/image/xxxxx/drop
+ $user = User::getByNickname($a->argv[1]);
+ if (!DBA::isResult($user)) {
+ throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
+ }
+
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
notice(DI::l10n()->t('Public access denied.'));
return;
}
- if (empty($a->data['user'])) {
+ if (empty($user)) {
notice(DI::l10n()->t('No photos selected'));
return;
}
@@ -871,9 +860,9 @@ function photos_content(App $a)
$edit = '';
$drop = '';
- $owner_uid = $a->data['user']['uid'];
+ $owner_uid = $user['uid'];
- $community_page = (($a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
+ $community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
if (local_user() && (local_user() == $owner_uid)) {
$can_post = true;
@@ -899,10 +888,11 @@ function photos_content(App $a)
if (!$remote_contact && local_user()) {
$contact_id = $_SESSION['cid'];
- $contact = $a->contact;
+
+ $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => $owner_uid, 'blocked' => false, 'pending' => false]);
}
- if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
+ if ($user['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
notice(DI::l10n()->t('Access to this item is restricted.'));
return;
}
@@ -913,7 +903,7 @@ function photos_content(App $a)
// tabs
$is_owner = (local_user() && (local_user() == $owner_uid));
- $o .= BaseProfile::getTabsHTML($a, 'photos', $is_owner, $a->data['user']['nickname']);
+ $o .= BaseProfile::getTabsHTML($a, 'photos', $is_owner, $user);
// Display upload form
if ($datatype === 'upload') {
@@ -927,8 +917,9 @@ function photos_content(App $a)
$albumselect = '';
$albumselect .= '';
- if (!empty($a->data['albums'])) {
- foreach ($a->data['albums'] as $album) {
+ $albums = Photo::getAlbums($owner_uid);
+ if (!empty($albums)) {
+ foreach ($albums as $album) {
if (($album['album'] === '') || ($album['album'] === Photo::CONTACT_PHOTOS) || ($album['album'] === DI::l10n()->t(Photo::CONTACT_PHOTOS))) {
continue;
}
@@ -939,7 +930,7 @@ function photos_content(App $a)
$uploader = '';
- $ret = ['post_url' => 'photos/' . $a->data['user']['nickname'],
+ $ret = ['post_url' => 'photos/' . $user['nickname'],
'addon_text' => $uploader,
'default_upload' => true];
@@ -960,7 +951,7 @@ function photos_content(App $a)
'$pagename' => DI::l10n()->t('Upload Photos'),
'$sessid' => session_id(),
'$usage' => $usage_message,
- '$nickname' => $a->data['user']['nickname'],
+ '$nickname' => $user['nickname'],
'$newalbum' => DI::l10n()->t('New album name: '),
'$existalbumtext' => DI::l10n()->t('or select existing album:'),
'$nosharetext' => DI::l10n()->t('Do not show a status post for this upload'),
@@ -989,7 +980,7 @@ function photos_content(App $a)
if ($datatype === 'album') {
// if $datum is not a valid hex, redirect to the default page
if (!Strings::isHex($datum)) {
- DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname']. '/album');
+ DI::baseUrl()->redirect('photos/' . $user['nickname']. '/album');
}
$album = hex2bin($datum);
@@ -1047,7 +1038,7 @@ function photos_content(App $a)
$o .= Renderer::replaceMacros($edit_tpl,[
'$nametext' => DI::l10n()->t('New album name: '),
- '$nickname' => $a->data['user']['nickname'],
+ '$nickname' => $user['nickname'],
'$album' => $album_e,
'$hexalbum' => bin2hex($album),
'$submit' => DI::l10n()->t('Submit'),
@@ -1057,15 +1048,15 @@ function photos_content(App $a)
}
} else {
if (($album !== DI::l10n()->t('Profile Photos')) && ($album !== Photo::CONTACT_PHOTOS) && ($album !== DI::l10n()->t(Photo::CONTACT_PHOTOS)) && $can_post) {
- $edit = [DI::l10n()->t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit'];
- $drop = [DI::l10n()->t('Drop Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/drop'];
+ $edit = [DI::l10n()->t('Edit Album'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album) . '/edit'];
+ $drop = [DI::l10n()->t('Drop Album'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album) . '/drop'];
}
}
if ($order_field === 'posted') {
- $order = [DI::l10n()->t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album), 'oldest'];
+ $order = [DI::l10n()->t('Show Newest First'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album), 'oldest'];
} else {
- $order = [DI::l10n()->t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?order=posted', 'newest'];
+ $order = [DI::l10n()->t('Show Oldest First'), 'photos/' . $user['nickname'] . '/album/' . bin2hex($album) . '?order=posted', 'newest'];
}
$photos = [];
@@ -1084,7 +1075,7 @@ function photos_content(App $a)
$photos[] = [
'id' => $rr['id'],
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
- 'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
+ 'link' => 'photos/' . $user['nickname'] . '/image/' . $rr['resource-id']
. ($order_field === 'posted' ? '?order=posted' : ''),
'title' => DI::l10n()->t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
@@ -1101,7 +1092,7 @@ function photos_content(App $a)
'$photos' => $photos,
'$album' => $album,
'$can_post' => $can_post,
- '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)],
+ '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $user['nickname'] . '/upload/' . bin2hex($album)],
'$order' => $order,
'$edit' => $edit,
'$drop' => $drop,
@@ -1184,10 +1175,10 @@ function photos_content(App $a)
}
if (!is_null($prv)) {
- $prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
+ $prevlink = 'photos/' . $user['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
}
if (!is_null($nxt)) {
- $nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
+ $nextlink = 'photos/' . $user['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . ($order_field === 'posted' ? '?order=posted' : '');
}
$tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl');
@@ -1220,17 +1211,17 @@ function photos_content(App $a)
}
}
- $album_link = 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']);
+ $album_link = 'photos/' . $user['nickname'] . '/album/' . bin2hex($ph[0]['album']);
$tools = null;
if ($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = [];
if ($cmd === 'edit') {
- $tools['view'] = ['photos/' . $a->data['user']['nickname'] . '/image/' . $datum, DI::l10n()->t('View photo')];
+ $tools['view'] = ['photos/' . $user['nickname'] . '/image/' . $datum, DI::l10n()->t('View photo')];
} else {
- $tools['edit'] = ['photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit', DI::l10n()->t('Edit photo')];
- $tools['delete'] = ['photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/drop', DI::l10n()->t('Delete photo')];
+ $tools['edit'] = ['photos/' . $user['nickname'] . '/image/' . $datum . '/edit', DI::l10n()->t('Edit photo')];
+ $tools['delete'] = ['photos/' . $user['nickname'] . '/image/' . $datum . '/drop', DI::l10n()->t('Delete photo')];
$tools['profile'] = ['settings/profile/photo/crop/' . $ph[0]['resource-id'], DI::l10n()->t('Use as profile photo')];
}
@@ -1329,7 +1320,7 @@ function photos_content(App $a)
'$rotate_cw' => ['rotate', DI::l10n()->t("Rotate CW \x28right\x29"),1,''],
'$rotate_ccw' => ['rotate', DI::l10n()->t("Rotate CCW \x28left\x29"),2,''],
- '$nickname' => $a->data['user']['nickname'],
+ '$nickname' => $user['nickname'],
'$resource_id' => $ph[0]['resource-id'],
'$permissions' => DI::l10n()->t('Permissions'),
'$aclselect' => $aclselect_e,
@@ -1379,7 +1370,6 @@ function photos_content(App $a)
'$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'),
'$loading' => DI::l10n()->t('Loading...'),
- '$sourceapp' => DI::l10n()->t($a->sourcename),
'$qcomment' => $qcomment,
'$rand_num' => Crypto::randomDigits(12)
]);
@@ -1435,7 +1425,6 @@ function photos_content(App $a)
'$comment' => DI::l10n()->t('Comment'),
'$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'),
- '$sourceapp' => DI::l10n()->t($a->sourcename),
'$qcomment' => $qcomment,
'$rand_num' => Crypto::randomDigits(12)
]);
@@ -1510,7 +1499,6 @@ function photos_content(App $a)
'$comment' => DI::l10n()->t('Comment'),
'$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'),
- '$sourceapp' => DI::l10n()->t($a->sourcename),
'$qcomment' => $qcomment,
'$rand_num' => Crypto::randomDigits(12)
]);
@@ -1577,7 +1565,7 @@ function photos_content(App $a)
$total = 0;
$r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
$sql_extra GROUP BY `resource-id`",
- intval($a->data['user']['uid']),
+ intval($user['uid']),
DBA::escape(Photo::CONTACT_PHOTOS),
DBA::escape(DI::l10n()->t(Photo::CONTACT_PHOTOS))
);
@@ -1592,7 +1580,7 @@ function photos_content(App $a)
ANY_VALUE(`created`) AS `created` FROM `photo`
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
$sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
- intval($a->data['user']['uid']),
+ intval($user['uid']),
DBA::escape(Photo::CONTACT_PHOTOS),
DBA::escape(DI::l10n()->t(Photo::CONTACT_PHOTOS)),
$pager->getStart(),
@@ -1618,12 +1606,12 @@ function photos_content(App $a)
$photos[] = [
'id' => $rr['id'],
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
- 'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
+ 'link' => 'photos/' . $user['nickname'] . '/image/' . $rr['resource-id'],
'title' => DI::l10n()->t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
'alt' => $alt_e,
'album' => [
- 'link' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
+ 'link' => 'photos/' . $user['nickname'] . '/album/' . bin2hex($rr['album']),
'name' => $name_e,
'alt' => DI::l10n()->t('View Album'),
],
@@ -1636,7 +1624,7 @@ function photos_content(App $a)
$o .= Renderer::replaceMacros($tpl, [
'$title' => DI::l10n()->t('Recent Photos'),
'$can_post' => $can_post,
- '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'],
+ '$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $user['nickname'] . '/upload'],
'$photos' => $photos,
'$paginate' => $pager->renderFull($total),
]);
diff --git a/mod/ping.php b/mod/ping.php
index 146e7e75b..93c579e0a 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -230,7 +230,7 @@ function ping_init(App $a)
$all_events = count($ev);
if ($all_events) {
- $str_now = DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d');
+ $str_now = DateTimeFormat::timezoneNow($a->getTimeZone(), 'Y-m-d');
foreach ($ev as $x) {
$bd = false;
if ($x['type'] === 'birthday') {
@@ -239,7 +239,7 @@ function ping_init(App $a)
} else {
$events ++;
}
- if (DateTimeFormat::convert($x['start'], ((intval($x['adjust'])) ? $a->timezone : 'UTC'), 'UTC', 'Y-m-d') === $str_now) {
+ if (DateTimeFormat::convert($x['start'], ((intval($x['adjust'])) ? $a->getTimeZone() : 'UTC'), 'UTC', 'Y-m-d') === $str_now) {
$all_events_today ++;
if ($bd) {
$birthdays_today ++;
diff --git a/mod/redir.php b/mod/redir.php
index 2f97911dc..557bbe444 100644
--- a/mod/redir.php
+++ b/mod/redir.php
@@ -58,7 +58,7 @@ function redir_init(App $a) {
$contact_url = $contact['url'];
- if (!empty($a->contact['id']) && $a->contact['id'] == $cid) {
+ if (!empty($a->getContactId()) && $a->getContactId() == $cid) {
// Local user is already authenticated.
redir_check_url($contact_url, $url);
$a->redirect($url ?: $contact_url);
@@ -73,7 +73,7 @@ function redir_init(App $a) {
$cid = $contact['id'];
}
- if (!empty($a->contact['id']) && $a->contact['id'] == $cid) {
+ if (!empty($a->getContactId()) && $a->getContactId() == $cid) {
// Local user is already authenticated.
redir_check_url($contact_url, $url);
$target_url = $url ?: $contact_url;
diff --git a/mod/videos.php b/mod/videos.php
index 89097f5cd..f678e13fc 100644
--- a/mod/videos.php
+++ b/mod/videos.php
@@ -22,17 +22,17 @@
use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
-use Friendica\Content\Text\BBCode;
+use Friendica\Content\Widget;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Attach;
-use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Module\BaseProfile;
use Friendica\Security\Security;
+use Friendica\Network\HTTPException;
function videos_init(App $a)
{
@@ -43,38 +43,17 @@ function videos_init(App $a)
Nav::setSelected('home');
if ($a->argc > 1) {
- $nick = $a->argv[1];
- $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
- DBA::escape($nick)
- );
-
- if (!DBA::isResult($user)) {
- return;
+ $owner = User::getOwnerDataByNick($a->argv[1]);
+ if (empty($owner)) {
+ throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
- $a->data['user'] = $user[0];
- $a->profile_uid = $user[0]['uid'];
-
- $profile = User::getOwnerDataByNick($nick);
-
- $account_type = Contact::getAccountType($profile);
-
- $tpl = Renderer::getMarkupTemplate('widget/vcard.tpl');
-
- $vcard_widget = Renderer::replaceMacros($tpl, [
- '$name' => $profile['name'],
- '$photo' => $profile['photo'],
- '$addr' => $profile['addr'] ?? '',
- '$account_type' => $account_type,
- '$about' => BBCode::convert($profile['about']),
- ]);
-
// If not there, create 'aside' empty
if (!isset(DI::page()['aside'])) {
DI::page()['aside'] = '';
}
- DI::page()['aside'] .= $vcard_widget;
+ DI::page()['aside'] .= Widget\VCard::getHTML($owner);
$tpl = Renderer::getMarkupTemplate("videos_head.tpl");
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl);
@@ -85,10 +64,13 @@ function videos_init(App $a)
function videos_post(App $a)
{
- $owner_uid = $a->data['user']['uid'];
+ $user = User::getByNickname($a->argv[1]);
+ if (!DBA::isResult($user)) {
+ throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
+ }
- if (local_user() != $owner_uid) {
- DI::baseUrl()->redirect('videos/' . $a->data['user']['nickname']);
+ if (local_user() != $user['uid']) {
+ DI::baseUrl()->redirect('videos/' . $user['nickname']);
}
if (($a->argc == 2) && !empty($_POST['delete']) && !empty($_POST['id'])) {
@@ -105,11 +87,11 @@ function videos_post(App $a)
], local_user());
}
- DI::baseUrl()->redirect('videos/' . $a->data['user']['nickname']);
+ DI::baseUrl()->redirect('videos/' . $user['nickname']);
return; // NOTREACHED
}
- DI::baseUrl()->redirect('videos/' . $a->data['user']['nickname']);
+ DI::baseUrl()->redirect('videos/' . $user['nickname']);
}
function videos_content(App $a)
@@ -123,13 +105,17 @@ function videos_content(App $a)
// videos/name/video/xxxxx
// videos/name/video/xxxxx/edit
+ $user = User::getByNickname($a->argv[1]);
+ if (!DBA::isResult($user)) {
+ throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
+ }
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
notice(DI::l10n()->t('Public access denied.'));
return;
}
- if (empty($a->data['user'])) {
+ if (empty($user)) {
notice(DI::l10n()->t('No videos selected') . EOL );
return;
}
@@ -154,41 +140,38 @@ function videos_content(App $a)
//
$can_post = false;
$visitor = 0;
- $contact = null;
$remote_contact = false;
$contact_id = 0;
- $owner_uid = $a->data['user']['uid'];
+ $community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
- $community_page = (($a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
-
- if ((local_user()) && (local_user() == $owner_uid)) {
+ if ((local_user()) && (local_user() == $user['uid'])) {
$can_post = true;
- } elseif ($community_page && !empty(Session::getRemoteContactID($owner_uid))) {
- $contact_id = Session::getRemoteContactID($owner_uid);
+ } elseif ($community_page && !empty(Session::getRemoteContactID($user['uid']))) {
+ $contact_id = Session::getRemoteContactID($user['uid']);
$can_post = true;
$remote_contact = true;
$visitor = $contact_id;
}
// perhaps they're visiting - but not a community page, so they wouldn't have write access
- if (!empty(Session::getRemoteContactID($owner_uid)) && !$visitor) {
- $contact_id = Session::getRemoteContactID($owner_uid);
+ if (!empty(Session::getRemoteContactID($user['uid'])) && !$visitor) {
+ $contact_id = Session::getRemoteContactID($user['uid']);
$remote_contact = true;
}
- if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
+ if ($user['hidewall'] && (local_user() != $user['uid']) && !$remote_contact) {
notice(DI::l10n()->t('Access to this item is restricted.'));
return;
}
- $sql_extra = Security::getPermissionsSQLByUserId($owner_uid);
+ $sql_extra = Security::getPermissionsSQLByUserId($user['uid']);
$o = "";
// tabs
- $_is_owner = (local_user() && (local_user() == $owner_uid));
- $o .= BaseProfile::getTabsHTML($a, 'videos', $_is_owner, $a->data['user']['nickname']);
+ $_is_owner = (local_user() && (local_user() == $user['uid']));
+ $o .= BaseProfile::getTabsHTML($a, 'videos', $_is_owner, $user);
//
// dispatch request
@@ -218,7 +201,7 @@ function videos_content(App $a)
$total = 0;
$r = q("SELECT hash FROM `attach` WHERE `uid` = %d AND filetype LIKE '%%video%%'
$sql_extra GROUP BY hash",
- intval($a->data['user']['uid'])
+ intval($user['uid'])
);
if (DBA::isResult($r)) {
$total = count($r);
@@ -231,7 +214,7 @@ function videos_content(App $a)
FROM `attach`
WHERE `uid` = %d AND filetype LIKE '%%video%%'
$sql_extra GROUP BY hash ORDER BY `created` DESC LIMIT %d , %d",
- intval($a->data['user']['uid']),
+ intval($user['uid']),
$pager->getStart(),
$pager->getItemsPerPage()
);
@@ -247,13 +230,13 @@ function videos_content(App $a)
$videos[] = [
'id' => $rr['id'],
- 'link' => DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['hash'],
+ 'link' => DI::baseUrl() . '/videos/' . $user['nickname'] . '/video/' . $rr['hash'],
'title' => DI::l10n()->t('View Video'),
'src' => DI::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
'alt' => $alt_e,
'mime' => $rr['filetype'],
'album' => [
- 'link' => DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
+ 'link' => DI::baseUrl() . '/videos/' . $user['nickname'] . '/album/' . bin2hex($rr['album']),
'name' => $name_e,
'alt' => DI::l10n()->t('View Album'),
],
@@ -265,9 +248,9 @@ function videos_content(App $a)
$o .= Renderer::replaceMacros($tpl, [
'$title' => DI::l10n()->t('Recent Videos'),
'$can_post' => $can_post,
- '$upload' => [DI::l10n()->t('Upload New Videos'), DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/upload'],
+ '$upload' => [DI::l10n()->t('Upload New Videos'), DI::baseUrl() . '/videos/' . $user['nickname'] . '/upload'],
'$videos' => $videos,
- '$delete_url' => (($can_post) ? DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] : false)
+ '$delete_url' => (($can_post) ? DI::baseUrl() . '/videos/' . $user['nickname'] : false)
]);
$o .= $pager->renderFull($total);
diff --git a/src/App.php b/src/App.php
index 5c74b1b53..df15bf095 100644
--- a/src/App.php
+++ b/src/App.php
@@ -56,32 +56,24 @@ use Psr\Log\LoggerInterface;
*/
class App
{
- public $profile;
- public $profile_uid;
public $user;
- public $cid;
- public $contact;
- public $contacts;
- public $page_contact;
- public $content;
public $data = [];
/** @deprecated 2019.09 - use App\Arguments->getArgv() or Arguments->get() */
public $argv;
/** @deprecated 2019.09 - use App\Arguments->getArgc() */
public $argc;
- public $timezone;
- public $interactive = true;
- public $identities;
public $theme_info = [];
- public $category;
// Allow themes to control internal parameters
// by changing App values in theme.php
- public $sourcename = '';
public $videowidth = 425;
public $videoheight = 350;
public $theme_events_in_profile = true;
- public $queue;
+
+ private $timezone = '';
+ private $profile_owner = 0;
+ private $contact_id = 0;
+ private $queue = [];
/**
* @var App\Mode The Mode of the Application
@@ -138,6 +130,84 @@ class App
*/
private $pConfig;
+ /**
+ * Set the profile owner ID
+ *
+ * @param int $owner_id
+ * @return void
+ */
+ public function setProfileOwner(int $owner_id)
+ {
+ $this->profile_owner = $owner_id;
+ }
+
+ /**
+ * Get the profile owner ID
+ *
+ * @return int
+ */
+ public function getProfileOwner():int
+ {
+ return $this->profile_owner;
+ }
+
+ /**
+ * Set the contact ID
+ *
+ * @param int $contact_id
+ * @return void
+ */
+ public function setContactId(int $contact_id)
+ {
+ $this->contact_id = $contact_id;
+ }
+
+ /**
+ * Get the contact ID
+ *
+ * @return int
+ */
+ public function getContactId():int
+ {
+ return $this->contact_id;
+ }
+
+ /**
+ * Set the timezone
+ *
+ * @param int $timezone
+ * @return void
+ */
+ public function setTimeZone(string $timezone)
+ {
+ $this->timezone = $timezone;
+ }
+
+ /**
+ * Get the timezone
+ *
+ * @return int
+ */
+ public function getTimeZone():string
+ {
+ return $this->timezone;
+ }
+
+ public function setQueue(array $queue)
+ {
+ $this->queue = $queue;
+ }
+
+ public function getQueue()
+ {
+ return $this->queue ?? [];
+ }
+
+ public function getQueueValue(string $index)
+ {
+ return $this->queue[$index] ?? null;
+ }
+
/**
* Returns the current config cache of this node
*
@@ -317,10 +387,10 @@ class App
$page_theme = null;
// Find the theme that belongs to the user whose stuff we are looking at
- if ($this->profile_uid && ($this->profile_uid != local_user())) {
+ if (!empty($this->profile_owner) && ($this->profile_owner != local_user())) {
// 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_uid]);
+ $user = $this->database->selectFirst('user', ['theme'], ['uid' => $this->profile_owner]);
if ($this->database->isResult($user) && !$this->pConfig->get(local_user(), 'system', 'always_my_theme')) {
$page_theme = $user['theme'];
}
@@ -350,11 +420,11 @@ class App
$page_mobile_theme = null;
// Find the theme that belongs to the user whose stuff we are looking at
- if ($this->profile_uid && ($this->profile_uid != local_user())) {
+ if (!empty($this->profile_owner) && ($this->profile_owner != local_user())) {
// 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 (!$this->pConfig->get(local_user(), 'system', 'always_my_theme')) {
- $page_mobile_theme = $this->pConfig->get($this->profile_uid, 'system', 'mobile-theme');
+ $page_mobile_theme = $this->pConfig->get($this->profile_owner, 'system', 'mobile-theme');
}
}
@@ -547,7 +617,7 @@ class App
$this->baseURL->redirect('search');
}
- // Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
+ // Initialize module that can set the current theme in the init() method, either directly or via App->setProfileOwner
$page['page_title'] = $moduleName;
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
diff --git a/src/App/Page.php b/src/App/Page.php
index bf33ebfab..c6e3e723c 100644
--- a/src/App/Page.php
+++ b/src/App/Page.php
@@ -459,7 +459,6 @@ class Page implements ArrayAccess
}
$page = $this->page;
- $profile = $app->profile;
header("X-Friendica-Version: " . FRIENDICA_VERSION);
header("Content-type: text/html; charset=utf-8");
diff --git a/src/Content/Nav.php b/src/Content/Nav.php
index db3fa7863..20b3a9325 100644
--- a/src/Content/Nav.php
+++ b/src/Content/Nav.php
@@ -289,7 +289,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 (is_array($a->identities) && count($a->identities) > 1) {
+ if (User::hasIdentities(DI::session()->get('submanage') ?: local_user())) {
$nav['delegation'] = ['delegation', DI::l10n()->t('Accounts'), '', DI::l10n()->t('Manage other pages')];
}
diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php
index 51515137e..e65c89523 100644
--- a/src/Content/Text/HTML.php
+++ b/src/Content/Text/HTML.php
@@ -801,22 +801,6 @@ class HTML
]);
}
- /**
- * Get html for contact block.
- *
- * @deprecated since version 2019.03
- * @see ContactBlock::getHTML()
- * @return string
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- * @throws \ImagickException
- */
- public static function contactBlock()
- {
- $a = DI::app();
-
- return ContactBlock::getHTML($a->profile);
- }
-
/**
* Format contacts as picture links or as text links
*
diff --git a/src/Content/Widget.php b/src/Content/Widget.php
index 139fd8ebb..a899644c3 100644
--- a/src/Content/Widget.php
+++ b/src/Content/Widget.php
@@ -334,7 +334,7 @@ class Widget
{
$a = DI::app();
- $uid = intval($a->profile['uid']);
+ $uid = intval($a->getProfileOwner());
if (!Feature::isEnabled($uid, 'categories')) {
return '';
@@ -416,23 +416,20 @@ class Widget
/**
* Insert a tag cloud widget for the present profile.
*
+ * @param int $uid User ID
* @param int $limit Max number of displayed tags.
* @return string HTML formatted output.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function tagCloud($limit = 50)
+ public static function tagCloud(int $uid, int $limit = 50)
{
- $a = DI::app();
-
- $uid = intval($a->profile['uid']);
-
- if (!$uid || !$a->profile['url']) {
+ if (empty($uid)) {
return '';
}
if (Feature::isEnabled($uid, 'tagadelic')) {
- $owner_id = Contact::getIdForURL($a->profile['url'], 0, false);
+ $owner_id = Contact::getPublicIdByUserId($uid);
if (!$owner_id) {
return '';
diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php
index 340fc0cf3..ffe4759f5 100644
--- a/src/Content/Widget/VCard.php
+++ b/src/Content/Widget/VCard.php
@@ -21,9 +21,12 @@
namespace Friendica\Content\Widget;
+use Friendica\Content\ContactSelector;
use Friendica\Content\Text\BBCode;
+use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
+use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\Strings;
@@ -43,10 +46,16 @@ class VCard
*/
public static function getHTML(array $contact)
{
- if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
- $network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
+ if (!isset($contact['network']) || !isset($contact['id'])) {
+ Logger::warning('Incomplete contact', ['contact' => $contact ?? [], 'callstack' => System::callstack(20)]);
+ }
+
+ if ($contact['network'] != '') {
+ $network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
+ $network_avatar = ContactSelector::networkToIcon($contact['network'], $contact['url']);
} else {
- $network_link = '';
+ $network_link = '';
+ $network_avatar = '';
}
$follow_link = '';
@@ -87,6 +96,7 @@ class VCard
'$xmpp' => DI::l10n()->t('XMPP:'),
'$location' => DI::l10n()->t('Location:'),
'$network_link' => $network_link,
+ '$network_avatar' => $network_avatar,
'$network' => DI::l10n()->t('Network:'),
'$account_type' => Contact::getAccountType($contact),
'$follow' => DI::l10n()->t('Follow'),
diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php
index 75a869a38..bb404965e 100644
--- a/src/Core/Renderer.php
+++ b/src/Core/Renderer.php
@@ -48,7 +48,6 @@ class Renderer
* beyond are used.
*/
public static $theme = [
- 'sourcename' => '',
'videowidth' => 425,
'videoheight' => 350,
'stylesheet' => '',
diff --git a/src/Core/Worker.php b/src/Core/Worker.php
index f21513f33..824275fa7 100644
--- a/src/Core/Worker.php
+++ b/src/Core/Worker.php
@@ -446,7 +446,7 @@ class Worker
$queue['priority'] = PRIORITY_MEDIUM;
}
- $a->queue = $queue;
+ $a->setQueue($queue);
$up_duration = microtime(true) - self::$up_start;
@@ -462,7 +462,7 @@ class Worker
Logger::disableWorker();
- unset($a->queue);
+ $a->setQueue([]);
$duration = (microtime(true) - $stamp);
@@ -831,7 +831,7 @@ class Worker
$stamp = (float)microtime(true);
$queues = DBA::p("SELECT `process`.`pid`, COUNT(`workerqueue`.`pid`) AS `entries` FROM `process`
- LEFT JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `workerqueue`.`done`
+ LEFT JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` AND NOT `workerqueue`.`done`
GROUP BY `process`.`pid`");
while ($queue = DBA::fetch($queues)) {
$ids[$queue['pid']] = $queue['entries'];
@@ -1351,12 +1351,12 @@ class Worker
*/
public static function defer()
{
- if (empty(DI::app()->queue)) {
+ $queue = DI::app()->getQueue();
+
+ if (empty($queue)) {
return false;
}
- $queue = DI::app()->queue;
-
$retrial = $queue['retrial'];
$id = $queue['id'];
$priority = $queue['priority'];
@@ -1587,7 +1587,7 @@ class Worker
} else {
Logger::info('We are outside the maintenance window', ['current' => date('H:i:s', $current), 'start' => date('H:i:s', $start), 'end' => date('H:i:s', $end)]);
}
-
+
return $execute;
}
}
diff --git a/src/Factory/Notification/Notification.php b/src/Factory/Notification/Notification.php
index e69b2131e..9f833130a 100644
--- a/src/Factory/Notification/Notification.php
+++ b/src/Factory/Notification/Notification.php
@@ -63,8 +63,6 @@ class Notification extends BaseFactory
private $baseUrl;
/** @var L10n */
private $l10n;
- /** @var string */
- private $nurl;
public function __construct(LoggerInterface $logger, Database $dba, Repository\Notification $notification, BaseURL $baseUrl, L10n $l10n, App $app, IPConfig $pConfig, ISession $session)
{
@@ -74,7 +72,6 @@ class Notification extends BaseFactory
$this->notification = $notification;
$this->baseUrl = $baseUrl;
$this->l10n = $l10n;
- $this->nurl = $app->contact['nurl'] ?? '';
}
/**
diff --git a/src/Model/Contact.php b/src/Model/Contact.php
index 20135a49e..45a3d424e 100644
--- a/src/Model/Contact.php
+++ b/src/Model/Contact.php
@@ -1736,7 +1736,7 @@ class Contact
{
$condition = ["`nurl` = ? AND ((`uid` = ? AND `network` IN (?, ?)) OR `uid` = ?)",
Strings::normaliseLink($url), $uid, Protocol::FEED, Protocol::MAIL, 0];
- $contact = self::selectFirst(['id', 'updated'], $condition);
+ $contact = self::selectFirst(['id', 'updated'], $condition, ['order' => ['uid' => true]]);
return self::getAvatarUrlForId($contact['id'] ?? 0, $size, $contact['updated'] ?? '');
}
diff --git a/src/Model/Item.php b/src/Model/Item.php
index cbac14a11..327c60d5c 100644
--- a/src/Model/Item.php
+++ b/src/Model/Item.php
@@ -2685,7 +2685,7 @@ class Item
continue;
}
- if ((local_user() == $item['uid']) && ($item['private'] == self::PRIVATE) && ($item['contact-id'] != $app->contact['id']) && ($item['network'] == Protocol::DFRN)) {
+ if ((local_user() == $item['uid']) && ($item['private'] == self::PRIVATE) && ($item['contact-id'] != $app->getContactId()) && ($item['network'] == Protocol::DFRN)) {
$img_url = 'redir/' . $item['contact-id'] . '?url=' . urlencode($mtch[1]);
$item['body'] = str_replace($mtch[0], '[img]' . $img_url . '[/img]', $item['body']);
}
diff --git a/src/Model/Profile.php b/src/Model/Profile.php
index 95fdc0cea..1c75201c9 100644
--- a/src/Model/Profile.php
+++ b/src/Model/Profile.php
@@ -205,31 +205,27 @@ class Profile
* load a lot of theme-specific content
*
* @param App $a
- * @param string $nickname string
- * @param array $profiledata array
- * @param boolean $show_connect Show connect link
+ * @param string $nickname string
+ *
+ * @return array Profile
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function load(App $a, $nickname)
+ public static function load(App $a, string $nickname, bool $show_contacts = true)
{
$profile = User::getOwnerDataByNick($nickname);
if (empty($profile)) {
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
- return;
+ return [];
}
- $a->profile = $profile;
- $a->profile_uid = $profile['uid'];
+ $a->setProfileOwner($profile['uid']);
- $a->profile['mobile-theme'] = DI::pConfig()->get($a->profile['uid'], 'system', 'mobile_theme');
- $a->profile['network'] = Protocol::DFRN;
-
- DI::page()['title'] = $a->profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
+ DI::page()['title'] = $profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
if (!DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
- $a->setCurrentTheme($a->profile['theme']);
- $a->setCurrentMobileTheme($a->profile['mobile-theme']);
+ $a->setCurrentTheme($profile['theme']);
+ $a->setCurrentMobileTheme(DI::pConfig()->get($a->getProfileOwner(), 'system', 'mobile_theme'));
}
/*
@@ -250,9 +246,9 @@ class Profile
* By now, the contact block isn't shown, when a different profile is given
* But: When this profile was on the same server, then we could display the contacts
*/
- DI::page()['aside'] .= self::sidebar($a, $a->profile, $block);
+ DI::page()['aside'] .= self::sidebar($profile, $block, $show_contacts);
- return;
+ return $profile;
}
/**
@@ -261,9 +257,9 @@ class Profile
* It is very difficult to templatise the HTML completely
* because of all the conditional logic.
*
- * @param array $profile
- * @param int $block
- * @param boolean $show_connect Show connect link
+ * @param array $profile Profile array
+ * @param bool $block Block personal details
+ * @param bool $show_contacts Show contact block
*
* @return string HTML sidebar module
*
@@ -276,15 +272,11 @@ class Profile
* @hooks 'profile_sidebar'
* array $arr
*/
- private static function sidebar(App $a, array $profile, $block = 0)
+ private static function sidebar(array $profile, bool $block, bool $show_contacts)
{
$o = '';
$location = false;
- // This function can also use contact information in $profile, but the 'cid'
- // value is going to be coming from 'owner-view', which means it's the wrong
- // contact ID for the user viewing this page. Use 'nurl' to look up the
- // correct contact table entry for the logged-in user.
$profile_contact = [];
if (local_user() && ($profile['uid'] ?? 0) != local_user()) {
@@ -403,10 +395,10 @@ class Profile
$updated = date('c', strtotime($profile['last-item']));
}
- if (!$block) {
- $contact_block = ContactBlock::getHTML($a->profile);
+ if (!$block && $show_contacts) {
+ $contact_block = ContactBlock::getHTML($profile);
- if (is_array($a->profile) && !$a->profile['hide-friends']) {
+ if (is_array($profile) && !$profile['hide-friends']) {
$contact_count = DBA::count('contact', [
'uid' => $profile['uid'],
'self' => false,
@@ -552,7 +544,7 @@ class Profile
$rr['link'] = Contact::magicLinkById($rr['cid']);
$rr['title'] = $rr['name'];
- $rr['date'] = DI::l10n()->getDay(DateTimeFormat::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . DI::l10n()->t('[today]') : '');
+ $rr['date'] = DI::l10n()->getDay(DateTimeFormat::convert($rr['start'], $a->getTimeZone(), 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . DI::l10n()->t('[today]') : '');
$rr['startime'] = null;
$rr['today'] = $today;
}
@@ -611,8 +603,8 @@ class Profile
$total++;
}
- $strt = DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', 'Y-m-d');
- if ($strt === DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d')) {
+ $strt = DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->getTimeZone() : 'UTC', 'UTC', 'Y-m-d');
+ if ($strt === DateTimeFormat::timezoneNow($a->getTimeZone(), 'Y-m-d')) {
$istoday = true;
}
@@ -627,17 +619,17 @@ class Profile
$description = DI::l10n()->t('[No description]');
}
- $strt = DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC');
+ $strt = DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->getTimeZone() : 'UTC');
- if (substr($strt, 0, 10) < DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d')) {
+ if (substr($strt, 0, 10) < DateTimeFormat::timezoneNow($a->getTimeZone(), 'Y-m-d')) {
continue;
}
- $today = ((substr($strt, 0, 10) === DateTimeFormat::timezoneNow($a->timezone, 'Y-m-d')) ? true : false);
+ $today = ((substr($strt, 0, 10) === DateTimeFormat::timezoneNow($a->getTimeZone(), 'Y-m-d')) ? true : false);
$rr['title'] = $title;
$rr['description'] = $description;
- $rr['date'] = DI::l10n()->getDay(DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . DI::l10n()->t('[today]') : '');
+ $rr['date'] = DI::l10n()->getDay(DateTimeFormat::convert($rr['start'], $rr['adjust'] ? $a->getTimeZone() : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . DI::l10n()->t('[today]') : '');
$rr['startime'] = $strt;
$rr['today'] = $today;
@@ -776,7 +768,7 @@ class Profile
Session::setVisitorsContacts();
- $a->contact = $visitor;
+ $a->setContactId($visitor['id']);
Logger::info('Authenticated visitor', ['url' => $visitor['url']]);
@@ -837,7 +829,7 @@ class Profile
*/
Hook::callAll('magic_auth_success', $arr);
- $a->contact = $arr['visitor'];
+ $a->setContactId($arr['visitor']['id']);
info(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
@@ -879,7 +871,7 @@ class Profile
*/
public static function getThemeUid(App $a)
{
- $uid = !empty($a->profile_uid) ? intval($a->profile_uid) : 0;
+ $uid = !empty($a->getProfileOwner()) ? intval($a->getProfileOwner()) : 0;
if (local_user() && (DI::pConfig()->get(local_user(), 'system', 'always_my_theme') || !$uid)) {
return local_user();
}
diff --git a/src/Model/User.php b/src/Model/User.php
index 3d76b0800..94e41387b 100644
--- a/src/Model/User.php
+++ b/src/Model/User.php
@@ -1569,6 +1569,38 @@ class User
return $identities;
}
+ /**
+ * Check if the given user id has delegations or is delegated
+ *
+ * @param int $uid
+ * @return bool
+ */
+ public static function hasIdentities(int $uid):bool
+ {
+ if (empty($uid)) {
+ return false;
+ }
+
+ $user = DBA::selectFirst('user', ['parent-uid'], ['uid' => $uid, 'account_removed' => false]);
+ if (!DBA::isResult($user)) {
+ return false;
+ }
+
+ if ($user['parent-uid'] != 0) {
+ return true;
+ }
+
+ if (DBA::exists('user', ['parent-uid' => $uid, 'account_removed' => false])) {
+ return true;
+ }
+
+ if (DBA::exists('manage', ['uid' => $uid])) {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Returns statistical information about the current users of this node
*
diff --git a/src/Module/BaseProfile.php b/src/Module/BaseProfile.php
index c6b297300..e84ebded1 100644
--- a/src/Module/BaseProfile.php
+++ b/src/Module/BaseProfile.php
@@ -39,11 +39,9 @@ class BaseProfile extends BaseModule
* @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function getTabsHTML(App $a, string $current, bool $is_owner, string $nickname = null)
+ public static function getTabsHTML(App $a, string $current, bool $is_owner, array $profile)
{
- if (is_null($nickname)) {
- $nickname = $a->user['nickname'];
- }
+ $nickname = $profile['nickname'];
$baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
@@ -116,7 +114,7 @@ class BaseProfile extends BaseModule
];
}
- if (empty($a->profile['hide-friends'])) {
+ if (empty($profile['hide-friends'])) {
$tabs[] = [
'label' => DI::l10n()->t('Contacts'),
'url' => $baseProfileUrl . '/contacts',
diff --git a/src/Module/Contact.php b/src/Module/Contact.php
index 89051f27d..6aa602af2 100644
--- a/src/Module/Contact.php
+++ b/src/Module/Contact.php
@@ -156,12 +156,6 @@ class Contact extends BaseModule
if (!DBA::isResult($r)) {
notice(DI::l10n()->t('Failed to update contact record.'));
}
-
- $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
- if (DBA::isResult($contact)) {
- $a->data['contact'] = $contact;
- }
-
return;
}
@@ -306,8 +300,6 @@ class Contact extends BaseModule
}
}
- $a->data['contact'] = $contact;
-
$vcard_widget = Widget\VCard::getHTML($contact);
$findpeople_widget = '';
@@ -453,9 +445,7 @@ class Contact extends BaseModule
$_SESSION['return_path'] = DI::args()->getQueryString();
- if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
- $contact = $a->data['contact'];
-
+ if (!empty($contact)) {
DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
'$baseurl' => DI::baseUrl()->get(true),
]);
diff --git a/src/Module/Contact/Poke.php b/src/Module/Contact/Poke.php
index 6e8920c5c..955d4bab0 100644
--- a/src/Module/Contact/Poke.php
+++ b/src/Module/Contact/Poke.php
@@ -11,6 +11,7 @@ use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model;
+use Friendica\Model\Contact;
use Friendica\Network\HTTPException;
use Friendica\Protocol\Activity;
use Friendica\Util\XML;
@@ -59,7 +60,7 @@ class Poke extends BaseModule
$deny_cid = ($private ? '' : $a->user['deny_cid']);
$deny_gid = ($private ? '' : $a->user['deny_gid']);
- $actor = $a->contact;
+ $actor = Contact::getById($a->getContactId());
$uri = Model\Item::newURI($uid);
diff --git a/src/Module/Debug/Localtime.php b/src/Module/Debug/Localtime.php
index 5030cb37e..ff1466408 100644
--- a/src/Module/Debug/Localtime.php
+++ b/src/Module/Debug/Localtime.php
@@ -29,6 +29,8 @@ use Friendica\Util\Temporal;
class Localtime extends BaseModule
{
+ static $mod_localtime = '';
+
public static function post(array $parameters = [])
{
$time = ($_REQUEST['time'] ?? '') ?: 'now';
@@ -36,14 +38,12 @@ class Localtime extends BaseModule
$bd_format = DI::l10n()->t('l F d, Y \@ g:i A');
if (!empty($_POST['timezone'])) {
- DI::app()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
+ self::$mod_localtime = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
}
}
public static function content(array $parameters = [])
{
- $app = DI::app();
-
$time = ($_REQUEST['time'] ?? '') ?: 'now';
$output = '' . DI::l10n()->t('Time Conversion') . '
';
@@ -54,8 +54,8 @@ class Localtime extends BaseModule
$output .= '' . DI::l10n()->t('Current timezone: %s', $_REQUEST['timezone']) . '
';
}
- if (!empty($app->data['mod-localtime'])) {
- $output .= '' . DI::l10n()->t('Converted localtime: %s', $app->data['mod-localtime']) . '
';
+ if (!empty(self::$mod_localtime)) {
+ $output .= '' . DI::l10n()->t('Converted localtime: %s', self::$mod_localtime) . '
';
}
$output .= '