Как сделать NULLED версию IPS Community Suite 4 (how to null ips 4)
Код и строки могут отличаться в более ранних или новых дистрибутивах IPS, но суть та же.
Список файлов которые мы будем редактировать:
Переходим к редактированию файлов:
1. admin\install\html\global\globalTemplate.phtml
находим (23 строка):
добавляем после:
2. admin\install\lang.php
находим (133 строка):
заменяем на:
3. admin\upgrade\html\global\globalTemplate.phtml
находим (24 строка):
добавляем после:
4. admin\upgrade\lang.php
находим (526 строка)
заменяем на:
5. applications\calendar\data\settings.json
находим (30-33 строки):
меняем на:
6. applications\core\data\lang.xml
находим (4 строка):
добавляем после:
7. applications\core\data\schema.json
находим (3061-3063 строки):
меняем на:
8. applications\core\data\settings.json
находим (438 - 442 строки):
меняем на:
находим (473 - 477 строки:
меняем на:
находим (894 - 897 строки):
меняем на:
9. applications\core\data\theme.xml
находим (17480 строка):
меняем на:
находим (17494 - 17508 строки):
меняем на:
10. applications\core\extensions\core\CommunityEnhancements\GeoIP.php
находим (82 строка):
заменяем на:
11. applications\core\extensions\core\CommunityEnhancements\SpamMonitoring.php
находим (80 строка) и удаляем!:
12. applications\core\extensions\core\Dashboard\LatestNews.php
находим (30-33 строка):
меняем на:
находим (40-57 строка):
меняем на:
13. applications\core\modules\admin\membersettings\spam.php
находим (182-193):
меняем на:
14. applications\core\modules\admin\overview\dashboard.php
находим (188-212 строка) и удаляем весь код:
находим (325-328 строка):
заменяем на:
15. applications\core\modules\admin\settings\general.php
находим (53 строка) и удаляем!
16. applications\core\modules\admin\settings\licensekey.php
находим (104-131 строка):
заменяем на:
17. applications\core\modules\admin\support\support.php
находим (214-240 строка):
меняем на:
находим (302-312) строка:
меняем на:
находим (319-368) строка:
меняем на:
находим (423-433 строка):
меняем на:
находим (440-443 строка):
меняем на:
находим (450-453 строка):
меняем на:
находим (756-862 строка):
меняем на:
18. applications\core\modules\admin\system\upgrade.php
найти (35-549 строка):
заменить на:
19. applications\core\modules\setup\install\license.php
находим (33 строка):
меняем на:
находим: (54 строка):
меняем на:
20. applications\core\modules\setup\install\serverdetails.php
находим (45 строка):
меняем на:
21. applications\core\modules\setup\upgrade\license.php
находим (31-148 строка):
меняем на:
22. applications\core\modules\setup\upgrade\systemcheck.php
находим (85-121 строка) и удаляем код:
23. applications\core\setup\upg_101079\options.php
находим (12 строка):
заменяем на:
24. init.php
находим (644-718строка):
меняем на:
находим (728-782 строка):
меняем на:
Код и строки могут отличаться в более ранних или новых дистрибутивах IPS, но суть та же.
Список файлов которые мы будем редактировать:
admin\install\html\global\globalTemplate.phtml
admin\install\lang.php
admin\upgrade\html\global\globalTemplate.phtml
admin\upgrade\lang.php
applications\calendar\data\settings.json
applications\core\data\lang.xml
applications\core\data\schema.json
applications\core\data\settings.json
applications\core\data\theme.xml
applications\core\extensions\core\CommunityEnhancements\GeoIP.php
applications\core\extensions\core\CommunityEnhancements\SpamMonitoring.php
applications\core\extensions\core\Dashboard\LatestNews.php
applications\core\modules\admin\membersettings\spam.php
applications\core\modules\admin\overview\dashboard.php
applications\core\modules\admin\settings\general.php
applications\core\modules\admin\settings\licensekey.php
applications\core\modules\admin\support\support.php
applications\core\modules\admin\system\upgrade.php
applications\core\modules\setup\install\license.php
applications\core\modules\setup\install\serverdetails.php
applications\core\modules\setup\upgrade\license.php
applications\core\modules\setup\upgrade\systemcheck.php
applications\core\setup\upg_101079\options.php
init.php
admin\install\lang.php
admin\upgrade\html\global\globalTemplate.phtml
admin\upgrade\lang.php
applications\calendar\data\settings.json
applications\core\data\lang.xml
applications\core\data\schema.json
applications\core\data\settings.json
applications\core\data\theme.xml
applications\core\extensions\core\CommunityEnhancements\GeoIP.php
applications\core\extensions\core\CommunityEnhancements\SpamMonitoring.php
applications\core\extensions\core\Dashboard\LatestNews.php
applications\core\modules\admin\membersettings\spam.php
applications\core\modules\admin\overview\dashboard.php
applications\core\modules\admin\settings\general.php
applications\core\modules\admin\settings\licensekey.php
applications\core\modules\admin\support\support.php
applications\core\modules\admin\system\upgrade.php
applications\core\modules\setup\install\license.php
applications\core\modules\setup\install\serverdetails.php
applications\core\modules\setup\upgrade\license.php
applications\core\modules\setup\upgrade\systemcheck.php
applications\core\setup\upg_101079\options.php
init.php
Переходим к редактированию файлов:
1. admin\install\html\global\globalTemplate.phtml
находим (23 строка):
Код:
<body class='ipsApp ipsApp_installer'>
добавляем после:
Код:
<script>
$(document).ready(function(){
$('input[name="diagnostics_reporting_checkbox"]').attr("disabled","disabled");
});
</script>
2. admin\install\lang.php
находим (133 строка):
Код:
'diagnostics_reporting_desc' => "Help Invision Community improve by automatically sending usage and diagnostic information. The data sent does not contain any private information about your users or your community.",
заменяем на:
Код:
'diagnostics_reporting_desc' => "NULLED Release, diagnostic does not work",
3. admin\upgrade\html\global\globalTemplate.phtml
находим (24 строка):
Код:
<body class='ipsApp ipsApp_installer'>
добавляем после:
Код:
<script>
$(document).ready(function(){
$('input[name="101079_diagnostics_reporting_checkbox"]').attr("disabled","disabled");
});
</script>
4. admin\upgrade\lang.php
находим (526 строка)
Код:
'101079_diagnostics_reporting_desc' => "Help Invision Community improve by automatically sending usage and diagnostic information. The data sent does not contain any private information about your users or your community.",
заменяем на:
Код:
'101079_diagnostics_reporting_desc' => "NULLED Release, diagnostic does not work",
5. applications\calendar\data\settings.json
находим (30-33 строки):
Код:
{
"key": "ipb_calendar_mon",
"default": "0"
},
меняем на:
Код:
{
"key": "ipb_calendar_mon",
"default": "1"
},
6. applications\core\data\lang.xml
находим (4 строка):
Код:
<word key="__app_core" js="0">System</word>
добавляем после:
Код:
<word key="__null_alert" js="0">This distribution is NULLED! You can't use this function.</word>
7. applications\core\data\schema.json
находим (3061-3063 строки):
Код:
"g_edit_cutoff": "5",
"g_photo_max_vars": "500:170:170",
"g_dohtml": "0",
меняем на:
Код:
"g_edit_cutoff": "0",
"g_photo_max_vars": "1024:500:500",
"g_dohtml": "1",
8. applications\core\data\settings.json
находим (438 - 442 строки):
Код:
{
"key": "ipb_reg_number",
"default": ""
},
меняем на:
Код:
{
"key": "ipb_reg_number",
"default": "LICENSE KEY GOES HERE!-123456789"
},
{
"key": "ipb_license_active",
"default": "1"
},
{
"key": "ipb_license_cloud",
"default": "0"
},
{
"key": "ipb_license_url",
"default": "https:\/\/www.invisionpower.com\/buy\/self-hosted"
},
{
"key": "ipb_license_test_url",
"default": "http:\/\/community.invisionpower.com"
},
{
"key": "ipb_license_expires",
"default": "09 MAR 2037"
},
{
"key": "ipb_license_product_forums",
"default": "1"
},
{
"key": "ipb_license_product_calendar",
"default": "1"
},
{
"key": "ipb_license_product_blog",
"default": "1"
},
{
"key": "ipb_license_product_gallery",
"default": "1"
},
{
"key": "ipb_license_product_downloads",
"default": "1"
},
{
"key": "ipb_license_product_cms",
"default": "1"
},
{
"key": "ipb_license_product_nexus",
"default": "1"
},
{
"key": "ipb_license_product_copyright",
"default": "1"
},
{
"key": "ipb_license_chat_limit",
"default": "0"
},
{
"key": "ipb_license_support",
"default": "N/A"
},
находим (473 - 477 строки:
Код:
{
"key": "ipsgeoip",
"default": "1"
},
Код:
{
"key": "ipsgeoip",
"default": "0"
},
находим (894 - 897 строки):
Код:
{
"key": "signatures_enabled",
"default": "0"
},
Код:
{
"key": "signatures_enabled",
"default": "1"
},
9. applications\core\data\theme.xml
находим (17480 строка):
Код:
{{if !is_int( $connectionCheckResult )}}
Код:
{{if is_int( $connectionCheckResult )}}
находим (17494 - 17508 строки):
Код:
{{if abs( $connectionCheckResult - time() ) > 30}}
{{$fails = TRUE;}}
<li class="ipsDataItem">
<div class="ipsDataItem_icon ipsType_warning ipsPos_top ipsType_large"><i class="fa fa-exclamation-triangle"></i></div>
<div class="ipsDataItem_generic ipsType_warning">
<div>{lang="server_time_fail"}</div>
<a href="{url="app=core&module=support&controller=support&do=servertimefail"}" data-ipsDialog data-ipsDialog-title="{lang="self_service"}" class="ipsButton ipsButton_negative ipsButton_verySmall ipsSpacer_top ipsSpacer_half">{lang="help_me_fix_this"}</a>
</div>
</li>
{{else}}
<li class="ipsDataItem">
<div class="ipsDataItem_icon ipsType_success ipsPos_top ipsType_large"><i class="fa fa-check"></i></div>
<div class="ipsDataItem_generic ipsType_success">{lang="server_time_ok"}</div>
</li>
{{endif}}
меняем на:
Код:
<li class="ipsDataItem">
<div class="ipsDataItem_icon ipsType_success ipsPos_top ipsType_large"><i class="fa fa-check"></i></div>
<div class="ipsDataItem_generic ipsType_success">{lang="server_time_ok"}</div>
</li>
10. applications\core\extensions\core\CommunityEnhancements\GeoIP.php
находим (82 строка):
Код:
\IPS\Settings::i()->changeValues( array( 'ipsgeoip' => $enabled ) );
Код:
\IPS\Settings::i()->changeValues( array( 'ipsgeoip' => 0 ) );
11. applications\core\extensions\core\CommunityEnhancements\SpamMonitoring.php
находим (80 строка) и удаляем!:
Код:
\IPS\Output::i()->error( $e->getMessage(), '2C116/2', 403, '' );
12. applications\core\extensions\core\Dashboard\LatestNews.php
находим (30-33 строка):
Код:
public function canView()
{
return TRUE;
}
Код:
public function canView()
{
return FALSE;
}
Код:
public function getBlock()
{
$ipsNews = ( isset( \IPS\Data\Store::i()->ips_news ) ) ? json_decode( \IPS\Data\Store::i()->ips_news, TRUE ) : array();
if( empty( $ipsNews ) or $ipsNews['time'] < ( time() - 43200 ) )
{
try
{
$this->refreshNews();
$ipsNews = ( isset( \IPS\Data\Store::i()->ips_news ) ) ? json_decode( \IPS\Data\Store::i()->ips_news, TRUE ) : array();
}
catch ( \IPS\Http\Exception $e ) {}
catch( \IPS\Http\Request\Exception $e ) {}
catch( \RuntimeException $e ) {}
}
return \IPS\Theme::i()->getTemplate( 'dashboard' )->ipsNews( isset( $ipsNews['content'] ) ? $ipsNews['content'] : NULL );
}
Код:
public function getBlock()
{
return NULL;
}
13. applications\core\modules\admin\membersettings\spam.php
находим (182-193):
Код:
if( !$licenseData or !isset( $licenseData['products']['spam'] ) or !$licenseData['products']['spam'] or ( !$licenseData['cloud'] AND strtotime( $licenseData['expires'] ) < time() ) )
{
$disabled = TRUE;
if( !\IPS\Settings::i()->ipb_reg_number )
{
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( 'spam_service_nokey', FALSE, array( 'sprintf' => array( \IPS\Http\Url::internal( 'app=core&module=settings&controller=licensekey', null ) ) ) );
}
else
{
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( 'spam_service_noservice' );
}
}
меняем на:
Код:
if( !$licenseData or !isset( $licenseData['products']['spam'] ) or !$licenseData['products']['spam'] or ( !$licenseData['cloud'] AND strtotime( $licenseData['expires'] ) < time() ) )
{
$disabled = TRUE;
if( !\IPS\Settings::i()->ipb_reg_number )
{
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__null_alert' );
}
else
{
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__null_alert' );
}
}
14. applications\core\modules\admin\overview\dashboard.php
находим (188-212 строка) и удаляем весь код:
Код:
/* Don't do this for IN_DEV on localhost */
$doUrlCheck = TRUE;
$parsed = parse_url( \IPS\Settings::i()->base_url );
if ( ( \IPS\IN_DEV AND ( $parsed['host'] === 'localhost' or mb_substr( $parsed['host'], -4 ) === '.dev' or mb_substr( $parsed['host'], -5 ) === '.test' ) ) OR \IPS\CIC )
{
$doUrlCheck = FALSE;
}
if ( $doUrlCheck )
{
$data = \IPS\IPS::licenseKey();
/* Normalize our URL's. Specifically ignore the www. subdomain. */
$validUrls = array();
$validUrls[] = rtrim( str_replace( array( 'http://', 'https://', 'www.' ), '', $data['url'] ), '/' );
$validUrls[] = rtrim( str_replace( array( 'http://', 'https://', 'www.' ), '', $data['test_url'] ), '/' );
$ourUrl = rtrim( str_replace( array( 'http://', 'https://', 'www.' ), '', \IPS\Settings::i()->base_url ), '/' );
if ( !in_array( $ourUrl, $validUrls ) )
{
$warnings[] = array(
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_url_invalid' ),
'description' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_url_invalid_desc' )
);
}
}
находим (325-328 строка):
Код:
$toShow = array(
'main' => array( 'core_BackgroundQueue', 'core_Registrations' ),
'side' => array( 'core_AdminNotes', 'core_OnlineUsers' ),
);
заменяем на:
Код:
$toShow = array(
'main' => array( 'core_AdminNotes', 'core_Registrations', 'core_AwaitingValidation', 'core_BackgroundQueue' ),
'side' => array( 'core_OnlineAdmins', 'core_FailedLogins', 'core_OnlineUsers' ),
);
15. applications\core\modules\admin\settings\general.php
находим (53 строка) и удаляем!
Код:
$form->add( new \IPS\Helpers\Form\YesNo( 'diagnostics_reporting', \IPS\Settings::i()->diagnostics_reporting ) );
16. applications\core\modules\admin\settings\licensekey.php
находим (104-131 строка):
Код:
protected function settings()
{
$form = new \IPS\Helpers\Form;
$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 );
}
$form->saveAsSettings( $values );
\IPS\Session::i()->log( 'acplogs__license_settings' );
/* Refresh the locally stored license info */
unset( \IPS\Data\Store::i()->license_data );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=licensekey' ), 'saved' );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('license_settings');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_settings_licensekey', $form );
}
заменяем на:
Код:
protected function settings()
{
$$form = new \IPS\Helpers\Form;
$form->addHeader('ipb_license_edit_main');
$form->add( new \IPS\Helpers\Form\Text( 'ipb_reg_number', \IPS\Settings::i()->ipb_reg_number, TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_active', \IPS\Settings::i()->ipb_license_active ) );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_expires', \IPS\Settings::i()->ipb_license_expires ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_cloud', \IPS\Settings::i()->ipb_license_cloud ) );
$form->addHeader('ipb_license_urls');
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_url', \IPS\Settings::i()->ipb_license_url ) );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_test_url', \IPS\Settings::i()->ipb_license_test_url ) );
$form->addHeader('ipb_license_components');
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_forums', \IPS\Settings::i()->ipb_license_product_forums ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_calendar', \IPS\Settings::i()->ipb_license_product_calendar ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_blog', \IPS\Settings::i()->ipb_license_product_blog ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_gallery', \IPS\Settings::i()->ipb_license_product_gallery ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_downloads', \IPS\Settings::i()->ipb_license_product_downloads ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_cms', \IPS\Settings::i()->ipb_license_product_cms ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_nexus', \IPS\Settings::i()->ipb_license_product_nexus ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_copyright', \IPS\Settings::i()->ipb_license_product_copyright ) );
$form->addHeader('ipb_license_services');
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_chat_limit', \IPS\Settings::i()->ipb_license_chat_limit ) );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_support', \IPS\Settings::i()->ipb_license_support ) );
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 );
}
$form->saveAsSettings( $values );
\IPS\Session::i()->log( 'acplogs__license_settings' );
/* Refresh the locally stored license info */
unset( \IPS\Data\Store::i()->license_data );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=licensekey' ), 'saved' );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('license_settings');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_settings_licensekey', $form );
}
17. applications\core\modules\admin\support\support.php
находим (214-240 строка):
Код:
protected function _upgradeCheck()
{
try
{
$url = \IPS\Http\Url::ips('updateCheck')->setQueryString( array( 'type' => 'support', 'key' => \IPS\Settings::i()->ipb_reg_number ) );
if ( \IPS\USE_DEVELOPMENT_BUILDS )
{
$url = $url->setQueryString( 'development', 1 );
}
$response = $url->request()->get()->decodeJson();
if ( $response['longversion'] > \IPS\Application::load('core')->long_version )
{
if ( $response['version'] != \IPS\Application::load('core')->version )
{
return TRUE;
}
elseif ( count( $response['changes'] ) )
{
return $response['changes'];
}
}
}
catch ( \Exception $e ) { }
return FALSE;
}
меняем на:
Код:
protected function _upgradeCheck()
{
return NULL;
}
находим (302-312) строка:
Код:
protected function _md5sumChecker()
{
try
{
return \IPS\Application::md5Check();
}
catch ( \Exception $e )
{
return array();
}
}
Код:
protected function _md5sumChecker()
{
return NULL;
}
Код:
protected function md5fail()
{
/* Get modified files */
$modifiedFiles = $this->_md5sumChecker();
/* Build form */
$form = new \IPS\Helpers\Form( 'login', 'continue' );
$form->ajaxOutput = TRUE;
$form->add( new \IPS\Helpers\Form\Email( 'ips_email_address', NULL ) );
$form->add( new \IPS\Helpers\Form\Password( 'ips_password', NULL ) );
if ( $values = $form->values() )
{
$files = array_map( function( $file ) {
return preg_replace( '/^\/' . preg_quote( \IPS\CP_DIRECTORY, '/' ) . '\//', '/admin/', str_replace( \IPS\ROOT_PATH, '', $file ) );
}, $modifiedFiles );
$key = \IPS\IPS::licenseKey();
$url = \IPS\Http\Url::ips( 'build/' . $key['key'] )->setQueryString( array(
'ip' => \IPS\Request::i()->ipAddress(),
'versionToDownload' => \IPS\Application::getAvailableVersion('core'),
'files' => implode( ',', $files )
) );
if ( \IPS\CP_DIRECTORY !== 'admin' )
{
$url = $url->setQueryString( 'cp_directory', \IPS\CP_DIRECTORY );
}
$response = $url->request( \IPS\LONG_REQUEST_TIMEOUT )->login( $values['ips_email_address'], $values['ips_password'] )->get();
if ( $response->httpResponseCode == 200 and preg_match( '/^ips_[a-z0-9]{5}$/', (string) $response ) )
{
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( \IPS\Theme::i()->getTemplate( 'support' )->fixMd5Download( \IPS\Http\Url::ips( "download/{$response}" ) ) ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
}
else
{
if ( (string) $response )
{
$form->error = (string) $response;
}
else
{
$form->error = \IPS\Member::loggedIn()->language()->addToStack('md5_build_fail');
}
}
}
/* Output */
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support' )->fixMd5( $modifiedFiles, $form );
}
меняем на:
Код:
protected function md5fail()
{
return NULL;
}
Код:
protected function _connectionChecker()
{
try
{
return intval( (string) \IPS\Http\Url::ips( 'connectionCheck' )->request()->get() );
}
catch ( \Exception $e )
{
return (string) $e->getMessage();
}
}
Код:
protected function _connectionChecker()
{
return NULL;
}
Код:
protected function connectionfail()
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support' )->fixConnection( $this->_connectionChecker() );
}
Код:
protected function connectionfail()
{
return NULL;
}
Код:
protected function servertimefail()
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support' )->fixServerTime( new \IPS\DateTime );
}
Код:
protected function servertimefail()
{
return NULL;
}
Код:
public function _contactSupport( $data )
{
$licenseData = \IPS\IPS::licenseKey();
if ( !$licenseData or strtotime( $licenseData['expires'] ) < time() )
{
return \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( 'get_support_no_license', 'warning' );
}
try
{
$supportedVerions = \IPS\Http\Url::ips('support/versions')->request()->get()->decodeJson();
if ( \IPS\Application::load('core')->long_version > $supportedVerions['max'] )
{
return \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( 'get_support_unsupported_prerelease', 'warning' );
}
if ( \IPS\Application::load('core')->long_version < $supportedVerions['min'] )
{
return \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( 'get_support_unsupported_obsolete', 'warning' );
}
}
catch ( \Exception $e ) {}
$form = new \IPS\Helpers\Form( 'contact_support', 'contact_support_submit' );
$form->class = 'ipsForm_vertical';
$extraOptions = array( 'admin' => 'support_request_admin' );
$form->add( new \IPS\Helpers\Form\Text( 'support_request_title', NULL, TRUE, array( 'maxLength' => 128 ) ) );
$form->add( new \IPS\Helpers\Form\Editor( 'support_request_body', NULL, TRUE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'acp-support-request' ) ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'support_request_extra', array( 'admin' ), FALSE, array( 'options' => $extraOptions ) ) );
if ( $values = $form->values() )
{
$admin = NULL;
if ( in_array( 'admin', $values['support_request_extra'] ) )
{
$password = '';
$length = rand( 8, 15 );
for ( $i = 0; $i < $length; $i++ )
{
do {
$key = rand( 33, 126 );
} while ( in_array( $key, array( 34, 39, 60, 62, 92 ) ) );
$password .= chr( $key );
}
$supportAccount = \IPS\Member::load( '[email protected]', 'email' );
if ( !$supportAccount->member_id )
{
$name = 'IPS Support';
$_supportAccount = \IPS\Member::load( $name, 'name' );
if ( $_supportAccount->member_id )
{
$number = 2;
while ( $_supportAccount->member_id )
{
$name = "IPS Support {$number}";
$_supportAccount = \IPS\Member::load( $name, 'name' );
$number++;
}
}
$supportAccount = new \IPS\Member;
$supportAccount->name = $name;
$supportAccount->email = '[email protected]';
$supportAccount->member_group_id = \IPS\Settings::i()->admin_group;
}
$supportAccount->members_pass_salt = $supportAccount->generateSalt();
$supportAccount->members_pass_hash = $supportAccount->encryptedPassword( $password );
$supportAccount->save();
$admin = json_encode( array( 'name' => $supportAccount->name, 'email' => $supportAccount->email, 'password' => $password, 'dir' => \IPS\CP_DIRECTORY ) );
}
$key = md5( \IPS\Http\Url::internal('app=core&module=support&controller=support') );
unset( $_SESSION["wizard-{$key}-step"] );
unset( $_SESSION["wizard-{$key}-data"] );
\IPS\Output::i()->parseFileObjectUrls( $values['support_request_body'] );
$response = \IPS\Http\Url::ips('support')->request()->login( \IPS\Settings::i()->ipb_reg_number, '' )->post( array(
'title' => $values['support_request_title'],
'message' => $values['support_request_body'],
'admin' => $admin,
) );
switch ( $response->httpResponseCode )
{
case 200:
case 201:
return \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( \IPS\Member::loggedIn()->language()->addToStack( 'get_support_done', FALSE, array( 'pluralize' => array( intval( (string) $response ) ) ) ), 'success' );
case 401:
case 403:
return \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( 'get_support_no_license', 'warning' );
case 429:
return \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( 'get_support_duplicate', 'error' );
case 502:
default:
return \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( 'get_support_error', 'error' );
}
}
return (string) $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'support', 'core', 'admin' ) ), 'contact' ) );
}
Код:
public function _contactSupport( $data )
{
return \IPS\Theme::i()->getTemplate( 'global' )->message( '__null_alert', 'error' );
}
18. applications\core\modules\admin\system\upgrade.php
найти (35-549 строка):
Код:
protected function manage()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'upgrade_manage' );
if ( \IPS\NO_WRITES )
{
\IPS\Output::i()->error( 'no_writes', '1C287/1', 403, '' );
}
$initialData = NULL;
if ( isset( \IPS\Request::i()->patch ) )
{
$initialData = array( 'patch' => 1 );
}
$wizard = new \IPS\Helpers\Wizard( array(
'upgrade_confirm_update' => array( $this, '_selectVersion' ),
'upgrade_login' => array( $this, '_login' ),
'upgrade_ftp_details' => array( $this, '_ftpDetails' ),
'upgrade_extract_update' => array( $this, '_extractUpdate' ),
'upgrade_upgrade' => array( $this, '_upgrade' ),
), \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade' ), TRUE, $initialData );
\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')->setQueryString( array( 'type' => 'upgrader', 'key' => \IPS\Settings::i()->ipb_reg_number ) );
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( FALSE, !isset( $data['patch'] ) ) as $possibleVersion )
{
$options[ $possibleVersion['longversion'] ] = $possibleVersion['version'];
$descriptions[ $possibleVersion['longversion'] ] = $possibleVersion;
if ( $latestVersion < $possibleVersion['longversion'] )
{
$latestVersion = $possibleVersion['longversion'];
}
}
if ( \IPS\TEST_DELTA_ZIP )
{
$options['test'] = 'x.y.z';
$descriptions['test'] = array(
'releasenotes' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis scelerisque rhoncus leo. In eu ultricies magna. Vivamus nec est vitae felis iaculis mollis non ac ante. In vitae erat quis urna volutpat vulputate. Integer ultrices tellus felis, at posuere nulla faucibus nec. Fusce malesuada nunc purus, luctus accumsan nulla rhoncus ut. Nam ac pharetra magna. Nam semper augue at mi tempus, sed dapibus metus cursus. Suspendisse potenti. Curabitur at pulvinar metus, sed pharetra elit.</p>',
'security' => FALSE,
'updateurl' => '',
);
}
if ( !$options )
{
\IPS\Output::i()->error( 'download_upgrade_nothing', '1C287/4', 403, '' );
}
$form->add( new \IPS\Helpers\Form\Radio( 'version', $latestVersion, TRUE, array( 'options' => $options, '_details' => $descriptions ) ) );
/* Handle submissions */
if ( $values = $form->values() )
{
/* Check requirements */
try
{
$requirements = \IPS\Http\Url::ips('requirements')->setQueryString( 'version', $values['version'] )->request()->get()->decodeJson();
$phpVersion = PHP_VERSION;
$mysqlVersion = \IPS\Db::i()->server_info;
if ( !( version_compare( $phpVersion, $requirements['php']['required'] ) >= 0 ) )
{
if ( $requirements['php']['required'] == $requirements['php']['recommended'] )
{
$message = \IPS\Member::loggedIn()->language()->addToStack( 'requirements_php_version_fail_no_recommended', FALSE, array( 'sprintf' => array( $phpVersion, $requirements['php']['required'] ) ) );
}
else
{
$message = \IPS\Member::loggedIn()->language()->addToStack( 'requirements_php_version_fail', FALSE, array( 'sprintf' => array( $phpVersion, $requirements['php']['required'], $requirements['php']['recommended'] ) ) );
}
\IPS\Output::i()->error( $message, '1C287/2' );
}
if ( !( version_compare( $mysqlVersion, $requirements['mysql']['required'] ) >= 0 ) )
{
\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack( 'requirements_mysql_version_fail', FALSE, array( 'sprintf' => array( $mysqlVersion, $requirements['mysql']['required'], $requirements['mysql']['recommended'] ) ) ), '1C287/3', 403, '' );
}
}
catch ( \Exception $e ) {}
/* Check our files aren't modified */
if ( !\IPS\Request::i()->skip_md5_check )
{
try
{
$files = \IPS\Application::md5Check();
if ( count( $files ) )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaMd5( $values['version'], $files );
}
}
catch ( \Exception $e ) {}
}
/* Return */
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 )
{
/* If we're just testing, we can skip this step */
if ( \IPS\TEST_DELTA_ZIP and $data['version'] == 'test' )
{
$data['key'] = 'test';
return $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() )
{
try
{
$this->_clientAreaPassword = $values['ips_password'];
if ( $downloadKey = $this->_getDownloadKey( $values['ips_email_address'], isset( $values['version'] ) ? $values['version'] : NULL ) )
{
$data['key'] = $downloadKey;
$data['ips_email'] = $values['ips_email_address'];
$data['ips_pass'] = $values['ips_password'];
return $data;
}
else
{
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');
}
}
catch ( \LogicException $e )
{
\IPS\Log::log( $e, 'auto_upgrade' );
$form->error = $e->getMessage();
}
catch ( \RuntimeException $e )
{
\IPS\Log::log( $e, 'auto_upgrade' );
$form->error = \IPS\Member::loggedIn()->language()->addToStack('download_upgrade_error');
}
}
return (string) $form;
}
/**
* Get a download key
*
* @param string $clientAreaEmail IPS client area email address
* @param string $version Version to download
* @param array $files If desired, specific files to download rather than a delta from current version
* @return string|NULL string is a download key. NULL indicates already running the latest version
* @throws \LogicException
* @throws \IPS\Http\Request\Exception
* @throws \RuntimeException
*/
protected function _getDownloadKey( $clientAreaEmail, $version, $files=array() )
{
$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 ( $version )
{
$url = $url->setQueryString( 'versionToDownload', $version );
}
if ( \IPS\CP_DIRECTORY !== 'admin' )
{
$url = $url->setQueryString( 'cp_directory', \IPS\CP_DIRECTORY );
}
/* Check whether the converter application is present and installed */
if ( array_key_exists( 'convert', \IPS\Application::applications() ) AND file_exists( \IPS\ROOT_PATH . '/applications/convert/Application.php' ) )
{
$url = $url->setQueryString( 'includeConverters', 1 );
}
if ( $files )
{
$url = $url->setQueryString( 'files', implode( ',', $files ) );
}
$response = $url->request( \IPS\LONG_REQUEST_TIMEOUT )->login( $clientAreaEmail, $this->_clientAreaPassword )->get();
switch ( $response->httpResponseCode )
{
case 200:
if ( !preg_match( '/^ips_[a-z0-9]{5}$/', (string) $response ) )
{
throw new \RuntimeException( (string) $response );
}
else
{
return (string) $response;
}
case 304:
return NULL;
default:
throw new \LogicException( (string) $response );
}
}
/**
* Get FTP Details
*
* @param array $data Wizard data
* @return string|array
*/
public function _ftpDetails( $data )
{
if ( \IPS\DELTA_FORCE_FTP or !is_writable( \IPS\ROOT_PATH . '/init.php' ) or !is_writable( \IPS\ROOT_PATH . '/applications/core/Application.php' ) or !is_writable( \IPS\ROOT_PATH . '/system/Db/Db.php' ) )
{
/* If the server does not have the Ftp extension, we can't do this and have to prompt the user to downlad manually... */
if ( !function_exists( 'ftp_connect' ) )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( 'ftp', isset( $data['key'] ) ? \IPS\Http\Url::ips("download/{$data['key']}") : NULL );
}
/* Otherwise, we can ask for FTP details... */
else
{
/* If they've clicked the button to manually apply patch, let them do that */
if ( isset( \IPS\Request::i()->manual ) )
{
$data['manual'] = TRUE;
return $data;
}
/* Otherwise, carry on */
else
{
/* Define the method we will use to validate the FTP details */
$validateCallback = function( $ftp ) {
try
{
if ( file_get_contents( \IPS\ROOT_PATH . '/conf_global.php' ) != $ftp->download( 'conf_global.php' ) )
{
throw new \DomainException('delta_upgrade_ftp_details_no_match');
}
}
catch ( \IPS\Ftp\Exception $e )
{
throw new \DomainException('delta_upgrade_ftp_details_err');
}
};
/* If we have details stored, retreive them */
if ( \IPS\Settings::i()->upgrade_ftp_details and $decoded = @json_decode( \IPS\Text\Encrypt::fromCipher( \IPS\Settings::i()->upgrade_ftp_details )->decrypt(), TRUE ) )
{
$defaultDetails = $decoded;
}
/* Otherwise, guess the server/username/password for the user's benefit */
else
{
$defaultDetails = array(
'server' => \IPS\Http\Url::internal('')->data['host'],
'un' => @get_current_user(),
'path' => str_replace( '/home/' . @get_current_user(), '', \IPS\ROOT_PATH )
);
}
/* Build the form */
$form = new \IPS\Helpers\Form( 'ftp_details', 'continue' );
$form->add( new \IPS\Helpers\Form\Ftp( 'delta_upgrade_ftp_details', $defaultDetails, TRUE, array( 'rejectUnsupportedSftp' => TRUE, 'allowBypassValidation' => FALSE ), $validateCallback ) );
$form->add( new \IPS\Helpers\Form\Checkbox( 'delta_upgrade_ftp_remember', TRUE ) );
/* Handle submissions */
if ( $values = $form->values() )
{
if ( $values['delta_upgrade_ftp_remember'] )
{
\IPS\Settings::i()->changeValues( array( 'upgrade_ftp_details' => \IPS\Text\Encrypt::fromPlaintext( json_encode( $values['delta_upgrade_ftp_details'] ) )->cipher ) );
}
$data['ftpDetails'] = $values['delta_upgrade_ftp_details'];
return $data;
}
/* Display the form */
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFtp( (string) $form );
}
}
}
else
{
return $data;
}
}
/**
* Download & Extract Update
*
* @param array $data Wizard data
* @return string|array
*/
public function _extractUpdate( $data )
{
/* If extraction failed, show error */
if ( isset( \IPS\Request::i()->fail ) )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( 'exception', isset( $data['key'] ) ? \IPS\Http\Url::ips("download/{$data['key']}") : NULL );
}
/* Download & Extract */
if ( $data['key'] and !isset( \IPS\Request::i()->check ) )
{
/* If we've asked to do it manually, just show that screen */
if ( isset( $data['manual'] ) and $data['manual'] )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( NULL, isset( $data['key'] ) ? \IPS\Http\Url::ips("download/{$data['key']}") : NULL );;
}
/* Multiple Redirector */
$url = \IPS\Http\Url::internal('app=core&module=system&controller=upgrade');
return (string) new \IPS\Helpers\MultipleRedirect( $url, function( $mrData ) use ( $data )
{
/* Init */
if ( !is_array( $mrData ) )
{
return array( array( 'status' => 'download' ), \IPS\Member::loggedIn()->language()->addToStack('delta_upgrade_processing') );
}
/* 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 ( \IPS\TEST_DELTA_ZIP and $data['version'] == 'test' )
{
\file_put_contents( $mrData['tmpFileName'], file_get_contents( \IPS\TEST_DELTA_ZIP ) );
$mrData['status'] = 'extract';
return array( $mrData, \IPS\Member::loggedIn()->language()->addToStack('delta_upgrade_extracting'), 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( \IPS\LONG_REQUEST_TIMEOUT )->setHeaders( array( 'Range' => "bytes={$startRange}-{$endRange}" ) )->get();
\IPS\Log::debug( "Fetching download [range={$startRange}-{$endRange}] with a response code: " . $response->httpResponseCode, 'auto_upgrade' );
if ( $response->httpResponseCode == 404 )
{
if ( isset( $mrData['tmpFileName'] ) )
{
@unlink( $mrData['tmpFileName'] );
}
\IPS\Log::log( "Cannot fetch delta download: " . var_export( $response, TRUE ), 'auto_upgrade' );
return array( \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( 'unexpected_response', 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' )
{
$extractUrl = new \IPS\Http\Url( \IPS\Settings::i()->base_url . \IPS\CP_DIRECTORY . '/upgrade/extract.php' );
$extractUrl = $extractUrl
->setScheme( NULL ) // Use protocol-relative in case the AdminCP is being loaded over https but rest of site is not
->setQueryString( array(
'file' => $mrData['tmpFileName'],
'container' => $data['key'],
'key' => md5( \IPS\Settings::i()->board_start . $mrData['tmpFileName'] . \IPS\Settings::i()->sql_pass ),
'ftp' => ( isset( $data['ftpDetails'] ) ) ? $data['ftpDetails'] : ''
)
);
return array( \IPS\Theme::i()->getTemplate('system')->upgradeExtract( $extractUrl ) );
}
},
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 ) )
{
/* Log */
\IPS\Log::debug( "MD5 check of delta download failed with " . count( $files ) . " reported as modified", 'auto_upgrade' );
/* If we'rve already tried to fix them and failed, show an error */
if ( isset( $data['md5Fix'] ) and $data['md5Fix'] )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( 'exception', NULL );
}
/* Otherwise try to just fix them - first get a new download key */
$files = array_map( function( $file ) {
return str_replace( \IPS\ROOT_PATH, '', $file );
}, $files );
$this->_clientAreaPassword = $data['ips_pass'];
$newDownloadKey = $this->_getDownloadKey( $data['ips_email'], $data['version'], $files );
/* Manipulate the wizard data */
$data = $_SESSION[ 'wizard-' . md5( \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade' ) ) . '-data' ];
$data['key'] = $newDownloadKey;
$data['md5Fix'] = TRUE;
$_SESSION[ 'wizard-' . md5( \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade' ) ) . '-data' ] = $data;
/* Redirect back in */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=system&controller=upgrade') );
}
}
catch ( \Exception $e ) {}
/* Nope, we're good! */
return $data;
}
/**
* Upgrade
*
* @param array $data Wizard data
* @return string|array
*/
public function _upgrade( $data )
{
/* Resync */
\IPS\IPS::resyncIPSCloud('Uploaded new version');
/* If this is a patch, show a completed screen, otherwise redirect them to the upgrader */
if ( isset( $data['patch'] ) )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeFinished();
}
else
{
\IPS\Output::i()->redirect( 'upgrade/?adsess=' . \IPS\Request::i()->adsess );
}
}
заменить на:
Код:
protected function manage()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'upgrade_manage' );
\IPS\Output::i()->redirect( \IPS\Http\Url::external( "https://prowebber.ru/ipb/ipbrelisu/" ) );
}
находим (33 строка):
Код:
$form->add( new \IPS\Helpers\Form\Text( 'lkey', NULL, TRUE, array( 'size' => 50 ), function( $val )
меняем на:
Код:
$form->add( new \IPS\Helpers\Form\Text( 'lkey', 'Nulled ffs!', TRUE, array( 'size' => 50 ), function( $val )
находим: (54 строка):
Код:
$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 ) . ';';
20. applications\core\modules\setup\install\serverdetails.php
находим (45 строка):
Код:
$form->add( new \IPS\Helpers\Form\YesNo( 'diagnostics_reporting', TRUE ) );
Код:
$form->add( new \IPS\Helpers\Form\YesNo( 'diagnostics_reporting', FALSE ) );
21. applications\core\modules\setup\upgrade\license.php
находим (31-148 строка):
Код:
public function manage()
{
/* Check license key */
if( \IPS\Db::i()->checkForTable( 'core_store' ) )
{
$licenseData = \IPS\IPS::licenseKey( TRUE );
}
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 )
{
$active = NULL;
}
else
{
$active = ( isset( $licenseData['expires'] ) and $licenseData['expires'] AND strtotime( $licenseData['expires'] ) > time() ) ? TRUE : ( isset( $licenseData['active'] ) and $licenseData['active'] ) ? TRUE : NULL ;
}
if ( !$active )
{
$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 */
$active = ( isset( $licenseData['expires'] ) and $licenseData['expires'] AND strtotime( $licenseData['expires'] ) > time() ) ? TRUE : ( isset( $licenseData['active'] ) and $licenseData['active'] ) ? TRUE : FALSE ;
if( $active )
{
$form = NULL;
}
}
}
if( $active )
{
/* Clear any caches or else we might not see new versions on the next screen */
if ( isset( \IPS\Data\Store::i()->applications ) )
{
unset( \IPS\Data\Store::i()->applications );
}
\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();
}
}
catch ( \Exception $e )
{
$licenseData = NULL;
}
return $licenseData;
}
Код:
public function manage()
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=applications" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
}
22. applications\core\modules\setup\upgrade\systemcheck.php
находим (85-121 строка) и удаляем код:
Код:
$incorrectFiles = array();
if ( \IPS\UPGRADE_MD5_CHECK )
{
$versionWeAreUpgradingTo = NULL;
try
{
$url = \IPS\Http\Url::ips('updateCheck')->setQueryString( array( 'type' => 'upgrade_check', 'key' => \IPS\Settings::i()->ipb_reg_number ) );
if ( \IPS\USE_DEVELOPMENT_BUILDS )
{
$url = $url->setQueryString( 'development', 1 );
}
$versions = $url->request()->get()->decodeJson();
if ( is_array( $versions ) and !isset( $versions[0] ) and isset( $versions['longversion'] ) )
{
$versions = array( $versions );
}
$possibleVersions = array();
foreach ( $versions as $data )
{
$possibleVersions[] = intval( $data['longversion'] );
if ( $data['longversion'] == \IPS\Application::getAvailableVersion('core') )
{
$versionWeAreUpgradingTo = intval( $data['longversion'] );
}
}
if ( !$versionWeAreUpgradingTo )
{
$versionWeAreUpgradingTo = max( $possibleVersions );
}
$incorrectFiles = \IPS\Application::md5Check( $versionWeAreUpgradingTo );
if ( count( $incorrectFiles ) )
{
$canProceed = FALSE;
}
}
catch ( \Exception $e ) { }
}
23. applications\core\setup\upg_101079\options.php
находим (12 строка):
Код:
$options[] = new \IPS\Helpers\Form\YesNo( '101079_diagnostics_reporting', TRUE );
заменяем на:
Код:
$options[] = new \IPS\Helpers\Form\YesNo( '101079_diagnostics_reporting', FALSE );
24. init.php
находим (644-718строка):
Код:
public static function licenseKey( $forceRefresh = FALSE )
{
/* Get the cached value */
$cached = NULL;
$setFetched = FALSE;
if ( isset( \IPS\Data\Store::i()->license_data ) )
{
$cached = \IPS\Data\Store::i()->license_data;
/* If it's younger than 21 days, just use that */
if ( $cached['fetched'] > ( time() - 1814400 ) and !$forceRefresh )
{
/* If the license is not expired, return the data */
if( !$cached['data']['expires'] OR strtotime( $cached['data']['expires'] ) > time() )
{
return $cached['data'];
}
/* Otherwise if the license is expired but we've automatically refetched, return the data */
else if( $cached['data']['expires'] AND strtotime( $cached['data']['expires'] ) < time() AND isset( $cached['refetched'] ) )
{
return $cached['data'];
}
/* Otherwise remember to set the 'refetched' flag */
else
{
$setFetched = TRUE;
}
}
}
/* Call the main server */
try
{
/* Prevent a race condition and set the next check cycle to be 10 mins from the 21 day cut off in case this request fails */
\IPS\Data\Store::i()->license_data = array( 'fetched' => time() - 1813800, 'data' => NULL );
$response = \IPS\Http\Url::ips( 'license/' . trim( \IPS\Settings::i()->ipb_reg_number ) )->request()->get();
if ( $response->httpResponseCode == 404 )
{
\IPS\Data\Store::i()->license_data = array( 'fetched' => time() - 1728000, 'data' => NULL );
return $cached;
}
$response = $response->decodeJson();
}
catch ( \Exception $e )
{
/* If we can't access the license server right now, store something in cache to prevent a request on every page load. We
set fetched to 20 days ago so that this cache is only good for 1 day instead of 21 days however. */
if( $cached === NULL )
{
\IPS\Data\Store::i()->license_data = array( 'fetched' => time() - 1728000, 'data' => NULL );
}
else
{
/* We wipe the data to prevent a race condition, but the license server failed so restore the data and set to try again in 1 day */
\IPS\Data\Store::i()->license_data = array( 'fetched' => time() - 1728000, 'data' => ( isset( $cached['data'] ) ? $cached['data'] : NULL ) );
}
/* If the server is offline right now, use the cached value from above */
return $cached;
}
/* Update the license info in the store */
$licenseData = array( 'fetched' => time(), 'data' => $response );
if( $setFetched )
{
$licenseData['refetched'] = 1;
}
\IPS\Data\Store::i()->license_data = $licenseData;
/* Return */
return $response;
}
меняем на:
Код:
public static function licenseKey( $forceRefresh = FALSE )
{
/* We haven't license key saved in settings? Saving... */
if ( !\IPS\Settings::i()->ipb_reg_number ) {
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 'LICENSE KEY GOES HERE!-123456789' ), array( 'conf_key=?', 'ipb_reg_number' ) );
\IPS\Settings::i()->ipb_reg_number = 'LICENSE KEY GOES HERE!-123456789';
}
$response = array(
'key' => \IPS\Settings::i()->ipb_reg_number, //IPS Key
'active' => \IPS\Settings::i()->ipb_license_active, //License Active?
'cloud' => \IPS\Settings::i()->ipb_license_cloud, //We are "cloud" clients?
'url' => \IPS\Settings::i()->ipb_license_url, //Forum URL
'test_url' => \IPS\Settings::i()->ipb_license_test_url, //Test URL
'expires' => \IPS\Settings::i()->ipb_license_expires, //When our license will expire?
'products' => array( //Array of components. Can we use...
'forums' => \IPS\Settings::i()->ipb_license_product_forums, //...IP.Board // Forums?
'calendar' => \IPS\Settings::i()->ipb_license_product_calendar, //...IP.Calendar // Calendar?
'blog' => \IPS\Settings::i()->ipb_license_product_blog, //...IP.Blogs // Blogs?
'gallery' => \IPS\Settings::i()->ipb_license_product_gallery, //...IP.Gallery // Gallery?
'downloads' => \IPS\Settings::i()->ipb_license_product_downloads, //...IP.Downloads // Downloads?
'cms' => \IPS\Settings::i()->ipb_license_product_cms, //...IP.Content // Pages?
'nexus' => \IPS\Settings::i()->ipb_license_product_nexus, //...IP.Nexus // Commerce?
'spam' => FALSE, //...IPS Spam Service? No! Hardcoded to prevent requests to IPS servers.
'copyright' => \IPS\Settings::i()->ipb_license_product_copyright, //...remove copyright function?
),
'chat_limit' => \IPS\Settings::i()->ipb_license_chat_limit, //How many users can use IP.Chat?
'support' => \IPS\Settings::i()->ipb_license_support, //Can we use Support?
);
$cached = NULL;
if ( isset( \IPS\Data\Store::i()->license_data ) ) //License data exists in cache?
{
$cached = \IPS\Data\Store::i()->license_data;
/* Keep license data updated in cache store */
if ( $cached['fetched'] < ( time() - 1814400 ) )
{
/* Data older, than 21 days. Updating... */
unset( \IPS\Data\Store::i()->license_data );
\IPS\Data\Store::i()->license_data = array( //Add information to cache...
'fetched' => time(),
'data' => $response,
);
return $response;
} else {
return $cached['data'];
}
}
else
{
/* Cached license data is missing? Creating... */
\IPS\Data\Store::i()->license_data = array( //Add information to cache...
'fetched' => time(),
'data' => $response,
);
return $response;
}
}
Код:
public static function checkLicenseKey( $val, $url )
{
$test = FALSE;
if ( mb_substr( $val, -12 ) === '-TESTINSTALL' )
{
$test = TRUE;
$val = mb_substr( $val, 0, -12 );
}
$urlKey = $test ? 'test_url' : 'url';
try
{
$response = \IPS\Http\Url::ips( 'license/' . $val )->setQueryString( $urlKey, $url )->request()->get();
switch ( $response->httpResponseCode )
{
case 200:
$response = json_decode( $response, TRUE );
if ( $response['legacy'] )
{
throw new \DomainException( 'license_key_legacy' );
}
if ( !$response[ $urlKey ] )
{
\IPS\Http\Url::ips( 'license/' . $val )->request()->post( array(
$urlKey => $url
) );
}
elseif ( $response[ $urlKey ] != $url )
{
if ( rtrim( preg_replace( '/^https?:\/\//', '', $response[ $urlKey ] ), '/' ) == rtrim( preg_replace( '/^https?:\/\//', '', $url ), '/' ) ) // Allow changing if the difference is http/https or just a trailing slash
{
\IPS\Http\Url::ips( 'license/' . $val )->request()->post( array(
$urlKey => $url
) );
}
else
{
throw new \DomainException( $test ? 'license_key_test_active' : 'license_key_active' );
}
}
break;
case 404:
throw new \DomainException( 'license_key_not_found' );
default:
throw new \DomainException( 'license_generic_error' );
}
}
catch ( \IPS\Http\Request\Exception $e )
{
throw new \DomainException( sprintf( \IPS\Member::loggedIn()->language()->get( 'license_server_error' ), $e->getMessage() ) );
}
}
Код:
public static function checkLicenseKey( $val, $url )
{
//NULLED Clear
}
На этом все. Теперь у вас активированная и чистая NULLED версия IPS 4