Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.0
- * @ Author : DeZender
- * @ Release on : 15.05.2020
- * @ Official site : http://DeZender.Net
- *
- */
- namespace Backend;
- class BaseController extends \Illuminate\Routing\Controller
- {
- /**
- * @var \User
- */
- protected $user;
- /**
- * @var Application
- */
- protected $app;
- /**
- * @var string
- */
- protected $pageTitle = '';
- /**
- * @var string
- */
- public $pageSubtitle = '';
- /**
- * @var string
- */
- protected $pageDescription = '';
- /**
- * @var AssetsManager
- */
- public $assetsManager;
- /**
- * @var string
- */
- protected $assetsManagerScope = 'Backend';
- /**
- * @var BreadcrumbGenerator|null
- */
- public $pageBreadcrumbs;
- /**
- * @var FrontComponentExtension
- */
- public $frontComponent;
- /**
- * @var null
- */
- protected $request;
- /**
- * @var array
- */
- protected $viewVariables = [];
- /**
- * BaseController constructor.
- */
- public function __construct()
- {
- $licenseKey = config('app.licensekey', '');
- $licenseSecretKey = 'B1hzPcmuwdH8z7KJwam00kvYV9pm3PmFQDeGQBbmOSvoZg8wquwqP2pLbO7fEuVv';
- $localKeyDays = 1;
- $allowCheckFailDays = 3;
- $localKey = option_get('common.licensing.localkey', NULL);
- $crypter = new \Components\Helpers\Crypter(substr($licenseSecretKey, 0, 32));
- $countDevices = \DB::table('items')->where('mountable', 1)->count();
- $stats = [];
- $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()];
- $stats['settings'] = ['timezone' => option_get('backend.settings.timezone', 132), 'url' => option_get('common.url.default'), 'ssl_url' => option_get('common.url.secured')];
- $messageHolder = '<div style="font-size: 26px; position: fixed; background: red; color: #fff; bottom: 0; height: 130px; font-weight: bold; width: 100%; z-index: 99999; padding: 5px 0; border-top: solid 1px #fff; text-align: center;">:content</div>';
- $warningMessage = '';
- $app = app();
- $data = [];
- if (is_null($localKey) || empty($localKey) || (input_get('forceLicensing', 0) == 1)) {
- $checkToken = time() . sha1(time() . \Str::random(16));
- $serverSignature = $crypter->encrypt(serialize([$_SERVER['HTTP_HOST'], $_SERVER['REMOTE_ADDR'], getcwd(), $countDevices, $stats]));
- $validator = new \Components\Core\LicenseValidator($licenseKey, $checkToken, $serverSignature, $countDevices);
- $response = $validator->execute();
- $result = json_decode($response);
- if (!isset($result->status) || !isset($result->error)) {
- throw new \Components\Core\Exceptions\LicenseException('License - Could not connect to the license server');
- }
- if (isset($result->error) && ($result->error === true)) {
- throw new \Components\Core\Exceptions\LicenseException($result->msg);
- }
- if (isset($result->data) && !empty($result->data)) {
- $data = @unserialize($crypter->decrypt($result->data));
- if (isset($data['license']['token'])) {
- if ($data['license']['token'] !== sha1($checkToken . $licenseSecretKey)) {
- throw new \Components\Core\Exceptions\LicenseException('License - Security token not valid... Possible man in the middle attack.');
- }
- }
- else {
- throw new \Components\Core\Exceptions\LicenseException('License - Security token not present in the response...');
- }
- option_set('common.licensing.localkey', $result->data);
- }
- }
- else {
- $data = unserialize($crypter->decrypt($localKey));
- $checkTime = $data['license']['validationtime'];
- $maxValidTime = $checkTime + ($allowCheckFailDays * 24 * 60 * 60);
- if (isset($data['license']['validationtime'])) {
- ...................................................................
- ........................................
- ................
Add Comment
Please, Sign In to add comment