コード例 #1
0
 public function hookLeftColumn($params)
 {
     if (!$this->_isTsIdActive((int) $params['cookie']->id_lang)) {
         return false;
     }
     self::$smarty->assign('display_widget', Configuration::get('TS_TAB0_DISPLAY_IN_SHOP'));
     if (Configuration::get('TS_TAB0_DISPLAY_IN_SHOP')) {
         $filename = $this->getWidgetFilename((int) $params['cookie']->id_lang);
         $cache = new WidgetCache(_PS_MODULE_DIR_ . $filename, Configuration::get('TS_TAB0_ID_' . (int) $params['cookie']->id_lang));
         if (!$cache->isFresh()) {
             $cache->refresh();
         }
         self::$smarty->assign(array('ts_id' => Configuration::get('TS_TAB0_ID_' . (int) $params['cookie']->id_lang), 'filename' => _MODULE_DIR_ . $filename));
     }
     self::$smarty->assign('display_rating_link', (int) Configuration::get('TS_TAB0_DISPLAY_RATING_FRONT_END'));
     if (Configuration::get('TS_TAB0_DISPLAY_RATING_FRONT_END')) {
         self::$smarty->assign(array('rating_url' => $this->getRatingUrl(), 'language' => Language::getIsoById((int) $params['cookie']->id_lang)));
     }
     $displayWidget = false;
     foreach (TSBuyerProtection::$CERTIFICATE as $lang => $certificate) {
         $certificate = (array) $certificate;
         if (isset($certificate['tsID']) && $certificate['tsID'] !== '' && $certificate['user'] != '') {
             $displayWidget = true;
         }
     }
     if ($displayWidget == false) {
         return '';
     }
     return $this->display(self::$module_name, 'widget.tpl');
 }
コード例 #2
0
 public function hookLeftColumn($params)
 {
     global $cookie;
     if (isset($cookie) && is_object($cookie)) {
         $id_lang = (int) $cookie->id_lang;
     } else {
         if (Tools::getValue('id_lang')) {
             $id_lang = (int) Tools::getValue('id_lang');
         } else {
             $id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
         }
     }
     if (!$this->_isTsIdActive((int) $id_lang)) {
         return false;
     }
     $iso = Language::getIsoById((int) $id_lang);
     $tab_id = Configuration::get(self::PREFIX_CONF_NAME . (int) $id_lang);
     $display_in_shop = Configuration::get('TS_TAB0_DISPLAY_IN_SHOP');
     $display_rating_frontend = Configuration::get('TS_TAB0_DISPLAY_RATING_FRONT_END');
     self::$smarty->assign('display_widget', $display_in_shop);
     if ($display_in_shop) {
         $filename = $this->getWidgetFilename((int) $id_lang);
         $cache = new WidgetCache(_PS_MODULE_DIR_ . $filename, $tab_id);
         if (!$cache->isFresh()) {
             $cache->refresh();
         }
         if (file_exists(_PS_MODULE_DIR_ . $filename)) {
             self::$smarty->assign(array('ts_id' => $tab_id, 'filename' => _MODULE_DIR_ . $filename));
         }
     }
     self::$smarty->assign('display_rating_link', (int) $display_rating_frontend);
     if ($display_rating_frontend) {
         self::$smarty->assign(array('rating_url' => $this->getRatingUrl(), 'language' => $iso));
     }
     if (Configuration::get(self::PREFIX_CONF_NAME . (int) $id_lang)) {
         return $this->display(self::$module_name, 'widget.tpl');
         //TrustedShops::display_seal();
     }
     return '';
 }
