Version 4.0.13.1
This commit is contained in:
1 parent
f9e857d255
commit
c6a86f0d9b
7517 files changed
+597400
-668041
No files matched your search
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Installer: Admin Account
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 2 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: Admin Account
|
||||
*/
|
||||
class _admin extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
$form = new \IPS\Helpers\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 ) );
|
||||
$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 ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$INFO = NULL;
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
$INFO = array_merge( $INFO, $values );
|
||||
|
||||
$toWrite = "<?php\n\n" . '$INFO = ' . var_export( $INFO, TRUE ) . ";";
|
||||
|
||||
try
|
||||
{
|
||||
if ( \file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', $toWrite ) )
|
||||
{
|
||||
/* PHP 5.6 - clear opcode cache or details won't be seen on next page load */
|
||||
if( function_exists('opcache_reset') )
|
||||
{
|
||||
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
|
||||
@opcache_reset();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=install' ) );
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
{
|
||||
$errorform = new \IPS\Helpers\Form( 'admin', 'continue' );
|
||||
$errorform->add( new \IPS\Helpers\Form\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 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('admin');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'admin', $form );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Installer: Applications
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 2 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: Applications
|
||||
*/
|
||||
class _applications extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
$INFO = NULL;
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
|
||||
if( !isset( $INFO['lkey'] ) OR !$INFO['lkey'] )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=license' ) );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'applications', 'continue' );
|
||||
|
||||
$apps = array();
|
||||
$defaultTicks = array( 'core' );
|
||||
foreach( new \DirectoryIterator( \IPS\ROOT_PATH . '/applications' ) as $app )
|
||||
{
|
||||
if ( mb_substr( $app, 0, 1 ) !== '.' and $app != 'index.html' )
|
||||
{
|
||||
/* Skip incomplete apps */
|
||||
if ( ! is_dir( $app->getPathName() . '/data' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
|
||||
if ( file_exists( $app->getPathName() . '/setup/requirements.php' ) )
|
||||
{
|
||||
require $app->getPathName() . '/setup/requirements.php';
|
||||
}
|
||||
|
||||
if ( empty( $errors ) and (string) $app !== 'core' )
|
||||
{
|
||||
$defaultTicks[] = (string) $app;
|
||||
}
|
||||
|
||||
$name = $app;
|
||||
|
||||
/* Get app name */
|
||||
if ( file_exists( $app->getPathName() . '/data/lang.xml' ) )
|
||||
{
|
||||
$xml = new \XMLReader;
|
||||
$xml->open( $app->getPathName() . '/data/lang.xml' );
|
||||
$xml->read();
|
||||
|
||||
$xml->read();
|
||||
while ( $xml->read() )
|
||||
{
|
||||
if ( $xml->getAttribute('key') === '__app_' . $app )
|
||||
{
|
||||
$name = $xml->readString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$apps[ (string) $app ] = array(
|
||||
'name' => (string) $name,
|
||||
'disabled' => ( !empty( $errors ) or (string) $app === 'core' ),
|
||||
'errors' => $errors,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Bring core app to top */
|
||||
$system['core'] = $apps['core'];
|
||||
unset( $apps['core'] );
|
||||
$apps = array_merge( $system, $apps );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Custom( 'apps', $defaultTicks, TRUE, array(
|
||||
'getHtml' => function( $element ) use ( $apps )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'forms' )->apps( $apps, $element->value );
|
||||
},
|
||||
'validate' => function( $element ) use ( $defaultTicks )
|
||||
{
|
||||
if ( !in_array( 'core', $element->value ) )
|
||||
{
|
||||
$element->value['core'] = TRUE;
|
||||
}
|
||||
$uninstallable = array_diff( array_keys( $element->value ), $defaultTicks );
|
||||
if ( !empty( $uninstallable ) )
|
||||
{
|
||||
throw new \DomainException;
|
||||
}
|
||||
}
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Custom( 'default_app', 'forums', TRUE, array(
|
||||
'getHtml' => function( $element ) use ( $apps )
|
||||
{
|
||||
$options = array_combine( array_keys( $apps ), array_map( function( $value ){ return $value['name']; }, $apps ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'forms' )->select( 'default_app', $element->value, TRUE, $options );
|
||||
},
|
||||
'validate' => function( $element ) use ( $apps )
|
||||
{
|
||||
if ( !in_array( $element->value, array_keys( $apps ) ) or !array_key_exists( $element->value, \IPS\Request::i()->apps ) )
|
||||
{
|
||||
throw new \DomainException('default_app_invalid');
|
||||
}
|
||||
}
|
||||
) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( !in_array( $values['default_app'], array_keys( $values['apps'] ) ) )
|
||||
{
|
||||
throw new \DomainException('default_app_invalid');
|
||||
}
|
||||
|
||||
$INFO['apps'] = array_keys( $values['apps'] );
|
||||
$INFO['default_app'] = $values['default_app'];
|
||||
|
||||
$toWrite = "<?php\n\n" . '$INFO = ' . var_export( $INFO, TRUE ) . ';';
|
||||
|
||||
try
|
||||
{
|
||||
if ( \file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', $toWrite ) )
|
||||
{
|
||||
/* PHP 5.6 - clear opcode cache or details won't be seen on next page load */
|
||||
if( function_exists('opcache_reset') )
|
||||
{
|
||||
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
|
||||
@opcache_reset();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=serverdetails' ) );
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
{
|
||||
$errorform = new \IPS\Helpers\Form( 'applications', 'continue' );
|
||||
$errorform->add( new \IPS\Helpers\Form\TextArea( 'conf_global_error', $toWrite, FALSE ) );
|
||||
$errorform->class = 'ipsForm_vertical';
|
||||
|
||||
foreach( $values as $k => $v )
|
||||
{
|
||||
$errorform->hiddenValues[ $k ] = $v;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->confWriteError( $errorform, \IPS\ROOT_PATH );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('applications');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'applications', $form );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Installer: Finished Screen
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 2 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: Finished Screen
|
||||
*/
|
||||
class _done extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Finished
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
/* Reset theme maps to make sure bad data hasn't been cached by visits mid-setup */
|
||||
foreach( \IPS\Application::applications() as $app => $data )
|
||||
{
|
||||
\IPS\Theme::deleteCompiledTemplate( $app);
|
||||
\IPS\Theme::deleteCompiledCss( $app );
|
||||
\IPS\Theme::deleteCompiledResources( $app );
|
||||
}
|
||||
|
||||
\IPS\Output::clearJsFiles();
|
||||
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $INFO['lkey'] ), array( 'conf_key=?', 'ipb_reg_number' ) );
|
||||
\IPS\Settings::i()->ipb_reg_number = $INFO['lkey'];
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
\file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', "<?php\n\n" . '$INFO = ' . var_export( array(
|
||||
'sql_host' => $INFO['sql_host'],
|
||||
'sql_database' => $INFO['sql_database'],
|
||||
'sql_user' => $INFO['sql_user'],
|
||||
'sql_pass' => $INFO['sql_pass'],
|
||||
'sql_port' => $INFO['sql_port'],
|
||||
'sql_socket' => $INFO['sql_socket'],
|
||||
'sql_tbl_prefix' => $INFO['sql_tbl_prefix'],
|
||||
'sql_utf8mb4' => $INFO['sql_utf8mb4'],
|
||||
'board_start' => time(),
|
||||
'installed' => TRUE,
|
||||
'base_url' => $INFO['base_url'],
|
||||
'guest_group' => 2,
|
||||
'member_group' => 3,
|
||||
'admin_group' => 4
|
||||
), TRUE ) . ';' );
|
||||
|
||||
/* PHP 5.6 - clear opcode cache or details won't be seen on next page load */
|
||||
if( function_exists('opcache_reset') )
|
||||
{
|
||||
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
|
||||
@opcache_reset();
|
||||
}
|
||||
|
||||
\IPS\Settings::i()->base_url = $INFO['base_url'];
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('done');
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Installer: Install
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 2 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: Install
|
||||
*/
|
||||
class _install extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Install
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
|
||||
/* Zend Server has an issue where it caches 'require'd files which means the admin details written in the
|
||||
previous step aren't in the $INFO array which causes the MultiRedirect to fail. Making the page reload after
|
||||
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();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$multipleRedirect = new \IPS\Helpers\MultipleRedirect(
|
||||
\IPS\Http\Url::internal( 'controller=install' ),
|
||||
function( $data )
|
||||
{
|
||||
try
|
||||
{
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
$install = new \IPS\core\Setup\Install(
|
||||
$INFO['apps'],
|
||||
$INFO['default_app'],
|
||||
$INFO['base_url'],
|
||||
mb_substr( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), 0, -mb_strlen( 'install/index.php' ) ),
|
||||
array( 'sql_host' => $INFO['sql_host'], 'sql_user' => $INFO['sql_user'], 'sql_pass' => $INFO['sql_pass'], 'sql_database' => $INFO['sql_database'], 'sql_port' => $INFO['sql_port'], 'sql_socket' => $INFO['sql_socket'], 'sql_tbl_prefix' => $INFO['sql_tbl_prefix'] ),
|
||||
$INFO['admin_user'],
|
||||
$INFO['admin_pass1'],
|
||||
$INFO['admin_email'],
|
||||
$INFO['lkey']
|
||||
);
|
||||
}
|
||||
catch ( \InvalidArgumentException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'error', '4S112/1', 403, '' );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return $install->process( $data );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
ob_start();
|
||||
$backtrace = print_r( debug_backtrace( 0 ), TRUE );
|
||||
|
||||
$error = \IPS\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 );
|
||||
|
||||
/* If we're still here - output */
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Output::i()->output, 200, 'text/html', \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( \IPS\Output::i()->title, \IPS\Output::i()->output ), 403, 'text/html', \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
}
|
||||
},
|
||||
function()
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\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 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Installer: License
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 2 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: License
|
||||
*/
|
||||
class _license extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'license', 'continue', \IPS\Http\Url::external( ( \IPS\Request::i()->isSecure() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '?controller=license' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'lkey', NULL, TRUE, array( 'size' => 50 ), function( $val )
|
||||
{
|
||||
\IPS\IPS::checkLicenseKey( $val, ( \IPS\Request::i()->isSecure() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . mb_substr( $_SERVER['SCRIPT_NAME'], 0, -mb_strlen( \IPS\CP_DIRECTORY . '/install/index.php' ) ) );
|
||||
}, NULL, '<a href="' . \IPS\Http\Url::ips( 'docs/find_lkey' ) . '" target="_blank">' . \IPS\Member::loggedIn()->language()->addToStack('lkey_help') . '</a>' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Checkbox( 'eula', FALSE, TRUE, array( 'label' => 'eula_suffix' ), function( $val )
|
||||
{
|
||||
if ( !$val )
|
||||
{
|
||||
throw new \InvalidArgumentException('eula_err');
|
||||
}
|
||||
}, "<textarea disabled style='width: 100%; height: 250px'>" . file_get_contents( 'eula.txt' ) . "</textarea><br>" ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['lkey'] = trim( $values['lkey'] );
|
||||
|
||||
if ( mb_substr( $values['lkey'], -12 ) === '-TESTINSTALL' )
|
||||
{
|
||||
$values['lkey'] = mb_substr( $values['lkey'], 0, -12 );
|
||||
}
|
||||
|
||||
$toWrite = "<?php\n\n" . '$INFO = ' . var_export( array( 'lkey' => $values['lkey'] ), TRUE ) . ';';
|
||||
|
||||
try
|
||||
{
|
||||
$file = @\file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', $toWrite );
|
||||
if ( !$file )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* PHP 5.6 - clear opcode cache or details won't be seen on next page load */
|
||||
if( function_exists('opcache_reset') )
|
||||
{
|
||||
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
|
||||
@opcache_reset();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=applications' ) );
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'error' );
|
||||
$errorform = new \IPS\Helpers\Form( 'license', 'continue' );
|
||||
$errorform->class = '';
|
||||
$errorform->add( new \IPS\Helpers\Form\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 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('license');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'license', $form, TRUE, TRUE );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Installer: Server Details
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 2 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: Server Details
|
||||
*/
|
||||
class _serverdetails extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'serverdetails', 'continue' );
|
||||
|
||||
$form->addHeader( 'mysql_server' );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'sql_host', ini_get('mysqli.default_host') ?: 'localhost', TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'sql_user', ini_get('mysqli.default_user'), TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Password( 'sql_pass', ini_get('mysqli.default_pw'), FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'sql_database', NULL, TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'sql_port', ini_get('mysqli.default_port'), FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'sql_socket', ini_get('mysqli.default_socket'), FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'sql_tbl_prefix', NULL, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'sql_utf8mb4', TRUE, FALSE ) );
|
||||
$form->addHeader( 'http_server' );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'base_url', ( \IPS\Request::i()->isSecure() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . mb_substr( $_SERVER['SCRIPT_NAME'], 0, -mb_strlen( \IPS\CP_DIRECTORY . '/install/index.php' ) ), TRUE, array( 'size' => 50 ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
$db = \IPS\Db::i( 'test', $values );
|
||||
}
|
||||
catch( \IPS\Db\Exception $e )
|
||||
{
|
||||
/* Can't connect. Maybe db doesn't exist, let's create it if allowed */
|
||||
if( $e->getCode() == 1049 )
|
||||
{
|
||||
try
|
||||
{
|
||||
$dbName = $values['sql_database'];
|
||||
unset( $values['sql_database'] );
|
||||
|
||||
$db = \IPS\Db::i( 'create', $values )->createDatabase( $dbName );
|
||||
$values['sql_database'] = $dbName;
|
||||
|
||||
$db = \IPS\Db::i( 'created', $values );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack('err_db_cant_create') );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \DomainException( $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( $db->checkForTable( 'core_sys_conf_settings') )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack('err_db_exists') );
|
||||
}
|
||||
}
|
||||
catch ( \UnderflowException $e ) { }
|
||||
|
||||
if ( $values['sql_utf8mb4'] and version_compare( $db->server_info, '5.5.3', '<' ) )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack('err_no_utf8mb4') );
|
||||
}
|
||||
|
||||
$INFO = NULL;
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
$INFO = array_merge( $INFO, $values );
|
||||
|
||||
$toWrite = "<?php\n\n" . '$INFO = ' . var_export( $INFO, TRUE ) . ';';
|
||||
|
||||
try
|
||||
{
|
||||
if ( \file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', $toWrite ) )
|
||||
{
|
||||
/* PHP 5.6 - clear opcode cache or details won't be seen on next page load */
|
||||
if( function_exists('opcache_reset') )
|
||||
{
|
||||
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
|
||||
@opcache_reset();
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=admin' ) );
|
||||
}
|
||||
}
|
||||
catch( \Exception $ex )
|
||||
{
|
||||
$errorform = new \IPS\Helpers\Form( 'serverdetails', 'continue' );
|
||||
$errorform->add( new \IPS\Helpers\Form\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 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
if( $e->getMessage() == 'mysqli::set_charset(): Error executing query' )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('err_no_utf8mb4');
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('serverdetails');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'serverdetails', $form );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Installer: System Check
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @since 10 Dec 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\setup\install;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer: System Check
|
||||
*/
|
||||
class _systemcheck extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('healthcheck');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->healthcheck( \IPS\core\Setup\Install::systemRequirements() );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user