Advertisement
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 SourceGuardian Encoder)
- *
- * @ Version : 4.0.9.0
- * @ Author : DeZender
- * @ Release on : 08.08.2019
- * @ Official site : http://DeZender.Net
- *
- */
- class FaoscThemesBodyClass
- {
- static private $instance;
- private $class;
- private function __construct()
- {
- $this->class = [];
- }
- static public function newInstance()
- {
- if (!(self::$instance instanceof self)) {
- self::$instance = new self();
- }
- return self::$instance;
- }
- public function add($class)
- {
- $this->class[] = $class;
- }
- public function get()
- {
- return $this->class;
- }
- }
- class faosclass_divarman_guard_theme
- {
- private $localHost = ['127.0.0.1', '::1'];
- private $license_file_name = 'oc-content/themes/' . FOLDER_THEME_DIVAR . '/admin/license.php';
- static private $instance;
- static public function newInstance()
- {
- if (!(self::$instance instanceof self)) {
- self::$instance = new self();
- }
- return self::$instance;
- }
- public function __construct()
- {
- osc_add_hook('init_admin', [$this, 'install'], 2);
- osc_add_hook('login_admin', [$this, 'my_handle_login'], 0);
- $last_time = self::license_info();
- if (86400 < (time() - (int) $last_time['date'])) {
- osc_add_hook('admin_footer', [$this, 'check_divarman_ajax_update_admin_footer']);
- osc_add_hook('ajax_admin_check_divarman_ajax_update', [$this, 'check_divarman_ajax_update']);
- }
- }
- static public function get_host()
- {
- $possibleHostSources = ['HTTP_X_FORWARDED_HOST', 'HTTP_HOST', 'SERVER_NAME', 'SERVER_ADDR'];
- $sourceTransformations = ['HTTP_X_FORWARDED_HOST' => 'function($value) {' . "\n\t\t\t" . '$elements = explode(\',\', $value);' . "\n\t\t\t" . 'return trim(end($elements));' . "\n\t\t" . '}'];
- $host = '';
- foreach ($possibleHostSources as $source) {
- if (!empty($host)) {
- break;
- }
- if (empty($_SERVER[$source])) {
- continue;
- }
- $host = $_SERVER[$source];
- if (array_key_exists($source, $sourceTransformations)) {
- $host = $sourceTransformations[$source]($host);
- }
- }
- $host = preg_replace('/:\\d+$/', '', $host);
- $host = str_ireplace('www.', '', $host);
- return trim($host);
- }
- public function my_handle_login()
- {
- $this->revalidate_license();
- }
- static public function revalidate_license($forced = false)
- {
- $license_info = self::license_info();
- $license = $license_info['code'];
- $count = $old_count = (int) $license_info['count'];
- $message = $license_info['message'];
- $action = $license_info['action'];
- $date = $license_info['date'];
- $count = $count + 1;
- $sr = (int) $count % 5;
- if (($sr == 0) || $forced) {
- $result = self::check_license($license_info['code']);
- if ($result->status == 'successful') {
- $message = 'لایسنس معتبر می باشد.';
- $action = 1;
- $date = time();
- }
- else {
- $message = 'لایسنس نامعتبر می باشد.';
- $action = 0;
- $count = 0;
- $date = time();
- }
- }
- if ($count != $old_count) {
- $private_session = osc_get_preference(self::option_name());
- osc_delete_preference($private_session);
- $rand_key = md5(osc_genRandomPassword(12));
- osc_set_preference(self::option_name(), $rand_key);
- $result = ['starter' => base64_encode($license), 'url' => base64_encode(self::get_host()), 'count' => $count, 'action' => $action, 'message' => $message, 'timer' => $date];
- osc_set_preference($rand_key, self::crypt(json_encode($result)));
- }
- }
- public function check_divarman_ajax_update_admin_footer()
- {
- echo ' <script type="text/javascript">' . "\r\n" . ' $(document).ready(function() {' . "\r\n" . ' $.getJSON(' . "\r\n" . ' \'';
- echo osc_admin_base_url(true);
- echo '?page=ajax&action=runhook&hook=check_divarman_ajax_update\',' . "\r\n" . ' {},' . "\r\n" . ' function(data){}' . "\r\n" . ' );' . "\r\n" . ' });' . "\r\n" . ' </script>' . "\r\n" . ' ';
- }
- public function check_divarman_ajax_update()
- {
- self::revalidate_license(true);
- }
- static public function check_license($license_code)
- {
- $params = ['product' => self::productName(), 'domain' => self::get_host(), 'license_code' => $license_code];
- $result = self::send_request('verify', $params);
- return $result;
- }
- static public function send_request($method, $params = [])
- {
- $param_string = http_build_query($params);
- $url = self::api_url();
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL, $url . $method . '?' . $param_string);
- $content = curl_exec($ch);
- return json_decode($content);
- }
- static public function is_activated()
- {
- $private_session = osc_get_preference(self::option_name());
- $now = json_decode(self::decrypt(osc_get_preference($private_session)));
- if (empty($now)) {
- return false;
- }
- else if ($now->action != 1) {
- return false;
- }
- else {
- return true;
- }
- }
- static public function license_info()
- {
- $private_session = osc_get_preference(self::option_name());
- $get_data = json_decode(self::decrypt(osc_get_preference($private_session)));
- $license_info = [];
- if (($get_data != NULL) && !empty($get_data)) {
- $license_info['code'] = base64_decode($get_data->starter);
- $license_info['action'] = $get_data->action;
- $license_info['count'] = $get_data->count;
- $license_info['message'] = $get_data->message;
- $license_info['date'] = $get_data->timer;
- }
- return $license_info;
- }
- public function install()
- {
- $page = Params::getParam('page');
- $license = Params::getParam('license');
- $action = Params::getParam('action');
- $theme_action = Params::getParam('theme_action');
- $file = Params::getParam('file');
- if (($page == 'appearance') && ($file == $this->license_file_name) && ($action == 'render') && ($theme_action == 'check_license')) {
- if (empty($license)) {
- ob_get_clean();
- osc_add_flash_error_message('لایسنس را بصورت صحیح وارد نمایید.', 'admin');
- osc_redirect_to(osc_admin_render_theme_url($this->license_file_name));
- exit();
- }
- $private_session = osc_get_preference(self::option_name());
- osc_delete_preference($private_session);
- $result = self::check_license($license);
- $rand_key = md5(osc_genRandomPassword(12));
- osc_set_preference(self::option_name(), $rand_key);
- if ($result->status == 'successful') {
- $result = ['starter' => base64_encode($license), 'url' => base64_encode(self::get_host()), 'action' => 1, 'count' => 1, 'message' => implode('<br>', $result->message), 'timer' => time()];
- osc_set_preference($rand_key, self::crypt(json_encode($result)));
- ob_get_clean();
- osc_add_flash_ok_message('لایسنس با موفقیت ثبت شد.', 'admin');
- osc_redirect_to(osc_admin_render_theme_url($this->license_file_name));
- exit();
- }
- else {
- $result = ['starter' => base64_encode($license), 'url' => base64_encode(self::get_host()), 'action' => 0, 'count' => 0, 'message' => implode('<br>', $result->message), 'timer' => time()];
- osc_set_preference($rand_key, self::crypt(json_encode($result)));
- ob_get_clean();
- osc_add_flash_error_message('لایسنس وارد شده نامعتبر می باشد لطفا یک لایسنس معتبر وارد نمایید.', 'admin');
- osc_redirect_to(osc_admin_render_theme_url($this->license_file_name));
- exit();
- }
- }
- }
- static public function crypt($string)
- {
- if (class_exists('Cryptor') && Cryptor::Usable()) {
- $key = hash('sha256', self::crypt_key(), true);
- return Cryptor::Encrypt($string, $key);
- }
- $cypher = MCRYPT_RIJNDAEL_256;
- $mode = MCRYPT_MODE_ECB;
- return base64_encode(mcrypt_encrypt($cypher, self::crypt_key(), $string, $mode, mcrypt_create_iv(mcrypt_get_iv_size($cypher, $mode), MCRYPT_RAND)));
- }
- static public function decrypt($string)
- {
- if ($string == '') {
- return '';
- }
- if (class_exists('Cryptor') && Cryptor::Usable()) {
- $key = hash('sha256', self::crypt_key(), true);
- return Cryptor::Decrypt($string, $key);
- }
- $cypher = MCRYPT_RIJNDAEL_256;
- $mode = MCRYPT_MODE_ECB;
- return str_replace("\0", '', mcrypt_decrypt($cypher, self::crypt_key(), base64_decode($string), $mode, mcrypt_create_iv(mcrypt_get_iv_size($cypher, $mode), MCRYPT_RAND)));
- }
- static public function crypt_key()
- {
- return 'tr554fgft15edfgc';
- }
- static public function option_name()
- {
- return 'dajeqiys81rqw78eiuk7rshkgihhq0s901u';
- }
- static public function api_url()
- {
- return 'http://guard.faosclass.com/api/v1/';
- }
- static public function productName()
- {
- return 'faosclass_divar_man_theme';
- }
- }
- function faosc_themes_script()
- {
- if (!OC_ADMIN) {
- osc_enqueue_style('faosc-jquery-ui', osc_current_web_theme_url('js/jquery-ui/jquery-ui-1.10.2.custom.min.css'));
- osc_enqueue_style('faosc-themes-bootstrap-min', osc_current_web_theme_url('css/bootstrap.min.css'));
- osc_enqueue_style('faosc-themes-bootstrap-rtl', osc_current_web_theme_url('css/bootstrap-rtl.min.css'));
- osc_enqueue_style('faosc-themes-style', osc_current_web_theme_url('css/style.css'));
- ...............................................................................
- .....................................
- ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement