Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,21 +11,34 @@
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\core\Setup\Install as InstallClass;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\MultipleRedirect;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: Install
|
||||
*/
|
||||
class _install extends \IPS\Dispatcher\Controller
|
||||
class install extends Controller
|
||||
{
|
||||
/**
|
||||
* Install
|
||||
*/
|
||||
public function manage()
|
||||
public function manage() : void
|
||||
{
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
|
||||
@@ -34,20 +47,20 @@ class _install extends \IPS\Dispatcher\Controller
|
||||
a pause fixes the issue so we manually request a page refresh rather than doing it automatically */
|
||||
if ( ! isset( $INFO['admin_user'] ) )
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('install');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->manualStart();
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('install');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->manualStart();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$multipleRedirect = new \IPS\Helpers\MultipleRedirect(
|
||||
\IPS\Http\Url::internal( 'controller=install' ),
|
||||
$multipleRedirect = new MultipleRedirect(
|
||||
Url::internal( 'controller=install' ),
|
||||
function( $data )
|
||||
{
|
||||
try
|
||||
{
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
$install = new \IPS\core\Setup\Install(
|
||||
$install = new InstallClass(
|
||||
$INFO['apps'],
|
||||
$INFO['default_app'],
|
||||
$INFO['base_url'],
|
||||
@@ -59,43 +72,43 @@ class _install extends \IPS\Dispatcher\Controller
|
||||
$INFO['diagnostics_reporting']
|
||||
);
|
||||
}
|
||||
catch ( \InvalidArgumentException $e )
|
||||
catch ( InvalidArgumentException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'error', '4S112/1', 403, '' );
|
||||
Output::i()->error( 'error', '4S112/1', 403, '' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return $install->process( $data );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$backtrace = $e->getTraceAsString();
|
||||
|
||||
$error = \IPS\Theme::i()->getTemplate( 'global' )->error( "Error", $e->getMessage() ?: "Error", $e->getCode(), $backtrace );
|
||||
$error = Theme::i()->getTemplate( 'global' )->error( "Error", $e->getMessage() ?: "Error", $e->getCode(), $backtrace );
|
||||
|
||||
\IPS\Request::i()->start = true;
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('error');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'install', $error, FALSE );
|
||||
Request::i()->start = true;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('error');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->block( 'install', $error, FALSE );
|
||||
|
||||
/* If we're still here - output */
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
if ( Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Output::i()->output, 200, 'text/html' );
|
||||
Output::i()->sendOutput( Output::i()->output, 200, 'text/html' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( \IPS\Output::i()->title, \IPS\Output::i()->output ), 403, 'text/html' );
|
||||
Output::i()->sendOutput( Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( Output::i()->title, Output::i()->output ), 403, 'text/html' );
|
||||
}
|
||||
}
|
||||
},
|
||||
function()
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=done' ) );
|
||||
Output::i()->redirect( Url::internal( 'controller=done' ) );
|
||||
}
|
||||
);
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('install');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'install', $multipleRedirect, FALSE );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('install');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->block( 'install', $multipleRedirect, FALSE );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user