mirror of
https://github.com/friendica/friendica
synced 2025-04-28 00:30:10 +00:00
Get rid of App->user completely
This commit is contained in:
parent
fc283ab928
commit
28090bd793
39 changed files with 158 additions and 234 deletions
26
src/App.php
26
src/App.php
|
@ -57,8 +57,6 @@ use Psr\Log\LoggerInterface;
|
|||
*/
|
||||
class App
|
||||
{
|
||||
public $user;
|
||||
|
||||
// Allow themes to control internal parameters
|
||||
// by changing App values in theme.php
|
||||
private $theme_info = [
|
||||
|
@ -151,6 +149,11 @@ class App
|
|||
$this->nickname = $nickname;
|
||||
}
|
||||
|
||||
public function isLoggedIn()
|
||||
{
|
||||
return local_user() && $this->user_id && ($this->user_id == local_user());
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the user id
|
||||
* @return int
|
||||
|
@ -169,25 +172,6 @@ class App
|
|||
return $this->nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a specific user field
|
||||
*
|
||||
* @param string $index
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUserValue(string $index)
|
||||
{
|
||||
if (empty($this->user_id)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (empty($this->user)) {
|
||||
$this->user = User::getById($this->user_id);
|
||||
}
|
||||
|
||||
return $this->user[$index] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the profile owner ID
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue