Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.0.8.0
  8. * @ Author : DeZender
  9. * @ Release on : 25.09.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace WHMCS;
  15.  
  16. class License
  17. {
  18. const LICENSE_API_VERSION = '1.1';
  19. const LICENSE_API_HOSTS = array(
  20. 'a.licensing.whmcs.com',
  21. 'b.licensing.whmcs.com',
  22. 'c.licensing.whmcs.com',
  23. 'd.licensing.whmcs.com',
  24. 'e.licensing.whmcs.com',
  25. 'f.licensing.whmcs.com'
  26. );
  27.  
  28. private $licensekey = '';
  29. private $localkey = '';
  30. private $keydata = array( );
  31. private $salt = '';
  32. private $date = '';
  33. private $localkeydecoded = false;
  34. private $responsedata = '';
  35. private $postmd5hash = '';
  36. private $localkeydays = '10';
  37. private $allowcheckfaildays = '5';
  38. /**
  39. * @var array
  40. */
  41. private $debuglog = array( );
  42. private $version = '5cc7720f613926993107a6123a28eeaad706fc6a42324b40a3764748a28322280f5c373047bb2efad6f350a3bf070ad7ea0814abc720a6fb284fa6df4abea02e';
  43.  
  44. public function __construct(Application $whmcs)
  45. {
  46. $this->licensekey = $whmcs->get_license_key( );
  47. $this->localkey = $whmcs->get_config( 'License' );
  48. $this->salt = sha1( 'WHMCS' . $whmcs->get_config( 'Version' ) . 'TFB' . $whmcs->get_hash( ) );
  49. $this->date = date( 'Ymd' );
  50. $this->decodeLocalOnce( );
  51.  
  52. if (isset( $_GET['forceremote'] )) {
  53. $this->forceRemoteCheck( );
  54. Terminus::getInstance( )->doExit( );
  55. }
  56. }
  57.  
  58. /**
  59. * Retrieve a WHMCS\License object via singleton.
  60. *
  61. * @deprecated 6.0 Instance should be retrieved from DI [DI::make('license');]
  62. *
  63. * @return License
  64. */
  65. public static function getInstance()
  66. {
  67. return DI::make( 'license' );
  68. }
  69.  
  70. public function useInternalLicensingValidation()
  71. {
  72. $config = App::getApplicationConfig( );
  73. return (bool) $config['use_internal_licensing_validation'];
  74. }
  75.  
  76. /**
  77. * Retrieve a list of licensing server IPs
  78. *
  79. * @return array
  80. */
  81. private function getHosts()
  82. {
  83. if ($this->useInternalLicensingValidation( )) {
  84. return array( 'hou-1.licensing.web.staging.whmcs.com' );
  85. }
  86.  
  87. return self::LICENSE_API_HOSTS;
  88. }
  89.  
  90. public function getLicenseKey()
  91. {
  92. return $this->licensekey;
  93. }
  94.  
  95. private function getHostIP()
  96. {
  97. return WHMCS_LICENSE_IP;
  98. }
  99.  
  100. private function getHostDomain()
  101. {
  102. return WHMCS_LICENSE_DOMAIN;
  103. }
  104.  
  105. private function getHostDir()
  106. {
  107. return WHMCS_LICENSE_DIR;
  108. }
  109.  
  110. public function getSalt()
  111. {
  112. return $this->salt;
  113. }
  114.  
  115. public function getDate()
  116. {
  117. return $this->date;
  118. }
  119.  
  120. public function checkLocalKeyExpiry()
  121. {
  122. $originalcheckdate = $this->getKeyData( 'checkdate' );
  123. $localexpirymax = date( 'Ymd', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - $this->localkeydays, date( 'Y' ) ) );
  124.  
  125. if ($originalcheckdate < $localexpirymax) {
  126. return false;
  127. }
  128.  
  129. $localmax = date( 'Ymd', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + 2, date( 'Y' ) ) );
  130.  
  131. if ($localmax < $originalcheckdate) {
  132. return false;
  133. }
  134.  
  135. return true;
  136. }
  137.  
  138. /**
  139. * Build post data for license check.
  140. *
  141. * @return string[]
  142. */
  143. protected function buildPostData()
  144. {
  145. $postfields = array( );
  146. $postfields['licensekey'] = $this->getLicenseKey( );
  147. $postfields['domain'] = $this->getHostDomain( );
  148. $postfields['ip'] = $this->getHostIP( );
  149. $postfields['dir'] = $this->getHostDir( );
  150. $postfields['check_token'] = sha1( time( ) . $this->getLicenseKey( ) . mt_rand( 1000000000, 9999999999 ) );
  151. $whmcs = DI::make( 'app' );
  152. $postfields['version'] = $whmcs->getVersion( )->getCanonical( );
  153. $postfields['phpversion'] = PHP_VERSION;
  154. $stats = json_decode( $whmcs->get_config( 'SystemStatsCache' ), true );
  155.  
  156. if (!(is_array( $stats ))) {
  157. $stats = array( );
  158. }
  159.  
  160. $stats = array_merge( $stats, Environment\Environment::toArray( ) );
  161. $postfields['anondata'] = $this->encryptMemberData( $stats );
  162. .............................................................
  163. ..........................
  164. ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement