Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Feeds
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Feeds
Commits
2e3a9098
Commit
2e3a9098
authored
3 years ago
by
wn_
Browse files
Options
Downloads
Patches
Plain Diff
Address PHPStan warnings in 'classes/userhelper.php'.
parent
f704d25a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
classes/userhelper.php
+18
-16
18 additions, 16 deletions
classes/userhelper.php
with
18 additions
and
16 deletions
classes/userhelper.php
+
18
−
16
View file @
2e3a9098
...
...
@@ -32,7 +32,7 @@ class UserHelper {
/** has administrator permissions */
const
ACCESS_LEVEL_ADMIN
=
10
;
static
function
authenticate
(
string
$login
=
null
,
string
$password
=
null
,
bool
$check_only
=
false
,
string
$service
=
null
)
{
static
function
authenticate
(
string
$login
=
null
,
string
$password
=
null
,
bool
$check_only
=
false
,
string
$service
=
null
)
:
bool
{
if
(
!
Config
::
get
(
Config
::
SINGLE_USER_MODE
))
{
$user_id
=
false
;
$auth_module
=
false
;
...
...
@@ -99,7 +99,7 @@ class UserHelper {
}
}
static
function
load_user_plugins
(
int
$owner_uid
,
PluginHost
$pluginhost
=
null
)
{
static
function
load_user_plugins
(
int
$owner_uid
,
PluginHost
$pluginhost
=
null
)
:
void
{
if
(
!
$pluginhost
)
$pluginhost
=
PluginHost
::
getInstance
();
...
...
@@ -114,7 +114,7 @@ class UserHelper {
}
}
static
function
login_sequence
()
{
static
function
login_sequence
()
:
void
{
$pdo
=
Db
::
pdo
();
if
(
Config
::
get
(
Config
::
SINGLE_USER_MODE
))
{
...
...
@@ -159,7 +159,7 @@ class UserHelper {
}
}
static
function
print_user_stylesheet
()
{
static
function
print_user_stylesheet
()
:
void
{
$value
=
get_pref
(
Prefs
::
USER_STYLESHEET
);
if
(
$value
)
{
...
...
@@ -170,7 +170,7 @@ class UserHelper {
}
static
function
get_user_ip
()
{
static
function
get_user_ip
()
:
?string
{
foreach
([
"HTTP_X_REAL_IP"
,
"REMOTE_ADDR"
]
as
$hdr
)
{
if
(
isset
(
$_SERVER
[
$hdr
]))
return
$_SERVER
[
$hdr
];
...
...
@@ -179,7 +179,7 @@ class UserHelper {
return
null
;
}
static
function
get_login_by_id
(
int
$id
)
{
static
function
get_login_by_id
(
int
$id
)
:
?string
{
$user
=
ORM
::
for_table
(
'ttrss_users'
)
->
find_one
(
$id
);
...
...
@@ -189,7 +189,7 @@ class UserHelper {
return
null
;
}
static
function
find_user_by_login
(
string
$login
)
{
static
function
find_user_by_login
(
string
$login
)
:
?int
{
$user
=
ORM
::
for_table
(
'ttrss_users'
)
->
where
(
'login'
,
$login
)
->
find_one
();
...
...
@@ -200,7 +200,7 @@ class UserHelper {
return
null
;
}
static
function
logout
()
{
static
function
logout
()
:
void
{
if
(
session_status
()
===
PHP_SESSION_ACTIVE
)
session_destroy
();
...
...
@@ -211,11 +211,11 @@ class UserHelper {
session_commit
();
}
static
function
get_salt
()
{
static
function
get_salt
()
:
string
{
return
substr
(
bin2hex
(
get_random_bytes
(
125
)),
0
,
250
);
}
static
function
reset_password
(
$uid
,
$format_output
=
false
,
$new_password
=
""
)
{
static
function
reset_password
(
int
$uid
,
bool
$format_output
=
false
,
string
$new_password
=
""
)
:
void
{
$user
=
ORM
::
for_table
(
'ttrss_users'
)
->
find_one
(
$uid
);
$message
=
""
;
...
...
@@ -298,7 +298,7 @@ class UserHelper {
}
}
static
function
get_otp_secret
(
int
$owner_uid
,
bool
$show_if_enabled
=
false
)
{
static
function
get_otp_secret
(
int
$owner_uid
,
bool
$show_if_enabled
=
false
)
:
?string
{
$user
=
ORM
::
for_table
(
'ttrss_users'
)
->
find_one
(
$owner_uid
);
if
(
$user
)
{
...
...
@@ -333,7 +333,7 @@ class UserHelper {
return
null
;
}
static
function
is_default_password
()
{
static
function
is_default_password
()
:
bool
{
$authenticator
=
PluginHost
::
getInstance
()
->
get_plugin
(
$_SESSION
[
"auth_module"
]);
if
(
$authenticator
&&
...
...
@@ -345,10 +345,12 @@ class UserHelper {
return
false
;
}
static
function
hash_password
(
string
$pass
,
string
$salt
,
string
$algo
=
""
)
{
if
(
!
$algo
)
$algo
=
self
::
HASH_ALGOS
[
0
];
/**
* @param UserHelper::HASH_ALGO_* $algo
*
* @return false|string False if the password couldn't be hashed, otherwise the hash string.
*/
static
function
hash_password
(
string
$pass
,
string
$salt
,
string
$algo
=
self
::
HASH_ALGOS
[
0
])
{
$pass_hash
=
""
;
switch
(
$algo
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment