Replace x() by isset(), !empty() or defaults()
- Remove extraneous parentheses around empty() calls - Remove duplicate calls to intval(), count() or strlen() after empty() - Replace ternary operators outputting binary value with empty() return value - Rewrite defaults() without x()
This commit is contained in:
parent
ea4e772b1e
commit
458981f75c
101 changed files with 896 additions and 914 deletions
|
|
@ -27,7 +27,7 @@ function delegate_post(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
|
||||
if (count($a->user) && !empty($a->user['uid']) && $a->user['uid'] != local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ function delegate_content(App $a)
|
|||
|
||||
if ($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
|
||||
// delegated admins can view but not change delegation permissions
|
||||
if (x($_SESSION, 'submanage')) {
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
$a->internalRedirect('delegate');
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ function delegate_content(App $a)
|
|||
|
||||
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
|
||||
// delegated admins can view but not change delegation permissions
|
||||
if (x($_SESSION, 'submanage')) {
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
$a->internalRedirect('delegate');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue