Example #1
0
 public function __construct()
 {
     global $smarty;
     $this->name = 'trustedshops';
     $this->tab = 'payment_security';
     $this->version = '1.3.3';
     parent::__construct();
     if (empty(self::$objects_list)) {
         TSBuyerProtection::setTranslationObject($this);
         $obj_ts_rating = new TrustedShopsRating();
         $obj_ts_buyerprotection = new TSBuyerProtection();
         $obj_ts_buyerprotection->_setEnvApi(TSBuyerProtection::ENV_PROD);
         self::$objects_list = array($obj_ts_rating, $obj_ts_buyerprotection);
         self::$objects_list[0]->setModuleName($this->name);
         self::$objects_list[0]->setSmarty($smarty);
     }
     if (!extension_loaded('soap')) {
         $this->warnings[] = $this->l('This module requires the SOAP PHP extension to function properly.');
     }
     foreach (self::$objects_list as $object) {
         $this->limited_countries = array_merge($this->limited_countries, $object->limited_countries);
         if (!empty($object->warnings)) {
             $this->warnings = array_merge($this->warnings, $object->warnings);
         }
     }
     if (!empty($this->warnings)) {
         $this->warning = implode(',<br />', $this->warnings) . '.';
     }
     $this->displayName = $this->l('Trusted Shops trust solutions');
     $this->description = $this->l('Build confidence in your online shop with the Trusted Shops quality seal, buyer protection and customer rating.');
     $this->confirmUninstall = $this->l('Are you sure you want to delete all your settings?');
 }
    private function _displayFormEditCertificate($certificate)
    {
        $installed_modules = Module::getModulesInstalled();
        $payment_module_collection = '';
        foreach ($installed_modules as $k => $value) {
            if ($return = TSBuyerProtection::_isPaymentModule($value['name'])) {
                $payment_module_collection[$value['id_module']] = $value;
            }
        }
        $out = '
		<script type="text/javascript" src="' . $this->site_url . 'modules/trustedshops/lib/js/payment.js" ></script>
		<script type="text/javascript">
			$().ready(function()
			{
				TSPayment.payment_type = $.parseJSON(\'' . Tools::jsonEncode(TSBuyerProtection::$payments_type) . '\');
				TSPayment.payment_module = $.parseJSON(\'' . Tools::jsonEncode($payment_module_collection) . '\');
				$(\'.payment-module-label\').css(TSPayment.module_box.css).fadeIn();
				$(\'.choosen_payment_type\').each(function()
				{
					TSPayment.deleteModuleFromList($(this).val());
					TSPayment.setLabelModuleName($(this).val());
				});
				TSPayment.init();
			});

		</script>
		<form action="' . $this->_makeFormAction(strip_tags($_SERVER['REQUEST_URI']), $this->id_tab) . '" method="post" >
			<fieldset>
				<legend><img src="../img/admin/tab-tools.gif" alt="" />' . $this->l('Edit certificate') . '</legend>
				<input type="hidden" name="iso_lang" value="' . $certificate['language'] . '" />
				<label>' . $this->l('Language') . '</label>
				<div class="margin-form">' . $certificate['language'] . '</div>
				<label>' . $this->l('Shop url') . '</label>
				<div class="margin-form">' . $certificate['url'] . '</div>
				<label>' . $this->l('Certificate id') . '</label>
				<div class="margin-form">' . $certificate['tsID'] . '</div>
				<label>' . $this->l('User Name') . ' <sup>*</sup></label>
				<div class="margin-form"><input type="text" name="user" value="' . $certificate['user'] . '" style="width:300px;"/></div>
				<label>' . $this->l('Password') . ' <sup>*</sup></label>
				<div class="margin-form"><input type="text" name="password" value="' . $certificate['password'] . '" style="width:300px;"/></div>
				<div id="payment-type">
					<label>' . $this->l('Payment type to edit') . ' <sup>*</sup></label>
					<div class="margin-form">
						<select name="payment_type">';
        foreach (TSBuyerProtection::$payments_type as $type => $translation) {
            $out .= '	<option value="' . $type . '" >' . $translation . '</option>';
        }
        $out .= '		</select>&nbsp;' . $this->l('with') . '&nbsp;
						<select name="payment_module">';
        foreach ($payment_module_collection as $module_info) {
            $out .= '		<option value="' . $module_info['id_module'] . '" >' . $module_info['name'] . '</option>';
        }
        $out .= '		</select>&nbsp;' . $this->l('payment module') . '&nbsp;<input type="button" value="' . $this->l('Add it') . '" class="button" name="add_payment_module" />
					</div><!-- .margin-form -->
					<div id="payment_type_list">';
        $input_output = '';
        if (isset($certificate['payment_type']) and !empty($certificate['payment_type'])) {
            foreach ($certificate['payment_type'] as $payment_type => $modules) {
                $out .= '	<label style="clear:both;" class="payment-type-label" >' . TSBuyerProtection::$payments_type[$payment_type] . '</label>';
                $out .= '	<div class="margin-form" id="block-payment-' . $payment_type . '">';
                foreach ($modules as $module_id) {
                    $out .= '<b class="payment-module-label" id="label-module-' . $module_id . '"></b>';
                    $input_output .= '<input type="hidden" value="' . $module_id . '" class="choosen_payment_type" name="choosen_payment_type[' . $payment_type . '][]">';
                }
                $out .= '	</div><!-- .margin-form -->';
            }
        }
        $out .= '</div><!-- #payment_type_list -->
			</div><!-- #payment-type -->
			<p id="input-hidden-val" style="display:none;">' . $input_output . '</p>
			<p style="text-align:center;">
				<input type="submit" name="submit_change_certificate" class="button" value="' . $this->l('Update it') . '"/>
			</p>
			</fieldset>
		</form>';
        return $out;
    }
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2012 PrestaShop SA
*  @version  Release: $Revision: 14011 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/trustedshops.php';
if (isset($_GET['secure_key']) and !empty($_GET['secure_key']) and Configuration::get(TSBuyerProtection::PREFIX_TABLE . 'SECURE_KEY') == $_GET['secure_key']) {
    $ts_module = new TrustedShops();
    TSBuyerProtection::setTranslationObject($ts_module);
    $bp = new TSBuyerProtection();
    $bp->setModuleName($ts_module->name);
    $bp->cronTask();
}