public static function cb2cb857e022883e361cf5f2f3ece525()
 {
     $license_file = BASE_PATH . '/cache/temporary.bin';
     if (!file_exists($license_file)) {
         JO_Request::getInstance()->setModule('default');
         JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_found', 'text' => 'Licence file is not found!')));
     } else {
         $request = JO_Request::getInstance();
         $decripted = JO_Encrypt_Md5::decrypt(file_get_contents($license_file), $request->getDomain() . 'pinterestclonescript.info', false, 256);
         if ($decripted) {
             $data = explode(';', $decripted);
             $parts = array();
             foreach ($data as $row => $res) {
                 $res = explode(':', $res);
                 if (count($res) == 2) {
                     $parts[$res[0]] = $res[1];
                     JO_Registry::set('license_' . $res[0], $res[1]);
                 }
             }
             if (!isset($parts['powered_check'])) {
                 JO_Request::getInstance()->setModule('default');
                 JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_powered', 'text' => 'Missing powered information in licence file!')));
             } else {
                 if ($parts['powered_check'] != 'false') {
                     JO_Request::getInstance()->setModule('default');
                     JO_Registry::set('viewSetCallbackChildren', array(new self(), 'PoweredCheck'));
                 }
             }
             if (!isset($parts['domain'])) {
                 JO_Request::getInstance()->setModule('default');
                 JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_domain', 'text' => 'Missing domain information in licence file!')));
             } else {
                 if (mb_strtolower($parts['domain'], 'utf-8') != mb_strtolower($request->getDomain(), 'utf-8')) {
                     JO_Request::getInstance()->setModule('default');
                     JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_match_domain', 'text' => 'Domain information in licence file is not match with ' . $request->getDomain() . '!')));
                 }
             }
             if (isset($parts['amazon_s3']) && $parts['amazon_s3'] == 'true') {
                 JO_Registry::set('system_enable_amazon', true);
             }
         } else {
             JO_Request::getInstance()->setModule('default');
             JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'parse_error', 'text' => 'Unable to parse licence file!')));
         }
     }
 }
Example #2
0
 public function indexAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if ($request->getQuery('openId') && strlen($request->getQuery('openId')) == 32 && $request->getServer('HTTP_REFERER')) {
         $referer = str_replace('www.', '', JO_Validate::validateHost($request->getServer('HTTP_REFERER')));
         $domain = $request->getDomain();
         if ($referer && $referer != $domain && self::allowledReferal($referer)) {
             //check user
             if ($result = Model_Extensions_Singlesignon::checkUser($referer, $domain, $request->getQuery('openId'))) {
                 if ($result && $result['status'] == 'activate') {
                     $groups = unserialize($result['groups']);
                     if (is_array($groups) and count($groups) > 1) {
                         unset($result['groups']);
                         $fetch_all = Model_Users::getGroups($groups);
                         $result['access'] = array();
                         if ($fetch_all) {
                             foreach ($fetch_all as $row) {
                                 $modules = unserialize($row['rights']);
                                 if (is_array($modules)) {
                                     foreach ($modules as $module => $ison) {
                                         $result['access'][$module] = $module;
                                     }
                                 }
                             }
                         }
                     }
                     if (isset($result['access']) && count($result['access'])) {
                         $result['is_admin'] = true;
                     }
                     JO_Session::set($result);
                 }
             } elseif (!JO_Session::get('user_id')) {
                 $url = 'http://' . $referer . '/public/extensions_singlesignon/getUserData/?openId=' . $request->getQuery('openId') . '&referer=' . $referer . '&domain=' . $domain;
                 if (ini_get('allow_url_fopen')) {
                     $response = file_get_contents($url);
                 } elseif (function_exists('curl_init')) {
                     $response = $this->file_get_contents_curl($url);
                 }
                 if ($response) {
                     $response = JO_Json::decode(JO_Encrypt_Md5::decrypt($response, $domain), true);
                     //register user
                     if ($response && is_array($response)) {
                         if ($result = Model_Extensions_Singlesignon::createUser($response)) {
                             $groups = self::mb_unserialize($result['groups']);
                             if (is_array($groups) and count($groups) > 1) {
                                 unset($result['groups']);
                                 $fetch_all = Model_Users::getGroups($groups);
                                 $result['access'] = array();
                                 if ($fetch_all) {
                                     foreach ($fetch_all as $row) {
                                         $modules = self::mb_unserialize($row['rights']);
                                         if (is_array($modules)) {
                                             foreach ($modules as $module => $ison) {
                                                 $result['access'][$module] = $module;
                                             }
                                         }
                                     }
                                 }
                             }
                             if (isset($result['access']) && count($result['access'])) {
                                 $result['is_admin'] = true;
                             }
                             JO_Session::set($result);
                         }
                     }
                 }
             }
         }
         $this->redirect($request->getBaseUrl());
     }
     $this->view->single_sign_on = array();
     $single_sign_on = WM_Store::getSettingsPairs(array('filter_group' => 'single_sign_on'));
     $model_images = new Model_Images();
     $sort_order = array();
     foreach ($single_sign_on as $row => $data) {
         $sort_order[$row] = isset($data['sort_order']) ? $data['sort_order'] : 0;
         if ($data['site_logo'] && file_exists(BASE_PATH . '/uploads/' . $data['site_logo'])) {
             $data['preview'] = 'uploads/' . $data['site_logo'];
         } else {
             $data['preview'] = '';
         }
         $data['preview'] = $model_images->resize($data['site_logo'], 140, 30);
         $data['href'] = 'http://' . $data['url'] . '/public/';
         if (JO_Registry::get('singlesignon_enable_login') && JO_Session::get('user_id')) {
             $data['href'] .= '?openId=' . md5($request->getDomain() . $data['url'] . JO_Session::get('username') . JO_Session::get('email'));
         }
         $this->view->single_sign_on[$row] = $data;
     }
     array_multisort($sort_order, SORT_ASC, $this->view->single_sign_on);
     if (JO_Registry::get('singlesignon_enable_dropdown') && count($this->view->single_sign_on)) {
         $this->view->ext_css = WM_Router::create($request->getBaseUrl() . '?controller=cache&extension=singlesignon&action=css&setFile=css.css');
         $this->view->ext_js = WM_Router::create($request->getBaseUrl() . '?controller=cache&extension=singlesignon&action=js&setFile=js.js');
         $this->getLayout()->placeholder('singlesignon', $this->view->render('index', 'extensions_singlesignon'));
     }
 }
