mirror of
https://github.com/friendica/friendica
synced 2025-04-27 21:10:11 +00:00
Many more app-variables removed
This commit is contained in:
parent
e05c1821c2
commit
2502a9192d
30 changed files with 310 additions and 401 deletions
|
@ -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->profile_owner = $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->profile_owner, '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,
|
||||
|
@ -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->profile_owner) ? intval($a->profile_owner) : 0;
|
||||
if (local_user() && (DI::pConfig()->get(local_user(), 'system', 'always_my_theme') || !$uid)) {
|
||||
return local_user();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue