IP.Board Tutorials
Installation Tutorial unlicensed IPB 4.0
Submitted by BebeGFX, 08-06-2015, 10:35 AM, Thread ID: 4608
Thread Closed
This tutorial works only for installation , not upgrade !!! With IPB 4.0 , you can not switch installation unless you enter a valid license key , unlike the previous series . . Open the file init.php ( main folder ) and search (from line 498 )
/**
* Get license key data
*
* @return array|NULL
*/
public static function licenseKey()
{
/* Get the cached value */
$cached = NULL;
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 ) )
{
return $cached['data'];
}
}
/* Call the main server */
try
{
$response = \IPS\Http\Url::ips( 'license/' . \IPS\Settings::i()->ipb_reg_number )->request()->get();
if ( $response->httpResponseCode == 404 )
{
return NULL;
}
$response = $response->decodeJson();
}
catch ( \Exception $e )
{
/* If the server is offline right now, use the cached value from above */
return $cached;
}
/* Update the license info in the store */
\IPS\Data\Store::i()->license_data = array( 'fetched' => time(), 'data' => $response );
/* Return */
return $response;
}
/**
* Check license key
*
* @param string The license key
* @param string The site URL
* @return void
* @throws \DomainException
*/
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' );
}
/* Previously, URL's were stored as http://domain.com/forums - this check here may throw a "key already in use" error if upgrading or setting up a test install */
if ( rtrim( $response[ $urlKey ], '/' ) !== rtrim( $url, '/' ) )
{
if ( $response[ $urlKey ] )
{
throw new \DomainException( $test ? 'license_key_test_active' : 'license_key_active' );
}
else
{
\IPS\Http\Url::ips( 'license/' . $val )->request()->post( array(
$urlKey => $url
) );
}
}
break;
case 404:
throw new \DomainException( 'license_key_not_found' );
default:
throw new \DomainException( 'generic_license_error' );
}
}
catch ( \IPS\Http\Request\Exception $e )
{
throw new \DomainException( sprintf( \IPS\Member::loggedIn()->language()->get( 'license_server_error' ), $e->getMessage() ) );
}
}
And replace with:
And the license key is 1234 : D . May there change you want ( web url , etc ) .
Excuse typos are novel and not know English too .
/**
* Get license key data
*
* @return array|NULL
*/
public static function licenseKey()
{
/* Get the cached value */
$cached = NULL;
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 ) )
{
return $cached['data'];
}
}
/* Call the main server */
try
{
$response = \IPS\Http\Url::ips( 'license/' . \IPS\Settings::i()->ipb_reg_number )->request()->get();
if ( $response->httpResponseCode == 404 )
{
return NULL;
}
$response = $response->decodeJson();
}
catch ( \Exception $e )
{
/* If the server is offline right now, use the cached value from above */
return $cached;
}
/* Update the license info in the store */
\IPS\Data\Store::i()->license_data = array( 'fetched' => time(), 'data' => $response );
/* Return */
return $response;
}
/**
* Check license key
*
* @param string The license key
* @param string The site URL
* @return void
* @throws \DomainException
*/
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' );
}
/* Previously, URL's were stored as http://domain.com/forums - this check here may throw a "key already in use" error if upgrading or setting up a test install */
if ( rtrim( $response[ $urlKey ], '/' ) !== rtrim( $url, '/' ) )
{
if ( $response[ $urlKey ] )
{
throw new \DomainException( $test ? 'license_key_test_active' : 'license_key_active' );
}
else
{
\IPS\Http\Url::ips( 'license/' . $val )->request()->post( array(
$urlKey => $url
) );
}
}
break;
case 404:
throw new \DomainException( 'license_key_not_found' );
default:
throw new \DomainException( 'generic_license_error' );
}
}
catch ( \IPS\Http\Request\Exception $e )
{
throw new \DomainException( sprintf( \IPS\Member::loggedIn()->language()->get( 'license_server_error' ), $e->getMessage() ) );
}
}
And replace with:
/**
* Get license key data
*
* @return array|NULL
*/
public static function licenseKey()
{
$response = array(
'key' => '1234', // Cheia de licenta
'url' => 'Forum_ipb.ro', // URL-ul site-ului
//'expires' => '==NEVER==', //Nu-i nevoie
'active' => TRUE, //Licenta activa
'products' => array( //Ce putem folosi?
'forums' => TRUE, //...IP.Board?
'calendar' => TRUE, //...IP.Calendar?
'blog' => TRUE, //...IP.Blogs?
'gallery' => TRUE, //...IP.Gallery?
'downloads' => TRUE, //...IP.Downloads?
'cms' => TRUE, //...IP.Content?
'nexus' => TRUE, //...IP.Nexus?
'spam' => FALSE, //...IPS Spam Service? NO, WE CAN'T!!!
'copyright' => FALSE, //...remove copyright function?
),
'chat_limit' => '0', //How many users can use IP.Chat? ZERO!!!
'support' => 'No', //Can we use Standart Support? NO!!!
);
/* If key not saved in DB, we will save it manually */
if ( !\IPS\Settings::i()->ipb_reg_number ) {
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $response['key'] ), array( 'conf_key=?', 'ipb_reg_number' ) );
\IPS\Settings::i()->ipb_reg_number = $response['key'];
}
/* Update the license info in the store */
unset( \IPS\Data\Store::i()->license_data );
\IPS\Data\Store::i()->license_data = array( //Add information to cache...
'fetched' => time(),
'data' => $response,
);
/* Return */
return $response;
}
/**
* Check license key
*
* @param string The license key
* @param string The site URL
* @return void
* @throws \DomainException
*/
* Get license key data
*
* @return array|NULL
*/
public static function licenseKey()
{
$response = array(
'key' => '1234', // Cheia de licenta
'url' => 'Forum_ipb.ro', // URL-ul site-ului
//'expires' => '==NEVER==', //Nu-i nevoie
'active' => TRUE, //Licenta activa
'products' => array( //Ce putem folosi?
'forums' => TRUE, //...IP.Board?
'calendar' => TRUE, //...IP.Calendar?
'blog' => TRUE, //...IP.Blogs?
'gallery' => TRUE, //...IP.Gallery?
'downloads' => TRUE, //...IP.Downloads?
'cms' => TRUE, //...IP.Content?
'nexus' => TRUE, //...IP.Nexus?
'spam' => FALSE, //...IPS Spam Service? NO, WE CAN'T!!!
'copyright' => FALSE, //...remove copyright function?
),
'chat_limit' => '0', //How many users can use IP.Chat? ZERO!!!
'support' => 'No', //Can we use Standart Support? NO!!!
);
/* If key not saved in DB, we will save it manually */
if ( !\IPS\Settings::i()->ipb_reg_number ) {
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $response['key'] ), array( 'conf_key=?', 'ipb_reg_number' ) );
\IPS\Settings::i()->ipb_reg_number = $response['key'];
}
/* Update the license info in the store */
unset( \IPS\Data\Store::i()->license_data );
\IPS\Data\Store::i()->license_data = array( //Add information to cache...
'fetched' => time(),
'data' => $response,
);
/* Return */
return $response;
}
/**
* Check license key
*
* @param string The license key
* @param string The site URL
* @return void
* @throws \DomainException
*/
And the license key is 1234 : D . May there change you want ( web url , etc ) .
Excuse typos are novel and not know English too .
Users browsing this thread: 1 Guest(s)