Example #3
0
 public static function checkCache()
 {
     $request = JO_Request::getInstance();
     if (in_array($request->getDomain(), self::$allowedLocals)) {
         return true;
     }
     self::domainCheck();
     $license_file = BASE_PATH . '/cache/temporary.bin';
     if (!file_exists($license_file)) {
         if ($request->getController() != 'error' && $request->getAction() != 'licence') {
             $request->setModule('default');
             JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_found', 'text' => 'Licence file is not found!')));
         }
     } else {
         $decripted = JO_Encrypt_Md5::decrypt(file_get_contents($license_file), self::$domain_check . 'pinterestclonescript.info', false, 256);
         if ($decripted) {
             $data = explode(';', $decripted);
             $parts = array();
             foreach ($data as $row => $res) {
                 $res = explode(':', $res);
                 if (count($res) == 2) {
                     $parts[$res[0]] = $res[1];
                     JO_Registry::set('license_' . $res[0], $res[1]);
                 }
             }
             if (!isset($parts['powered_check'])) {
                 if ($request->getController() != 'error' && $request->getAction() != 'licence') {
                     $request->setModule('default');
                     JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_powered', 'text' => 'Missing powered information in licence file!')));
                 }
             } else {
                 if ($parts['powered_check'] != 'false') {
                     JO_Request::getInstance()->setModule('default');
                     JO_Registry::set('viewSetCallbackChildren', array(new self(), 'PoweredCheck'));
                 }
             }
             if (!isset($parts['domain'])) {
                 if ($request->getController() != 'error' && $request->getAction() != 'licence') {
                     $request->setModule('default');
                     JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'missing_domain', 'text' => 'Missing domain information in licence file!')));
                 }
             } else {
                 if (mb_strtolower($parts['domain'], 'utf-8') != mb_strtolower(self::$domain_check, 'utf-8')) {
                     $parts_lic = explode('.', $parts['domain']);
                     $parts_host = explode('.', self::$domain_check);
                     $expression = '';
                     for ($i = count($parts_lic); $i > 0; $i--) {
                         if (isset($parts_host[$i])) {
                             $expression = $parts_host[$i] . ($expression ? '.' : '') . $expression;
                         } else {
                             $expression .= md5(mt_rand(00, 9999));
                         }
                     }
                     if (mb_strtolower($expression, 'utf-8') != mb_strtolower(self::$domain_check, 'utf-8')) {
                         if ($request->getController() != 'error' && $request->getAction() != 'licence') {
                             $request->setModule('default');
                             JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'not_match_domain', 'text' => 'Domain information in licence file is not match with ' . $request->getDomain() . '!')));
                         }
                     }
                 }
             }
         } else {
             if ($request->getController() != 'error' && $request->getAction() != 'licence') {
                 $request->setModule('default');
                 JO_Action::getInstance()->forward('error', 'licence', self::checkIt(array('status' => 'error', 'type' => 'parse_error', 'text' => 'Unable to parse licence file!')));
             }
         }
     }
 }