Jump to content

Locked Pinned Tutorial Instalare Ipb 4.0 Fara Cheia De Licenta


justMe.

Recommended Posts

!!! Acest tutorial merge doar pentru instalare, nu şi upgrade !!!

Odată cu IPB 4.0, nu mai puteţi trece de instalare dacă nu introduceţi o cheie de licenţă validă, spre deosebire de seriile anterioare.

Deschideţi fişierul init.php (folderul principal) şi căutaţi (începând cu linia 498)

Spoiler

	
	/**
	 * Get license key data
	 *
	 * @return	array|NULL
	 */
	public static function licenseKey()
	{
		/* Get the cached value */
		$cached = NULL;
		if ( isset( IPSDataStore::i()->license_data ) )
		{
			$cached = IPSDataStore::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 = IPSHttpUrl::ips( 'license/' . IPSSettings::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 */
		IPSDataStore::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 = IPSHttpUrl::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
						{
							IPSHttpUrl::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 ( IPSHttpRequestException $e )
		{
			throw new DomainException( sprintf( IPSMember::loggedIn()->language()->get( 'license_server_error' ), $e->getMessage() ) );
		}
	}

 

 

Şi înlocuiţi cu:

 

Spoiler

	/**
	 * 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 ( !IPSSettings::i()->ipb_reg_number ) {
			IPSDb::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $response['key'] ), array( 'conf_key=?', 'ipb_reg_number' ) );
			IPSSettings::i()->ipb_reg_number	= $response['key'];							
		}

		/* Update the license info in the store */
		unset( IPSDataStore::i()->license_data );
		IPSDataStore::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
	 */
	public static function checkLicenseKey( $val, $url )
	{
	}

 

 

Iar cheia de licenţă devine 1234 :D. Mai modificaţi acolo ce doriţi (url site, etc).

 

Spoiler

jhaze3w.png

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...