コード例 #3
0
 public function hookLeftColumn($params)
 {
     if (!$this->_isTsIdActive((int) $params['cookie']->id_lang)) {
         return false;
     }
     self::$smarty->assign('display_widget', Configuration::get('TS_TAB0_DISPLAY_IN_SHOP'));
     if (Configuration::get('TS_TAB0_DISPLAY_IN_SHOP')) {
         $filename = $this->getWidgetFilename((int) $params['cookie']->id_lang);
         $cache = new WidgetCache(_PS_MODULE_DIR_ . $filename, Configuration::get('TS_TAB0_ID_' . (int) $params['cookie']->id_lang));
         if (!$cache->isFresh()) {
             $cache->refresh();
         }
         self::$smarty->assign(array('ts_id' => Configuration::get('TS_TAB0_ID_' . (int) $params['cookie']->id_lang), 'filename' => _MODULE_DIR_ . $filename));
     }
     self::$smarty->assign('display_rating_link', (int) Configuration::get('TS_TAB0_DISPLAY_RATING_FRONT_END'));
     if (Configuration::get('TS_TAB0_DISPLAY_RATING_FRONT_END')) {
         self::$smarty->assign(array('rating_url' => $this->getRatingUrl(), 'language' => Language::getIsoById((int) $params['cookie']->id_lang)));
     }
     return $this->display(self::$module_name, 'widget.tpl');
 }
コード例 #4
0
ファイル: TSCommon.php プロジェクト: alexsimple/trustedshops
 /**
  * Checks the Trusted Shops IDs entered in the shop administration
  * and returns the characteristics of the corresponding certificate.
  *
  * @uses TSCommon::getClient()
  * @param string $certificate certificate code already send by Trusted Shops
  */
 private function checkCertificate($certificate, $lang)
 {
     $array_state = array('PRODUCTION' => $this->l('The Trusted Shops ID is valid'), 'NO_AUDIT' => $this->l('The Trusted Shops ID is not audit'), 'CANCELLED' => $this->l('The Trusted Shops ID has expired'), 'DISABLED' => $this->l('The Trusted Shops ID has been disabled'), 'INTEGRATION' => $this->l('The shop is currently being certified'), 'INVALID_TS_ID' => $this->l('No ID has been allocated to the Trusted Shops ID'), 'TEST' => $this->l('Test Trusted Shops ID'));
     $client = $this->getClient();
     $validation = false;
     if ($lang == '') {
         $this->errors[] = $this->l('Select language');
     } elseif (!in_array($lang, self::$available_languages_for_adding)) {
         $this->errors[] = $this->l('This language is not in list of available languages for Trusted Shops ID');
     } elseif ($this->isValidCertificateID($certificate)) {
         try {
             $validation = $client->checkCertificate($certificate);
         } catch (SoapFault $fault) {
             $this->errors[] = $this->l('Code #') . $fault->faultcode . ',<br />' . $this->l('message:') . $fault->faultstring;
             return false;
         }
         if (is_int($validation)) {
             throw new TSBPException($validation, TSBPException::ADMINISTRATION);
         }
         if (!$validation || array_key_exists($validation->stateEnum, $array_state)) {
             if ($validation->stateEnum === 'TEST' || $validation->stateEnum === 'PRODUCTION' || $validation->stateEnum === 'INTEGRATION') {
                 $this->confirmations[] = $array_state[$validation->stateEnum];
                 return $validation;
             } elseif ($validation->stateEnum == 'INVALID_TS_ID' || $validation->stateEnum == 'NO_AUDIT') {
                 $filename = $this->getTempWidgetFilename($certificate);
                 $cache = new WidgetCache(_PS_MODULE_DIR_ . $filename, $certificate);
                 if (!$cache->isFresh()) {
                     $cache->refresh();
                 }
                 if (filesize(_PS_MODULE_DIR_ . $filename) > 1000) {
                     $validation->certificationLanguage = $lang;
                     $validation->stateEnum = 'PRODUCTION';
                     $validation->typeEnum = 'UNKNOWN';
                     return $validation;
                 } else {
                     $this->errors[] = $array_state[$validation->stateEnum];
                     return false;
                 }
             } else {
                 $this->errors[] = $array_state[$validation->stateEnum];
                 return false;
             }
         } else {
             $this->errors[] = $this->l('Unknown error.');
         }
     } else {
         $this->errors[] = $this->l('Invalid Trusted Shops ID.');
     }
 }