Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Core AJAX Responders
|
||||
* @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 13 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -65,6 +65,7 @@ class _ajax extends \IPS\core\modules\front\system\ajax
|
||||
\IPS\Db::i()->delete( 'core_acp_search_index', array( 'url=?', $url ) );
|
||||
|
||||
$inserts = array();
|
||||
|
||||
foreach ( \IPS\Request::i()->keywords as $word )
|
||||
{
|
||||
$inserts[] = array(
|
||||
@@ -80,15 +81,15 @@ class _ajax extends \IPS\core\modules\front\system\ajax
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_acp_search_index', $inserts );
|
||||
}
|
||||
|
||||
|
||||
$keywords = array();
|
||||
foreach ( \IPS\Db::i()->select( '*', 'core_acp_search_index', array( 'app=?', $qs['app'] ) ) as $word )
|
||||
foreach ( \IPS\Db::i()->select( '*', 'core_acp_search_index', array( 'app=?', $qs['app'] ), 'url ASC, keyword ASC' ) as $word )
|
||||
{
|
||||
$keywords[ $word['url'] ]['lang_key'] = $word['lang_key'];
|
||||
$keywords[ $word['url'] ]['restriction'] = $word['restriction'];
|
||||
$keywords[ $word['url'] ]['keywords'][] = $word['keyword'];
|
||||
}
|
||||
|
||||
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/applications/{$qs['app']}/data/acpsearch.json", json_encode( $keywords, version_compare( PHP_VERSION, '5.4.0' ) >= 0 ? JSON_PRETTY_PRINT : 0 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Background processes 'Run Now'
|
||||
* @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 28 Jan 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -30,6 +30,11 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
if ( \IPS\CIC )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_writes', '2C347/1', 403, '' );
|
||||
}
|
||||
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -71,59 +76,22 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$queueData = \IPS\Db::i()->select( '*', 'core_queue', NULL, 'priority ASC, RAND()', 1 )->first();
|
||||
$newOffset = 0;
|
||||
try
|
||||
{
|
||||
$extensions = \IPS\Application::load( $queueData['app'] )->extensions( 'core', 'Queue', FALSE );
|
||||
if ( !isset( $extensions[ $queueData['key'] ] ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
$class = new $extensions[ $queueData['key'] ];
|
||||
$json = json_decode( $queueData['data'], TRUE );
|
||||
$newOffset = $class->run( $json, $queueData['offset'] );
|
||||
|
||||
if ( is_null( $newOffset ) )
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->write( "Finished " . json_encode( $queueData ), 'runQueue_log' );
|
||||
\IPS\Db::i()->delete( 'core_queue', array( 'id=?', $queueData['id'] ) );
|
||||
|
||||
/* Update count */
|
||||
$data['count'] = $self->getCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_queue', array( 'offset' => $newOffset ), array( 'id=?', $queueData['id'] ) );
|
||||
|
||||
$newData = json_encode( $json );
|
||||
|
||||
/* Did it change?? */
|
||||
if ( $newData !== $json )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_queue', array( 'data' => $newData ), array( 'id=?', $queueData['id'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->write( "Finished " . json_encode( $queueData ), 'runQueue_log' );
|
||||
|
||||
\IPS\Db::i()->delete( 'core_queue', array( 'id=?', $queueData['id'] ) );
|
||||
|
||||
/* Update count */
|
||||
$data['count'] = $self->getCount();
|
||||
}
|
||||
{
|
||||
/* Run the next queue task, if any */
|
||||
$queueData = \IPS\Task::runQueue();
|
||||
|
||||
/* Update count */
|
||||
$data['count'] = $self->getCount();
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
/* All done */
|
||||
/* If we're here it means there were no rows in core_queue and we are done */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$data['done'] = $data['done'] + ( $newOffset - $queueData['offset'] );
|
||||
$data['done'] = $data['done'] + ( $queueData['offset'] - $queueData['_originalOffset'] );
|
||||
$json = json_decode( $queueData['data'], TRUE );
|
||||
|
||||
$lang = array( $queueData['key'] );
|
||||
|
||||
if ( isset( $json['class'] ) )
|
||||
@@ -141,7 +109,13 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( isset( $json['count'] ) )
|
||||
{
|
||||
$lang[] = " " . intval( $newOffset ) . ' / ' . $json['count'];
|
||||
/* If the offset is larger than the count, then we should just show the count instead (to avoid situations where it will display 150 / 139, for example) */
|
||||
$offset = intval( $queueData['offset'] );
|
||||
if ( $offset > $json['count'] )
|
||||
{
|
||||
$offset = $json['count'];
|
||||
}
|
||||
$lang[] = " " . $offset . ' / ' . $json['count'];
|
||||
}
|
||||
|
||||
return array( $data, \IPS\Member::loggedIn()->language()->addToStack('background_processes_processing', FALSE, array( 'sprintf' => array( implode( ' - ', $lang ) ) ) ), ( $data['count'] ) ? round( ( 100 / $data['count'] * $data['done'] ), 2 ) : 100 );
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Editor AJAX functions Controller
|
||||
* @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 29 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Language Changer
|
||||
* @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 7 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -44,7 +44,6 @@ class _language extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Member::loggedIn()->acp_language = (int) \IPS\Request::i()->id;
|
||||
\IPS\Member::loggedIn()->save();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::external( $_SERVER['HTTP_REFERER'] ) ?: \IPS\Http\Url::internal( '' ) );
|
||||
\IPS\Output::i()->redirect( isset( $_SERVER['HTTP_REFERER'] ) ? \IPS\Http\Url::external( $_SERVER['HTTP_REFERER'] ) : \IPS\Http\Url::internal( '' ) );
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief ACP Live Search
|
||||
* @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 18 Sep 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Admin CP 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 13 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -55,28 +55,7 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
/* Success */
|
||||
if ( $member->isAdmin() )
|
||||
{
|
||||
/* Set the member */
|
||||
\IPS\Session::i()->setMember( $member );
|
||||
|
||||
/* Log */
|
||||
$this->log( 'ok' );
|
||||
|
||||
/* Clean out any existing session ID in the URL */
|
||||
$queryString = array();
|
||||
if( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$_queryString = array();
|
||||
parse_str( preg_replace( "/adsess=([a-zA-Z0-9]+)(?:&|$)/", '', base64_decode( \IPS\Request::i()->ref ) ), $_queryString );
|
||||
foreach ( $_queryString as $k => $v )
|
||||
{
|
||||
if ( in_array( $k, array( 'app', 'module', 'controller' ) ) )
|
||||
{
|
||||
$queryString[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Boink */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( http_build_query( $queryString ) ) );
|
||||
$this->_doLogin( $member );
|
||||
}
|
||||
/* Error */
|
||||
else
|
||||
@@ -134,6 +113,105 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'system' )->login( $forms, $this->activeTab, $error, $icons, $upgradeError ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* MFA
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mfa()
|
||||
{
|
||||
/* Have we logged in? */
|
||||
$member = NULL;
|
||||
if ( isset( $_SESSION['processing2FA'] ) )
|
||||
{
|
||||
$member = \IPS\Member::load( $_SESSION['processing2FA']['memberId'] );
|
||||
}
|
||||
if ( !$member->member_id )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( '', 'admin' ) );
|
||||
}
|
||||
|
||||
/* Set the referer in the URL */
|
||||
$url = \IPS\Http\Url::internal( 'app=core&module=system&controller=login&do=mfa', 'admin', 'login' );
|
||||
if ( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'ref', \IPS\Request::i()->ref );
|
||||
}
|
||||
if ( isset( \IPS\Request::i()->auth ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'auth', \IPS\Request::i()->auth );
|
||||
}
|
||||
|
||||
/* Have we already done 2FA? */
|
||||
$output = \IPS\MFA\MFAHandler::accessToArea( 'core', 'AuthenticateAdmin', $url, $member );
|
||||
if ( !$output )
|
||||
{
|
||||
$this->_doLogin( $member, TRUE );
|
||||
}
|
||||
|
||||
/* Nope, displau the 2FA form over the login page */
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'system/login.css', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'system' )->mfaLogin( $output ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process log in
|
||||
*
|
||||
* @param \IPS\Member $member The member
|
||||
* @param bool $bypass2FA If true, will not perform 2FA check
|
||||
* @return void
|
||||
*/
|
||||
protected function _doLogin( $member, $bypass2FA = FALSE )
|
||||
{
|
||||
/* Do we need to do 2FA? */
|
||||
if ( !$bypass2FA and $output = \IPS\MFA\MFAHandler::accessToArea( 'core', 'AuthenticateAdmin', \IPS\Http\Url::internal( '' ), $member ) )
|
||||
{
|
||||
$_SESSION['processing2FA'] = array( 'memberId' => $member->member_id );
|
||||
|
||||
$url = \IPS\Http\Url::internal( 'app=core&module=system&controller=login&do=mfa', 'admin', 'login' );
|
||||
if ( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'ref', \IPS\Request::i()->ref );
|
||||
}
|
||||
if ( isset( \IPS\Request::i()->auth ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'auth', \IPS\Request::i()->auth );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
}
|
||||
|
||||
/* Set the member */
|
||||
\IPS\Session::i()->setMember( $member );
|
||||
|
||||
/* Log */
|
||||
$this->log( 'ok' );
|
||||
|
||||
/* Clean out any existing session ID in the URL */
|
||||
$queryString = array();
|
||||
if( isset( \IPS\Request::i()->ref ) )
|
||||
{
|
||||
$_queryString = array();
|
||||
parse_str( preg_replace( "/adsess=([a-zA-Z0-9]+)(?:&|$)/", '', base64_decode( \IPS\Request::i()->ref ) ), $_queryString );
|
||||
foreach ( $_queryString as $k => $v )
|
||||
{
|
||||
if ( in_array( $k, array( 'app', 'module', 'controller', 'id' ) ) )
|
||||
{
|
||||
$queryString[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Boink - if we're in recovery mode, go there */
|
||||
if ( \IPS\RECOVERY_MODE === TRUE )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=support&controller=recovery" ), '', 303 );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( http_build_query( $queryString ) ), '', 303 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log Out
|
||||
*
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Theme Changer
|
||||
* @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 7 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ class _theme extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Member::loggedIn()->acp_skin = (int) \IPS\Request::i()->id;
|
||||
\IPS\Member::loggedIn()->save();
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::external( $_SERVER['HTTP_REFERER'] ) ?: \IPS\Http\Url::internal( '' ) );
|
||||
|
||||
\IPS\Output::i()->redirect( isset( $_SERVER['HTTP_REFERER'] ) ? \IPS\Http\Url::external( $_SERVER['HTTP_REFERER'] ) : \IPS\Http\Url::internal( '' ) );
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief 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 28 Jul 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -31,322 +31,6 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'upgrade_manage' );
|
||||
|
||||
if ( \IPS\NO_WRITES )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_writes', '1C287/1', 403, '' );
|
||||
}
|
||||
|
||||
$wizard = new \IPS\Helpers\Wizard( array(
|
||||
'upgrade_confirm_update' => array( $this, '_selectVersion' ),
|
||||
'upgrade_login' => array( $this, '_login' ),
|
||||
'upgrade_extract_update' => array( $this, '_extractUpdate' ),
|
||||
'upgrade_upgrade' => array( $this, '_upgrade' ),
|
||||
), \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade' ) );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('ips_suite_upgrade');
|
||||
\IPS\Output::i()->output = $wizard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select Version
|
||||
*
|
||||
* @param array $data Wizard data
|
||||
* @return string|array
|
||||
*/
|
||||
public function _selectVersion( $data )
|
||||
{
|
||||
/* Check latest version */
|
||||
$versions = array();
|
||||
foreach ( \IPS\Db::i()->select( '*', 'core_applications', \IPS\Db::i()->in( 'app_directory', \IPS\Application::$ipsApps ) ) as $app )
|
||||
{
|
||||
if ( $app['app_enabled'] )
|
||||
{
|
||||
$versions[] = $app['app_long_version'];
|
||||
}
|
||||
}
|
||||
$version = min( $versions );
|
||||
$url = \IPS\Http\Url::ips('updateCheck');
|
||||
if ( \IPS\USE_DEVELOPMENT_BUILDS )
|
||||
{
|
||||
$url = $url->setQueryString( 'development', 1 );
|
||||
}
|
||||
try
|
||||
{
|
||||
$response = $url->setQueryString( 'version', $version )->request()->get()->decodeJson();
|
||||
$coreApp = \IPS\Application::load('core');
|
||||
$coreApp->update_version = json_encode( $response );
|
||||
$coreApp->update_last_check = time();
|
||||
$coreApp->save();
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
|
||||
/* Build form */
|
||||
$form = new \IPS\Helpers\Form( 'select_version' );
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
$latestVersion = 0;
|
||||
foreach( \IPS\Application::load( 'core' )->availableUpgrade() as $possibleVersion )
|
||||
{
|
||||
$options[ $possibleVersion['longversion'] ] = $possibleVersion['version'];
|
||||
$descriptions[ $possibleVersion['longversion'] ] = $possibleVersion;
|
||||
if ( $latestVersion < $possibleVersion['longversion'] )
|
||||
{
|
||||
$latestVersion = $possibleVersion['longversion'];
|
||||
}
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'version', $latestVersion, TRUE, array( 'options' => $options, '_details' => $descriptions ) ) );
|
||||
|
||||
/* Handle submissions */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
return array( 'version' => $values['version'] );
|
||||
}
|
||||
|
||||
/* Display */
|
||||
return $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'system' ) ), 'upgradeSelectVersion' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Login
|
||||
*
|
||||
* @param array $data Wizard data
|
||||
* @return string|array
|
||||
*/
|
||||
public function _login( $data )
|
||||
{
|
||||
/* Build form */
|
||||
$form = new \IPS\Helpers\Form( 'login', 'continue' );
|
||||
$form->hiddenValues['version'] = $data['version'];
|
||||
$form->add( new \IPS\Helpers\Form\Email( 'ips_email_address', NULL ) );
|
||||
$form->add( new \IPS\Helpers\Form\Password( 'ips_password', NULL ) );
|
||||
|
||||
/* Handle submissions */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$key = \IPS\IPS::licenseKey();
|
||||
|
||||
$url = \IPS\Http\Url::ips( 'build/' . $key['key'] )->setQueryString( 'ip', \IPS\Request::i()->ipAddress() );
|
||||
if ( \IPS\USE_DEVELOPMENT_BUILDS )
|
||||
{
|
||||
$url = $url->setQueryString( 'development', 1 );
|
||||
}
|
||||
elseif ( isset( $values['version'] ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'versionToDownload', $values['version'] );
|
||||
}
|
||||
if ( \IPS\CP_DIRECTORY !== 'admin' )
|
||||
{
|
||||
$url = $url->setQueryString( 'cp_directory', \IPS\CP_DIRECTORY );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$response = $url->request( 30 )->login( $values['ips_email_address'], $values['ips_password'] )->get();
|
||||
switch ( $response->httpResponseCode )
|
||||
{
|
||||
case 200:
|
||||
if ( !preg_match( '/^ips_[a-z0-9]{5}$/', (string) $response ) )
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->write( (string) $response );
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('download_upgrade_error');
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['key'] = (string) $response;
|
||||
return $data;
|
||||
}
|
||||
|
||||
case 304:
|
||||
if ( \IPS\Db::i()->select( 'MIN(app_long_version)', 'core_applications', \IPS\Db::i()->in( 'app_directory', \IPS\Application::$ipsApps ) )->first() < \IPS\Application::getAvailableVersion('core') )
|
||||
{
|
||||
$data['key'] = NULL;
|
||||
return $data;
|
||||
}
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('download_upgrade_nothing');
|
||||
break;
|
||||
|
||||
default:
|
||||
$form->error = (string) $response;
|
||||
}
|
||||
|
||||
}
|
||||
catch ( \Exception $exception )
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->write( get_class( $exception ) . "\n" . $exception->getCode() . ": " . $exception->getMessage() . "\n" . $exception->getTraceAsString() );
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack('download_upgrade_error');
|
||||
}
|
||||
}
|
||||
|
||||
return (string) $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract Update
|
||||
*
|
||||
* @param array $data Wizard data
|
||||
* @return string|array
|
||||
*/
|
||||
public function _extractUpdate( $data )
|
||||
{
|
||||
/* Download & Extract */
|
||||
if ( $data['key'] and !isset( \IPS\Request::i()->check ) )
|
||||
{
|
||||
/* Muliple Redirector */
|
||||
return (string) new \IPS\Helpers\MultipleRedirect( \IPS\Http\Url::internal('app=core&module=system&controller=upgrade'), function( $mrData ) use ( $data )
|
||||
{
|
||||
/* Init */
|
||||
if ( !is_array( $mrData ) )
|
||||
{
|
||||
return array( array( 'status' => 'download' ), \IPS\Member::loggedIn()->language()->addToStack('delta_upgrade_downloading'), 0 );
|
||||
}
|
||||
/* Download */
|
||||
elseif ( $mrData['status'] == 'download' )
|
||||
{
|
||||
if ( !isset( $mrData['tmpFileName'] ) )
|
||||
{
|
||||
$mrData['tmpFileName'] = tempnam( \IPS\TEMP_DIRECTORY, 'IPS' ) . '.zip';
|
||||
|
||||
return array( $mrData, \IPS\Member::loggedIn()->language()->addToStack('delta_upgrade_downloading'), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !isset( $mrData['range'] ) )
|
||||
{
|
||||
$mrData['range'] = 0;
|
||||
}
|
||||
$startRange = $mrData['range'];
|
||||
$endRange = $startRange + 1000000 - 1;
|
||||
|
||||
$response = \IPS\Http\Url::ips("download/{$data['key']}")->request( 30 )->setHeaders( array( 'Range' => "bytes={$startRange}-{$endRange}" ) )->get();
|
||||
|
||||
try
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Fetching download [range={$startRange}-{$endRange}] with a response code: " . $response->httpResponseCode, 'auto_upgrade' );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
|
||||
if ( $response->httpResponseCode == 404 )
|
||||
{
|
||||
if ( isset( $mrData['tmpFileName'] ) )
|
||||
{
|
||||
@unlink( $mrData['tmpFileName'] );
|
||||
}
|
||||
|
||||
return array( \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( TRUE, isset( $data['key'] ) ? \IPS\Http\Url::ips("download/{$data['key']}") : NULL ) );
|
||||
}
|
||||
elseif ( $response->httpResponseCode == 206 )
|
||||
{
|
||||
$totalFileSize = intval( mb_substr( $response->httpHeaders['Content-Range'], mb_strpos( $response->httpHeaders['Content-Range'], '/' ) + 1 ) );
|
||||
$fh = \fopen( $mrData['tmpFileName'], 'a' );
|
||||
\fwrite( $fh, (string) $response );
|
||||
\fclose( $fh );
|
||||
|
||||
$mrData['range'] = $endRange + 1;
|
||||
return array( $mrData, \IPS\Member::loggedIn()->language()->addToStack('delta_upgrade_downloading'), 100 / $totalFileSize * $mrData['range'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$mrData['status'] = 'extract';
|
||||
return array( $mrData, \IPS\Member::loggedIn()->language()->addToStack('delta_upgrade_extracting'), 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Extract */
|
||||
elseif ( $mrData['status'] == 'extract' )
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Attempting to extract", 'auto_upgrade' );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
|
||||
/* Open the zip */
|
||||
$zip = \IPS\Archive\Zip::fromLocalFile( $mrData['tmpFileName'], $data['key'] . '/' );
|
||||
|
||||
/* Extract some files */
|
||||
$numberToDo = 20;
|
||||
if ( !isset( $mrData['extractNumber'] ) )
|
||||
{
|
||||
$mrData['extractNumber'] = 0;
|
||||
}
|
||||
$offset = $mrData['extractNumber'];
|
||||
|
||||
if ( $zip->extract( \IPS\ROOT_PATH, $numberToDo, $offset ) === TRUE )
|
||||
{
|
||||
if ( isset( $mrData['tmpFileName'] ) )
|
||||
{
|
||||
@unlink( $mrData['tmpFileName'] );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mrData['extractNumber'] += $numberToDo;
|
||||
$numberOfFiles = $zip->numberOfFiles();
|
||||
|
||||
try
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Extracting files {$mrData['extractNumber']} / {$numberOfFiles}", 'auto_upgrade' );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
|
||||
return array( $mrData, \IPS\Member::loggedIn()->language()->addToStack('delta_upgrade_extracting'), 100 / $numberOfFiles * $mrData['extractNumber'] );
|
||||
}
|
||||
}
|
||||
catch ( \RuntimeException $e )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Log::i( LOG_ERR )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Extract Failed", 'auto_upgrade' );
|
||||
\IPS\Log::i( LOG_ERR )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( $e, 'auto_upgrade' );
|
||||
}
|
||||
catch( \Exception $ex ) { }
|
||||
|
||||
\IPS\Session\Admin::i()->log( ( $e->getCode() === \IPS\Archive\Exception::COULD_NOT_OPEN ) ? 'delta_upgrade_zip_fail' : ( $e->getCode() === \IPS\Archive\Exception::COULD_NOT_WRITE ? 'delta_upgrade_write_fail' : '' ) );
|
||||
|
||||
if ( isset( $mrData['tmpFileName'] ) )
|
||||
{
|
||||
@unlink( $mrData['tmpFileName'] );
|
||||
}
|
||||
|
||||
return array( \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( $e->getCode(), isset( $data['key'] ) ? \IPS\Http\Url::ips("download/{$data['key']}") : NULL ) );
|
||||
}
|
||||
}
|
||||
},
|
||||
function()
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=system&controller=upgrade&check=1') );
|
||||
} );
|
||||
}
|
||||
|
||||
/* Run md5 check */
|
||||
try
|
||||
{
|
||||
$files = \IPS\Application::md5Check();
|
||||
if ( count( $files ) )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( $files, isset( $data['key'] ) ? \IPS\Http\Url::ips("download/{$data['key']}") : NULL );
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
|
||||
/* Nope, we're good! */
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade
|
||||
*
|
||||
* @param array $data Wizard data
|
||||
* @return string|array
|
||||
*/
|
||||
public function _upgrade( $data )
|
||||
{
|
||||
\IPS\Output::i()->redirect( 'upgrade/?adsess=' . \IPS\Request::i()->adsess );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::external( "http://ipbmafia.ru/files/file/1560-ips-community-suite-41-nulled/" ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Visual Language Editor
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @since 27 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visual Language Editor
|
||||
*/
|
||||
class _vle extends \IPS\core\modules\front\system\vle
|
||||
{
|
||||
// This class only exists to extend the front-end controller
|
||||
// so that within the ACP we can call this endpoint and the
|
||||
// CSRF checks will work
|
||||
}
|
||||
Reference in new issue
Block a user