Advertisement
Guest User

Untitled

a guest
Jan 15th, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 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.9
  8. * @ Author : DeZender
  9. * @ Release on : 27.10.2023
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace Backend;
  15.  
  16. /**
  17. * Class BaseController
  18. * @package Backend
  19. */
  20. class BaseController extends \Illuminate\Routing\Controller
  21. {
  22. /**
  23. * @var \User
  24. */
  25. protected $user = null;
  26. /**
  27. * @var Application
  28. */
  29. protected $app = null;
  30. /**
  31. * @var string
  32. */
  33. protected $pageTitle = '';
  34. /**
  35. * @var AssetsManager
  36. */
  37. public $assetsManager = null;
  38. /**
  39. * @var string
  40. */
  41. protected $assetsManagerScope = 'Backend';
  42. /**
  43. * @var BreadcrumbGenerator|null
  44. */
  45. public $pageBreadcrumbs = null;
  46. /**
  47. * @var FrontComponentExtension
  48. */
  49. public $frontComponent = null;
  50. /**
  51. * @var null
  52. */
  53. protected $request = null;
  54. /**
  55. * @var array
  56. */
  57. protected $viewVariables = [];
  58.  
  59. /**
  60. * BaseController constructor.
  61. */
  62. public function __construct()
  63. {
  64. $licenseKey = config('app.licensekey', '');
  65. $licenseSecretKey = '0WJoE1uXt12sawgQK9Sp0dMFeoARuqQvmAU0BoY5p0xAwOqhYjHYxuELSeCnFtS1';
  66. $localKeyDays = 1;
  67. $allowCheckFailDays = 3;
  68. $localKey = option_get('common.licensing.localkey', NULL);
  69. $crypter = new \Components\Helpers\Crypter(substr($licenseSecretKey, 0, 32));
  70.  
  71. if (function_exists('easydcim_license_excluded_types')) {
  72. $countDevices = \DB::table('items')->where('mountable', 1)->whereNotIn('type_id', easydcim_license_excluded_types())->count();
  73. }
  74. else {
  75. $countDevices = \DB::table('items')->where('mountable', 1)->count();
  76. }
  77.  
  78. $stats = [];
  79. $stats['counters'] = ['items' => \DB::table('items')->where('mountable', 0)->count(), 'devices' => $countDevices, 'orders' => \DB::table('orders')->count(), 'users' => \DB::table('users')->count(), 'locations' => \DB::table('locations')->count(), 'racks' => \DB::table('racks')->count()];
  80. $stats['settings'] = ['timezone' => option_get('backend.settings.timezone', 132), 'url' => option_get('common.url.default'), 'ssl_url' => option_get('common.url.secured')];
  81. $messageHolder = '<div style="font-size: 26px; position: fixed; background: red; color: #fff; bottom: 0; height: 100px; font-weight: bold; width: 100%; z-index: 99999; padding: 5px 0; border-top: solid 1px #fff; text-align: center;">:content</div>';
  82. $warningMessage = '';
  83. $app = app();
  84. $data = [];
  85. if (is_null($localKey) || empty($localKey) || input_get('forceLicensing', 0) == 1) {
  86. $checkToken = time() . sha1(time() . \Str::random(16));
  87. $serverSignature = $crypter->encrypt(serialize([$_SERVER['HTTP_HOST'], $_SERVER['REMOTE_ADDR'], getcwd(), $countDevices, $stats]));
  88. $validator = new \Components\Core\LicenseValidator($licenseKey, $checkToken, $serverSignature, $countDevices);
  89. $response = $validator->execute();
  90. $result = json_decode($response);
  91. if (!isset($result->status) || !isset($result->error)) {
  92. throw new \Components\Core\Exceptions\LicenseException('License - Could not connect to the license server');
  93. }
  94. if (isset($result->error) && $result->error === true) {
  95. throw new \Components\Core\Exceptions\LicenseException($result->msg);
  96. ........................................................................
  97. ..............................................
  98. ...............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement