Advertisement
Guest User

Untitled

a guest
Aug 7th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.55 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.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace EdgeHosting;
  15.  
  16. function xero_output($vars)
  17. {
  18. if (!\WHMCS\Database\Capsule::table('mod_xero')->get()) {
  19. if (!$_GET['install'] && !$_GET['sync']) {
  20. return include __DIR__ . '/install.phtml';
  21. }
  22. else if ($_GET['install']) {
  23. install_defaults();
  24. }
  25. }
  26.  
  27. try {
  28. $whmcsxero = new WHMCSXero(getXeroRedirectUri());
  29.  
  30. if (isset($_POST['updatesettings'])) {
  31. $gatewayfields = [];
  32. $gatewayfees = [];
  33. $gatewayfeesex = [];
  34. $groupfields = [];
  35. $taxratefields = [];
  36.  
  37. foreach ($_POST as $field => $value) {
  38. if (\strpos($field, 'gateway_') === 0) {
  39. $gatewayfields[\str_replace('gateway_', '', $field)] = $value;
  40. }
  41. else if (\strpos($field, 'gatewayfees_') === 0) {
  42. $gatewayfees[\str_replace('gatewayfees_', '', $field)] = $value;
  43. }
  44. else if (\strpos($field, 'gatewayfeesex_') === 0) {
  45. $gatewayfeesex[\str_replace('gatewayfeesex_', '', $field)] = $value;
  46. }
  47. else if (\strpos($field, 'group_') === 0) {
  48. $groupfields[$_POST['groupname_' . \str_replace('group_', '', $field)]] = $value;
  49. }
  50. else if (\strpos($field, 'taxes_') === 0) {
  51. $taxratefields[\str_replace(['taxes_', '_'], ['', '.'], $field)] = $value;
  52. }
  53. }
  54.  
  55. \WHMCS\Database\Capsule::table('mod_xero')->truncate();
  56. \WHMCS\Database\Capsule::table('mod_xero')->insert([
  57. ['setting' => 'synccontacts', 'value' => $_POST['contactsenable'] == 'on'],
  58. ['setting' => 'syncproducts', 'value' => $_POST['productsenable'] == 'on'],
  59. ['setting' => 'syncinvoices', 'value' => $_POST['invoicesenable'] == 'on'],
  60. ['setting' => 'syncpayments', 'value' => $_POST['paymentsenable'] == 'on'],
  61. ['setting' => 'syncxeropayments', 'value' => $_POST['xeropaymentsenable'] == 'on'],
  62. ['setting' => 'nextinvoice', 'value' => $_POST['startinvoice']],
  63. ['setting' => 'nexttransaction', 'value' => $_POST['nexttransaction']],
  64. ['setting' => 'onlytransaction', 'value' => $_POST['onlytransaction']],
  65. ['setting' => 'brandingtheme', 'value' => $_POST['brandingtheme']],
  66. ['setting' => 'nextcredit', 'value' => $whmcsxero->getSetting('nextcredit')],
  67. ['setting' => 'acc_rec', 'value' => isset($_POST['settingspage']) ? $_POST['acc_rec'] : $whmcsxero->getSetting('acc_rec')],
  68. ['setting' => 'gateways', 'value' => isset($_POST['settingspage']) ? \serialize($gatewayfields) : $whmcsxero->getSetting('gateways')],
  69. ['setting' => 'gatewayfees', 'value' => isset($_POST['settingspage']) ? \serialize($gatewayfees) : $whmcsxero->getSetting('gatewayfees')],
  70. ['setting' => 'gatewayfeesex', 'value' => isset($_POST['settingspage']) ? \serialize($gatewayfeesex) : $whmcsxero->getSetting('gatewayfeesex')],
  71. ['setting' => 'taxrates', 'value' => isset($_POST['settingspage']) ? \serialize($taxratefields) : $whmcsxero->getSetting('taxrates')],
  72. ['setting' => 'groups', 'value' => isset($_POST['settingspage']) ? \serialize($groupfields) : $whmcsxero->getSetting('groups')],
  73. ['setting' => 'xerotoken', 'value' => $whmcsxero->getSetting('xerotoken')],
  74. ['setting' => 'xerotenant', 'value' => isset($_POST['settingspage']) ? $_POST['xerotenant'] : $whmcsxero->getSetting('xerotenant')],
  75. ['setting' => 'xerorefreshtoken', 'value' => $whmcsxero->getSetting('xerorefreshtoken')],
  76. ['setting' => 'xerotokenexpiry', 'value' => $whmcsxero->getSetting('xerotokenexpiry')]
  77. ]);
  78. \header('Location: ' . $vars['modulelink']);
  79. exit();
  80. }
  81.  
  82. $action = (isset($_GET['action']) ? $_GET['action'] : NULL);
  83.  
  84. if ($action == 'settings') {
  85. $whmcspaymentgateways = \WHMCS\Database\Capsule::table('tblpaymentgateways')->where('setting', 'name')->groupBy('gateway')->get();
  86. $whmcsproductgroups = \array_map(function($each) {
  87. return $each['name'];
  88. }, \json_decode(\json_encode(\WHMCS\Database\Capsule::table('tblproductgroups')->select('name')->get()), true));
  89. $whmcsproductgroups[] = 'Addons';
  90. $whmcsproductgroups[] = 'Domains';
  91. $whmcsproductgroups[] = 'Late Fees';
  92. $whmcsproductgroups[] = 'Setup Fees';
  93. $whmcsproductgroups[] = 'Project Management';
  94. $whmcstaxcountries = \WHMCS\Database\Capsule::table('tbltax')->where('level', 1)->groupBy('country')->groupBy('taxrate')->get();
  95. $taxrates1 = \array_map(function($each) {
  96. ...................................................................
  97. ........................................
  98. .................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement