Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -108,7 +108,7 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
if( count( $errors ) )
|
||||
if( \count( $errors ) )
|
||||
{
|
||||
$haltUpgrade = TRUE;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
unset( $apps['core'] );
|
||||
$apps = array_merge( $system, $apps );
|
||||
|
||||
if( count( $defaultTicks ) )
|
||||
if( \count( $defaultTicks ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'applications', 'continue' );
|
||||
$form->add( new \IPS\Helpers\Form\Custom( 'apps', $defaultTicks, TRUE, array(
|
||||
@@ -156,11 +156,11 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
$_SESSION['apps']['core'] = 'core';
|
||||
}
|
||||
|
||||
if( count( $values['apps'] ) )
|
||||
if( \count( $values['apps'] ) )
|
||||
{
|
||||
foreach ( $values['apps'] as $k => $v )
|
||||
{
|
||||
if ( !is_int( $k ) )
|
||||
if ( !\is_int( $k ) )
|
||||
{
|
||||
$_SESSION['apps'][$k] = $k;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
|
||||
$warnings = array();
|
||||
$coreVersion = array_key_exists( 'core', $_SESSION['apps'] ) ? \IPS\Application::getAvailableVersion( 'core' ) : \IPS\Application::load( 'core' )->long_version;
|
||||
foreach ( \IPS\Application::$ipsApps as $key )
|
||||
foreach ( \IPS\IPS::$ipsApps as $key )
|
||||
{
|
||||
if ( $key == 'chat' )
|
||||
{
|
||||
@@ -191,7 +191,7 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $warnings ) )
|
||||
if ( \count( $warnings ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=applications&do=warning" )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'warnings' => implode( ',', $warnings ) ) ) );
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -33,6 +33,43 @@ class _confirm extends \IPS\Dispatcher\Controller
|
||||
$_SESSION['lastJsonIndex'] = 0;
|
||||
$_SESSION['lastSqlError'] = NULL;
|
||||
$_SESSION['sqlFinished'] = array();
|
||||
|
||||
/* Create our temporary upgrade data storage table */
|
||||
if( !\IPS\Db::i()->checkForTable( 'upgrade_temp' ) )
|
||||
{
|
||||
\IPS\Db::i()->createTable( array(
|
||||
'name' => 'upgrade_temp',
|
||||
'columns' => array(
|
||||
array(
|
||||
'name' => 'id',
|
||||
'type' => 'int',
|
||||
'length' => 10,
|
||||
'allow_null' => false,
|
||||
'auto_increment' => true
|
||||
),
|
||||
array(
|
||||
'name' => 'upgrade_data',
|
||||
'type' => 'mediumtext',
|
||||
'length' => null,
|
||||
'allow_null' => true,
|
||||
'default' => null
|
||||
),
|
||||
array(
|
||||
'name' => 'lastaccess',
|
||||
'type' => 'int',
|
||||
'length' => 10,
|
||||
'allow_null' => false,
|
||||
'default' => 0
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
array(
|
||||
'type' => 'primary',
|
||||
'columns' => array( 'id' )
|
||||
),
|
||||
)
|
||||
) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('confirmpage');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->confirm();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -30,9 +30,16 @@ class _continueupgrade extends \IPS\Dispatcher\Controller
|
||||
public function manage()
|
||||
{
|
||||
/* Best check for the upgrade file first */
|
||||
$json = json_decode( @file_get_contents( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ), TRUE );
|
||||
try
|
||||
{
|
||||
$json = json_decode( \IPS\Db::i()->select( 'upgrade_data', 'upgrade_temp' )->first(), TRUE );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$json = NULL;
|
||||
}
|
||||
|
||||
if ( is_array( $json ) and isset( $json['session'] ) and isset( $json['data'] ) )
|
||||
if ( \is_array( $json ) and isset( $json['session'] ) and isset( $json['data'] ) )
|
||||
{
|
||||
$url = \IPS\Http\Url::internal( "controller=upgrade" )->setQueryString( 'key', $_SESSION['uniqueKey'] );
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -93,7 +93,7 @@ class _customoptions extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* If there are no options, no need to show an empty/blank form */
|
||||
if( !count( $elements ) )
|
||||
if( !\count( $elements ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=confirm" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -31,10 +31,8 @@ class _done extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Output::clearJsFiles();
|
||||
|
||||
if ( file_exists( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ) )
|
||||
{
|
||||
@unlink( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' );
|
||||
}
|
||||
/* Get rid of temporary upgrade data */
|
||||
\IPS\Db::i()->dropTable( 'upgrade_temp', TRUE );
|
||||
|
||||
/* Reset theme maps to make sure bad data hasn't been cached by visits mid-setup */
|
||||
foreach( \IPS\Theme::themes() as $id => $set )
|
||||
@@ -63,6 +61,9 @@ class _done extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
unset( $_SESSION['key'] );
|
||||
|
||||
/* Clear recent datastore logs to prevent an error message displaying immediately after upgrade */
|
||||
\IPS\Db::i()->delete( 'core_log', array( '`category`=? AND `time`>?', 'datastore', \IPS\DateTime::create()->sub( new \DateInterval( 'PT1H' ) )->getTimestamp() ) );
|
||||
|
||||
/* Unset settings datastore to prevent any upgrade settings that were overridden becoming persistent */
|
||||
\IPS\Settings::i()->clearCache();
|
||||
@@ -70,7 +71,13 @@ class _done extends \IPS\Dispatcher\Controller
|
||||
/* IPS Cloud Sync */
|
||||
\IPS\IPS::resyncIPSCloud('Upgraded community');
|
||||
|
||||
/* Remove any new version ACP Notifications */
|
||||
\IPS\core\AdminNotification::remove( 'core', 'NewVersion' );
|
||||
|
||||
/* And show the complete page - the template handles this step special already so we don't have to output anything */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('done');
|
||||
|
||||
/* The upgrader will cause a few syncs on Cloud2, but we don't have to wait for those. Clear the flag here. */
|
||||
unset( \IPS\Data\Store::i()->syncCompleted );
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -31,7 +31,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
public function manage()
|
||||
{
|
||||
/* Clear previous session data */
|
||||
if( !isset( \IPS\Request::i()->sessionCheck ) AND count( $_SESSION ) )
|
||||
if( !isset( \IPS\Request::i()->sessionCheck ) AND \count( $_SESSION ) )
|
||||
{
|
||||
foreach( $_SESSION as $k => $v )
|
||||
{
|
||||
@@ -54,15 +54,19 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Are we automatically logging in? */
|
||||
if ( isset( \IPS\Request::i()->adsess ) )
|
||||
if ( isset( \IPS\Request::i()->autologin ) and isset( \IPS\Request::i()->cookie['IPSSessionAdmin'] ) )
|
||||
{
|
||||
$session = \IPS\Db::i()->select( '*', 'core_sys_cp_sessions', array( 'session_id=?', \IPS\Request::i()->adsess ) )->first();
|
||||
$member = $session['session_member_id'] ? \IPS\Member::load( $session['session_member_id'] ) : new \IPS\Member;
|
||||
if ( $member->member_id and $this->_memberHasUpgradePermission( $member ) and ( !\IPS\Settings::i()->match_ipaddress or ( $session['session_ip_address'] === \IPS\Request::i()->ipAddress() ) ) )
|
||||
try
|
||||
{
|
||||
$_SESSION['uniqueKey'] = \IPS\Login::generateRandomString();
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=systemcheck" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
$session = \IPS\Db::i()->select( '*', 'core_sys_cp_sessions', array( 'session_id=?', \IPS\Request::i()->cookie['IPSSessionAdmin'] ) )->first();
|
||||
$member = $session['session_member_id'] ? \IPS\Member::load( $session['session_member_id'] ) : new \IPS\Member;
|
||||
if ( $member->member_id and $this->_memberHasUpgradePermission( $member ) and ( !\IPS\Settings::i()->match_ipaddress or ( $session['session_ip_address'] === \IPS\Request::i()->ipAddress() ) ) )
|
||||
{
|
||||
$_SESSION['uniqueKey'] = \IPS\Login::generateRandomString();
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=systemcheck" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
}
|
||||
if ( \IPS\BYPASS_UPGRADER_LOGIN )
|
||||
{
|
||||
@@ -91,7 +95,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* We need to allow logins if the previous upgrade wasn't finished */
|
||||
if( file_exists( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ) )
|
||||
if( \IPS\Db::i()->checkForTable( 'upgrade_temp' ) )
|
||||
{
|
||||
$canUpgrade = TRUE;
|
||||
}
|
||||
@@ -99,6 +103,9 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
if ( !$canUpgrade )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'forms' )->noapps();
|
||||
|
||||
/* We do this just to be 100% certain the flag didn't get "stuck" and needs to be reset. */
|
||||
\IPS\core\Setup\Upgrade::setUpgradingFlag( FALSE );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,13 +120,13 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
$memberRows = \IPS\Db::i()->select( '*', $table, array( 'email=? OR email=? OR name=? OR name=?', \IPS\Request::i()->auth, \IPS\Request::legacyEscape( \IPS\Request::i()->auth ), \IPS\Request::i()->auth, \IPS\Request::legacyEscape( \IPS\Request::i()->auth ) ) );
|
||||
if ( count( $memberRows ) )
|
||||
if ( \count( $memberRows ) )
|
||||
{
|
||||
foreach( $memberRows as $memberRow )
|
||||
{
|
||||
$member = \IPS\Member::constructFromData( $memberRow );
|
||||
|
||||
if ( password_verify( \IPS\Request::i()->password, $member->members_pass_hash ) or $member->verifyLegacyPassword( \IPS\Request::i()->password ) )
|
||||
if ( password_verify( \IPS\Request::i()->password, $member->members_pass_hash ) or $member->verifyLegacyPassword( \IPS\Request::i()->protect('password') ) )
|
||||
{
|
||||
if ( $this->_memberHasUpgradePermission( $member ) )
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -30,25 +30,30 @@ class _systemcheck extends \IPS\Dispatcher\Controller
|
||||
public function manage()
|
||||
{
|
||||
/* Do we have an older upgrade session hanging around? */
|
||||
if ( ! isset( \IPS\Request::i()->skippreviousupgrade ) AND file_exists( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ) )
|
||||
if ( ! isset( \IPS\Request::i()->skippreviousupgrade ) AND \IPS\Db::i()->checkForTable( 'upgrade_temp' ) )
|
||||
{
|
||||
$json = json_decode( @file_get_contents( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ), TRUE );
|
||||
|
||||
if ( is_array( $json ) and isset( $json['session'] ) and isset( $json['data'] ) )
|
||||
try
|
||||
{
|
||||
$row = \IPS\Db::i()->select( '*', 'upgrade_temp' )->first();
|
||||
$json = json_decode( $row['upgrade_data'], TRUE );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$json = NULL;
|
||||
}
|
||||
|
||||
if ( \is_array( $json ) and isset( $json['session'] ) and isset( $json['data'] ) )
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('unfinished_upgrade');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->unfinishedUpgrade( $json, @filemtime( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->unfinishedUpgrade( $json, $row['lastaccess'] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
elseif( isset( \IPS\Request::i()->skippreviousupgrade ) AND \IPS\Request::i()->skippreviousupgrade )
|
||||
{
|
||||
/* If we skip the previous upgrade remove the file now. That way if we hit utf8 upgrader and come back to upgrader we are
|
||||
not prompted again to continue our conversion we already elected to start over */
|
||||
if ( file_exists( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ) )
|
||||
{
|
||||
@unlink( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' );
|
||||
}
|
||||
/* If we skip the previous upgrade remove the temp upgrade data now. That way if we hit utf8 upgrader and come back to upgrader we are
|
||||
not prompted again to continue our upgrade we already elected to start over */
|
||||
\IPS\Db::i()->dropTable( 'upgrade_temp', TRUE );
|
||||
}
|
||||
|
||||
/* Do we need to disable designer mode? */
|
||||
@@ -65,7 +70,7 @@ class _systemcheck extends \IPS\Dispatcher\Controller
|
||||
$canProceed = FALSE;
|
||||
if ( !$designersModeEnabled )
|
||||
{
|
||||
$canProceed = !isset( $requirements['advice'] ) or !count( $requirements['advice'] );
|
||||
$canProceed = !isset( $requirements['advice'] ) or !\count( $requirements['advice'] );
|
||||
if ( $canProceed )
|
||||
{
|
||||
foreach ( $requirements['requirements'] as $k => $_requirements )
|
||||
@@ -82,6 +87,7 @@ class _systemcheck extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Check we have the latest version and run an md5 check */
|
||||
$incorrectFiles = array();
|
||||
/* Or do not check :) */
|
||||
|
||||
/* Display */
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
|
||||
Reference in new issue
Block a user