mirror of
https://github.com/friendica/friendica
synced 2025-04-26 03:10:13 +00:00
Rearranged function order
This commit is contained in:
parent
11c8dfe73a
commit
95cac04540
2 changed files with 52 additions and 52 deletions
|
@ -38,6 +38,25 @@ class BasicAuth
|
|||
*/
|
||||
protected static $current_token = [];
|
||||
|
||||
/**
|
||||
* Get current user id, returns 0 if $login is set to false and not logged in.
|
||||
* When $login is true, the execution will stop when not logged in.
|
||||
*
|
||||
* @param bool $login Perform a login request if "true"
|
||||
*
|
||||
* @return int User ID
|
||||
*/
|
||||
public static function getCurrentUserID(bool $login = true)
|
||||
{
|
||||
if (empty(self::$current_user_id)) {
|
||||
api_login(DI::app(), $login);
|
||||
|
||||
self::$current_user_id = api_user();
|
||||
}
|
||||
|
||||
return (int)self::$current_user_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a dummy application token
|
||||
*
|
||||
|
@ -66,23 +85,4 @@ class BasicAuth
|
|||
|
||||
return self::$current_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current user id, returns 0 if $login is set to false and not logged in.
|
||||
* When $login is true, the execution will stop when not logged in.
|
||||
*
|
||||
* @param bool $login Perform a login request if "true"
|
||||
*
|
||||
* @return int User ID
|
||||
*/
|
||||
public static function getCurrentUserID(bool $login = true)
|
||||
{
|
||||
if (empty(self::$current_user_id)) {
|
||||
api_login(DI::app(), $login);
|
||||
|
||||
self::$current_user_id = api_user();
|
||||
}
|
||||
|
||||
return (int)self::$current_user_id;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue