Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2023
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP8 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 8.1.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 21.06.2023
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace WHMCS\Module\Addon\Transferwise\Admin;
  15.  
  16. /**
  17. * Sample Admin Area Controller
  18. */
  19. class Controller
  20. {
  21. /** @var \Smarty Contain a smarty instance */
  22. public $view = null;
  23. /** @var string Contain chosen tabs name */
  24. public $action = null;
  25. /** @var string Contain a module link */
  26. public $modulelink = null;
  27. /** @var array Contain "vars" array from WHMCS */
  28. protected $vars = null;
  29. protected $whmcs = null;
  30. protected $settings = null;
  31. protected $license = null;
  32.  
  33. /**
  34. * Constructor.
  35. *
  36. * @param array $vars "vars" array from WHCMS.
  37. */
  38. public function __construct($vars, $controllerName)
  39. {
  40. global $templates_compiledir;
  41. global $customadminpath;
  42. global $module;
  43. global $_LANG;
  44. global $CONFIG;
  45. $this->view = new \Smarty();
  46. $this->whmcs = new Service\WhmcsService();
  47. $this->view->template_dir = ROOTDIR . '/modules/addons/' . $module . '/templates/';
  48. $this->view->compile_dir = $templates_compiledir;
  49. $this->view->assign('_LANG', $_LANG);
  50. $this->view->assign('_CONFIG', $CONFIG);
  51. $this->view->assign('csrfToken', generate_token('plain'));
  52. $this->settings = $this->getSettings();
  53. $this->vars = $vars;
  54. $this->view->assign('vars', $this->vars);
  55. $this->view->assign('module', $module);
  56. $this->view->assign('controller', $controllerName);
  57. $this->view->assign('customadminpath', $customadminpath);
  58. $this->modulelink = $CONFIG['SystemURL'] . '/' . $customadminpath . '/addonmodules.php?module=' . $module;
  59. $this->view->assign('modulelink', $this->modulelink);
  60. $licenseCheck = $this->checkLicense($this->settings['licensekey'], $this->settings['localkey']);
  61.  
  62. if ($licenseCheck['status'] == 'Active') {
  63. if ($licenseCheck['remotecheck'] == 1) {
  64. $this->updateLocalKey($licenseCheck['localkey']);
  65. }
  66. }
  67.  
  68. $this->license = ['status' => $licenseCheck['status'], 'nextduedate' => $licenseCheck['nextduedate'], 'billingcycle' => $licenseCheck['billingcycle'], 'checkdate' => $licenseCheck['checkdate']];
  69. }
  70.  
  71. private function updateLocalKey($localKey)
  72. {
  73. $localKeyExists = \WHMCS\Database\Capsule::table('trws_config')->select('value')->where('setting', 'localkey')->exists();
  74.  
  75. if ($localKeyExists) {
  76. $result = \WHMCS\Database\Capsule::table('trws_config')->where('setting', 'localkey')->update(['value' => $localKey]);
  77. return $result;
  78. }
  79. else {
  80. $result = \WHMCS\Database\Capsule::table('trws_config')->insert(['setting' => 'localkey', 'value' => $localKey]);
  81. ........................................................................
  82. ................................................
  83. .................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement