if (!empty($info['auth']) && api_user() === false) {
api_login($a);
- Logger::info(API_LOG_PREFIX . 'nickname {nickname}', ['module' => 'api', 'action' => 'call', 'nickname' => $a->getNickname()]);
+ Logger::info(API_LOG_PREFIX . 'nickname {nickname}', ['module' => 'api', 'action' => 'call', 'nickname' => $a->getUserNickname()]);
}
Logger::debug(API_LOG_PREFIX . 'parameters', ['module' => 'api', 'action' => 'call', 'parameters' => $_REQUEST]);
if (local_user()) {
$item = Post::selectFirstForUser(local_user(), $fields, ['guid' => DI::args()->getArgv()[1], 'uid' => local_user()]);
if (DBA::isResult($item)) {
- $nick = $a->getNickname();
+ $nick = $a->getUserNickname();
}
}
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => ' ', // DI::l10n()->t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
- '$nickname' => $a->getNickname(),
+ '$nickname' => $a->getUserNickname(),
'$is_mobile' => DI::mode()->isMobile(),
]);
$tabs = '';
// tabs
if ($a->getThemeInfoValue('events_in_profile')) {
- $tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->getNickname(), false);
+ $tabs = BaseProfile::getTabsHTML($a, 'events', true, $a->getUserNickname(), false);
}
$mode = 'view';
}
return [
- DI::baseUrl() . '/photos/' . $a->getNickname() . '/image/' . $rr['resource-id'],
+ DI::baseUrl() . '/photos/' . $a->getUserNickname() . '/image/' . $rr['resource-id'],
$filename_e,
DI::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext
];
'$folders' => $albums,
'$files' => $files,
'$cancel' => DI::l10n()->t('Cancel'),
- '$nickname' => $a->getNickname(),
+ '$nickname' => $a->getUserNickname(),
'$upload' => DI::l10n()->t('Upload')
]);
'$folders' => false,
'$files' => $files,
'$cancel' => DI::l10n()->t('Cancel'),
- '$nickname' => $a->getNickname(),
+ '$nickname' => $a->getUserNickname(),
'$upload' => DI::l10n()->t('Upload')
]);
}
{
$return_path = 'follow?url=' . urlencode($url);
- $result = Contact::createFromProbe($a->getUserId(), $url);
+ $result = Contact::createFromProbeForUser($a->getUserId(), $url);
if ($result['success'] == false) {
// Possibly it is a remote item and not an account
return Login::form();
}
- $myprofile = DI::baseUrl() . '/profile/' . $a->getNickname();
+ $myprofile = DI::baseUrl() . '/profile/' . $a->getUserNickname();
$tpl = Renderer::getMarkupTemplate('mail_head.tpl');
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'new') {
$tpl = Renderer::getMarkupTemplate('msg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => DI::baseUrl()->get(true),
- '$nickname' => $a->getNickname(),
+ '$nickname' => $a->getUserNickname(),
'$linkurl' => DI::l10n()->t('Please enter a link URL:')
]);
$tpl = Renderer::getMarkupTemplate('msg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => DI::baseUrl()->get(true),
- '$nickname' => $a->getNickname(),
+ '$nickname' => $a->getUserNickname(),
'$linkurl' => DI::l10n()->t('Please enter a link URL:')
]);
$tpl = Renderer::getMarkupTemplate($t);
$rslt = '';
- $myprofile = DI::baseUrl() . '/profile/' . $a->getNickname();
+ $myprofile = DI::baseUrl() . '/profile/' . $a->getUserNickname();
foreach ($msg as $rr) {
if ($rr['unknown']) {
return;
}
- $o = BaseProfile::getTabsHTML($a, 'notes', true, $a->getNickname(), false);
+ $o = BaseProfile::getTabsHTML($a, 'notes', true, $a->getUserNickname(), false);
if (!$update) {
$o .= '<h3>' . DI::l10n()->t('Personal Notes') . '</h3>';
$probed = Contact::getByURL($url);
if (in_array($probed['network'], Protocol::FEDERATED)) {
- $result = Contact::createFromProbe($a->getUserId(), $probed['url']);
+ $result = Contact::createFromProbeForUser($a->getUserId(), $probed['url']);
if ($result['success']) {
$o .= ' - ' . DI::l10n()->t('success');
} else {
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
- DI::baseUrl()->redirect('photos/' . $a->getNickname() . '/album/' . bin2hex($newalbum));
+ DI::baseUrl()->redirect('photos/' . $a->getUserNickname() . '/album/' . bin2hex($newalbum));
return; // NOTREACHED
}
$intro_count = count($intros1) + count($intros2);
$intros = $intros1 + $intros2;
- $myurl = DI::baseUrl() . '/profile/' . $a->getNickname();
+ $myurl = DI::baseUrl() . '/profile/' . $a->getUserNickname();
$mails = q(
"SELECT `id`, `from-name`, `from-url`, `from-photo`, `created` FROM `mail`
WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
$o .= "<p>".DI::l10n()->t("Keep this window open until done.")."</p>";
- Contact::createFromProbe($a->getUserId(), $r[0]["url"]);
+ Contact::createFromProbeForUser($a->getUserId(), $r[0]["url"]);
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="1; URL=' . DI::baseUrl() . '/repair_ostatus?counter='.$counter.'">';
$username = $user['username'];
$email = $user['email'];
- $nickname = $a->getNickname();
+ $nickname = $a->getUserNickname();
$timezone = $user['timezone'];
$language = $user['language'];
$notify = $user['notify-flags'];
* Fetch the user nick name
* @return string
*/
- public function getNickname()
+ public function getUserNickname()
{
return $this->nickname;
}
// If you're just visiting, let javascript take you home
if (!empty($_SESSION['visitor_home'])) {
$homebase = $_SESSION['visitor_home'];
- } elseif (!empty($app->getNickname())) {
- $homebase = 'profile/' . $app->getNickname();
+ } elseif (!empty($app->getUserNickname())) {
+ $homebase = 'profile/' . $app->getUserNickname();
}
if (isset($homebase)) {
public static function checkFormSecurityTokenRedirectOnError($err_redirect, $typename = '', $formname = 'form_security_token')
{
if (!self::checkFormSecurityToken($typename, $formname)) {
- Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getNickname() . ' - form element ' . $typename);
+ Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getUserNickname() . ' - form element ' . $typename);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
notice(self::getFormSecurityStandardErrorMessage());
DI::baseUrl()->redirect($err_redirect);
public static function checkFormSecurityTokenForbiddenOnError($typename = '', $formname = 'form_security_token')
{
if (!self::checkFormSecurityToken($typename, $formname)) {
- Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getNickname() . ' - form element ' . $typename);
+ Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getUserNickname() . ' - form element ' . $typename);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
throw new \Friendica\Network\HTTPException\ForbiddenException();
$network = CliPrompt::prompt();
}
- $result = ContactModel::createFromProbe($user['uid'], $url, $network);
+ $result = ContactModel::createFromProbeForUser($user['uid'], $url, $network);
if ($result['success']) {
$this->out('User ' . $user['nickname'] . ' now connected to ' . $url . ', contact ID ' . $result['cid']);
* Display the current site location as a navigation aid.
*/
- $myident = !empty($a->getNickname() ? $a->getNickname() . '@' : '');
+ $myident = !empty($a->getUserNickname()) ? $a->getUserNickname() . '@' : '';
$sitelocation = $myident . substr(DI::baseUrl()->get($ssl_state), strpos(DI::baseUrl()->get($ssl_state), '//') + 2);
if ($a->isLoggedIn()) {
// user menu
- $nav['usermenu'][] = ['profile/' . $a->getNickname(), DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
- $nav['usermenu'][] = ['profile/' . $a->getNickname() . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
- $nav['usermenu'][] = ['photos/' . $a->getNickname(), DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
- $nav['usermenu'][] = ['videos/' . $a->getNickname(), DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')];
+ $nav['usermenu'][] = ['profile/' . $a->getUserNickname(), DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
+ $nav['usermenu'][] = ['profile/' . $a->getUserNickname() . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
+ $nav['usermenu'][] = ['photos/' . $a->getUserNickname(), DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
+ $nav['usermenu'][] = ['videos/' . $a->getUserNickname(), DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')];
$nav['usermenu'][] = ['events/', DI::l10n()->t('Events'), '', DI::l10n()->t('Your events')];
$nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')];
}
// The following nav links are only show to logged in users
- if (local_user() && !empty($a->getNickname())) {
+ if (local_user() && !empty($a->getUserNickname())) {
$nav['network'] = ['network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')];
- $nav['home'] = ['profile/' . $a->getNickname(), DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')];
+ $nav['home'] = ['profile/' . $a->getUserNickname(), DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')];
// Don't show notifications for public communities
if (Session::get('page_flags', '') != User::PAGE_FLAGS_COMMUNITY) {
$this->l10n = $l10n;
$this->pConfig = $pConfig;
$this->session = $session;
- $this->nick = $app->getNickname() ?? '';
+ $this->nick = $app->getUserNickname() ?? '';
}
/**
* @throws HTTPException\NotFoundException
* @throws \ImagickException
*/
- public static function createFromProbe(int $uid, $url, $network = '')
+ public static function createFromProbeForUser(int $uid, $url, $network = '')
{
$result = ['cid' => -1, 'success' => false, 'message' => ''];
{
$contact = self::getById($cid, ['url']);
- $result = self::createFromProbe($uid, $contact['url']);
+ $result = self::createFromProbeForUser($uid, $contact['url']);
return $result['cid'];
}
}
} elseif (DBA::isResult($user) && in_array($user['page-flags'], [User::PAGE_FLAGS_SOAPBOX, User::PAGE_FLAGS_FREELOVE, User::PAGE_FLAGS_COMMUNITY])) {
if (($user['page-flags'] == User::PAGE_FLAGS_FREELOVE) && ($network != Protocol::DIASPORA)) {
- self::createFromProbe($importer['uid'], $url, $network);
+ self::createFromProbeForUser($importer['uid'], $url, $network);
}
$condition = ['uid' => $importer['uid'], 'url' => $url, 'pending' => true];
$recip_host = substr($recip_host, 0, strpos($recip_host, '/'));
$recip_handle = (($contact['addr']) ? $contact['addr'] : $contact['nick'] . '@' . $recip_host);
- $sender_handle = $a->getNickname() . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
+ $sender_handle = $a->getUserNickname() . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
$conv_guid = System::createUUID();
$convuri = $recip_handle . ':' . $conv_guid;
}
if ($contact['network'] == Protocol::OSTATUS) {
- $result = Model\Contact::createFromProbe($contact['uid'], $contact['url'], $contact['network']);
+ $result = Model\Contact::createFromProbeForUser($contact['uid'], $contact['url'], $contact['network']);
if ($result['success']) {
DBA::update('contact', ['subhub' => 1], ['id' => $contact_id]);
$ret = [];
Hook::callAll('home_init', $ret);
- DI::baseUrl()->redirect('profile/' . DI::app()->getNickname());
+ DI::baseUrl()->redirect('profile/' . DI::app()->getUserNickname());
// NOTREACHED
}
$identities[$key]['thumb'] = Contact::getAvatarUrlForId($self['id'], Proxy::SIZE_THUMB, $self['updated']);
- $identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getNickname());
+ $identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getUserNickname());
$condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Notification\Type::INTRO, Notification\Type::MAIL];
$params = ['distinct' => true, 'expression' => 'parent'];
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user
- $nickname = $a->getNickname();
+ $nickname = $a->getUserNickname();
} elseif (empty($parameters['action'])) {
// Show the profile hCard
$nickname = $parameters['profile'];
Hook::callAll('home_init', $ret);
- if (local_user() && ($app->getNickname())) {
+ if (local_user() && ($app->getUserNickname())) {
DI::baseUrl()->redirect('network');
}
DI::l10n()->t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n"
. $linkTxt
. "\r\n" . "\r\n" . (($inviteOnly) ? DI::l10n()->t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . DI::l10n()->t('Once you have registered, please connect with me via my profile page at:')
- . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->getNickname()
+ . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->getUserNickname()
. "\r\n" . "\r\n" . DI::l10n()->t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n",
],
'$submit' => DI::l10n()->t('Submit')
$which = $parameters['nick'];
} elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login)
- $which = $a->getNickname();
+ $which = $a->getUserNickname();
} else {
System::jsonError(403, 'Authentication required');
}
$a = DI::app();
- $o = self::getTabsHTML($a, 'schedule', true, $a->getNickname(), false);
+ $o = self::getTabsHTML($a, 'schedule', true, $a->getUserNickname(), false);
$schedule = [];
$delayed = DBA::select('delayed-post', [], ['uid' => local_user()]);
$selectionW = intval($_POST['width'] ?? 0);
$selectionH = intval($_POST['height'] ?? 0);
- $path = 'profile/' . DI::app()->getNickname();
+ $path = 'profile/' . DI::app()->getUserNickname();
$base_image = Photo::selectFirst([], ['resource-id' => $resource_id, 'uid' => local_user(), 'scale' => $scale]);
if (DBA::isResult($base_image)) {
info(DI::l10n()->t('Profile picture successfully updated.'));
- DI::baseUrl()->redirect('profile/' . DI::app()->getNickname());
+ DI::baseUrl()->redirect('profile/' . DI::app()->getUserNickname());
}
$Image = Photo::getImageForPhoto($photos[0]);
DI::l10n()->t('or'),
($newuser) ?
'<a href="' . DI::baseUrl() . '">' . DI::l10n()->t('skip this step') . '</a>'
- : '<a href="' . DI::baseUrl() . '/photos/' . DI::app()->getNickname() . '">'
+ : '<a href="' . DI::baseUrl() . '/photos/' . DI::app()->getUserNickname() . '">'
. DI::l10n()->t('select a photo from your photo albums') . '</a>'
),
]);
switch ($action) {
case "backup":
header("Content-type: application/json");
- header('Content-Disposition: attachment; filename="' . DI::app()->getNickname() . '.' . $action . '"');
+ header('Content-Disposition: attachment; filename="' . DI::app()->getUserNickname() . '.' . $action . '"');
self::exportAll(local_user());
break;
case "account":
header("Content-type: application/json");
- header('Content-Disposition: attachment; filename="' . DI::app()->getNickname() . '.' . $action . '"');
+ header('Content-Disposition: attachment; filename="' . DI::app()->getUserNickname() . '.' . $action . '"');
self::exportAccount(local_user());
break;
case "contact":
header("Content-type: application/csv");
- header('Content-Disposition: attachment; filename="' . DI::app()->getNickname() . '-contacts.csv' . '"');
+ header('Content-Disposition: attachment; filename="' . DI::app()->getUserNickname() . '-contacts.csv' . '"');
self::exportContactsAsCSV(local_user());
break;
}
$disclaimer = '<hr />' . $l10n->t('This message was sent to you by %s, a member of the Friendica social network.', $user['username'])
. '<br />';
- $disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->getNickname()) . EOL;
+ $disclaimer .= $l10n->t('You may visit them online at %s', $baseUrl . '/profile/' . $a->getUserNickname()) . EOL;
$disclaimer .= $l10n->t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$item['title'] == '') {
$subject = EmailProtocol::encodeHeader($item['title'], 'UTF-8');
} else {
$subject = EmailProtocol::encodeHeader('[Friendica]' . ' ' . $l10n->t('%s posted an update.', $user['username']), 'UTF-8');
}
- $link = '<a href="' . $baseUrl . '/profile/' . $a->getNickname() . '"><img src="' . $authorThumb . '" alt="' . $user['username'] . '" /></a><br /><br />';
+ $link = '<a href="' . $baseUrl . '/profile/' . $a->getUserNickname() . '"><img src="' . $authorThumb . '" alt="' . $user['username'] . '" /></a><br /><br />';
$html = Item::prepareBody($item);
$message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';;
return;
}
- $result = Contact::createFromProbe($uid, $url);
+ $result = Contact::createFromProbeForUser($uid, $url);
Logger::info('Added contact', ['uid' => $uid, 'url' => $url, 'result' => $result]);
}
}
$args = DI::args();
- if ($args->get(0) === 'profile' && $args->get(1) === ($a->getNickname() ?? '') || $args->get(0) === 'network' && local_user()
+ if ($args->get(0) === 'profile' && $args->get(1) === ($a->getUserNickname() ?? '') || $args->get(0) === 'network' && local_user()
) {
vier_community_info();