Improve update handling
This commit is contained in:
parent
de2493069c
commit
3501e1194d
2 changed files with 23 additions and 12 deletions
|
@ -132,12 +132,6 @@ if (!$options || !$options->getOption('isInstalled')) {
|
|||
if ($options && $options->getOption('isInstalled')) {
|
||||
if (-1 === version_compare($options->version, VERSION)) {
|
||||
$options->setOption('updateAvailable', true);
|
||||
|
||||
if (isset($user->power) && 100 === $user->power) {
|
||||
$page = 'update';
|
||||
} else {
|
||||
$page = 'maintenance';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,18 +116,19 @@ class Page
|
|||
/**
|
||||
* Session
|
||||
*/
|
||||
global $user;
|
||||
global $user, $options;
|
||||
|
||||
$disableRedirect = array(
|
||||
$ignorePower = array(
|
||||
'home',
|
||||
'login',
|
||||
'register',
|
||||
'install'
|
||||
'install',
|
||||
'maintenance',
|
||||
);
|
||||
if (
|
||||
!isset($_SESSION['user'])
|
||||
&& isset($_GET['page'])
|
||||
&& !in_array($_GET['page'], $disableRedirect)
|
||||
&& !in_array($_GET['page'], $ignorePower)
|
||||
) {
|
||||
redirect('/?page=login');
|
||||
}
|
||||
|
@ -139,11 +140,27 @@ class Page
|
|||
redirect('/?page=power&required=' . $this->power);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update
|
||||
*/
|
||||
$ignoreUpdateRedirect = array(
|
||||
'maintenance',
|
||||
'login',
|
||||
'logout',
|
||||
'update',
|
||||
);
|
||||
|
||||
if ($options && $options->getOption('updateAvailable') && !in_array($this->name, $ignoreUpdateRedirect)) {
|
||||
if (100 === $user->power) {
|
||||
redirect('/?page=update');
|
||||
} else {
|
||||
redirect('/?page=maintenance');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect
|
||||
*/
|
||||
global $options;
|
||||
|
||||
if ($options && $options->getOption('isInstalled') && isset($_SERVER['QUERY_STRING'])) {
|
||||
$url = new URL($_SERVER['QUERY_STRING']);
|
||||
$redirect_to = $url->getPretty();
|
||||
|
|
Loading…
Reference in a new issue