Guest User

Untitled

a guest
Jul 19th, 2020
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 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.1.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 15.05.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class MulticraftIntegration
  15. {
  16. public $logEnabled = true;
  17. public $logApi = false;
  18. public $logVerbose = false;
  19. public $api;
  20. public $clientData = [];
  21. public $server = [];
  22. public $serverConfig = [];
  23. public $options = [];
  24. public $clientId = 0;
  25. public $serviceId = 0;
  26. public $packageId = 0;
  27. public $userId = 0;
  28. public $serverId = 0;
  29. public $messages = [];
  30. public $failed = false;
  31. public $lockFile = false;
  32. public $action = '';
  33. public $params = [];
  34. public $assignedIps = '';
  35. public $updateAssignedIps = false;
  36. public $dedicatedIpAvailable = [];
  37. public $whmcsServerId = 0;
  38. public $_cfg = false;
  39.  
  40. public function __construct()
  41. {
  42. $this->server = ['name' => NULL, 'ip' => NULL, 'port' => '', 'dir' => NULL, 'world' => NULL, 'players' => NULL, 'memory' => NULL, 'start_memory' => NULL, 'jarfile' => NULL, 'autostart' => NULL, 'default_level' => NULL, 'daemon_id' => NULL, 'announce_save' => NULL, 'kick_delay' => NULL, 'suspended' => NULL, 'autosave' => NULL, 'jardir' => NULL, 'template' => NULL, 'setup' => NULL, 'prev_jarfile' => NULL, 'params' => NULL, 'crash_check' => NULL, 'disk_quota' => NULL, 'domain' => NULL];
  43.  
  44. foreach ($this->server as $k => $v) {
  45. $this->server[$k] = $this->cfg('server', $k, $v);
  46. }
  47.  
  48. $this->serverConfig = ['ip_auth_role' => NULL, 'give_role' => NULL, 'tp_role' => NULL, 'summon_role' => NULL, 'chat_role' => NULL, 'user_jar' => NULL, 'user_ftp' => NULL, 'visible' => NULL, 'user_schedule' => NULL, 'user_name' => NULL, 'user_visibility' => NULL, 'display_ip' => NULL, 'user_players' => NULL, 'user_mysql' => NULL, 'user_jardir' => NULL, 'user_params' => NULL, 'user_templates' => NULL, 'user_memory' => NULL, 'user_crash_check' => NULL, 'user_subdomain' => NULL];
  49.  
  50. foreach ($this->serverConfig as $k => $v) {
  51. $this->serverConfig[$k] = $this->cfg('server_config', $k, $v);
  52. }
  53.  
  54. $this->options = ['location' => '_default_', 'max_per_daemon' => '', 'allowed_daemons' => '', 'shuffle_daemons' => '', 'delete_worlds' => '', 'delete_user' => '', 'dedicated_ip' => '', 'use_best_daemon' => '', 'retry_times' => '10', 'existing_password' => 'Your existing panel password', 'op_player' => 1, 'store_id_as_domain' => false, 'keep_id_after_terminate' => false, 'keep_domain_after_terminate' => false];
  55.  
  56. foreach ($this->options as $k => $v) {
  57. $this->options[$k] = $this->cfg('settings', $k, $v);
  58. }
  59.  
  60. $this->logEnabled = $this->cfg('log', 'enabled', $this->logEnabled);
  61. $this->logApi = $this->cfg('log', 'api', $this->logApi);
  62. $this->logVerbose = $this->cfg('log', 'verbose', $this->logVerbose);
  63. }
  64.  
  65. public function cfg($section, $param, $default)
  66. {
  67. if ($this->_cfg === false) {
  68. $this->_cfg = @include 'config.php';
  69.  
  70. if (!$this->_cfg) {
  71. $this->_cfg = [];
  72. }
  73. }
  74.  
  75. $o = (isset($this->_cfg[$section][$param]) ? $this->_cfg[$section][$param] : $default);
  76.  
  77. if ($o !== $default) {
  78. $this->debug('Overriding ' . $section . '.' . $param . ': ' . var_export($o, true));
  79. }
  80.  
  81. return $o;
  82. }
  83.  
  84. static public function call($func, $params)
  85. {
  86. try {
  87. $mc = new MulticraftIntegration();
  88. $mc->action = ucfirst($func);
  89.  
  90. if (!$mc->init($params)) {
  91. return $mc->end();
  92. }
  93.  
  94. $mc->$func();
  95. return $mc->end();
  96. }
  97. catch (Exception $e) {
  98. return MulticraftIntegration::encode($e->getMessage());
  99. }
  100. }
  101.  
  102. public function fail($error)
  103. {
  104. $this->failed = true;
  105. $this->debug($error);
  106. return false;
  107. }
  108.  
  109. public function debug($msg)
  110. {
  111. $this->messages[] = $msg;
  112.  
  113. if (!$this->logVerbose) {
  114. return false;
  115. }
  116.  
  117. $this->logModule($msg);
  118. return false;
  119. }
  120.  
  121. public function _logModuleCall($action, $params, $raw, $pretty)
  122. {
  123. if (!$this->logEnabled) {
  124. return NULL;
  125. }
  126.  
  127. logModuleCall('Multicraft', $action, $params, $raw, $pretty, [$this->params['password'], $this->params['customfields']['password'], $this->params['configoptions']['password'], $this->params['clientsdetails']['password'], $this->params['serverpassword'], $this->params['serveraccesshash']]);
  128. }
  129.  
  130. public function logModule($raw, $pretty = false)
  131. {
  132. $this->_logModuleCall($this->action, $this->params, $raw, $pretty);
  133. }
  134.  
  135. public function logApi($method, $params, $response)
  136. {
  137. if (!$this->logApi) {
  138. return NULL;
  139. }
  140.  
  141. $this->_logModuleCall($this->action . '>' . $method, $params, $response, NULL);
  142. ............................................................................
  143. ...............................................
  144. ......................
Add Comment
Please, Sign In to add comment