use Friendica\Content\Text\HTML;
use Friendica\Content\Widget\ContactBlock;
use Friendica\Core\Cache\Duration;
-use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
*
* @param App $a
* @param string $nickname string
- * @param int $profile int
+ * @param int $profile_id int
* @param array $profiledata array
* @param boolean $show_connect Show connect link
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function load(App $a, $nickname, $profile = 0, array $profiledata = [], $show_connect = true)
+ public static function load(App $a, $nickname, $profile_id = 0, array $profiledata = [], $show_connect = true)
{
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
}
}
- $pdata = self::getByNickname($nickname, $user['uid'], $profile);
+ $profile = self::getByNickname($nickname, $user['uid'], $profile_id);
- if (empty($pdata) && empty($profiledata)) {
+ if (empty($profile) && empty($profiledata)) {
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
return;
}
- if (empty($pdata)) {
- $pdata = ['uid' => 0, 'profile_uid' => 0, 'is-default' => false,'name' => $nickname];
+ if (empty($profile)) {
+ $profile = ['uid' => 0, 'is-default' => false,'name' => $nickname];
}
// fetch user tags if this isn't the default profile
- if (!$pdata['is-default']) {
- $condition = ['uid' => $pdata['profile_uid'], 'is-default' => true];
- $profile = DBA::selectFirst('profile', ['pub_keywords'], $condition);
- if (DBA::isResult($profile)) {
- $pdata['pub_keywords'] = $profile['pub_keywords'];
+ if (!$profile['is-default']) {
+ $condition = ['uid' => $profile['uid'], 'is-default' => true];
+ $profile_id = DBA::selectFirst('profile', ['pub_keywords'], $condition);
+ if (DBA::isResult($profile_id)) {
+ $profile['pub_keywords'] = $profile_id['pub_keywords'];
}
}
- $a->profile = $pdata;
- $a->profile_uid = $pdata['profile_uid'];
+ $a->profile = $profile;
+ $a->profile_uid = $profile['uid'];
- $a->profile['mobile-theme'] = DI::pConfig()->get($a->profile['profile_uid'], 'system', 'mobile_theme');
+ $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');
$profile = DBA::fetchFirst(
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`,
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
- `profile`.`uid` AS `profile_uid`, `profile`.*,
+ `profile`.*,
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `contact`.`url`, `user`.*
FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
$profile = DBA::fetchFirst(
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
- `profile`.`uid` AS `profile_uid`, `profile`.*,
+ `profile`.*,
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `contact`.`url`, `user`.*
FROM `profile`
INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
$profile_is_dfrn = $profile['network'] == Protocol::DFRN;
$profile_is_native = in_array($profile['network'], Protocol::NATIVE_SUPPORT);
- $local_user_is_self = local_user() && local_user() == ($profile['profile_uid'] ?? 0);
+ $local_user_is_self = local_user() && local_user() == ($profile['uid'] ?? 0);
$visitor_is_authenticated = (bool)self::getMyURL();
$visitor_is_following =
in_array($visitor_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND])
$p['url'] = Contact::magicLink(($p['url'] ?? '') ?: $profile_url);
- $tpl = Renderer::getMarkupTemplate('profile_vcard.tpl');
+ $tpl = Renderer::getMarkupTemplate('profile/vcard.tpl');
$o .= Renderer::replaceMacros($tpl, [
'$profile' => $p,
'$xmpp' => $xmpp,
$uid = intval($a->profile['uid']);
if ($a->profile['name']) {
- $tpl = Renderer::getMarkupTemplate('profile_advanced.tpl');
-
$profile = [];
$profile['fullname'] = [DI::l10n()->t('Full Name:'), $a->profile['name']];
if (!empty($a->profile['dob'])
&& $a->profile['dob'] > DBA::NULL_DATE
- && $age = Temporal::getAgeByTimezone($a->profile['dob'], $a->profile['timezone'], '')
+ && $age = Temporal::getAgeByTimezone($a->profile['dob'], $a->profile['timezone'])
) {
- $profile['age'] = [DI::l10n()->t('Age:'), $age];
+ $profile['age'] = [DI::l10n()->t('Age: ') , DI::l10n()->tt('%d year old', '%d years old', $age)];
}
if ($a->profile['marital']) {
$profile['edit'] = [DI::baseUrl() . '/profiles/' . $a->profile['id'], DI::l10n()->t('Edit profile'), '', DI::l10n()->t('Edit profile')];
}
+ $tpl = Renderer::getMarkupTemplate('profile/advanced.tpl');
return Renderer::replaceMacros($tpl, [
'$title' => DI::l10n()->t('Profile'),
'$basic' => DI::l10n()->t('Basic'),