Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for Zend Guard Encoder)
  6. *
  7. * @ Version : 3.0.4.0
  8. * @ Author : DeZender
  9. * @ Release on : 02.04.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function vpnpanel_config()
  15. {
  16. $configarray = array(
  17. 'name' => 'VPN Panel',
  18. 'description' => 'The module provide the VPN User and Reseller Management.',
  19. 'author' => '<img src="../modules/addons/vpnpanel/whmcssmarters.png"><br><a href="https://whmcssmarters.com/" target="_blank">WHMCS Smarters</a>',
  20. 'language' => 'english',
  21. 'version' => '2.5',
  22. 'fields' => array(
  23. 'licenseregto' => array(
  24. 'FriendlyName' => 'License Registered To',
  25. 'Description' => 'Not Available'
  26. ),
  27. 'licenseregmail' => array(
  28. 'FriendlyName' => 'License Registered Email',
  29. 'Description' => 'Not Available'
  30. ),
  31. 'licenseduedate' => array(
  32. 'FriendlyName' => 'License Due Date',
  33. 'Description' => 'Not Available'
  34. ),
  35. 'licensestatus' => array(
  36. 'FriendlyName' => 'License Status',
  37. 'Description' => 'Not Available'
  38. ),
  39. 'license' => array(
  40. 'FriendlyName' => 'License',
  41. 'Type' => 'text',
  42. 'Size' => '35'
  43. ),
  44. 'deletetables' => array(
  45. 'FriendlyName' => 'Delete Records',
  46. 'Type' => 'yesno',
  47. 'Size' => '25',
  48. 'Description' => 'Tick to check it should delete all the tables relative to this module on deactivation'
  49. ),
  50. 'downloadbutton' => array(
  51. 'FriendlyName' => 'Download Cetificate Button',
  52. 'Type' => 'yesno',
  53. 'Description' => 'Tick to Show Download Button On Client Area.'
  54. )
  55. )
  56. );
  57. $licenseinfo = vpnpanel_doCheckLicense( );
  58.  
  59. if ($licenseinfo['status'] != 'licensekeynotfound') {
  60. if ($licenseinfo['status'] == 'Active') {
  61. if (isset( $licenseinfo['localkey'] ) && !(empty( $licenseinfo['localkey'] ))) {
  62. $moduledata = \WHMCS\Database\Capsule::table( 'tbladdonmodules' )->where( 'module', '=', 'vpnpanel' )->where( 'setting', '=', 'localkey' )->get( );
  63. if (isset( $moduledata ) && !(empty( $moduledata ))) {
  64. \WHMCS\Database\Capsule::table( 'tbladdonmodules' )->where( 'setting', 'localkey' )->where( 'module', 'vpnpanel' )->update( array( 'value' => $licenseinfo['localkey'] ) );
  65. }
  66. else {
  67. \WHMCS\Database\Capsule::table( 'tbladdonmodules' )->insert( array(
  68. 'setting' => 'localkey',
  69. 'value' => $licenseinfo['localkey'],
  70. 'module' => 'vpnpanel'
  71. ) );
  72. }
  73. }
  74. }
  75.  
  76. if ($licenseinfo['registeredname']) {
  77. $configarray['fields']['licenseregto']['Description'] = $licenseinfo['registeredname'];
  78. }
  79.  
  80. if ($licenseinfo['email']) {
  81. $configarray['fields']['licenseregmail']['Description'] = $licenseinfo['email'];
  82. }
  83.  
  84. if ($licenseinfo['nextduedate']) {
  85. $configarray['fields']['licenseduedate']['Description'] = $licenseinfo['nextduedate'];
  86. }
  87.  
  88. $configarray['fields']['licensestatus']['Description'] = $licenseinfo['status'];
  89. $configarray['fields']['license']['Value'] = $licenseinfo['licensekey'];
  90. }
  91.  
  92. return $configarray;
  93. }
  94.  
  95. function vpnpanel_doCheckLicense()
  96. {
  97. $result = \WHMCS\Database\Capsule::table( 'tbladdonmodules' )->where( 'module', '=', 'vpnpanel' )->get( );
  98.  
  99. foreach ($result as $row) {
  100. $settings[$row->setting] = $row->value;
  101. }
  102.  
  103. if ($settings['license']) {
  104. $localkey = $settings['localkey'];
  105. $licenseinfo = $result = vpnpanel_checkLicense( $settings['license'], $localkey );
  106.  
  107. if ($licenseinfo['status'] == 'Active') {
  108. if (isset( $licenseinfo['localkey'] ) && !(empty( $licenseinfo['localkey'] ))) {
  109. $moduledata = \WHMCS\Database\Capsule::table( 'tbladdonmodules' )->where( 'module', '=', 'vpnpanel' )->where( 'setting', '=', 'localkey' )->get( );
  110. if (isset( $moduledata ) && !(empty( $moduledata ))) {
  111. \WHMCS\Database\Capsule::table( 'tbladdonmodules' )->where( 'setting', 'localkey' )->where( 'module', 'vpnpanel' )->update( array( 'value' => $licenseinfo['localkey'] ) );
  112. }
  113. else {
  114. \WHMCS\Database\Capsule::table( 'tbladdonmodules' )->insert( array(
  115. 'setting' => 'localkey',
  116. 'value' => $licenseinfo['localkey'],
  117. 'module' => 'vpnpanel'
  118. ) );
  119. }
  120. }
  121. }
  122.  
  123. $result['licensekey'] = $settings['license'];
  124. .........................................................................
  125. ........................................
  126. ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement