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,32 +11,48 @@
|
||||
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 IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Email;
|
||||
use IPS\Helpers\Form\Password;
|
||||
use IPS\Helpers\Form\Text;
|
||||
use IPS\Helpers\Form\TextArea;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
use function file_put_contents;
|
||||
use function function_exists;
|
||||
|
||||
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: Admin Account
|
||||
*/
|
||||
class _admin extends \IPS\Dispatcher\Controller
|
||||
class admin extends Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*/
|
||||
public function manage()
|
||||
public function manage() : void
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'admin', 'continue' );
|
||||
$form = new Form( 'admin', 'continue' );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'admin_user', NULL, TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Password( 'admin_pass1', NULL, TRUE, array() ) );
|
||||
$form->add( new \IPS\Helpers\Form\Password( 'admin_pass2', NULL, TRUE, array( 'confirm' => 'admin_pass1' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Email( 'admin_email', NULL, TRUE ) );
|
||||
$form->add( new Text( 'admin_user', NULL, TRUE ) );
|
||||
$form->add( new Password( 'admin_pass1', NULL, TRUE, array() ) );
|
||||
$form->add( new Password( 'admin_pass2', NULL, TRUE, array( 'confirm' => 'admin_pass1' ) ) );
|
||||
$form->add( new Email( 'admin_email', NULL, TRUE ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$INFO = NULL;
|
||||
$INFO = [];
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
$INFO = array_merge( $INFO, $values );
|
||||
|
||||
@@ -44,33 +60,33 @@ class _admin extends \IPS\Dispatcher\Controller
|
||||
|
||||
try
|
||||
{
|
||||
if ( \file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', $toWrite ) )
|
||||
if ( file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', $toWrite ) )
|
||||
{
|
||||
/* PHP 5.5 - clear opcode cache or details won't be seen on next page load */
|
||||
if ( \function_exists( 'opcache_invalidate' ) )
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( \IPS\ROOT_PATH . '/conf_global.php' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=install' ) );
|
||||
Output::i()->redirect( Url::internal( 'controller=install' ) );
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
catch( Exception $ex )
|
||||
{
|
||||
$errorform = new \IPS\Helpers\Form( 'admin', 'continue' );
|
||||
$errorform->add( new \IPS\Helpers\Form\TextArea( 'conf_global_error', $toWrite, FALSE ) );
|
||||
$errorform = new Form( 'admin', 'continue' );
|
||||
$errorform->add( new TextArea( 'conf_global_error', $toWrite, FALSE ) );
|
||||
|
||||
foreach( $values as $k => $v )
|
||||
{
|
||||
$errorform->hiddenValues[ $k ] = $v;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->confWriteError( $errorform, \IPS\ROOT_PATH );
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->confWriteError( $errorform, \IPS\ROOT_PATH );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('admin');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'admin', $form );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('admin');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->block( 'admin', $form );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user