$item = Post::selectFirst(['uid', 'parent-uri-id'], ['uri-id' => $uri_id, 'uid' => $update_uid]);
if (!empty($item)) {
if ($item['uid'] != 0) {
- $a->profile_owner = intval($item['uid']);
+ $a->setProfileOwner($item['uid']);
} else {
- $a->profile_owner = intval($update_uid);
+ $a->setProfileOwner($update_uid);
}
$parent_uri_id = $item['parent-uri-id'];
}
'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',
$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);
$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;
*/
class App
{
- public $profile_owner;
- public $contact_id;
+ private $profile_owner;
+ private $contact_id;
+
public $user;
public $data = [];
/** @deprecated 2019.09 - use App\Arguments->getArgv() or Arguments->get() */
*/
private $pConfig;
+ public function setProfileOwner(int $owner_id)
+ {
+ $this->profile_owner = $owner_id;
+ }
+
+ public function getProfileOwner()
+ {
+ return $this->profile_owner;
+ }
+
+ public function setContactId(int $contact_id)
+ {
+ $this->contact_id = $contact_id;
+ }
+
+ public function getContactId()
+ {
+ return $this->contact_id;
+ }
+
/**
* Returns the current config cache of this node
*
{
$a = DI::app();
- $uid = intval($a->profile_owner);
+ $uid = intval($a->getProfileOwner());
if (!Feature::isEnabled($uid, 'categories')) {
return '';
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']);
}
return [];
}
- $a->profile_owner = $profile['uid'];
+ $a->setProfileOwner($profile['uid']);
DI::page()['title'] = $profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
if (!DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
$a->setCurrentTheme($profile['theme']);
- $a->setCurrentMobileTheme(DI::pConfig()->get($a->profile_owner, 'system', 'mobile_theme'));
+ $a->setCurrentMobileTheme(DI::pConfig()->get($a->getProfileOwner(), 'system', 'mobile_theme'));
}
/*
Session::setVisitorsContacts();
- $a->contact_id = $visitor['id'];
+ $a->setContactId($visitor['id']);
Logger::info('Authenticated visitor', ['url' => $visitor['url']]);
*/
Hook::callAll('magic_auth_success', $arr);
- $a->contact_id = $arr['visitor']['id'];
+ $a->setContactId($arr['visitor']['id']);
info(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
*/
public static function getThemeUid(App $a)
{
- $uid = !empty($a->profile_owner) ? intval($a->profile_owner) : 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();
}
$deny_cid = ($private ? '' : $a->user['deny_cid']);
$deny_gid = ($private ? '' : $a->user['deny_gid']);
- $actor = Contact::getById($a->contact_id);
+ $actor = Contact::getById($a->getContactId());
$uri = Model\Item::newURI($uid);
$compose_title = DI::l10n()->t('Compose new personal note');
$type = 'note';
$doesFederate = false;
- $contact_allow_list = [$a->contact_id];
+ $contact_allow_list = [$a->getContactId()];
$group_allow_list = [];
$contact_deny_list = [];
$group_deny_list = [];
DI::page()->registerFooterScript(Theme::getPathForFile('js/linkPreview.js'));
DI::page()->registerFooterScript(Theme::getPathForFile('js/compose.js'));
- $contact = Contact::getById($a->contact_id);
+ $contact = Contact::getById($a->getContactId());
$tpl = Renderer::getMarkupTemplate('item/compose.tpl');
return Renderer::replaceMacros($tpl, [
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
// Redirect if the contact is already authenticated on this site.
- if (!empty($a->contact_id) && strpos($contact['nurl'], Strings::normaliseLink(DI::baseUrl()->get())) !== false) {
+ if (!empty($a->getContactId()) && strpos($contact['nurl'], Strings::normaliseLink(DI::baseUrl()->get())) !== false) {
if ($test) {
$ret['success'] = true;
$ret['message'] .= 'Local site - you are already authenticated.' . EOL;
$a = DI::app();
// Ensure we've got a profile owner if updating.
- $a->profile_owner = intval($_GET['p'] ?? 0);
+ $a->setProfileOwner($_GET['p'] ?? 0);
- if (DI::config()->get('system', 'block_public') && !local_user() && !Session::getRemoteContactID($a->profile_owner)) {
+ if (DI::config()->get('system', 'block_public') && !local_user() && !Session::getRemoteContactID($a->getProfileOwner())) {
throw new ForbiddenException();
}
- $remote_contact = Session::getRemoteContactID($a->profile_owner);
- $is_owner = local_user() == $a->profile_owner;
- $last_updated_key = "profile:" . $a->profile_owner . ":" . local_user() . ":" . $remote_contact;
+ $remote_contact = Session::getRemoteContactID($a->getProfileOwner());
+ $is_owner = local_user() == $a->getProfileOwner();
+ $last_updated_key = "profile:" . $a->getProfileOwner() . ":" . local_user() . ":" . $remote_contact;
if (!$is_owner && !$remote_contact) {
- $user = User::getById($a->profile_owner, ['hidewall']);
+ $user = User::getById($a->getProfileOwner(), ['hidewall']);
if ($user['hidewall']) {
throw new ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
}
}
// Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
- $sql_extra = Item::getPermissionsSQLByUserId($a->profile_owner);
+ $sql_extra = Item::getPermissionsSQLByUserId($a->getProfileOwner());
$last_updated_array = Session::get('last_updated', []);
AND `visible` AND (NOT `deleted` OR `gravity` = ?)
AND `wall` $sql_extra4 $sql_extra
GROUP BY `parent-uri-id` ORDER BY `received` DESC",
- $a->profile_owner,
+ $a->getProfileOwner(),
GRAVITY_ACTIVITY
);
$last_updated_array[$last_updated_key] = time();
Session::set('last_updated', $last_updated_array);
- if ($is_owner && !$a->profile_owner && !DI::config()->get('theme', 'hide_eventlist')) {
+ if ($is_owner && !$a->getProfileOwner() && !DI::config()->get('theme', 'hide_eventlist')) {
$o .= ProfileModel::getBirthdays();
$o .= ProfileModel::getEventsReminderHTML();
}
$items = DBA::toArray($items_stmt);
- $o .= conversation($a, $items, 'profile', $a->profile_owner, false, 'received', $a->profile_owner);
+ $o .= conversation($a, $items, 'profile', $a->getProfileOwner(), false, 'received', $a->getProfileOwner());
System::htmlUpdateExit($o);
}
$uid = $conv->getProfileOwner();
$parent_uid = $this->getDataValue('uid');
- $contact = Contact::getById($a->contact_id);
+ $contact = Contact::getById($a->getContactId());
$default_text = $this->getDefaultText();
$this->writable = true;
break;
case 'profile':
- $this->profile_owner = $a->profile_owner;
+ $this->profile_owner = $a->getProfileOwner();
$this->writable = Security::canWriteToUserWall($this->profile_owner);
break;
case 'display':
- $this->profile_owner = $a->profile_owner;
+ $this->profile_owner = $a->getProfileOwner();
$this->writable = Security::canWriteToUserWall($this->profile_owner) || $writable;
break;
case 'community':
if ($this->session->get('visitor_id') && !$this->session->get('uid')) {
$contact = $this->dba->selectFirst('contact', ['id'], ['id' => $this->session->get('visitor_id')]);
if ($this->dba->isResult($contact)) {
- $a->contact_id = $contact['id'];
+ $a->setContactId($contact['id']);
}
}
$contact = $this->dba->selectFirst('contact', ['id'], ['uid' => $user_record['uid'], 'self' => true]);
if ($this->dba->isResult($contact)) {
- $a->contact_id = $contact['id'];
+ $a->setContactId($contact['id']);
$this->session->set('cid', $contact['id']);
}