shorten some expressions with ??

This commit is contained in:
slawkens 2023-02-06 20:05:01 +01:00
parent 56bd2c86b7
commit 4eb9bbbbcf
7 changed files with 19 additions and 19 deletions

View File

@ -14,5 +14,5 @@ $twig->display('admin.login.html.twig', [
'logout' => (ACTION == 'logout' ? 'You have been logged out!' : ''), 'logout' => (ACTION == 'logout' ? 'You have been logged out!' : ''),
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number', 'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
'account_login_by' => getAccountLoginByLabel(), 'account_login_by' => getAccountLoginByLabel(),
'errors' => isset($errors)? $errors : '' 'errors' => $errors ?? ''
]); ]);

View File

@ -116,20 +116,20 @@ if($action == 'edit' || $action == 'new') {
'action' => $action, 'action' => $action,
'news_link' => getLink(PAGE), 'news_link' => getLink(PAGE),
'news_link_form' => '?p=news&action=' . ($action == 'edit' ? 'edit' : 'new'), 'news_link_form' => '?p=news&action=' . ($action == 'edit' ? 'edit' : 'new'),
'news_id' => isset($id) ? $id : null, 'news_id' => $id ?? null,
'title' => isset($p_title) ? $p_title : '', 'title' => $p_title ?? '',
'body' => isset($body) ? escapeHtml($body) : '', 'body' => isset($body) ? escapeHtml($body) : '',
'type' => isset($type) ? $type : null, 'type' => $type ?? null,
'player' => isset($player) && $player->isLoaded() ? $player : null, 'player' => isset($player) && $player->isLoaded() ? $player : null,
'player_id' => isset($player_id) ? $player_id : null, 'player_id' => $player_id ?? null,
'account_players' => $account_players, 'account_players' => $account_players,
'category' => isset($category) ? $category : 0, 'category' => $category ?? 0,
'categories' => $categories, 'categories' => $categories,
'forum_boards' => getForumBoards(), 'forum_boards' => getForumBoards(),
'forum_section' => isset($forum_section) ? $forum_section : null, 'forum_section' => $forum_section ?? null,
'comments' => isset($comments) ? $comments : null, 'comments' => $comments ?? null,
'article_text' => isset($article_text) ? $article_text : null, 'article_text' => $article_text ?? null,
'article_image' => isset($article_image) ? $article_image : null 'article_image' => $article_image ?? null
)); ));
} }

View File

@ -56,7 +56,7 @@ if(!$logged && isset($_POST['account_login'], $_POST['password_login']))
$tmp = array(); $tmp = array();
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
$t = isset($tmp[$ip]) ? $tmp[$ip] : NULL; $t = $tmp[$ip] ?? null;
} }
if(config('recaptcha_enabled') && !config('account_create_auto_login')) if(config('recaptcha_enabled') && !config('account_create_auto_login'))

View File

@ -16,10 +16,10 @@ if(!$logged)
$twig->display('error_box.html.twig', array('errors' => $errors)); $twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('account.login.html.twig', array( $twig->display('account.login.html.twig', array(
'redirect' => isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : null, 'redirect' => $_REQUEST['redirect'] ?? null,
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number', 'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
'account_login_by' => getAccountLoginByLabel(), 'account_login_by' => getAccountLoginByLabel(),
'error' => isset($errors[0]) ? $errors[0] : null 'error' => $errors[0] ?? null
)); ));
return; return;

View File

@ -63,10 +63,10 @@ if($show_form) {
} }
$twig->display('account.change_info.html.twig', array( $twig->display('account.change_info.html.twig', array(
'countries' => isset($countries) ? $countries : [], 'countries' => $countries ?? [],
'account_rlname' => $account_rlname, 'account_rlname' => $account_rlname,
'account_location' => $account_location, 'account_location' => $account_location,
'account_country' => isset($account_country) ? $account_country : '' 'account_country' => $account_country ?? ''
)); ));
} }
?> ?>

View File

@ -17,9 +17,9 @@ if(!$logged) {
return; return;
} }
$new_password = isset($_POST['newpassword']) ? $_POST['newpassword'] : NULL; $new_password = $_POST['newpassword'] ?? NULL;
$new_password2 = isset($_POST['newpassword2']) ? $_POST['newpassword2'] : NULL; $new_password2 = $_POST['newpassword2'] ?? NULL;
$old_password = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : NULL; $old_password = $_POST['oldpassword'] ?? NULL;
if(empty($new_password) && empty($new_password2) && empty($old_password)) { if(empty($new_password) && empty($new_password2) && empty($old_password)) {
$twig->display('account.change_password.html.twig'); $twig->display('account.change_password.html.twig');
} }

View File

@ -11,7 +11,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Confirm Email'; $title = 'Confirm Email';
$hash = isset($_GET['hash']) ? $_GET['hash'] : ''; $hash = $_GET['hash'] ?? '';
if(empty($hash)) { if(empty($hash)) {
warning('Please enter email hash code.<br/>If you copied the link, please try again with full link.'); warning('Please enter email hash code.<br/>If you copied the link, please try again with full link.');
return; return;