Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @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.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -47,13 +47,12 @@ class _admin extends \IPS\Dispatcher\Controller
{
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') )
/* PHP 5.5 - clear opcode cache or details won't be seen on next page load */
if ( function_exists( 'opcache_invalidate' ) )
{
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
@opcache_reset();
@opcache_invalidate( \IPS\ROOT_PATH . '/conf_global.php' );
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=install' ) );
}
}
@@ -2,9 +2,9 @@
/**
* @brief Installer: Applications
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -69,7 +69,7 @@ class _applications extends \IPS\Dispatcher\Controller
/* Get app name */
if ( file_exists( $app->getPathName() . '/data/lang.xml' ) )
{
$xml = new \XMLReader;
$xml = new \IPS\Xml\XMLReader;
$xml->open( $app->getPathName() . '/data/lang.xml' );
$xml->read();
@@ -147,11 +147,10 @@ class _applications extends \IPS\Dispatcher\Controller
{
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') )
/* PHP 5.5 - clear opcode cache or details won't be seen on next page load */
if ( function_exists( 'opcache_invalidate' ) )
{
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
@opcache_reset();
@opcache_invalidate( \IPS\ROOT_PATH . '/conf_global.php' );
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=serverdetails' ) );
@@ -2,9 +2,9 @@
/**
* @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.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -37,11 +37,16 @@ class _done extends \IPS\Dispatcher\Controller
}
\IPS\Output::clearJsFiles();
/* Build default front navigation - if you visit ACP directly after it won't build, and you can run into issues */
\IPS\core\FrontNavigation::i()->buildDefaultFrontNavigation();
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'];
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => md5( $INFO['sql_pass'] . $INFO['base_url'] . $INFO['sql_database'] ) ), array( 'conf_key=?', 'site_secret_key' ) );
\IPS\Settings::i()->ipb_reg_number = $INFO['lkey'];
\IPS\Settings::i()->site_secret_key = md5( $INFO['sql_pass'] . $INFO['base_url'] . $INFO['sql_database'] );
unset( \IPS\Data\Store::i()->settings );
\file_put_contents( \IPS\ROOT_PATH . '/conf_global.php', "<?php\n\n" . '$INFO = ' . var_export( array(
@@ -61,11 +66,10 @@ class _done extends \IPS\Dispatcher\Controller
'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') )
/* PHP 5.5 - clear opcode cache or details won't be seen on next page load */
if ( function_exists( 'opcache_invalidate' ) )
{
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
@opcache_reset();
@opcache_invalidate( \IPS\ROOT_PATH . '/conf_global.php' );
}
\IPS\Settings::i()->base_url = $INFO['base_url'];
@@ -2,9 +2,9 @@
/**
* @brief Installer: Install
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -57,7 +57,7 @@ class _install extends \IPS\Dispatcher\Controller
$INFO['admin_user'],
$INFO['admin_pass1'],
$INFO['admin_email'],
$INFO['lkey']
$INFO['diagnostics_reporting']
);
}
catch ( \InvalidArgumentException $e )
@@ -2,9 +2,9 @@
/**
* @brief Installer: License
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -31,7 +31,7 @@ class _license extends \IPS\Dispatcher\Controller
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 )
$form->add( new \IPS\Helpers\Form\Text( 'lkey', 'Nulled by IPBMafia.ru | 15.03.2017', 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>' ) );
@@ -52,7 +52,7 @@ class _license extends \IPS\Dispatcher\Controller
$values['lkey'] = mb_substr( $values['lkey'], 0, -12 );
}
$toWrite = "<?php\n\n" . '$INFO = ' . var_export( array( 'lkey' => $values['lkey'] ), TRUE ) . ';';
$toWrite = "<?php\n\n" . '$INFO = ' . var_export( array( 'lkey' => 'LICENSE KEY GOES HERE!-123456789' ), TRUE ) . ';';
try
{
@@ -63,11 +63,10 @@ class _license extends \IPS\Dispatcher\Controller
}
else
{
/* PHP 5.6 - clear opcode cache or details won't be seen on next page load */
if( function_exists('opcache_reset') )
/* PHP 5.5 - clear opcode cache or details won't be seen on next page load */
if ( function_exists( 'opcache_invalidate' ) )
{
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
@opcache_reset();
@opcache_invalidate( \IPS\ROOT_PATH . '/conf_global.php' );
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=applications' ) );
@@ -2,9 +2,9 @@
/**
* @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.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -43,6 +43,7 @@ class _serverdetails extends \IPS\Dispatcher\Controller
$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 ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'diagnostics_reporting', FALSE ) );
if ( $values = $form->values() )
{
@@ -51,6 +52,14 @@ class _serverdetails extends \IPS\Dispatcher\Controller
try
{
$db = \IPS\Db::i( 'test', $values );
/* Connection Success, check MySQL version */
$result = \IPS\core\Setup\Upgrade::mysqlRequirements( $db );
if( !$result['requirements']['MySQL']['version']['success'] )
{
throw new \DomainException( $result['requirements']['MySQL']['version']['message'] );
}
}
catch( \IPS\Db\Exception $e )
{
@@ -103,12 +112,11 @@ class _serverdetails extends \IPS\Dispatcher\Controller
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') )
if ( function_exists( 'opcache_invalidate' ) )
{
/* Avoid throwing an exception Zend OPcache API is restricted by "restrict_api" configuration directive */
@opcache_reset();
@opcache_invalidate( \IPS\ROOT_PATH . '/conf_global.php' );
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'controller=admin' ) );
}
}
@@ -139,7 +147,7 @@ class _serverdetails extends \IPS\Dispatcher\Controller
}
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('serverdetails');
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('serverdetails');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'serverdetails', $form );
}
}
@@ -2,9 +2,9 @@
/**
* @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.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 10 Dec 2014
* @version SVN_VERSION_NUMBER
*/
@@ -30,6 +30,29 @@ class _systemcheck extends \IPS\Dispatcher\Controller
*/
public function manage()
{
/* Clear previous session data */
if( !isset( \IPS\Request::i()->sessionCheck ) AND count( $_SESSION ) )
{
foreach( $_SESSION as $k => $v )
{
unset( $_SESSION[ $k ] );
}
}
/* Store a session variable and then check it on the next page load to make sure PHP sessions are working */
if( !isset( \IPS\Request::i()->sessionCheck ) )
{
$_SESSION['sessionCheck'] = TRUE;
\IPS\Output::i()->redirect( \IPS\Request::i()->url()->setQueryString( 'sessionCheck', 1 ) );
}
else
{
if( !isset( $_SESSION['sessionCheck'] ) OR !$_SESSION['sessionCheck'] )
{
\IPS\Output::i()->error( 'session_check_fail', '5C348/1', 500, '' );
}
}
\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() );
}
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: Applications
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 20 May 2014
* @version SVN_VERSION_NUMBER
*/
@@ -89,7 +89,7 @@ class _applications extends \IPS\Dispatcher\Controller
/* Get app name */
if ( file_exists( $path . '/data/lang.xml' ) )
{
$xml = new \XMLReader;
$xml = new \IPS\Xml\XMLReader;
$xml->open( $path . '/data/lang.xml' );
$xml->read();
@@ -220,7 +220,7 @@ class _applications extends \IPS\Dispatcher\Controller
$path = \IPS\ROOT_PATH . '/applications/' . $key;
if ( file_exists( $path . '/data/lang.xml' ) )
{
$xml = new \XMLReader;
$xml = new \IPS\Xml\XMLReader;
$xml->open( $path . '/data/lang.xml' );
$xml->read();
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: Confirm
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 20 May 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: Continue Upgrade
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 4 Nov 2014
* @version SVN_VERSION_NUMBER
*/
@@ -36,7 +36,6 @@ class _continueupgrade extends \IPS\Dispatcher\Controller
if ( is_array( $json ) and isset( $json['session'] ) and isset( $json['data'] ) )
{
$url = \IPS\Http\Url::internal( "controller=upgrade" )->setQueryString( 'key', $_SESSION['uniqueKey'] );
$mr = array();
/* Update session */
foreach( $json['session'] as $k => $v )
@@ -47,7 +46,9 @@ class _continueupgrade extends \IPS\Dispatcher\Controller
}
}
\IPS\Output::i()->redirect( $url->setQueryString( 'mr', base64_encode( urlencode( json_encode( $json['data'] ) ) ) )->setQueryString( 'mr_continue', 1 ) );
/* Populate the MR data */
$_SESSION[ 'mr-' . md5( $url ) ] = json_encode( $json['data'] );
\IPS\Output::i()->redirect( $url->setQueryString( 'mr', 1 )->setQueryString( 'mr_continue', 1 ) );
}
else
{
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: Custom Upgrade Options
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 20 May 2014
* @version SVN_VERSION_NUMBER
*/
@@ -66,6 +66,16 @@ class _customoptions extends \IPS\Dispatcher\Controller
$appOptions[$option->name] = $app;
}
}
if( file_exists( \IPS\ROOT_PATH . "/applications/{$app}/setup/upg_{$step}/postUpgrade.php" ) )
{
$message = NULL;
require_once( \IPS\ROOT_PATH . "/applications/{$app}/setup/upg_{$step}/postUpgrade.php" );
if ( $message !== NULL )
{
$_SESSION['upgrade_postUpgrade'][ $app ][ $step ] = $message;
}
}
}
}
@@ -76,8 +86,13 @@ class _customoptions extends \IPS\Dispatcher\Controller
{
\IPS\Db::i()->update( 'core_applications', array( 'app_enabled' => 0 ), array( 'app_directory=?', $app ) );
}
if ( isset( \IPS\Data\Store::i()->applications ) )
{
unset( \IPS\Data\Store::i()->applications );
}
}
/* If there are no options, no need to show an empty/blank form */
if( !count( $elements ) )
{
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: Finished Screen
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 20 May 2014
* @version SVN_VERSION_NUMBER
*/
@@ -60,6 +60,9 @@ class _done extends \IPS\Dispatcher\Controller
unset( $_SESSION['key'] );
/* IPS Cloud Sync */
\IPS\IPS::resyncIPSCloud();
/* 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');
}
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: License
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 25 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -25,114 +25,12 @@ class _license extends \IPS\Dispatcher\Controller
{
/**
* Show Form
* Show Form... Or not.
*
* @return void
*/
public function manage()
{
/* Check license key */
if( \IPS\Db::i()->checkForTable( 'core_store' ) )
{
$licenseData = \IPS\IPS::licenseKey();
}
else
{
$licenseData = NULL;
try
{
$license = \IPS\Db::i()->select( '*', 'cache_store', array( 'cs_key=?', 'licenseData' ) )->first();
$licenseData = unserialize( $license['cs_value'] );
}
catch( \Exception $e ){}
}
if( isset( $licenseData['key'] ) AND !isset( $licenseData['expires'] ) )
{
$licenseData = $this->getLicenseData();
}
if ( !$licenseData or !isset( $licenseData['expires'] ) )
{
$response = NULL;
$active = NULL;
$form = new \IPS\Helpers\Form( 'licensekey', 'continue' );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_reg_number', NULL, TRUE, array(), function( $val ){
\IPS\IPS::checkLicenseKey( $val, \IPS\Settings::i()->base_url );
} ) );
if( $values = $form->values() )
{
$values['ipb_reg_number'] = trim( $values['ipb_reg_number'] );
if ( mb_substr( $values['ipb_reg_number'], -12 ) === '-TESTINSTALL' )
{
$values['ipb_reg_number'] = mb_substr( $values['ipb_reg_number'], 0, -12 );
}
/* Save */
$form->saveAsSettings( $values );
/* Refresh the locally stored license info */
if( \IPS\Db::i()->checkForTable( 'core_store' ) )
{
unset( \IPS\Data\Store::i()->license_data );
$licenseData = \IPS\IPS::licenseKey();
}
else
{
/* Call the main server */
$licenseData = $this->getLicenseData();
}
/* Reset some vars now */
$form = NULL;
$active = isset( $licenseData['expires'] ) ? strtotime( $licenseData['expires'] ) > time() : NULL;
}
}
else
{
$active = isset( $licenseData['expires'] ) ? strtotime( $licenseData['expires'] ) > time() : NULL;
}
if( $active )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=applications" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('license');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->license( $form, $active );
}
/**
* Retrieve license data from license server
*
* @return mixed
*/
protected function getLicenseData()
{
/* Call the main server */
try
{
$response = \IPS\Http\Url::ips( 'license/' . \IPS\Settings::i()->ipb_reg_number )->request()->get();
if ( $response->httpResponseCode == 404 )
{
$licenseData = NULL;
}
else
{
$licenseData = $response->decodeJson();
}
\IPS\Db::i()->replace( 'cache_store', array( 'cs_key' => 'licenseData', 'cs_array' => 1, 'cs_value' => serialize( $licenseData ) ) );
}
catch ( \Exception $e )
{
$licenseData = NULL;
}
return $licenseData;
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=applications" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
}
}
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: Login
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 20 May 2014
* @version SVN_VERSION_NUMBER
*/
@@ -32,27 +32,41 @@ class _login extends \IPS\Dispatcher\Controller
public function manage()
{
/* Clear previous session data */
if( count( $_SESSION ) )
if( !isset( \IPS\Request::i()->sessionCheck ) AND count( $_SESSION ) )
{
foreach( $_SESSION as $k => $v )
{
unset( $_SESSION[ $k ] );
}
}
/* Store a session variable and then check it on the next page load to make sure PHP sessions are working */
if( !isset( \IPS\Request::i()->sessionCheck ) )
{
$_SESSION['sessionCheck'] = TRUE;
\IPS\Output::i()->redirect( \IPS\Request::i()->url()->setQueryString( 'sessionCheck', 1 ), NULL, 307 ); // 307 instructs the browser to resubmit the form as a POST request maintaining all the values from before
}
else
{
if( !isset( $_SESSION['sessionCheck'] ) OR !$_SESSION['sessionCheck'] )
{
\IPS\Output::i()->error( 'session_check_fail', '5C289/1', 500, '' );
}
}
/* Are we automatically logging in? */
if ( isset( \IPS\Request::i()->adsess ) )
{
$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 $member->isAdmin() and ( !\IPS\Settings::i()->match_ipaddress or ( $session['session_ip_address'] === \IPS\Request::i()->ipAddress() ) ) )
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'] = md5( uniqid( microtime(), TRUE ) );
$_SESSION['uniqueKey'] = \IPS\Login::generateRandomString();
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=systemcheck" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
}
}
$login = new \IPS\Login( \IPS\Http\Url::internal( "controller=login&start=1", NULL, NULL, NULL, \IPS\Settings::i()->logins_over_https ) );
$login = new \IPS\Login( \IPS\Http\Url::internal( "controller=login&start=1&sessionCheck=1", NULL, NULL, NULL, \IPS\Settings::i()->logins_over_https ) );
$login->flagOptions = FALSE;
/* < 4.0.0 */
@@ -98,9 +112,19 @@ class _login extends \IPS\Dispatcher\Controller
$member = $login->authenticate();
if ( $member !== NULL )
{
/* Check permission */
if ( !$this->_memberHasUpgradePermission( $member ) )
{
throw new \DomainException('login_upgrader_no_permission');
}
/* Create a unique session key and redirect */
$_SESSION['uniqueKey'] = md5( uniqid( microtime(), TRUE ) );
$_SESSION['uniqueKey'] = \IPS\Login::generateRandomString();
/* IPS Cloud Sync */
\IPS\IPS::resyncIPSCloud();
/* Redirect */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=systemcheck" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
}
}
@@ -113,4 +137,69 @@ class _login extends \IPS\Dispatcher\Controller
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('login');
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'forms' )->login( $login->forms( TRUE ), $error );
}
/**
* Can member log into upgrader?
*
* @param \IPS\Member $member The member
* @return bool
*/
protected function _memberHasUpgradePermission( \IPS\Member $member )
{
/* 4.x */
if ( \IPS\Db::i()->checkForTable( 'core_admin_permission_rows' ) )
{
/* This permission was added in 4.1.6, so if we have it, use it */
if ( \IPS\Application::load('core')->long_version > 101021 )
{
return $member->hasAcpRestriction( 'core', 'overview', 'upgrade_manage' );
}
/* Otherwise, let them in if they're an admin */
else
{
return $member->isAdmin();
}
}
/* 3.x */
else
{
/* Does our primary group have permission? */
try
{
$admin = (bool) \IPS\Db::i()->select( 'g_access_cp', 'groups', array( 'g_id=?', $member->member_group_id ) )->first();
}
catch( \UnderflowException $e )
{
throw new \OutOfRangeException( 'upgrade_group_not_exist' );
}
if( $admin )
{
return TRUE;
}
/* Check secondary groups as well */
if( $member->mgroup_others )
{
/* In some versions we stored as ",1,2," with trailing/preceeding commas, so account for that */
foreach( explode( ',', trim( $member->mgroup_others, ',' ) ) as $group )
{
try
{
$admin = (bool) \IPS\Db::i()->select( 'g_access_cp', 'groups', array( 'g_id=?', $group ) )->first();
if( $admin )
{
return TRUE;
}
}
/* It is possible the user has an old group that no longer exists defined as a secondary group */
catch( \UnderflowException $e ){}
}
}
/* Still here? No permission */
return FALSE;
}
}
}
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: System Check
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 20 May 2014
* @version SVN_VERSION_NUMBER
*/
@@ -38,7 +38,7 @@ class _systemcheck extends \IPS\Dispatcher\Controller
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, \IPS\DateTime::ts( @filemtime( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ) ) );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->unfinishedUpgrade( $json, @filemtime( \IPS\ROOT_PATH . '/uploads/logs/upgrader_data.cgi' ) );
return;
}
}
@@ -2,9 +2,9 @@
/**
* @brief Upgrader: Perform Upgrade
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 20 May 2014
* @version SVN_VERSION_NUMBER
*/
@@ -49,52 +49,22 @@ class _upgrade extends \IPS\Dispatcher\Controller
}
catch( \Exception $e )
{
try
{
\IPS\Log::i( LOG_ERR )->write( "Error : " . $e->getMessage() . "\n" . $e->getTraceAsString(), 'upgrade_error' );
}
catch( \RuntimeException $ex ){}
\IPS\Log::log( $e, 'upgrade_error' );
/* Error thrown that we want to handle differently */
$mrData = json_decode( urldecode( base64_decode( \IPS\Request::i()->mr ) ), true );
$key = 'mr-' . md5( \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
if ( isset( $_SESSION['updatedData'] ) and isset( $_SESSION['updatedData'][1] ) )
{
$mrData = $_SESSION['updatedData'];
$_SESSION[ $key ] = json_encode( $_SESSION['updatedData'] );
}
$continueData = $mrData;
$retryData = $mrData;
if ( isset( $mrData['extra'] ) or isset( $_SESSION['lastJsonIndex'] ) )
{
$continueData['extra']['lastSqlId'] = ( isset($_SESSION['lastJsonIndex']) ? ( $_SESSION['lastJsonIndex'] + 1 ) : 0 );
$retryData['extra']['lastSqlId'] = ( ( isset($_SESSION['lastJsonIndex']) and $_SESSION['lastJsonIndex'] > 1 ) ? $_SESSION['lastJsonIndex'] - 1 : 0 );
}
if ( isset( $mrData['extra']['_upgradeStep'] ) )
{
$continueData['extra']['_upgradeStep'] += 1;
$continueData['extra']['_upgradeData'] = 0;
}
$continueUrl = \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr' => base64_encode( urlencode( json_encode( $continueData ) ) ), 'mr_continue' => 1 ) );
$retryUrl = \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr' => base64_encode( urlencode( json_encode( $retryData ) ) ), 'mr_continue' => 1 ) );
$continueUrl = \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr' => 1, 'mr_continue' => 1 ) );
$retryUrl = \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr' => 1 ) );
$error = \IPS\Theme::i()->getTemplate( 'global' )->upgradeError( $e, $continueUrl, $retryUrl );
\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\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( \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 ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
}
return array( \IPS\Theme::i()->getTemplate( 'global' )->block( 'install', $error, FALSE ) );
}
catch( \BadMethodCallException $e )
{