Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 3.5.0.0
- * @ Author : DeZender
- * @ Release on : 22.06.2018
- * @ Official site : http://DeZender.Net
- *
- */
- namespace WHMCS;
- class License
- {
- private $licensekey = '';
- private $localkey = false;
- private $keydata = null;
- private $salt = '';
- private $postmd5hash = '';
- private $localkeydays = '10';
- private $allowcheckfaildays = '5';
- private $useInternalLicensingMirror = false;
- private $debuglog = array();
- private $lastCurlError = null;
- const LICENSE_API_VERSION = '1.1';
- const LICENSE_API_HOSTS = array('a.licensing.whmcs.com', 'b.licensing.whmcs.com', 'c.licensing.whmcs.com', 'd.licensing.whmcs.com', 'e.licensing.whmcs.com', 'f.licensing.whmcs.com');
- const STAGING_LICENSE_API_HOSTS = array('hou-1.licensing.web.staging.whmcs.com');
- const UNLICENSED_KEY = 'LICENSE-REQUIRED';
- public function checkFile($value)
- {
- if ($value != 'a896faf2c31f2acd47b0eda0b3fd6070958f1161') {
- throw new Exception\Fatal('File version mismatch. Please contact support.');
- }
- return $this;
- }
- public function setLicenseKey($licenseKey)
- {
- $this->licensekey = $licenseKey;
- return $this;
- }
- public function setLocalKey($localKey)
- {
- $this->decodeLocal($localKey);
- return $this;
- }
- public function setSalt($version, $hash)
- {
- if (empty($version) || empty($hash)) {
- throw new Exception('Unable to generate licensing salt');
- }
- $this->salt = sha1(sprintf('WHMCS%s%s%s', $version, '|-|', $hash));
- return $this;
- }
- public function useInternalValidationMirror()
- {
- $this->useInternalLicensingMirror = true;
- return $this;
- }
- protected function getHosts()
- {
- if ($this->useInternalLicensingMirror) {
- return self::STAGING_LICENSE_API_HOSTS;
- }
- return self::LICENSE_API_HOSTS;
- }
- public function getLicenseKey()
- {
- return $this->licensekey;
- }
- protected function getHostDomain()
- {
- $domain = (defined('WHMCS_LICENSE_DOMAIN') ? WHMCS_LICENSE_DOMAIN : '');
- if (empty($domain) || $domain == '-') {
- throw new Exception('Unable to retrieve current server name. Please check PHP/vhost configuration and ensure SERVER_NAME is displaying appropriately via PHP Info.');
- }
- $this->debug('Host Domain: ' . $domain);
- return $domain;
- }
- protected function getHostIP()
- {
- $ip = (defined('WHMCS_LICENSE_IP') ? WHMCS_LICENSE_IP : '');
- $this->debug('Host IP: ' . $ip);
- return $ip;
- }
- protected function getHostDir()
- {
- $directory = (defined('WHMCS_LICENSE_DIR') ? WHMCS_LICENSE_DIR : '');
- $this->debug('Host Directory: ' . $directory);
- return $directory;
- }
- private function getSalt()
- {
- return $this->salt;
- }
- protected function isLocalKeyValidToUse()
- {
- $licenseKey = $this->getKeyData('key');
- if (empty($licenseKey) || $licenseKey != $this->licensekey) {
- throw new Exception('License Key Mismatch in Local Key');
- }
- $originalcheckdate = $this->getCheckDate();
- $localmax = Carbon::now()->startOfDay()->addDays(2);
- if ($originalcheckdate->gt($localmax)) {
- throw new Exception('Original check date is in the future');
- }
- }
- protected function hasLocalKeyExpired()
- {
- $originalCheckDate = $this->getCheckDate();
- $localExpiryMax = Carbon::now()->startOfDay()->subDays($this->localkeydays);
- if (!$originalCheckDate || $originalCheckDate->lt($localExpiryMax)) {
- throw new Exception('Original check date is outside allowed validity period');
- }
- }
- protected function buildPostData()
- {
- $whmcs = \DI::make('app');
- $stats = json_decode($whmcs->get_config('SystemStatsCache'), true);
- if (!is_array($stats)) {
- ..........................................................................
- .........................................
- ....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement