88 lines
2.2 KiB
PHP
88 lines
2.2 KiB
PHP
<?php
|
|
/**
|
|
* <pre>
|
|
* Invision Power Services
|
|
* IP.Board v3.2.3
|
|
* Installer: License Key
|
|
* Last Updated: $LastChangedDate: 2011-05-26 15:04:51 -0400 (Thu, 26 May 2011) $
|
|
* </pre>
|
|
*
|
|
* @author $Author: bfarber $
|
|
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
|
* @license This is NULLED!
|
|
* @package IP.Board
|
|
* @link http://hatynka.in
|
|
* @version $Rev: 8903 $
|
|
*
|
|
*/
|
|
|
|
|
|
class upgrade_license extends ipsCommand
|
|
{
|
|
/**
|
|
* Execute selected method
|
|
*
|
|
* @access public
|
|
* @param object Registry object
|
|
* @return @e void
|
|
*/
|
|
public function doExecute( ipsRegistry $registry )
|
|
{
|
|
/* If less than 3, just bounce out as settings tables won't be here, etc */
|
|
if ( IPSSetUp::is300plus() !== TRUE )
|
|
{
|
|
$this->registry->autoLoadNextAction( 'upgrade' );
|
|
return;
|
|
}
|
|
|
|
if ( $this->request['do'] == 'check' )
|
|
{
|
|
$lcheck = $this->check();
|
|
if ( $lcheck === TRUE )
|
|
{
|
|
$this->registry->autoLoadNextAction( 'upgrade' );
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$lcheck = $this->check( TRUE );
|
|
if ( $lcheck === TRUE )
|
|
{
|
|
$this->registry->autoLoadNextAction( 'upgrade' );
|
|
return;
|
|
}
|
|
}
|
|
|
|
$this->registry->output->setTitle( "Ключ лицензии" );
|
|
$this->registry->output->setNextAction( "license&do=check" );
|
|
$this->registry->output->addContent( $this->registry->output->template()->page_license( $lcheck ) );
|
|
$this->registry->output->sendOutput();
|
|
}
|
|
|
|
/**
|
|
* Check License Key
|
|
*
|
|
* @access public
|
|
* @return bool
|
|
*/
|
|
private function check( $init=FALSE )
|
|
{
|
|
$this->request['lkey'] = ( $init ) ? ipsRegistry::$settings['ipb_reg_number'] : trim( $this->request['lkey'] );
|
|
|
|
if ( !$this->request['lkey'] and !$init )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
$url = ipsRegistry::$settings['board_url'] ? ipsRegistry::$settings['board_url'] : ipsRegistry::$settings['base_url'];
|
|
|
|
require_once( IPS_KERNEL_PATH . 'classFileManagement.php' );/*noLibHook*/
|
|
$query = new classFileManagement();
|
|
$query->use_sockets = 1;
|
|
$response = $query->getFileContents( "http://myipb.in/license.php?api=activateKey&lk={$this->request['lkey']}&domain=".urlencode($url) );
|
|
$response = json_decode( $response, true );
|
|
IPSLib::updateSettings( array( 'ipb_reg_number' => $this->request['lkey'] ) );
|
|
return TRUE;
|
|
}
|
|
} |