Fix php errors during install
This commit is contained in:
parent
05a8549566
commit
43a6d67909
2 changed files with 17 additions and 8 deletions
|
@ -20,11 +20,19 @@ class Options
|
|||
|
||||
public function getOption(string $key): string
|
||||
{
|
||||
$value = '';
|
||||
|
||||
try {
|
||||
$option = $this->database->query(
|
||||
'SELECT * FROM `options`
|
||||
WHERE `key` = "' . $key . '";'
|
||||
)->fetch();
|
||||
|
||||
return $option['value'] ?? '';
|
||||
$value = $option['value'] ?? '';
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ class Page
|
|||
*/
|
||||
$disableRedirect = array(
|
||||
'login',
|
||||
'register',
|
||||
'install'
|
||||
);
|
||||
if (!isset($_SESSION['user']) && isset($_GET['page']) && !in_array($_GET['page'], $disableRedirect)) {
|
||||
|
@ -126,9 +127,9 @@ class Page
|
|||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<?php
|
||||
$user = new User();
|
||||
$user = isset($_SESSION['user']) ? new User() : null;
|
||||
|
||||
if ($user->isLoggedIn()) {
|
||||
if ($user && $user->isLoggedIn()) {
|
||||
?>
|
||||
<a class="item" href="/?page=logout">
|
||||
<i class="sign out alternate icon"></i>
|
||||
|
@ -151,7 +152,7 @@ class Page
|
|||
</div>
|
||||
</div>
|
||||
<?php global $options; ?>
|
||||
<?php if ($options->updateAvailable) { ?>
|
||||
<?php if ($options->updateAvailable && $user && $user->isLoggedIn()) { ?>
|
||||
<a class="item" href="/?page=update">
|
||||
<i class="upload icon"></i> Update
|
||||
</a>
|
||||
|
|
Loading…
Reference in a new issue