Advertisement
Guest User

Untitled

a guest
Apr 17th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.0.2.0
  8. * @ Author : DeZender
  9. * @ Release on : 06.04.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class Am_LicenseChecker
  15. {
  16. const OK = 'ok';
  17. const CONNECTION_ERROR = 'connection_error';
  18. const LICENSE_EMPTY = 'license_empty';
  19. const LICENSE_NOT_FOUND = 'license_not_found';
  20. const LICENSE_DISABLED = 'license_disabled';
  21. const LICENSE_EXPIRED = 'license_expired';
  22. const LICENSE_SERVER_ERROR = 'license_server_error';
  23. const ACTIVATION_SERVER_ERROR = 'activation_server_error';
  24. const ERROR_INVALID_INPUT = 'invalid_input';
  25. const ERROR_NO_SPARE_ACTIVATIONS = 'no_spare_activations';
  26. const ERROR_NO_ACTIVATION_FOUND = 'no_activation_found';
  27. const ERROR_NO_REACTIVATION_ALLOWED = 'no_reactivation_allowed';
  28. const ERROR_NO_RESPONSE = 'no_response';
  29. const ERROR_OTHER = 'other_error';
  30.  
  31. /** that is how activation cache will be encrypted - CHANGE IT! */
  32. private $_local_encryption_key = 'dd2b31f68b870fc54ee5b8b342fc720e05374574';
  33. public $messages = ['ok' => 'License OK', 'connection_error' => 'Could not connect to licensing server - please try again later', 'license_empty' => 'Empty or invalid license key submitted', 'license_not_found' => 'License key not found on licensing server', 'license_disabled' => 'License key has been disabled', 'license_expired' => 'License key expired', 'license_server_error' => 'License server is not available - please try again later', 'activation_server_error' => 'Activation server error', 'invalid_input' => 'Activation failed: invalid input', 'no_spare_activations' => 'No more activations allowed', 'no_activation_found' => 'No activation found for this installation', 'no_reactivation_allowed' => 'Re-activation is not allowed', 'no_response' => 'Internal problem on activation server', 'other_error' => 'Error returned from activation server'];
  34. protected $api_version = 1;
  35. /** @var int last code returned from */
  36. protected $code = 'ok';
  37. /** @var string last error message */
  38. protected $message;
  39. /** @var string license key */
  40. protected $key;
  41. /** @var string activation url */
  42. protected $url;
  43. /** @var int call home every .. days, 0 - disabled */
  44. protected $call_home_days = 2;
  45. /** @var int grace period .. hours, 24 - default. if "call home" failed, allow to continue */
  46. protected $grace_period = 24;
  47. /** @var array request_vars: set of
  48. * 'ip' : 'Server IP' : detected automatically by getServerIp() method
  49. * 'url' : 'Installation URL' : you must override getRootUrl() method to return it
  50. * 'domain' : 'Domain' : detected automatically by getDomain() method
  51. * 'sdomain' : 'Secure Domain (if application can use 2 domains)': override getSdomain() method to return
  52. * 'hardware-id' : Hardware ID - it can be any info on your choice that identifies the installation - override getHardwareId() method to return
  53. * */
  54. protected $request_vars = ['domain'];
  55. /** @var array() */
  56. public $openurl_callbacks = [
  57. ['this', 'openUrlFsockopen'],
  58. ['this', 'openUrlCurl'],
  59. ['this', 'openUrlFopen']
  60. ];
  61. /** @var stdclass */
  62. public $license_response;
  63. /** @var Am_LicenseChecker_ActivationResponse */
  64. public $activation_response;
  65. /** @var array cache */
  66. protected $_request;
  67.  
  68. /**
  69. * Constructor
  70. * @param string $key license key value
  71. * @param string $url activation url
  72. * @param string|array $hash verification hash
  73. */
  74. public function __construct($key, $url, $hash = NULL)
  75. {
  76. $this->key = $key;
  77. $this->url = $url;
  78. $this->hash = $hash;
  79. }
  80.  
  81. public function setError($code, $message = NULL)
  82. {
  83. $this->code = $code;
  84. $this->message = ($message !== NULL ? $message : $this->messages[$code]);
  85. return $this;
  86. }
  87.  
  88. /**
  89. * Check license key against remote server
  90. * @return bool true of success
  91. * @see getCode()
  92. * @see getMessage()
  93. */
  94. public function checkLicenseKey()
  95. {
  96. $body = $this->makeRequest('GET', 'check-license', ['key' => $this->key], 'license_server_error');
  97. ..............................................................................
  98. ........................................
  99. ................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement