public function canonicalRedirection()
 {
     // Automatically redirect to the canonical URL if the current in is the right one
     // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
     if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         if (Validate::isLoadedObject($this->cms) and $canonicalURL = self::$link->getCMSLink($this->cms)) {
             if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
                 header('HTTP/1.0 301 Moved');
                 header('Cache-Control: no-cache');
                 if (_PS_MODE_DEV_) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
                 }
                 Tools::redirectLink($canonicalURL);
             }
         }
         if (Validate::isLoadedObject($this->cms_category) and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) {
             if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
                 header('HTTP/1.0 301 Moved');
                 header('Cache-Control: no-cache');
                 if (_PS_MODE_DEV_) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
                 }
                 Tools::redirectLink($canonicalURL);
             }
         }
     }
 }
 public function preProcess()
 {
     if ($id_category = (int) Tools::getValue('id_category')) {
         $this->category = new Category($id_category, self::$cookie->id_lang);
     }
     if (!Validate::isLoadedObject($this->category)) {
         header('HTTP/1.1 404 Not Found');
         header('Status: 404 Not Found');
     } else {
         // Automatically redirect to the canonical URL if the current in is the right one
         // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
         $currentURL = self::$link->getCategoryLink($this->category);
         $currentURL = preg_replace('/[?&].*$/', '', $currentURL);
         if (!preg_match('/^' . Tools::pRegexp($currentURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $currentURL . '">' . $currentURL . '</a>');
             }
             Tools::redirectLink($currentURL);
         }
     }
     parent::preProcess();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         if ($id_category = (int) Tools::getValue('id_category')) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             $default_rewrite = array();
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = self::$link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
             self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
         }
     }
 }
Example #3
0
 /**
  * Assign wishlist template
  */
 public function assign()
 {
     $errors = array();
     if ($this->context->customer->isLogged()) {
         $add = Tools::getIsset('add');
         $add = empty($add) === false ? 1 : 0;
         $delete = Tools::getIsset('deleted');
         $delete = empty($delete) === false ? 1 : 0;
         $id_wishlist = Tools::getValue('id_wishlist');
         if (Tools::isSubmit('submitWishlist')) {
             if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 and strcmp(Tools::getToken(), Tools::getValue('token'))) {
                 $errors[] = $this->module->l('Invalid token', 'mywishlist');
             }
             if (!sizeof($errors)) {
                 $name = Tools::getValue('name');
                 if (empty($name)) {
                     $errors[] = $this->module->l('You must specify a name.', 'mywishlist');
                 }
                 if (WishList::isExistsByNameForUser($name)) {
                     $errors[] = $this->module->l('This name is already used by another list.', 'mywishlist');
                 }
                 if (!sizeof($errors)) {
                     $wishlist = new WishList();
                     $wishlist->id_shop = $this->context->shop->id;
                     $wishlist->id_shop_group = $this->context->shop->id_shop_group;
                     $wishlist->name = $name;
                     $wishlist->id_customer = (int) $this->context->customer->id;
                     list($us, $s) = explode(' ', microtime());
                     srand($s * $us);
                     $wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $this->context->customer->id), 0, 16));
                     $wishlist->add();
                     Mail::Send($this->context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $this->context->language->id), array('{wishlist}' => $wishlist->name, '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist->token), $this->context->customer->email, $this->context->customer->firstname . ' ' . $this->context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, $this->module->getLocalPath() . 'mails/');
                 }
             }
         } else {
             if ($add) {
                 WishList::addCardToWishlist($this->context->customer->id, Tools::getValue('id_wishlist'), $this->context->language->id);
             } else {
                 if ($delete and empty($id_wishlist) === false) {
                     $wishlist = new WishList((int) $id_wishlist);
                     if (Validate::isLoadedObject($wishlist)) {
                         $wishlist->delete();
                     } else {
                         $errors[] = $this->module->l('Cannot delete this wishlist', 'mywishlist');
                     }
                 }
             }
         }
         $this->context->smarty->assign('wishlists', WishList::getByIdCustomer($this->context->customer->id));
         $this->context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($this->context->customer->id));
     } else {
         Tools::redirect('index.php?controller=authentication&back=' . urlencode($this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
     }
     $this->context->smarty->assign(array('id_customer' => (int) $this->context->customer->id, 'errors' => $errors, 'form_link' => $errors));
     $this->setTemplate('mywishlist.tpl');
 }
 public function canonicalRedirection()
 {
     if (Validate::isLoadedObject($this->manufacturer) && Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         $canonicalURL = self::$link->getManufacturerLink($this->manufacturer);
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
 }
 public function canonicalRedirection()
 {
     // Automatically redirect to the canonical URL if the current in is the right one
     // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
     if (Validate::isLoadedObject($this->product) && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         $canonicalURL = self::$link->getProductLink($this->product);
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
 }
 function __construct()
 {
     $this->name = 'socolissimo';
     $this->tab = 'shipping_logistics';
     $this->version = '2.3';
     $this->author = 'PrestaShop';
     $this->limited_countries = array('fr');
     parent::__construct();
     $this->page = basename(__FILE__, '.php');
     $this->displayName = $this->l('So Colissimo');
     $this->description = $this->l('Offer your customers, different delivery methods with LaPoste.');
     $this->url = Tools::getProtocol() . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/' . $this->name . '/validation.php';
     /** Backward compatibility */
     require _PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php';
     if (self::isInstalled($this->name)) {
         $ids = array();
         $warning = array();
         $soCarrier = new Carrier(Configuration::get('SOCOLISSIMO_CARRIER_ID'));
         if (Validate::isLoadedObject($soCarrier)) {
             if (!$this->checkZone((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier Zone(s)\'') . ' ';
             }
             if (!$this->checkGroup((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier Group\'') . ' ';
             }
             if (!$this->checkRange((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier Range(s)\'') . ' ';
             }
             if (!$this->checkDelivery((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier price delivery\'') . ' ';
             }
         }
         //Check config and display warning
         if (!Configuration::get('SOCOLISSIMO_ID')) {
             $warning[] .= $this->l('\'Id FO\'') . ' ';
         }
         if (!Configuration::get('SOCOLISSIMO_KEY')) {
             $warning[] .= $this->l('\'Key\'') . ' ';
         }
         if (!Configuration::get('SOCOLISSIMO_URL')) {
             $warning[] .= $this->l('\'Url So\'') . ' ';
         }
         if (count($warning)) {
             $this->warning .= implode(' , ', $warning) . $this->l('must be configured to use this module correctly') . ' ';
         }
     }
     $this->errorMessage = array('998' => $this->l('Invalid key'), '999' => $this->l('Error occurred during shipping step.'), '001' => $this->l('Login FO missing'), '002' => $this->l('Login FO incorrect'), '003' => $this->l('Customer unauthorized'), '004' => $this->l('Required field missing'), '006' => $this->l('Missing signature'), '007' => $this->l('Invalid signature'), '008' => $this->l('Invalid Zip/ Postal code'), '009' => $this->l('Incorrect url format return validation.'), '010' => $this->l('Incorrect url format return error.'), '011' => $this->l('Invalid transaction ID.'), '012' => $this->l('Format incorrect shipping costs.'), '015' => $this->l('Socolissimo server unavailable.'), '016' => $this->l('Socolissimo server unavailable.'), '004' => $this->l('Required field missing'), '004' => $this->l('Required field missing'));
 }
Example #7
0
 function __construct()
 {
     $this->name = 'socolissimo';
     $this->tab = 'shipping_logistics';
     $this->version = '2.7.6';
     $this->author = 'PrestaShop';
     $this->limited_countries = array('fr');
     $this->module_key = 'faa857ecf7579947c8eee2d9b3d1fb04';
     parent::__construct();
     $this->page = basename(__FILE__, '.php');
     $this->displayName = $this->l('So Colissimo');
     $this->description = $this->l('Offer your customer 5 different delivery methods with LaPoste.');
     $this->url = Tools::getProtocol() . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/' . $this->name . '/validation.php';
     /** Backward compatibility */
     require _PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php';
     if (self::isInstalled($this->name)) {
         $warning = array();
         $soCarrier = new Carrier(Configuration::get('SOCOLISSIMO_CARRIER_ID'));
         if (Validate::isLoadedObject($soCarrier)) {
             if (!$this->checkZone((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier Zone(s)\'') . ' ';
             }
             if (!$this->checkGroup((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier Group\'') . ' ';
             }
             if (!$this->checkRange((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier Range(s)\'') . ' ';
             }
             if (!$this->checkDelivery((int) $soCarrier->id)) {
                 $warning[] .= $this->l('\'Carrier price delivery\'') . ' ';
             }
         }
         //Check config and display warning
         if (!Configuration::get('SOCOLISSIMO_ID')) {
             $warning[] .= $this->l('\'Id FO\'') . ' ';
         }
         if (!Configuration::get('SOCOLISSIMO_KEY')) {
             $warning[] .= $this->l('\'Key\'') . ' ';
         }
         if (!Configuration::get('SOCOLISSIMO_URL')) {
             $warning[] .= $this->l('\'Url So\'') . ' ';
         }
         if (count($warning)) {
             $this->warning .= implode(' , ', $warning) . $this->l('must be configured to use this module correctly') . ' ';
         }
     }
 }
 public function preProcess()
 {
     if ($id_cms = (int) Tools::getValue('id_cms')) {
         $this->cms = new CMS($id_cms, self::$cookie->id_lang);
     } elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
         $this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang);
     }
     // Automatically redirect to the canonical URL if the current in is the right one
     // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
     if ($this->cms and $canonicalURL = self::$link->getCMSLink($this->cms)) {
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined(_PS_MODE_DEV_) and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
     if ($this->cms_category and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) {
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (_PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
     parent::preProcess();
     /* assignCase (1 = CMS page, 2 = CMS category) */
     if (Validate::isLoadedObject($this->cms) and ($this->cms->active or Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS' . $this->cms->id) and file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php'))) {
         $this->assignCase = 1;
     } elseif (Validate::isLoadedObject($this->cms_category)) {
         $this->assignCase = 2;
     } else {
         Tools::redirect('404.php');
     }
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
         $default_rewrite = array();
         foreach ($rewrite_infos as $infos) {
             $arr_link = (isset($id_cms) and !isset($id_cms_category)) ? self::$link->getCMSLink($id_cms, $infos['link_rewrite'], $this->ssl, $infos['id_lang']) : self::$link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
             $default_rewrite[$infos['id_lang']] = $arr_link;
         }
         self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
     }
 }
Example #9
0
    public function getContent()
    {
        if (Tools::isSubmit('submitLiveZilla')) {
            Configuration::updateValue('LIVEZILLA_URL', Tools::getValue('LIVEZILLA_URL_TYPE') . Tools::getValue('LIVEZILLA_URL'));
            Configuration::updateValue('LIVEZILLA_SCRIPT', Tools::getValue('LIVEZILLA_SCRIPT'), true);
            echo $this->displayConfirmation($this->l('Settings updated'));
        }
        $html = '<h2>' . $this->displayName . '</h2>
		<fieldset><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('How-to') . '</legend>
			<img src="../modules/' . $this->name . '/lz_package.gif" style="float:right;margin-left:10px" />
			' . $this->l('LiveZilla is not a hosted solution, which means that LiveZilla needs to be installed on your local computer (step 1) and on your webserver (step 2) as well.') . '
			' . $this->l('The LiveZilla installation on your webserver is called the LiveZilla Server.') . '
			<br /><br />
			' . $this->l('Once you have finished step 1 & 2, you must fill in the URL of your LiveZilla installation below or directly copy / paste the script in the text area. This will integrate LiveZilla with your website (step 3).') . '
			<br /><br />
			' . $this->l('The full installation guide is available on') . ' <a href="http://www.livezilla.net/installation/" style="text-decoration:underline">' . $this->l('the official LiveZilla website') . '</a>.
			<br /><br />
			<a href="https://www.livezilla.net/downloads/" style="font-weight:700"><img src="../modules/' . $this->name . '/lz_download.gif" style="vertical-align:middle" /> ' . $this->l('Download LiveZilla now!') . '</a>
		</fieldset>
		<div class="clear">&nbsp;</div>
		<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Configuration') . '</legend>
				<label>' . $this->l('Enter the URL to your LiveZilla installation') . '</label>
				<div class="margin-form">
					<select name="LIVEZILLA_URL_TYPE">
						<option ' . (Tools::getValue('LIVEZILLA_URL_TYPE') == 'http://' ? ' selected="selected" ' : '') . ' value="http://">http://</option>
						<option ' . (Tools::getValue('LIVEZILLA_URL_TYPE') == 'https://' ? ' selected="selected" ' : '') . ' value="https://">https://</option>
					</select>
					<input type="text" name="LIVEZILLA_URL" style="width:300px" value="' . Tools::htmlentitiesUTF8(Tools::getValue('LIVEZILLA_URL', Configuration::get('LIVEZILLA_URL'))) . '" />
					<p>' . $this->l('Absolute URL with the trailing slash, e.g.,') . ' ' . Tools::getProtocol() . Tools::htmlentitiesUTF8($_SERVER['HTTP_HOST']) . '/LiveZilla/</p>
				</div>
				<div class="clear">&nbsp;</div>
				<div style="font-size:1.2em;font-weight:700;text-align:center">' . $this->l('-- OR --') . '</div>
				<div class="clear">&nbsp;</div>
				<label>' . $this->l('Copy / paste the script given by LiveZilla') . '</label>
				<div class="margin-form">
					<textarea name="LIVEZILLA_SCRIPT" style="width:600px;height:200px" />' . Tools::htmlentitiesUTF8(Tools::getValue('LIVEZILLA_SCRIPT', Configuration::get('LIVEZILLA_SCRIPT'))) . '</textarea>
				</div>
				<div class="clear">&nbsp;</div>
				<input type="submit" name="submitLiveZilla" value="' . $this->l('Update settings') . '" class="button" />
			</fieldset>
		</form>';
        return $html;
    }
 public static function logHttpReferer(Cookie $cookie = null)
 {
     if (!$cookie) {
         $cookie = Context::getContext()->cookie;
     }
     if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     // If the referrer is not correct, we drop the connection
     if (isset($_SERVER['HTTP_REFERER']) && !Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         return false;
     }
     // If there is no referrer and we do not want to save direct traffic (as opposed to referral traffic), we drop the connection
     if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     // There are a few more operations if there is a referrer
     if (isset($_SERVER['HTTP_REFERER'])) {
         // If the referrer is internal (i.e. from your own website), then we drop the connection
         $parsed = parse_url($_SERVER['HTTP_REFERER']);
         $parsed_host = parse_url(Tools::getProtocol() . Tools::getHttpHost(false, false) . __PS_BASE_URI__);
         if (!isset($parsed['host']) || (!isset($parsed['path']) || !isset($parsed_host['path']))) {
             return false;
         }
         if (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
             return false;
         }
         $source->http_referer = substr($_SERVER['HTTP_REFERER'], 0, ConnectionsSource::$uri_max_size);
         $source->keywords = substr(trim(SearchEngine::getKeywords($_SERVER['HTTP_REFERER'])), 0, ConnectionsSource::$uri_max_size);
     }
     $source->id_connections = (int) $cookie->id_connections;
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= $_SERVER['REQUEST_URI'];
     } elseif (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= $_SERVER['REDIRECT_URL'];
     }
     if (!Validate::isUrl($source->request_uri)) {
         $source->request_uri = '';
     }
     $source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
     return $source->add();
 }
Example #11
0
 public function __construct()
 {
     $this->name = 'dibs';
     $this->tab = 'payments_gateways';
     $this->version = '1.2.2';
     $this->author = 'PrestaShop';
     parent::__construct();
     $this->displayName = $this->l('DIBS');
     $this->description = $this->l('DIBS payment API');
     if ($this->active) {
         if (self::$site_url === NULL) {
             if (method_exists('Tools', 'getProtocol')) {
                 self::$site_url = Tools::htmlentitiesutf8(Tools::getProtocol() . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
             } else {
                 self::$site_url = Tools::htmlentitiesutf8((!is_null($use_ssl) && $use_ssl ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
             }
         }
         self::$ID_MERCHANT = Configuration::get('DIBS_ID_MERCHANT');
         self::$ACCEPTED_URL = Configuration::get('DIBS_ACCEPTED_URL');
         self::$CANCELLED_URL = Configuration::get('DIBS_CANCELLED_URL');
         self::$TESTING = (int) Configuration::get('DIBS_TESTING');
         self::$MORE_SETTINGS = Configuration::get('DIBS_MORE_SETTINGS') != '' ? unserialize(Tools::htmlentitiesDecodeUTF8(Configuration::get('DIBS_MORE_SETTINGS'))) : array();
         if (!isset(self::$MORE_SETTINGS['k1']) or isset(self::$MORE_SETTINGS['k1']) and (self::$MORE_SETTINGS['k1'] === '' or self::$MORE_SETTINGS['k2'] === '')) {
             $this->warning = $this->l('For security reasons, you must set key #1 and key #2 used by MD5 control of DIBS API.');
         }
         if (!self::$ID_MERCHANT or self::$ID_MERCHANT === '') {
             $this->warning = $this->l('You have to set your merchant ID to use DIBS API.');
         }
         /* For 1.4.3 and less compatibility */
         $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
         if (!Configuration::get('PS_OS_PAYMENT')) {
             foreach ($updateConfig as $u) {
                 if (!Configuration::get($u) && defined('_' . $u . '_')) {
                     Configuration::updateValue($u, constant('_' . $u . '_'));
                 }
             }
         }
         /** Backward compatibility */
         require _PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php';
     }
 }
 public static function logHttpReferer(Cookie $cookie = null)
 {
     if (!$cookie) {
         $cookie = Context::getContext()->cookie;
     }
     if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     if (isset($_SERVER['HTTP_REFERER']) && Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         $parsed = parse_url($_SERVER['HTTP_REFERER']);
         $parsed_host = parse_url(Tools::getProtocol() . Tools::getHttpHost(false, false) . __PS_BASE_URI__);
         if (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
             return false;
         }
         if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
             $source->http_referer = substr(strval($_SERVER['HTTP_REFERER']), 0, ConnectionsSource::$uri_max_size);
             $source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
             if (!Validate::isMessage($source->keywords)) {
                 return false;
             }
         }
     }
     $source->id_connections = (int) $cookie->id_connections;
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= strval($_SERVER['REDIRECT_URL']);
     } elseif (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= strval($_SERVER['REQUEST_URI']);
     }
     if (!Validate::isUrl($source->request_uri)) {
         $source->request_uri = '';
     }
     $source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
     return $source->add();
 }
 public function displayForm($order_states, $features, $attribute_groups, $neteven_feature_categories)
 {
     $customizable_fields = array();
     if (Gateway::getConfig('CUSTOMIZABLE_FIELDS')) {
         foreach (explode('¤', Gateway::getConfig('CUSTOMIZABLE_FIELDS')) as $customizable_field) {
             $customizable_fields[] = explode('|', $customizable_field);
         }
     }
     $carriers = Carrier::getCarriers((int) $this->context->cookie->id_lang);
     $this->context->smarty->assign(array('SHIPPING_CARRIER_FRANCE' => Tools::safeOutput(Tools::getValue('SHIPPING_CARRIER_FRANCE', Gateway::getConfig('SHIPPING_CARRIER_FRANCE'))), 'SHIPPING_ZONE_FRANCE' => Tools::safeOutput(Tools::getValue('SHIPPING_ZONE_FRANCE', Gateway::getConfig('SHIPPING_ZONE_FRANCE'))), 'SHIPPING_CARRIER_INTERNATIONAL' => Tools::safeOutput(Tools::getValue('SHIPPING_CARRIER_INTERNATIONAL', Gateway::getConfig('SHIPPING_CARRIER_INTERNATIONAL'))), 'SHIPPING_ZONE_INTERNATIONAL' => Tools::safeOutput(Tools::getValue('SHIPPING_ZONE_INTERNATIONAL', Gateway::getConfig('SHIPPING_ZONE_INTERNATIONAL'))), 'carriers' => $carriers, 'order_states' => $order_states, 'features' => $features, 'module_path' => $this->_path, 'module_display_name' => $this->displayName, 'attribute_groups' => $attribute_groups, 'neteven_feature_categories' => $neteven_feature_categories, 'default_currency' => new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT')), 'format_images' => ImageType::getImagesTypes('products'), 'cron_feature_url' => Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/' . $this->name . $this->feature_url, 'cron_order_url' => Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/' . $this->name . $this->order_url, 'cron_product_url' => Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/' . $this->name . $this->product_url, 'customizable_fields' => $customizable_fields, 'neteven_token' => Tools::encrypt(Configuration::get('PS_SHOP_NAME')), 'NETEVEN_LOGIN' => Tools::safeOutput(Tools::getValue('NETEVEN_LOGIN', Gateway::getConfig('NETEVEN_LOGIN'))), 'NETEVEN_PASSWORD' => Tools::safeOutput(Tools::getValue('NETEVEN_PASSWORD', Gateway::getConfig('NETEVEN_PASSWORD'))), 'SYNCHRONISATION_ORDER' => (int) Gateway::getConfig('SYNCHRONISATION_ORDER'), 'SYNCHRONISATION_PRODUCT' => (int) Gateway::getConfig('SYNCHRONISATION_PRODUCT'), 'DEFAULT_BRAND' => Tools::safeOutput(Tools::getValue('DEFAULT_BRAND', Gateway::getConfig('DEFAULT_BRAND'))), 'SHIPPING_DELAY' => Tools::safeOutput(Tools::getValue('SHIPPING_DELAY', Gateway::getConfig('SHIPPING_DELAY'))), 'IMAGE_TYPE_NAME' => Gateway::getConfig('IMAGE_TYPE_NAME'), 'COMMENT' => Tools::safeOutput(Tools::getValue('COMMENT', Gateway::getConfig('COMMENT'))), 'SHIPPING_PRICE_LOCAL' => Tools::safeOutput(Tools::getValue('SHIPPING_PRICE_LOCAL', Gateway::getConfig('SHIPPING_PRICE_LOCAL'))), 'SHIPPING_PRICE_INTERNATIONAL' => Tools::safeOutput(Tools::getValue('SHIPPING_PRICE_INTERNATIONAL', Gateway::getConfig('SHIPPING_PRICE_INTERNATIONAL'))), 'SHIPPING_BY_PRODUCT' => (int) Gateway::getConfig('SHIPPING_BY_PRODUCT'), 'SHIPPING_BY_PRODUCT_FIELDNAME' => Tools::safeOutput(Tools::getValue('SHIPPING_BY_PRODUCT_FIELDNAME', Gateway::getConfig('SHIPPING_BY_PRODUCT_FIELDNAME'))), 'ID_ORDER_STATE_NETEVEN' => (int) Gateway::getConfig('ID_ORDER_STATE_NETEVEN'), 'NETEVEN_URL' => Tools::safeOutput(Tools::getValue('NETEVEN_URL', Gateway::getConfig('NETEVEN_URL'))), 'NETEVEN_NS' => Tools::safeOutput(Tools::getValue('NETEVEN_NS', Gateway::getConfig('NETEVEN_NS'))), 'MAIL_LIST_ALERT' => Tools::safeOutput(Tools::getValue('MAIL_LIST_ALERT', Gateway::getConfig('MAIL_LIST_ALERT'))), 'DEBUG' => (int) Gateway::getConfig('DEBUG'), 'SEND_REQUEST_BY_EMAIL' => (int) Gateway::getConfig('SEND_REQUEST_BY_EMAIL'), 'TYPE_SKU' => (int) (Gateway::getConfig('TYPE_SKU') !== false) ? Gateway::getConfig('TYPE_SKU') : 'reference'));
     return $this->display(__FILE__, 'views/templates/admin/nqgatewayneteven.tpl');
 }
 public function preProcess()
 {
     if ((int) Tools::getValue('pp') == 1) {
         $intime = time();
         echo 'intime: ' . $intime;
     }
     if ($id_product = (int) Tools::getValue('id_product')) {
         $this->product = new Product($id_product, true, self::$cookie->id_lang);
         //if((int)Tools::getValue('pp') == 1){
         //	print_r($this->product->getPrice(false, null, 2));
         //}
         $id_product = (int) Tools::getValue('id_product');
         $productsViewed = (isset(self::$cookie->viewed) and !empty(self::$cookie->viewed)) ? array_slice(explode(',', self::$cookie->viewed), 0, 12) : array();
         if (sizeof($productsViewed)) {
             if ($id_product and !in_array($id_product, $productsViewed)) {
                 array_unshift($productsViewed, $id_product);
             }
         } else {
             $productsViewed[] = $id_product;
         }
         self::$cookie->viewed = implode(',', $productsViewed);
     }
     if (!Validate::isLoadedObject($this->product)) {
         header('HTTP/1.1 404 Not Found');
         header('Status: 404 Not Found');
     } else {
         // Automatically redirect to the canonical URL if the current in is the right one
         // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
         if (Validate::isLoadedObject($this->product)) {
             $canonicalURL = self::$link->getProductLink($this->product);
             if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) && !Tools::getValue('adtoken')) {
                 header('HTTP/1.0 301 Moved');
                 if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
                 }
                 Tools::redirectLink($canonicalURL);
             }
         }
     }
     parent::preProcess();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         if ($id_product = (int) Tools::getValue('id_product')) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             $default_rewrite = array();
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = self::$link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
             self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
         }
     }
     //get categories
     $categories = $this->product->getCategories();
     if (in_array(CAT_SAREE, $categories)) {
         if (in_array(CAT_BOLLYWOOD_SAREE, $categories)) {
             self::$smarty->assign('bollywood', true);
         }
         $this->is_saree = true;
     } else {
         if (in_array(CAT_SKD, $categories)) {
             if (in_array(CAT_BOLLYWOOD_SKD, $categories)) {
                 self::$smarty->assign('bollywood', true);
             }
             if ($this->product->is_rts) {
                 $this->is_skd_rts = true;
                 if (in_array(CAT_PAKISTANI_SKD, $categories)) {
                     $this->is_pakistani_rts = true;
                 }
                 if ($this->product->has_bottom) {
                     $this->has_bottom = true;
                 }
             } else {
                 $this->is_skd = true;
             }
         } else {
             if (in_array(CAT_KURTI, $categories)) {
                 //replace 4 with constant from defines later
                 if ($this->product->is_rts) {
                     $this->is_skd_rts = true;
                 } else {
                     $this->is_skd = true;
                 }
                 if ($this->product->has_bottom) {
                     $this->has_bottom = true;
                 }
             } else {
                 if (in_array(CAT_LEHENGA, $categories)) {
                     if (in_array(CAT_BOLLYWOOD_LEHENGA, $categories)) {
                         self::$smarty->assign('bollywood', true);
                     }
                     $this->is_lehenga = true;
                 } else {
                     if (in_array(CAT_GIFTCARD, $categories)) {
                         $this->is_giftcard = true;
                     } else {
                         if (in_array(CAT_JEWELRY, $categories)) {
                             $this->is_jewelry = true;
                         } else {
                             if (in_array(CAT_KIDS, $categories)) {
                                 $this->is_kids = true;
                             } else {
                                 if (in_array(CAT_MEN, $categories)) {
                                     $this->is_men = true;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (in_array(CAT_ANARKALI, $categories)) {
         $this->is_anarkali = true;
     }
     if (in_array(CAT_BOTTOMS, $categories)) {
         $this->is_bottoms = true;
     }
     if (in_array(CAT_CHOLIS, $categories)) {
         $this->is_cholis = true;
     }
     if (in_array(CAT_ABAYA, $categories)) {
         $this->is_abaya = true;
     }
     if (in_array(CAT_HANDBAG, $categories)) {
         $this->is_handbag = true;
     }
     if (in_array(465, $categories)) {
         $this->is_wristwear = true;
     }
     if ((int) Tools::getValue('pp') == 1) {
         $time1 = time();
         echo 'preprocess end: ' . $time1;
     }
 }
Example #15
0
    public function getContent()
    {
        global $cookie;
        $message = '';
        if (Tools::isSubmit('SubmitFilter')) {
            if (!Tools::getValue('layered_tpl_name')) {
                $message = $this->displayError($this->l('Filter template name required (cannot be empty)'));
            } elseif (!Tools::getValue('categoryBox')) {
                $message = $this->displayError($this->l('You must select at least one category.'));
            } else {
                if (Tools::getValue('id_layered_filter')) {
                    Db::getInstance()->execute('
						DELETE FROM ' . _DB_PREFIX_ . 'layered_filter
						WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter'));
                    $this->buildLayeredCategories();
                }
                if (Tools::getValue('scope') == 1) {
                    Db::getInstance()->execute('TRUNCATE TABLE ' . _DB_PREFIX_ . 'layered_filter');
                    $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
						SELECT id_category
						FROM ' . _DB_PREFIX_ . 'category');
                    foreach ($categories as $category) {
                        $_POST['categoryBox'][] = (int) $category['id_category'];
                    }
                }
                $id_layered_filter = (int) Tools::getValue('id_layered_filter');
                if (!$id_layered_filter) {
                    $id_layered_filter = (int) Db::getInstance()->Insert_ID();
                }
                $shop_list = array();
                if (isset($_POST['checkBoxShopAsso_layered_filter'])) {
                    foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_shop => $row) {
                        $assos[] = array('id_object' => (int) $id_layered_filter, 'id_shop' => (int) $id_shop);
                        $shop_list[] = (int) $id_shop;
                    }
                } else {
                    $shop_list = array(Context::getContext()->shop->id);
                }
                Db::getInstance()->execute('
					DELETE FROM ' . _DB_PREFIX_ . 'layered_filter_shop
					WHERE `id_layered_filter` = ' . (int) $id_layered_filter);
                if (count($_POST['categoryBox'])) {
                    /* Clean categoryBox before use */
                    if (isset($_POST['categoryBox']) && is_array($_POST['categoryBox'])) {
                        foreach ($_POST['categoryBox'] as &$category_box_tmp) {
                            $category_box_tmp = (int) $category_box_tmp;
                        }
                    }
                    $filter_values = array();
                    foreach ($_POST['categoryBox'] as $idc) {
                        $filter_values['categories'][] = (int) $idc;
                    }
                    $filter_values['shop_list'] = $shop_list;
                    $values = false;
                    foreach ($_POST['categoryBox'] as $id_category_layered) {
                        foreach ($_POST as $key => $value) {
                            if (substr($key, 0, 17) == 'layered_selection' && $value == 'on') {
                                $values = true;
                                $type = 0;
                                $limit = 0;
                                if (Tools::getValue($key . '_filter_type')) {
                                    $type = Tools::getValue($key . '_filter_type');
                                }
                                if (Tools::getValue($key . '_filter_show_limit')) {
                                    $limit = Tools::getValue($key . '_filter_show_limit');
                                }
                                $filter_values[$key] = array('filter_type' => (int) $type, 'filter_show_limit' => (int) $limit);
                            }
                        }
                    }
                    $values_to_insert = array('name' => pSQL(Tools::getValue('layered_tpl_name')), 'filters' => pSQL(serialize($filter_values)), 'n_categories' => (int) count($filter_values['categories']), 'date_add' => date('Y-m-d H:i:s'));
                    if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) {
                        $values_to_insert['id_layered_filter'] = (int) Tools::getValue('id_layered_filter');
                    }
                    Db::getInstance()->autoExecute(_DB_PREFIX_ . 'layered_filter', $values_to_insert, 'INSERT');
                    $id_layered_filter = (int) Db::getInstance()->Insert_ID();
                    if (isset($assos)) {
                        foreach ($assos as $asso) {
                            Db::getInstance()->execute('
							INSERT INTO ' . _DB_PREFIX_ . 'layered_filter_shop (`id_layered_filter`, `id_shop`)
							VALUES(' . $id_layered_filter . ', ' . (int) $asso['id_shop'] . ')');
                        }
                    }
                    $this->buildLayeredCategories();
                    $message = $this->displayConfirmation($this->l('Your filter') . ' "' . Tools::safeOutput(Tools::getValue('layered_tpl_name')) . '" ' . (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter'] ? $this->l('was updated successfully.') : $this->l('was added successfully.')));
                }
            }
        } else {
            if (Tools::isSubmit('submitLayeredSettings')) {
                Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', (int) Tools::getValue('ps_layered_hide_0_values'));
                Configuration::updateValue('PS_LAYERED_SHOW_QTIES', (int) Tools::getValue('ps_layered_show_qties'));
                Configuration::updateValue('PS_LAYERED_FULL_TREE', (int) Tools::getValue('ps_layered_full_tree'));
                Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', (int) Tools::getValue('ps_layered_filter_price_usetax'));
                Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', (int) Tools::getValue('ps_layered_filter_category_depth'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', (int) Tools::getValue('ps_layered_filter_index_availability'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', (int) Tools::getValue('ps_layered_filter_index_condition'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', (int) Tools::getValue('ps_layered_filter_index_manufacturer'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', (int) Tools::getValue('ps_layered_filter_index_category'));
                if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
                    $message = '<div class="alert alert-success">' . $this->l('Settings saved successfully') . '</div>';
                } else {
                    $message = '<div class="conf">' . $this->l('Settings saved successfully') . '</div>';
                }
            } else {
                if (Tools::getValue('deleteFilterTemplate')) {
                    $layered_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
				SELECT filters
				FROM ' . _DB_PREFIX_ . 'layered_filter
				WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter'));
                    if ($layered_values) {
                        Db::getInstance()->execute('
					DELETE FROM ' . _DB_PREFIX_ . 'layered_filter
					WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter') . ' LIMIT 1');
                        $this->buildLayeredCategories();
                        $message = $this->displayConfirmation($this->l('Filter template deleted, categories updated (reverted to default Filter template).'));
                    } else {
                        $message = $this->displayError($this->l('Filter template not found'));
                    }
                }
            }
        }
        $category_box = array();
        $attribute_groups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT ag.id_attribute_group, ag.is_color_group, agl.name, COUNT(DISTINCT(a.id_attribute)) n
			FROM ' . _DB_PREFIX_ . 'attribute_group ag
			LEFT JOIN ' . _DB_PREFIX_ . 'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group)
			LEFT JOIN ' . _DB_PREFIX_ . 'attribute a ON (a.id_attribute_group = ag.id_attribute_group)
			WHERE agl.id_lang = ' . (int) $cookie->id_lang . '
			GROUP BY ag.id_attribute_group');
        $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT fl.id_feature, fl.name, COUNT(DISTINCT(fv.id_feature_value)) n
			FROM ' . _DB_PREFIX_ . 'feature_lang fl
			LEFT JOIN ' . _DB_PREFIX_ . 'feature_value fv ON (fv.id_feature = fl.id_feature)
			WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = ' . (int) $cookie->id_lang . '
			GROUP BY fl.id_feature');
        if (Shop::isFeatureActive() && count(Shop::getShops(true, null, true)) > 1) {
            $helper = new HelperForm();
            $helper->id = Tools::getValue('id_layered_filter', null);
            $helper->table = 'layered_filter';
            $helper->identifier = 'id_layered_filter';
            $this->context->smarty->assign('asso_shops', $helper->renderAssoShop());
        }
        if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
            $tree_categories_helper = new HelperTreeCategories('categories-treeview');
            $tree_categories_helper->setRootCategory(Shop::getContext() == Shop::CONTEXT_SHOP ? Category::getRootCategory()->id_category : 0)->setUseCheckBox(true);
        } else {
            if (Shop::getContext() == Shop::CONTEXT_SHOP) {
                $root_category = Category::getRootCategory();
                $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
            } else {
                $root_category = array('id_category' => '0', 'name' => $this->l('Root'));
            }
            $tree_categories_helper = new Helper();
        }
        $module_url = Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST'] . $this->getPathUri();
        if (method_exists($this->context->controller, 'addJquery')) {
            $this->context->controller->addJS($this->_path . 'js/blocklayered_admin.js');
            if (version_compare(_PS_VERSION_, '1.6.0.3', '>=') === true) {
                $this->context->controller->addjqueryPlugin('sortable');
            } elseif (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
                $this->context->controller->addJS(_PS_JS_DIR_ . 'jquery/plugins/jquery.sortable.js');
            } else {
                $this->context->controller->addJS($this->_path . 'js/jquery.sortable.js');
            }
        }
        if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
            $this->context->controller->addCSS($this->_path . 'css/blocklayered_admin_1.6.css');
        } else {
            $this->context->controller->addCSS($this->_path . 'css/blocklayered_admin.css');
        }
        if (Tools::getValue('add_new_filters_template')) {
            $this->context->smarty->assign(array('current_url' => $this->context->link->getAdminLink('AdminModules') . '&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered', 'uri' => $this->getPathUri(), 'id_layered_filter' => 0, 'template_name' => sprintf($this->l('My template - %s'), date('Y-m-d')), 'attribute_groups' => $attribute_groups, 'features' => $features, 'total_filters' => 6 + count($attribute_groups) + count($features)));
            if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
                $this->context->smarty->assign('categories_tree', $tree_categories_helper->render());
            } else {
                $this->context->smarty->assign('categories_tree', $tree_categories_helper->renderCategoryTree($root_category, array(), 'categoryBox'));
            }
            if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
                return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl');
            } else {
                return $this->display(__FILE__, 'views/templates/admin/add.tpl');
            }
        } else {
            if (Tools::getValue('edit_filters_template')) {
                $template = Db::getInstance()->getRow('
				SELECT *
				FROM `' . _DB_PREFIX_ . 'layered_filter`
				WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter'));
                $filters = unserialize($template['filters']);
                if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
                    $tree_categories_helper->setSelectedCategories($filters['categories']);
                    $this->context->smarty->assign('categories_tree', $tree_categories_helper->render());
                } else {
                    $this->context->smarty->assign('categories_tree', $tree_categories_helper->renderCategoryTree($root_category, $filters['categories'], 'categoryBox'));
                }
                $select_shops = $filters['shop_list'];
                unset($filters['categories']);
                unset($filters['shop_list']);
                $this->context->smarty->assign(array('current_url' => $this->context->link->getAdminLink('AdminModules') . '&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered', 'uri' => $this->getPathUri(), 'id_layered_filter' => (int) Tools::getValue('id_layered_filter'), 'template_name' => $template['name'], 'attribute_groups' => $attribute_groups, 'features' => $features, 'filters' => Tools::jsonEncode($filters), 'total_filters' => 6 + count($attribute_groups) + count($features)));
                if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
                    return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl');
                } else {
                    return $this->display(__FILE__, 'views/templates/admin/add.tpl');
                }
            } else {
                $this->context->smarty->assign(array('message' => $message, 'uri' => $this->getPathUri(), 'PS_LAYERED_INDEXED' => Configuration::getGlobalValue('PS_LAYERED_INDEXED'), 'current_url' => Tools::safeOutput(preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI'])), 'id_lang' => Context::getContext()->cookie->id_lang, 'token' => substr(Tools::encrypt('blocklayered/index'), 0, 10), 'base_folder' => urlencode(_PS_ADMIN_DIR_), 'price_indexer_url' => $module_url . 'blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10), 'full_price_indexer_url' => $module_url . 'blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1', 'attribute_indexer_url' => $module_url . 'blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10), 'url_indexer_url' => $module_url . 'blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1', 'filters_templates' => Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'layered_filter ORDER BY date_add DESC'), 'hide_values' => Configuration::get('PS_LAYERED_HIDE_0_VALUES'), 'show_quantities' => Configuration::get('PS_LAYERED_SHOW_QTIES'), 'full_tree' => Configuration::get('PS_LAYERED_FULL_TREE'), 'category_depth' => Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH'), 'price_use_tax' => Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX'), 'index_cdt' => Configuration::get('PS_LAYERED_FILTER_INDEX_CDT'), 'index_qty' => Configuration::get('PS_LAYERED_FILTER_INDEX_QTY'), 'index_mnf' => Configuration::get('PS_LAYERED_FILTER_INDEX_MNF'), 'index_cat' => Configuration::get('PS_LAYERED_FILTER_INDEX_CAT'), 'limit_warning' => $this->displayLimitPostWarning(21 + count($attribute_groups) * 3 + count($features) * 3)));
                if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true) {
                    return $this->display(__FILE__, 'views/templates/admin/view_1.6.tpl');
                } else {
                    return $this->display(__FILE__, 'views/templates/admin/view.tpl');
                }
            }
        }
    }
Example #16
0
            } else {
                echo '<div class="alert error"><img src="' . _PS_IMG_ . 'admin/forbbiden.gif" alt="nok" />&nbsp;' . $so->displaySoError('999') . '
						 <p><br/><a href="' . Tools::getProtocol(true) . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'order.php" class="button_small" title="Retour">« Retour</a></p></div>';
            }
        } else {
            echo '<div class="alert error"><img src="' . _PS_IMG_ . 'admin/forbbiden.gif" alt="nok" />&nbsp;' . $so->displaySoError('998') . '
				  <p><br/><a href="' . Tools::getProtocol(true) . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'order.php" class="button_small" title="Retour">« Retour</a></p></div>';
        }
    } else {
        echo '<div class="alert error"><img src="' . _PS_IMG_ . 'admin/forbbiden.gif" alt="nok" />&nbsp;' . $so->displaySoError('999') . ': ';
        $errors = explode(',', str_replace('+', ',', $return['ERRORCODE']));
        foreach ($errors as $error) {
            echo $so->displaySoError(rtrim($error));
        }
        echo '<p><br/>
			 <a href="' . Tools::getProtocol() . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'order.php" class="button_small" title="Retour">« Retour
			 </a></p></div>';
    }
} else {
    Tools::redirect();
}
include '../../footer.php';
function saveOrderShippingDetails($idCart, $idCustomer, $soParams)
{
    $deliveryMode = array('DOM' => 'Livraison à domicile', 'BPR' => 'Livraison en Bureau de Poste', 'A2P' => 'Livraison Commerce de proximité', 'MRL' => 'Livraison Commerce de proximité', 'CIT' => 'Livraison en Cityssimo', 'ACP' => 'Agence ColiPoste', 'CDI' => 'Centre de distribution', 'RDV' => 'Livraison sur Rendez-vous');
    $db = Db::getInstance();
    $db->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'socolissimo_delivery_info WHERE id_cart = ' . (int) $idCart . ' AND id_customer =' . (int) $idCustomer);
    $numRows = (int) $db->NumRows();
    if ($numRows == 0) {
        $sql = 'INSERT INTO ' . _DB_PREFIX_ . 'socolissimo_delivery_info
										( `id_cart`, `id_customer`, `delivery_mode`, `prid`, `prname`, `prfirstname`, `prcompladress`, 
Example #17
0
    public function hookAdminStatsModules()
    {
        $websites = $this->getOrigins(ModuleGraph::getDateBetween());
        if (Tools::getValue('export')) {
            if (Tools::getValue('exportType') == 'top') {
                $this->csvExport(array('type' => 'pie'));
            }
        }
        $this->_html = '<div class="panel-heading">' . $this->l('Origin') . '</div>';
        if (count($websites)) {
            $this->_html .= '
			<div class="alert alert-info">
				' . $this->l('In the tab, we break down the 10 most popular referral websites that bring customers to your online store.') . '
			</div>
			<h4>' . $this->l('Guide') . '</h4>
			<div class="alert alert-warning">
				<h4>' . $this->l('What is a referral website?') . '</h4>
				<p>
					' . $this->l('The referrer is the URL of the previous webpage from which a link was followed by the visitor.') . '<br />
					' . $this->l('A referrer also enables you to know which keywords visitors use in search engines when browsing for your online store.') . '<br /><br />
					' . $this->l('A referrer can be:') . '
				</p>
				<ul>
					<li>' . $this->l('Someone who posts a link to your shop.') . '</li>
					<li>' . $this->l('A partner who has agreed to a link exchange in order to attract new customers.') . '</li>
				</ul>
			</div>
			<div class="row row-margin-bottom">
				<div class="col-lg-12">
					<div class="col-lg-8">
						' . $this->engine(array('type' => 'pie')) . '
					</div>
					<div class="col-lg-4">
						<a href="' . Tools::safeOutput($_SERVER['REQUEST_URI'] . '&export=1&exportType=top') . '" class="btn btn-default">
							<i class="icon-cloud-upload"></i> ' . $this->l('CSV Export') . '
						</a>
					</div>
				</div>
			</div>
			<table class="table">
				<thead>
					<tr>
						<th><span class="title_box active">' . $this->l('Origin') . '</span></th>
						<th><span class="title_box active">' . $this->l('Total') . '</span></th>
					</tr>
				</thead>
				<tbody>';
            foreach ($websites as $website => $total) {
                $this->_html .= '
					<tr>
						<td>' . (!strstr($website, ' ') ? '<a href="' . Tools::getProtocol() . $website . '">' : '') . $website . (!strstr($website, ' ') ? '</a>' : '') . '</td><td>' . $total . '</td>
					</tr>';
            }
            $this->_html .= '
				</tbody>
			</table>';
        } else {
            $this->_html .= '<p>' . $this->l('Direct links only') . '</p>';
        }
        return $this->_html;
    }
    public function getContent()
    {
        global $cookie;
        $output = '
		<p><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo-mb.gif" alt="Moneybookers" /></p><br />';
        $errors = array();
        /* Validate account */
        if (isset($_POST['SubmitValidation'])) {
            if (isset($_POST['mb_email_to_validate']) and !empty($_POST['mb_email_to_validate'])) {
                $fp = fopen('http://moneybookers.prestashop.com/email_check.php?email=' . $_POST['mb_email_to_validate'] . '&url=' . Tools::getProtocol() . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__, 'r');
                if (!$fp) {
                    $errors[] = $this->l('Unable to contact activation server, please try again later.');
                } else {
                    $response = trim(strtolower(fgets($fp, 4096)));
                    if (!strstr('ok', $response)) {
                        $errors[] = $this->l('Account validation failed, please check your e-mail.');
                    } else {
                        Configuration::updateValue('MB_PAY_TO_EMAIL', $_POST['mb_email_to_validate']);
                        Configuration::updateValue('MB_PARAMETERS', 1);
                        $output .= '
						<ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;">
							<li>' . $this->l('E-mail activation successful, you can now validate your secret word.') . '<img src="http://www.prestashop.com/modules/moneybookers.png?email=' . urlencode($_POST['mb_email_to_validate']) . '" style="float:right" /></li>
						</ul>';
                    }
                    fclose($fp);
                }
            } else {
                $errors[] = $this->l('E-mail field is required');
            }
        }
        /* Validate secret word */
        if (isset($_POST['SubmitSecret'])) {
            if (isset($_POST['mb_sw_to_validate']) and !empty($_POST['mb_sw_to_validate'])) {
                $fp = fopen('http://moneybookers.prestashop.com/email_check.php?email=' . Configuration::get('MB_PAY_TO_EMAIL') . '&url=' . Tools::getProtocol() . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . '&sw=1&secret_word=' . md5($_POST['mb_sw_to_validate']), 'r');
                if (!$fp) {
                    $errors[] = $this->l('Unable to contact activation server, please try again later.');
                } else {
                    $response = trim(strtolower(fgets($fp, 4096)));
                    if (strstr('velocity_check_exceeded', $response)) {
                        $errors[] = $this->l('Secret word validation failed, exceeded max tries (3 per hour)');
                    } elseif (!strstr('ok', $response)) {
                        $errors[] = $this->l('Secret word validation failed, please check your secret word.');
                    } else {
                        Configuration::updateValue('MB_SECRET_WORD', $_POST['mb_sw_to_validate']);
                        Configuration::updateValue('MB_PARAMETERS_2', 1);
                        $output .= '
						<ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;">
							<li>' . $this->l('Account activation successful, secret word OK') . '</li>
						</ul>';
                    }
                    fclose($fp);
                }
            } else {
                $errors[] = $this->l('Secret word field is required');
            }
        }
        /* Update configuration variables */
        if (isset($_POST['submitMoneyBookers'])) {
            if (!isset($_POST['mb_hide_login'])) {
                $_POST['mb_hide_login'] = 0;
            }
            Configuration::updateValue('MB_CANCEL_URL', $_POST['mb_cancel_url']);
            Configuration::updateValue('MB_HIDE_LOGIN', (int) $_POST['mb_hide_login']);
            $local = '';
            $inter = '';
            foreach ($_POST as $key => $value) {
                if (strstr($key, 'mb_local_')) {
                    preg_match('/mb_local_([0-9]+)/', $key, $matches);
                    if (isset($matches[1])) {
                        $local .= $matches[1] . '|';
                    }
                } elseif (strstr($key, 'mb_inter_')) {
                    preg_match('/mb_inter_([0-9]+)/', $key, $matches);
                    if (isset($matches[1])) {
                        $inter .= $matches[1] . '|';
                    }
                }
            }
            $local = rtrim($local, '|');
            $inter = rtrim($inter, '|');
            Configuration::updateValue('MB_LOCAL_METHODS', $local);
            Configuration::updateValue('MB_INTER_METHODS', $inter);
            Configuration::updateValue('MB_DISPLAY_MODE', (int) $_POST['mb_display_mode']);
        }
        /* Display errors */
        if (sizeof($errors)) {
            $output .= '<ul style="color: red; font-weight: bold; margin-bottom: 30px; width: 506px; background: #FFDFDF; border: 1px dashed #BBB; padding: 10px;">';
            foreach ($errors as $error) {
                $output .= '<li>' . $error . '</li>';
            }
            $output .= '</ul>';
        }
        $lang = new Language((int) $cookie->id_lang);
        $iso_img = $lang->iso_code;
        if ($lang->iso_code != 'fr' and $lang->iso_code != 'en') {
            $iso_img = 'en';
        }
        $manual_links = array('en' => 'http://www.prestashop.com/partner/Activation_Manual_Prestashop_EN.pdf', 'es' => 'http://www.prestashop.com/partner/Manual%20de%20Activacion%20Prestashop_ES.pdf', 'fr' => 'http://www.prestashop.com/partner/Manuel_Activation_Prestashop_FR.pdf');
        $iso_manual = $lang->iso_code;
        if (!array_key_exists($lang->iso_code, $manual_links)) {
            $iso_manual = 'en';
        }
        /* Display settings form */
        $output .= '
		<b>' . $this->l('About Moneybookers') . '</b><br /><br /><p style="font-size: 11px;">' . $this->l('Moneybookers is one of Europe\'s largest online payment systems and among the world\'s leading eWallet providers, with over 14 million account holders. The simple eWallet enables customers to conveniently and securely pay online without revealing personal financial data, as well as to send and receive money transfers cost-effectively by using an e-mail address.') . '<br /><br />' . $this->l('Moneybookers worldwide payment network offers businesses access to over 80 local payment options in over 200 countries with just one integration. Already more than 60,000 merchants use the Moneybookers payment service, including global partners such as eBay, Skype and Thomas Cook.') . '<br /><br />' . $this->l('Moneybookers was founded in 2001 in London and is regulated by the Financial Services Authority of the United Kingdom.') . '</p>
                <div style="clear: both;"></div>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-opening">
			<fieldset class="width2" style="margin: 20px 0;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Open Account') . '</legend>
				' . $this->l('Start by opening a') . ' <b>' . $this->l('free account') . '</b> ' . $this->l('with Moneybookers:') . '
				<p><a href="http://www.moneybookers.com/partners/prestashop/' . ($lang->iso_code == 'fr' ? '' : strtolower($lang->iso_code) . '/') . '"><img src="../modules/moneybookers/prestashop_mb_' . $iso_img . '.gif" alt="PrestaShop & Moneybookers" /></a><br /><br />
				<span style="color: #CC0000; font-weight: bold; line-height: 20px;"><img src="../img/admin/gold.gif" alt="" /> ' . $this->l('Thanks to the PrestaShop/Moneybookers partnership,') . '<br />' . $this->l('you will get a preferential commission rate!') . '</span></p>
				<p style="margin: 0;">
					<hr size="1" style="margin: 0 0 15px 0;" noshade />
					' . $this->l('Then click here:') . ' <input type="button" class="button" value="' . $this->l('I already have a Moneybookers account') . '" style="margin: 0 auto;" onclick="$(\'#form-activation\').show(1500);" />
				</p>
			</fieldset>
		</form>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-activation"' . ((!Configuration::get('MB_PARAMETERS') and !isset($_POST['SubmitValidation'])) ? ' style="display: none;"' : '') . '>
			<fieldset class="width2" style="margin: 20px 0;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Account validation') . '</legend>
				' . (Configuration::get('MB_PARAMETERS') == 1 ? '<p style="font-weight: bold; color: green;"><img src="../img/admin/ok.gif" alt="" /> ' . $this->l('Your account has been activated') . '</p>' : '') . '
				<p style="line-height: 20px;">' . $this->l('You need to') . ' <b>' . $this->l('validate your account') . '</b>, ' . $this->l('please type the e-mail address used to open your Moneybookers account:') . '<br /><br />
				<input type="text" name="mb_email_to_validate" value="' . Configuration::get('MB_PAY_TO_EMAIL') . '" style="width: 250px;" />
				<input type="submit" name="SubmitValidation" class="button" value="' . $this->l('Validate my account') . '" /></p>
				<p style="font-size: 11px;"><a href="' . $manual_links[$iso_manual] . '" target="_blank"><img src="../img/admin/pdf.gif" alt="" /></a><a href="' . $manual_links[$iso_manual] . '" target="_blank">' . $this->l('For help, refer to the activation manual.') . '</a></p>
			</fieldset>
		</form>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-secret"' . ((!Configuration::get('MB_PARAMETERS') and !isset($_POST['SubmitSecret'])) ? ' style="display: none;"' : '') . '>
			<fieldset class="width2" style="margin: 20px 0;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Secret word validation') . '</legend>
				' . (Configuration::get('MB_PARAMETERS_2') == 1 ? '<p style="font-weight: bold; color: green;"><img src="../img/admin/ok.gif" alt="" /> ' . $this->l('Your secret word has been activated') . '</p>' : '') . '
				<p style="line-height: 20px;">' . $this->l('You need to') . ' <b>' . $this->l('validate your secret word') . '</b>, ' . $this->l('Please enter the secret word entered on your Moneybookers account:') . '<br /><br />
				<input type="password" name="mb_sw_to_validate" value="' . Configuration::get('MB_SECRET_WORD') . '" style="width: 250px;" />
				<input type="submit" name="SubmitSecret" class="button" value="' . $this->l('Validate my secret word') . '" /></p>
			</fieldset>
		</form>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-settings"' . (!Configuration::get('MB_PARAMETERS') ? ' style="display: none;"' : '') . '>
			<style type="text/css">
				label {
					width: 300px;
					margin-right: 10px;
					font-size: 12px;
				}
			</style>
			<fieldset style="width: 700px;">';
        $interActivated = Configuration::get('MB_INTER_METHODS') != '' ? explode('|', Configuration::get('MB_INTER_METHODS')) : array();
        $localActivated = Configuration::get('MB_LOCAL_METHODS') != '' ? explode('|', Configuration::get('MB_LOCAL_METHODS')) : array();
        $output .= '
				<p>' . $this->l('Click the') . ' <b>' . $this->l('international payment methods') . '</b> ' . $this->l('that you would like to enable:') . '</p>
				<div style="width: 200px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 0; $i != 3; $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 250px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 3; $i != 6; $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 200px; float: left; line-height: 75px;">';
        for ($i = 6; $i != sizeof($this->_internationalPaymentMethods); $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="clear: both;"></div>
				<hr size="1" noshade />
				<p>' . $this->l('Click the') . ' <b>' . $this->l('local payment methods') . '</b> ' . $this->l('that you would like to enable:') . '</p>
				<div style="width: 200px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 0; $i != 7; $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 250px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 8; $i != 15; $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 200px; float: left; line-height: 75px;">';
        for ($i = 16; $i != sizeof($this->_localPaymentMethods); $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="clear: both;"></div>

				<hr size="1" noshade />
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Settings and payment methods') . '</legend>
				<label>' . $this->l('Page displayed after payment cancellation:') . '</label>
				<div class="margin-form">
					<input type="text" name="mb_cancel_url" value="' . Configuration::get('MB_CANCEL_URL') . '" style="width: 300px;" />
				</div>
				<div style="clear: both;"></div>
				<label>' . $this->l('Hide the login form on Moneybookers page') . '</label>
				<div class="margin-form">
					<input type="checkbox" name="mb_hide_login" value="1" ' . (Configuration::get('MB_HIDE_LOGIN') ? 'checked="checked"' : '') . ' style="margin-top: 4px;" />
				</div>
				<div style="clear: both;"></div>
				<label>' . $this->l('Display mode:') . '</label>
				<div class="margin-form">
					<input type="radio" name="mb_display_mode" value="0" ' . (!Configuration::get('MB_DISPLAY_MODE') ? 'checked="checked"' : '') . ' style="vertical-align: text-bottom;" /> ' . $this->l('All logos in 1 block') . '
					<input type="radio" name="mb_display_mode" value="1" ' . (Configuration::get('MB_DISPLAY_MODE') ? 'checked="checked"' : '') . ' style="vertical-align: text-bottom; margin-left: 10px;" /> ' . $this->l('1 block for each logo') . '
				</div>
				<div style="clear: both;"></div>

				<center><input type="submit" class="button" name="submitMoneyBookers" value="' . $this->l('Save settings') . '" style="margin-top: 25px;" /></center>
			</fieldset>
		</form>';
        return $output;
    }
Example #19
0
             $errors[] = $module->l('You must specify a name.', 'mywishlist');
         }
         if (WishList::isExistsByNameForUser($name)) {
             $errors[] = $module->l('This name is already used by another list.', 'mywishlist');
         }
         if (!sizeof($errors)) {
             $wishlist = new WishList();
             $wishlist->name = $name;
             $wishlist->id_customer = (int) $context->customer->id;
             $wishlist->id_shop = $context->shop->id;
             $wishlist->id_shop_group = $context->shop->id_shop_group;
             list($us, $s) = explode(' ', microtime());
             srand($s * $us);
             $wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $context->customer->id), 0, 16));
             $wishlist->add();
             Mail::Send($context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $context->language->id), array('{wishlist}' => $wishlist->name, '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist->token), $context->customer->email, $context->customer->firstname . ' ' . $context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__) . '/mails/');
         }
     }
 } else {
     if ($add) {
         WishList::addCardToWishlist($context->customer->id, Tools::getValue('id_wishlist'), $context->language->id);
     } else {
         if ($delete and empty($id_wishlist) === false) {
             $wishlist = new WishList((int) $id_wishlist);
             if (Validate::isLoadedObject($wishlist)) {
                 $wishlist->delete();
             } else {
                 $errors[] = $module->l('Cannot delete this wishlist', 'mywishlist');
             }
         }
     }
Example #20
0
    public static function buildXML()
    {
        global $country_infos;
        $context = Context::getContext();
        $country_infos = array('id_group' => 0, 'id_tax' => 1);
        $html = '<products>' . "\n";
        /* First line, columns */
        $columns = array('id', 'name', 'smallimage', 'bigimage', 'producturl', 'description', 'price', 'retailprice', 'discount', 'recommendable', 'instock');
        /* Setting parameters */
        $conf = Configuration::getMultiple(array('PS_REWRITING_SETTINGS', 'PS_LANG_DEFAULT', 'PS_SHIPPING_FREE_PRICE', 'PS_SHIPPING_HANDLING', 'PS_SHIPPING_METHOD', 'PS_SHIPPING_FREE_WEIGHT', 'PS_COUNTRY_DEFAULT', 'PS_SHOP_NAME', 'PS_CURRENCY_DEFAULT', 'PS_CARRIER_DEFAULT'));
        /* Searching for products */
        $result = Db::getInstance()->executeS('
		SELECT DISTINCT p.`id_product`, i.`id_image`
		FROM `' . _DB_PREFIX_ . 'product` p
		JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.id_product = p.id_product)
		LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.id_product = p.id_product)
		WHERE p.`active` = 1 AND i.id_image IS NOT NULL
		GROUP BY p.id_product');
        foreach ($result as $k => $row) {
            if (Pack::isPack(intval($row['id_product']))) {
                continue;
            }
            $product = new Product(intval($row['id_product']), true);
            if (Validate::isLoadedObject($product)) {
                $imageObj = new Image($row['id_image']);
                $imageObj->id_product = intval($product->id);
                $line = array();
                $line[] = $product->manufacturer_name . ' - ' . $product->name[intval($conf['PS_LANG_DEFAULT'])];
                $line[] = Tools::getProtocol() . $_SERVER['HTTP_HOST'] . _THEME_PROD_DIR_ . $imageObj->getExistingImgPath() . '-small.jpg';
                $line[] = Tools::getProtocol() . $_SERVER['HTTP_HOST'] . _THEME_PROD_DIR_ . $imageObj->getExistingImgPath() . '-thickbox.jpg';
                $line[] = $context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13) . '&utm_source=criteo&aff=criteo';
                $line[] = str_replace(array("\n", "\r", "\t", '|'), '', strip_tags(html_entity_decode($product->description_short[intval($conf['PS_LANG_DEFAULT'])], ENT_COMPAT, 'UTF-8')));
                $price = $product->getPrice(true, intval(Product::getDefaultAttribute($product->id)));
                $line[] = number_format($price, 2, '.', '');
                $line[] = number_format($product->getPrice(true, intval(Product::getDefaultAttribute(intval($product->id))), 6, NULL, false, false), 2, '.', '');
                $line[] = $product->getPrice(true, NULL, 2, NULL, true);
                $line[] = '1';
                $line[] = '1';
                $cptXML = 1;
                $html .= "\t" . '<product id="' . $product->id . '">' . "\n";
                foreach ($line as $column) {
                    $html .= "\t\t" . '<' . $columns[$cptXML] . '>' . $column . '</' . $columns[$cptXML] . '>' . "\n";
                    $cptXML++;
                }
                $html .= "\t" . '</product>' . "\n";
            }
        }
        $html .= '</products>' . "\n";
        echo $html;
    }
    function hookAdminStatsModules()
    {
        if (Tools::isSubmit('submitTruncatePNF')) {
            Db::getInstance()->Execute('TRUNCATE `' . _DB_PREFIX_ . 'pagenotfound`');
            $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" /> ' . $this->l('Pages not found has been emptied.') . '</div>';
        }
        $this->_html .= '<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->displayName . '</legend>';
        if (!file_exists(dirname(__FILE__) . '/../../.htaccess')) {
            $this->_html .= '<div class="warning warn">' . $this->l('You <b>must</b> use a .htaccess file to redirect 404 errors to the page "404.php"') . '</div>';
        }
        $pages = $this->getPages();
        if (sizeof($pages)) {
            $this->_html .= '
			<table class="table" cellpadding="0" cellspacing="0">
				<tr>
					<th width="200">' . $this->l('Page') . '</th>
					<th width="500">' . $this->l('Referrer') . '</th>
					<th>' . $this->l('Counter') . '</th>
				</tr>';
            foreach ($pages as $ru => $hrs) {
                foreach ($hrs as $hr => $counter) {
                    if ($hr != 'nb') {
                        $this->_html .= '
						<tr>
							<td><a href="' . $ru . '-admin404">' . wordwrap($ru, 30, '<br />', true) . '</a></td>
							<td><a href="' . Tools::getProtocol() . $hr . '">' . wordwrap($hr, 40, '<br />', true) . '</a></td>
							<td align="right">' . $counter . '</td>
						</tr>';
                    }
                }
            }
            $this->_html .= '
			</table>';
        } else {
            $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" /> ' . $this->l('No pages registered') . '</div>';
        }
        $this->_html .= '</fieldset>';
        if (sizeof($pages)) {
            $this->_html .= '<div class="clear">&nbsp;</div>
			<fieldset class="width3"><legend><img src="../img/admin/delete.gif" /> ' . $this->l('Empty database') . '</legend>
				<form action="' . Tools::htmlEntitiesUtf8($_SERVER['REQUEST_URI']) . '" method="post"><input type="submit" class="button" name="submitTruncatePNF" value="' . $this->l('Empty ALL pages not found') . '"></form>
			</fieldset>';
        }
        $this->_html .= '<div class="clear">&nbsp;</div>
		<fieldset class="width3"><legend><img src="../img/admin/comment.gif" /> ' . $this->l('Guide') . '</legend>
			<h2>' . $this->l('404 errors') . '</h2>
			<p>' . $this->l('A 404 error is an HTTP error code which means that the file requested by the user cannot be found. In your case it means that one of your visitors entered a wrong URL in the address bar or that you or another website has a dead link. When it is available, the referrer is shown so you can find the page which contains the dead link. If not, it means generally that it is a direct access, so someone may have bookmarked a link which doesn\'t exist anymore.') . '</p>
			<h3>' . $this->l('How to catch these errors?') . '</h3>
			<p>' . $this->l('If your webhost supports the <i>.htaccess</i> file, you can create it in the root directory of PrestaShop and insert the following line inside:') . ' <i>ErrorDocument 404 ' . __PS_BASE_URI__ . '404.php</i>. ' . $this->l('A user requesting a page which doesn\'t exist will be redirected to the page.') . ' <i>' . __PS_BASE_URI__ . '404.php</i>. ' . $this->l('This module logs the accesses to this page: the page requested, the referrer and the number of times that it occurred.') . '</p><br />
		</fieldset>';
        return $this->_html;
    }
Example #22
0
    public function getManufacturers($limit = 0, $nrb_import = 100)
    {
        $identifier = 'id_manufacturer';
        $manufacturers = $this->executeS('
										SELECT manufacturers_id as id_manufacturer, manufacturers_name as name, 1 as active, manufacturers_image as images
										FROM  `' . bqSQL($this->prefix) . 'manufacturers` LIMIT ' . (int) $limit . ' , ' . (int) $nrb_import);
        foreach ($manufacturers as &$manufacturer) {
            $manufacturer['images'] = array(Tools::getProtocol() . Tools::getValue('shop_url') . '/images/' . $manufacturer['images']);
        }
        return $this->autoFormat($manufacturers, $identifier);
    }
    public function hookAdminStatsModules()
    {
        if (Tools::isSubmit('submitTruncatePNF')) {
            Db::getInstance()->execute('TRUNCATE `' . _DB_PREFIX_ . 'pagenotfound`');
            $this->html .= '<div class="alert alert-warning"> ' . $this->l('The "pages not found" cache has been emptied.') . '</div>';
        } else {
            if (Tools::isSubmit('submitDeletePNF')) {
                Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'pagenotfound`
				WHERE date_add BETWEEN ' . ModuleGraph::getDateBetween());
                $this->html .= '<div class="alert alert-warning"> ' . $this->l('The "pages not found" cache has been deleted.') . '</div>';
            }
        }
        $this->html .= '
			<div class="panel-heading">
				' . $this->displayName . '
			</div>
			<h4>' . $this->l('Guide') . '</h4>
			<div class="alert alert-warning">
				<h4>' . $this->l('404 errors') . '</h4>
				<p>' . $this->l('A 404 error is an HTTP error code which means that the file requested by the user cannot be found. In your case it means that one of your visitors entered a wrong URL in the address bar, or that you or another website has a dead link. When possible, the referrer is shown so you can find the page/site which contains the dead link. If not, it generally means that it is a direct access, so someone may have bookmarked a link which doesn\'t exist anymore.') . '
				</p>
				<p>&nbsp;</p>
				<h4>' . $this->l('How to catch these errors?') . '</h4>
				<p>' . sprintf($this->l('If your webhost supports .htaccess files, you can create one in the root directory of PrestaShop and insert the following line inside: "%s".'), 'ErrorDocument 404 ' . __PS_BASE_URI__ . '404.php') . '<br />' . sprintf($this->l('A user requesting a page which doesn\'t exist will be redirected to the following page: %s. This module logs access to this page.'), __PS_BASE_URI__ . '404.php') . '
				</p>
			</div>';
        if (!file_exists($this->_normalizeDirectory(_PS_ROOT_DIR_) . '.htaccess')) {
            $this->html .= '<div class="alert alert-warning">' . $this->l('You must use a .htaccess file to redirect 404 errors to the "404.php" page.') . '</div>';
        }
        $pages = $this->getPages();
        if (count($pages)) {
            $this->html .= '
			<table class="table">
				<thead>
					<tr>
						<th><span class="title_box active">' . $this->l('Page') . '</span></th>
						<th><span class="title_box active">' . $this->l('Referrer') . '</span></th>
						<th><span class="title_box active">' . $this->l('Counter') . '</span></th>
					</tr>
				</thead>
				<tbody>';
            foreach ($pages as $ru => $hrs) {
                foreach ($hrs as $hr => $counter) {
                    if ($hr != 'nb') {
                        $this->html .= '
						<tr>
							<td><a href="' . $ru . '-admin404">' . wordwrap($ru, 30, '<br />', true) . '</a></td>
							<td><a href="' . Tools::getProtocol() . $hr . '">' . wordwrap($hr, 40, '<br />', true) . '</a></td>
							<td>' . $counter . '</td>
						</tr>';
                    }
                }
            }
            $this->html .= '
				</tbody>
			</table>';
        } else {
            $this->html .= '<div class="alert alert-warning"> ' . $this->l('No "page not found" issue registered for now.') . '</div>';
        }
        if (count($pages)) {
            $this->html .= '
				<h4>' . $this->l('Empty database') . '</h4>
				<form action="' . Tools::htmlEntitiesUtf8($_SERVER['REQUEST_URI']) . '" method="post">
					<button type="submit" class="btn btn-default" name="submitDeletePNF">
						<i class="icon-remove"></i> ' . $this->l('Empty ALL "pages not found" notices for this period') . '
					</button>
					<button type="submit" class="btn btn-default" name="submitTruncatePNF">
						<i class="icon-remove"></i> ' . $this->l('Empty ALL "pages not found" notices') . '
					</button>
				</form>';
        }
        return $this->html;
    }
Example #24
0
    public function getContent()
    {
        $output = $this->postProcess() . '
		<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" enctype="multipart/form-data">
			<fieldset>
				<legend>' . $this->l('Store block configuration') . '</legend>';
        if (Configuration::get('BLOCKSTORE_IMG')) {
            $output .= '<div class="margin-form"><img src="' . Tools::getProtocol() . Tools::getMediaServer($this->name) . _MODULE_DIR_ . $this->name . '/' . Configuration::get('BLOCKSTORE_IMG') . '" alt="' . $this->l('Store image') . '" style="height:115px;margin-left: 100px;width:174px"/></div>';
        }
        $output .= '
				<label for="store_img">' . $this->l('Change image') . '</label>
				<div class="margin-form">
					<input id="store_img" type="file" name="store_img" /> ( ' . $this->l('image will be displayed as 174x115') . ' )
				</div>
		
				<p class="center">
					<input class="button" type="submit" name="submitStoreConf" value="' . $this->l('Save') . '"/>
				</p>
			</fieldset>
		</form>
		';
        return $output;
    }
Example #25
0
    public function getContent()
    {
        global $cookie;
        $html = '';
        if (Tools::isSubmit('SubmitFilter')) {
            if (!Tools::getValue('layered_tpl_name')) {
                $html .= '
				<div class="error">
					<span style="float:right">
						<a href="" id="hideError"><img src="../img/admin/close.png" alt="X"></a>
					</span>
					<img src="../img/admin/error2.png">' . $this->l('Filter template name required (cannot be empty)') . '
				</div>';
            } else {
                if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) {
                    Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter'));
                    $this->buildLayeredCategories();
                }
                if (Tools::getValue('scope') == 1) {
                    Db::getInstance()->execute('TRUNCATE TABLE ' . _DB_PREFIX_ . 'layered_filter');
                    $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_category FROM ' . _DB_PREFIX_ . 'category');
                    foreach ($categories as $category) {
                        $_POST['categoryBox'][] = (int) $category['id_category'];
                    }
                }
                $id_layered_filter = (int) $_POST['id_layered_filter'];
                if (!$id_layered_filter) {
                    $id_layered_filter = (int) Db::getInstance()->Insert_ID();
                }
                $shop_list = array();
                if (isset($_POST['checkBoxShopAsso_layered_filter'])) {
                    foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_shop => $row) {
                        $assos[] = array('id_object' => (int) $id_layered_filter, 'id_shop' => (int) $id_shop);
                        $shop_list[] = (int) $id_shop;
                    }
                } else {
                    $shop_list = array(Context::getContext()->shop->id);
                }
                if (count($_POST['categoryBox'])) {
                    /* Clean categoryBox before use */
                    if (isset($_POST['categoryBox']) && is_array($_POST['categoryBox'])) {
                        foreach ($_POST['categoryBox'] as &$category_box_tmp) {
                            $category_box_tmp = (int) $category_box_tmp;
                        }
                    }
                    $filter_values = array();
                    foreach ($_POST['categoryBox'] as $idc) {
                        $filter_values['categories'][] = (int) $idc;
                    }
                    $filter_values['shop_list'] = $shop_list;
                    $values = false;
                    foreach ($_POST['categoryBox'] as $id_category_layered) {
                        foreach ($_POST as $key => $value) {
                            if (substr($key, 0, 17) == 'layered_selection' && $value == 'on') {
                                $values = true;
                                $type = 0;
                                $limit = 0;
                                if (Tools::getValue($key . '_filter_type')) {
                                    $type = Tools::getValue($key . '_filter_type');
                                }
                                if (Tools::getValue($key . '_filter_show_limit')) {
                                    $limit = Tools::getValue($key . '_filter_show_limit');
                                }
                                $filter_values[$key] = array('filter_type' => (int) $type, 'filter_show_limit' => (int) $limit);
                            }
                        }
                    }
                    Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter_shop WHERE `id_layered_filter` = ' . (int) $id_layered_filter);
                    if (isset($assos)) {
                        foreach ($assos as $asso) {
                            Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'layered_filter_shop (`id_layered_filter`, `id_shop`)
								VALUES(' . $id_layered_filter . ', ' . (int) $asso['id_shop'] . ')');
                        }
                    }
                    $values_to_insert = array('name' => pSQL(Tools::getValue('layered_tpl_name')), 'filters' => pSQL(serialize($filter_values)), 'n_categories' => (int) count($filter_values['categories']), 'date_add' => date('Y-m-d H:i:s'));
                    if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) {
                        $values_to_insert['id_layered_filter'] = (int) Tools::getValue('id_layered_filter');
                    }
                    Db::getInstance()->autoExecute(_DB_PREFIX_ . 'layered_filter', $values_to_insert, 'INSERT');
                    $this->buildLayeredCategories();
                    $html .= '<div class="conf">' . $this->l('Your filter') . ' "' . Tools::safeOutput(Tools::getValue('layered_tpl_name')) . '" ' . (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter'] ? $this->l('was updated successfully.') : $this->l('was added successfully.')) . '</div>';
                }
            }
        } else {
            if (Tools::isSubmit('submitLayeredSettings')) {
                Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', (int) Tools::getValue('ps_layered_hide_0_values'));
                Configuration::updateValue('PS_LAYERED_SHOW_QTIES', (int) Tools::getValue('ps_layered_show_qties'));
                Configuration::updateValue('PS_LAYERED_FULL_TREE', (int) Tools::getValue('ps_layered_full_tree'));
                Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', (int) Tools::getValue('ps_layered_filter_price_usetax'));
                Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', (int) Tools::getValue('ps_layered_filter_category_depth'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', (int) Tools::getValue('ps_layered_filter_index_availability'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', (int) Tools::getValue('ps_layered_filter_index_condition'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', (int) Tools::getValue('ps_layered_filter_index_manufacturer'));
                Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', (int) Tools::getValue('ps_layered_filter_index_category'));
                $html .= '
			<div class="conf">' . $this->l('Settings saved successfully') . '</div>';
            } else {
                if (isset($_GET['deleteFilterTemplate'])) {
                    $layered_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
			SELECT filters 
			FROM ' . _DB_PREFIX_ . 'layered_filter 
			WHERE id_layered_filter = ' . (int) $_GET['id_layered_filter']);
                    if ($layered_values) {
                        Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) $_GET['id_layered_filter'] . ' LIMIT 1');
                        $this->buildLayeredCategories();
                        $html .= '
				<div class="conf">' . $this->l('Filter template deleted, categories updated (reverted to default Filter template).') . '
				</div>';
                    } else {
                        $html .= '
				<div class="error">
					<img src="../img/admin/error.png" alt="" title="" /> ' . $this->l('Filter template not found') . '
				</div>';
                    }
                }
            }
        }
        $html .= '
		<div id="ajax-message-ok" class="conf ajax-message" style="display: none">
			<span class="message"></span>
		</div>
		<div id="ajax-message-ko" class="error ajax-message" style="display: none">
			<span class="message"></span>
		</div>
		<h2>' . $this->l('Layered navigation') . '</h2>
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Indexes and caches') . '</legend>
			<span id="indexing-warning" style="display: none; color:red; font-weight: bold">' . $this->l('Indexing is in progress. Please do not leave this page') . '<br/><br/></span>';
        if (!Configuration::getGlobalValue('PS_LAYERED_INDEXED')) {
            $html .= '
			<script type="text/javascript">
			$(document).ready(function() {
				$(\'#url-indexer\').click();
				$(\'#full-index\').click();
			});
			</script>';
        }
        $category_ist = array();
        foreach (Db::getInstance()->executeS('SELECT id_category FROM `' . _DB_PREFIX_ . 'category`') as $category) {
            if ($category['id_category'] != 1) {
                $category_ist[] = $category['id_category'];
            }
        }
        $domain = Tools::getProtocol(Tools::usingSecureMode()) . $_SERVER['HTTP_HOST'];
        $html .= '
			<a class="bold ajaxcall-recurcive"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '">' . $this->l('Index all missing prices') . '</a>
			<br />
			<a class="bold ajaxcall-recurcive"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1">' . $this->l('Rebuild entire price index') . '</a>
			<br />
			<a class="bold ajaxcall" id="attribute-indexer" rel="attribute"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '">' . $this->l('Build attribute index') . '</a>
			<br />
			<a class="bold ajaxcall" id="url-indexer" rel="price"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1">' . $this->l('Build URL index') . '</a>
			<br />
			<br />
			' . $this->l('You can set a cron job that will rebuild price index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1</b>
			<br />
			' . $this->l('You can set a cron job that will rebuild URL index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1</b>
			<br />
			' . $this->l('You can set a cron job that will rebuild attribute index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '</b>
			<br /><br />
			' . $this->l('A nightly rebuild is recommended.') . '
			<script type="text/javascript">
				$(\'.ajaxcall\').click(function() {
					if (this.legend == undefined)
						this.legend = $(this).html();
						
					if (this.running == undefined)
						this.running = false;
					
					if (this.running == true)
						return false;
					
					$(\'.ajax-message\').hide();
					
					this.running = true;
					
					if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed)
					{
						$(this).html(this.legend+\' ' . addslashes($this->l('(in progress)')) . '\');
						$(\'#indexing-warning\').show();
					}
						
					this.restartAllowed = false;
					var type = $(this).attr(\'rel\');
					
					$.ajax({
						url: this.href+\'&ajax=1\',
						context: this,
						dataType: \'json\',
						cache: \'false\',
						success: function(res)
						{
							this.running = false;
							this.restartAllowed = true;
							$(\'#indexing-warning\').hide();
							$(this).html(this.legend);
							if (type == \'price\')
								$(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('URL indexation finished')) . '\');
							else
								$(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('Attribute indexation finished')) . '\');
							$(\'#ajax-message-ok\').show();
							return;
						},
						error: function(res)
						{
							this.restartAllowed = true;
							$(\'#indexing-warning\').hide();
							if (type == \'price\')
								$(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('URL indexation failed')) . '\');
							else
								$(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('Attribute indexation failed')) . '\');
							$(\'#ajax-message-ko\').show();
							$(this).html(this.legend);
							
							this.running = false;
						}
					});
					return false;
				});
				$(\'.ajaxcall-recurcive\').each(function(it, elm) {
					$(elm).click(function() {
						if (this.cursor == undefined)
							this.cursor = 0;
						
						if (this.legend == undefined)
							this.legend = $(this).html();
							
						if (this.running == undefined)
							this.running = false;
						
						if (this.running == true)
							return false;
						
						$(\'.ajax-message\').hide();
						
						this.running = true;
						
						if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed)
						{
							$(this).html(this.legend+\' ' . addslashes($this->l('(in progress)')) . '\');
							$(\'#indexing-warning\').show();
						}
							
						this.restartAllowed = false;
						
						$.ajax({
							url: this.href+\'&ajax=1&cursor=\'+this.cursor,
							context: this,
							dataType: \'json\',
							cache: \'false\',
							success: function(res)
							{
								this.running = false;
								if (res.result)
								{
									this.cursor = 0;
									$(\'#indexing-warning\').hide();
									$(this).html(this.legend);
									$(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('Price indexation finished')) . '\');
									$(\'#ajax-message-ok\').show();
									return;
								}
								this.cursor = parseInt(res.cursor);
								$(this).html(this.legend+\' ' . addslashes($this->l('(in progress, %s products price to index)')) . '\'.replace(\'%s\', res.count));
								$(this).click();
							},
							error: function(res)
							{
								this.restartAllowed = true;
								$(\'#indexing-warning\').hide();
								$(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('Price indexation failed')) . '\');
								$(\'#ajax-message-ko\').show();
								$(this).html(this.legend);
								
								this.cursor = 0;
								this.running = false;
							}
						});
						return false;
					});
				});
			</script>
		</fieldset>
		<br />
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Existing filter templates') . '</legend>';
        $filters_templates = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'layered_filter ORDER BY date_add DESC');
        if (count($filters_templates)) {
            $html .= '<p>' . count($filters_templates) . ' ' . $this->l('filter templates are configured:') . '</p>
			<table id="table-filter-templates" class="table" style="width: 700px;">
				<tr>
					<th>' . $this->l('ID') . '</th>
					<th>' . $this->l('Name') . '</th>
					<th>' . $this->l('Categories') . '</th>
					<th>' . $this->l('Created on') . '</th>
					<th>' . $this->l('Actions') . '</th>
				</tr>';
            foreach ($filters_templates as $filters_template) {
                /* Clean request URI first */
                $_SERVER['REQUEST_URI'] = preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI']);
                $html .= '
				<tr>
					<td>' . (int) $filters_template['id_layered_filter'] . '</td>
					<td style="text-align: left; padding-left: 10px; width: 270px;">' . $filters_template['name'] . '</td>
					<td style="text-align: center;">' . (int) $filters_template['n_categories'] . '</td>
					<td>' . Tools::displayDate($filters_template['date_add'], null, true) . '</td>
					<td>
						<a href="#" onclick="return updElements(' . ($filters_template['n_categories'] ? 0 : 1) . ', ' . (int) $filters_template['id_layered_filter'] . ');">
						<img src="../img/admin/edit.gif" alt="" title="' . $this->l('Edit') . '" /></a> 
						<a href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&deleteFilterTemplate=1&id_layered_filter=' . (int) $filters_template['id_layered_filter'] . '"
						onclick="return confirm(\'' . addslashes(sprintf($this->l('Delete filter template #%d?'), (int) $filters_template['id_layered_filter'])) . '\');">
						<img src="../img/admin/delete.gif" alt="" title="' . $this->l('Delete') . '" /></a>
					</td>
				</tr>';
            }
            $html .= '
			</table>';
        } else {
            $html .= $this->l('No filter template found.');
        }
        $html .= '
		</fieldset><br />
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Build your own filter template') . '</legend>
			<link rel="stylesheet" href="' . _PS_CSS_DIR_ . 'jquery-ui-1.8.10.custom.css" />
			<style type="text/css">
				#error-filter-name { display: none; }
				#layered_container_left ul, #layered_container_right ul { list-style-type: none; padding-left: 0px; }
				.ui-effects-transfer { border: 1px solid #CCC; }
				.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
				ul#selected_filters, #layered_container_right ul { list-style-type: none; margin: 0; padding: 0; }
				ul#selected_filters li, #layered_container_right ul li { width: 326px; font-size: 11px; padding: 8px 9px 7px 20px; height: 14px; margin-bottom: 5px; }
				ul#selected_filters li span.ui-icon { position: absolute; margin-top: -2px; margin-left: -18px; }
				#layered_container_right ul li span { display: none; }
				#layered_container_right ul li { padding-left: 8px; position: relative; }
				#layered_container_left ul li { cursor: move; position: relative; }
				#layered-cat-counter { display: none; }
				#layered-step-2, #layered-step-3 { display: none; }
				#layered-step-2 h3 { margin-top: 0; }
				#table-filter-templates tr th, #table-filter-templates tr td { text-align: center; }
				.filter_type { width: 70px; position: absolute; right: 53px; top: 5px;}
				.filter_show_limit { position: absolute; width: 40px; right: 5px; top: 5px; }
				#layered-step-3 .alert { width: auto; }
				#fancybox-content {
					height: 400px !important;
					overflow: auto !important;
				}
			</style>
			<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" onsubmit="return checkForm();">';
        $html .= '
			<h2>' . $this->l('Step 1/3 - Select categories') . '</h2>
			<p style="margin-top: 20px;">
				<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >' . $this->l('Use this template for:') . '</span>
				<input type="radio" id="scope_1" name="scope" value="1" style="margin-left: 15px;" onclick="$(\'#error-treeview\').hide(); $(\'#layered-step-2\').show(); updElements(1, 0);" /> 
				<label for="scope_1" style="float: none;">' . $this->l('All categories') . '</label>
				<input type="radio" id="scope_2" name="scope" value="2" style="margin-left: 15px;" class="layered-category-selection" onclick="$(\'label a#inline\').click(); $(\'#layered-step-2\').show();" /> 
				<style>
					.link {
						color: black;
						cursor: pointer;
						text-decoration: underline;
					}
					.link:hover {
						color: gray;
					}
				</style>
				<label for="scope_2" style="float: none;"><a id="inline" href="#layered-categories-selection" style="text-decoration: underline;"></a>' . preg_replace('/\\*([^*]+)\\*/Usi', '<span class="link">$1</span>', $this->l('*Specific* categories')) . '
				(<span id="layered-cat-counter"></span> ' . $this->l('selected') . ')</label>
			</p>';
        $shops = Shop::getShops(true, null, true);
        if (count($shops) > 1) {
            $helper = new HelperForm();
            $helper->id = null;
            $helper->table = 'layered_filter';
            $helper->identifier = 'id_layered_filter';
            if (Shop::isFeatureActive()) {
                $html .= '<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >' . $this->l('Choose shop association:') . '</span>';
                $html .= '<div id="shop_association" style="width: 300px;margin-left: 215px;">' . $helper->renderAssoShop() . '</div>';
            }
        }
        $html .= '
			<div id="error-treeview" class="error" style="display: none;">
				<img src="../img/admin/error2.png" alt="" /> ' . $this->l('Please select at least one specific category or select "All categories".') . '
			</div>
			<div style="display: none;">
				<div id="layered-categories-selection" style="padding: 10px; text-align: left;">
					<h2>' . $this->l('Categories using this template') . '</h2>
					<ol style="padding-left: 20px;">
						<li>' . $this->l('Select one ore more category using this filter template') . '</li>
						<li>' . $this->l('Press "Save this selection" or close the window to save') . '</li>
					</ol>';
        $selected_cat = array();
        // Translations are not automatic for the moment ;)
        if (Shop::getContext() == Shop::CONTEXT_SHOP) {
            $root_category = Category::getRootCategory();
            $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
        } else {
            $root_category = array('id_category' => '0', 'name' => $this->l('Root'));
        }
        $helper = new Helper();
        $html .= $helper->renderCategoryTree(null, $selected_cat, 'categoryBox');
        $html .= '
					<br />
					<center><input type="button" class="button" value="' . $this->l('Save this selection') . '" onclick="$.fancybox.close();" /></center>
				</div>
			</div>
			<div id="layered-step-2">
				<hr size="1" noshade />
				<h2>' . $this->l('Step 2/3 - Select filters') . '</h2>
				<div id="layered_container">
					<div id="layered_container_left" style="width: 360px; float: left; height: 200px; overflow-y: auto;">
						<h3>' . $this->l('Selected filters') . ' <span id="num_sel_filters">(0)</span></h3>
						<p id="no-filters">' . $this->l('No filters selected yet.') . '</p>
						<ul id="selected_filters"></ul>
					</div>
					<div id="layered-ajax-refresh">
					' . $this->ajaxCallBackOffice() . '
					</div>
				</div>
				<div class="clear"></div>
				<hr size="1" noshade />';
        $this->context->controller->addJQueryPlugin('fancybox');
        $this->context->controller->addJQueryUI('ui.sortable');
        $this->context->controller->addJQueryUI('ui.draggable');
        $this->context->controller->addJQueryUI('effects.transfer');
        $id_lang = Context::getContext()->cookie->id_lang;
        $html .= '
				<script type="text/javascript">
					function updLayCounters(showAlert)
					{
						$(\'#num_sel_filters\').html(\'(\'+$(\'ul#selected_filters\').find(\'li\').length+\')\');
						$(\'#num_avail_filters\').html(\'(\'+$(\'#layered_container_right ul\').find(\'li\').length+\')\');
						
						if ($(\'ul#selected_filters\').find(\'li\').length >= 1)
						{
							$(\'#layered-step-3\').show();
							$(\'#layered-step-3 .alert\').hide();
						}
						else
						{
							if (showAlert)
								$(\'#layered-step-3\').show();
							else
								$(\'#layered-step-3\').hide();
							
							$(\'#layered-step-3 .alert\').show();
							
						}
					}

					function updPositions()
					{
						$(\'#layered_container_left li\').each(function(idx) {
							$(this).find(\'span.position\').html(parseInt(1+idx)+\'. \');
						});
					}

					function updCatCounter()
					{
						$(\'#layered-cat-counter\').html($(\'#categories-treeview\').find(\'input:checked\').length);
						$(\'#layered-cat-counter\').show();
					}

					function updHeight()
					{
						$(\'#layered_container_left\').css(\'height\', 30+(1+$(\'#layered_container_left\').find(\'li\').length)*34);
						$(\'#layered_container_right\').css(\'height\', 30+(1+$(\'#layered_container_right\').find(\'li\').length)*34);
					}

					function updElements(all, id_layered_filter)
					{
						if ($(\'#error-treeview\').is(\':hidden\'))
							$(\'#layered-step-2\').show();
						else
							$(\'#layered-step-2\').hide();
						$(\'#layered-ajax-refresh\').css(\'background-color\', \'black\');
						$(\'#layered-ajax-refresh\').css(\'opacity\', \'0.2\');
						$(\'#layered-ajax-refresh\').html(\'<div style="margin: 0 auto; padding: 10px; text-align: center;">\'
						+\'<img src="../img/admin/ajax-loader-big.gif" alt="" /><br /><p style="color: white;">' . addslashes($this->l('Loading...')) . '</p></div>\');
						
						$.ajax(
						{
							type: \'POST\',
							url: \'' . __PS_BASE_URI__ . '\' + \'modules/blocklayered/blocklayered-ajax-back.php\',
							data: \'layered_token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&id_lang=' . $id_lang . '&\'
								+(all ? \'\' : $(\'input[name="categoryBox[]"]\').serialize()+\'&\')
								+(id_layered_filter ? \'id_layered_filter=\'+parseInt(id_layered_filter) : \'\')
								+\'&base_folder=' . urlencode(_PS_ADMIN_DIR_) . '\',
							success: function(result)
							{
								$(\'#layered-ajax-refresh\').css(\'background-color\', \'transparent\');
								$(\'#layered-ajax-refresh\').css(\'opacity\', \'1\');
								$(\'#layered-ajax-refresh\').html(result);
								
								$(\'#layered_container_right li input\').each(function() {
									if ($(\'#layered_container_left\').find(\'input[id="\'+$(this).attr(\'id\')+\'"]\').length > 0)
										$(this).parent().remove();
								});
								
								updHeight();
								updLayCounters(true);
							}
						});
						return false;
					}
					
					function checkForm()
					{
						if ($(\'#layered_tpl_name\').val() == \'\')
						{
							$(\'#error-filter-name\').show();
							return false;
						}
						else if ($(\'#scope_1\').attr(\'checked\') && $(\'#n_existing\').val() > 0)
							if (!confirm(\'' . addslashes($this->l('You selected -All categories-, all existing filter templates will be deleted, OK?')) . '\'))
								return false;

						return true;
					}

					function launch()
					{
						$(\'#layered_container input\').live(\'click\', function ()
						{
							if ($(this).parent().hasClass(\'layered_right\'))
							{
								$(\'p#no-filters\').hide();
								$(this).parent().css(\'background\', \'url("../img/jquery-ui/ui-bg_glass_100_fdf5ce_1x400.png") repeat-x scroll 50% 50% #FDF5CE\');
								$(this).parent().removeClass(\'layered_right\');
								$(this).parent().addClass(\'layered_left\');
								$(this).effect(\'transfer\', { to: $(\'#layered_container_left ul#selected_filters\') }, 300, function() {
									$(this).parent().appendTo(\'ul#selected_filters\');
									updLayCounters(false);
									updHeight();
									updPositions();
								});
							}
							else
							{
								$(this).parent().css(\'background\', \'url("../img/jquery-ui/ui-bg_glass_100_f6f6f6_1x400.png") repeat-x scroll 50% 50% #F6F6F6\');
								$(this).effect(\'transfer\', { to: $(\'#layered_container_right ul#all_filters\') }, 300, function() {
									$(this).parent().removeClass(\'layered_left\');
									$(this).parent().addClass(\'layered_right\');
									$(this).parent().appendTo(\'ul#all_filters\');
									updLayCounters(true);
									updHeight();
									updPositions();
									if ($(\'#layered_container_left ul\').length == 0)
										$(\'p#no-filters\').show();
								});
							}
							enableSortable();
						});
						
						$(\'label a#inline\').fancybox({ 
							\'hideOnContentClick\': false,
							\'onClosed\': function() {
								lock_treeview_hidding = false;
								$(\'#categories-treeview\').parent().parent().hide();
								updCatCounter();
								if ($(\'#categories-treeview\').find(\'input:checked\').length == 0)
									$(\'#error-treeview\').show();
								else
									$(\'#error-treeview\').hide();
								updElements(0, 0);
							},
							\'onComplete\': function() {
								lock_treeview_hidding = true;
								$(\'#categories-treeview\').parent().parent().show();
								if($($(\'#categories-treeview li\')[0]).attr(\'cleaned\'))
									return;
								if($($(\'#categories-treeview li\')[0]).attr(\'cleaned\', true))
								$($(\'#categories-treeview li\')[0]).removeClass(\'static\');
								$($(\'#categories-treeview li span\')[0]).trigger(\'click\');
								$($(\'#categories-treeview li\')[0]).children(\'div\').remove();
								$($(\'#categories-treeview li\')[0]).
									removeClass(\'collapsable lastCollapsable\').
									addClass(\'last static\');
								$(\'.hitarea\').live(\'click\', function(it)
								{
									$(this).parent().find(\'> .category_label\').click();
								});
							}
						});

						updHeight();
						updLayCounters(false);
						updPositions();
						updCatCounter();
						enableSortable();
					}
					
					function enableSortable()
					{
						$(function() {
							$(\'ul#selected_filters\').sortable({
								axis: \'y\',
								update: function() { updPositions(); },
								placeholder: \'ui-state-highlight\'

							});
							$(\'ul#selected_filters\').disableSelection();
						});
					}

					$(document).ready(function() {
						launch();
					});
				</script>
			</div>
			<div id="layered-step-3">
				<div id="error-filter-name" class="error">
					<img src="../img/admin/error.png" alt="" title="" />' . $this->l('Errors:') . '
					<ul>
						<li>' . $this->l('Filter template name required (cannot be empty)') . '</li>
					</ul>
				</div>
				<h2>' . $this->l('Step 3/3 - Name your template') . '</h2>
				<p>' . $this->l('Template name:') . ' <input type="text" id="layered_tpl_name" onkeyup="if ($(this).val() != \'\')
				{ $(\'#error-filter-name\').hide(); } else { $(\'#error-filter-name\').show(); }" name="layered_tpl_name" maxlength="64" value="' . sprintf($this->l('My template %s'), date('Y-m-d')) . '"
				style="width: 200px; font-size: 11px;" /> <span style="font-size: 10px; font-style: italic;">(' . $this->l('only as a reminder') . ')</span></p>
				<hr size="1" noshade />
				<p class="alert">' . $this->l('No filters selected, the blocklayered will be disable for the categories seleted.') . '</p>
				<br />
				<center><input type="submit" class="button" name="SubmitFilter" value="' . $this->l('Save this filter template') . '" /></center>
			</div>
				<input type="hidden" name="id_layered_filter" id="id_layered_filter" value="0" />
				<input type="hidden" name="n_existing" id="n_existing" value="' . (int) count($filters_templates) . '" />
			</form>
		</fieldset><br />
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" /> ' . $this->l('Configuration') . '</legend>
			<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">			
				<table border="0" style="font-size: 11px; width: 100%; margin: 0 auto;" class="table">
					<tr>
						<th style="text-align: center;">' . $this->l('Option') . '</th>
						<th style="text-align: center; width: 200px;">' . $this->l('Value') . '</th>
					</tr>
					<tr>
						<td style="text-align: right;">' . $this->l('Hide filter values with no product is matching') . '</td>
						<td style="text-align: center;">
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_hide_0_values" value="1" ' . (Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_hide_0_values" value="0" ' . (!Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;">' . $this->l('Show the number of matching products') . '</td>
						<td style="text-align: center;">
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_show_qties" value="1" ' . (Configuration::get('PS_LAYERED_SHOW_QTIES') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_show_qties" value="0" ' . (!Configuration::get('PS_LAYERED_SHOW_QTIES') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;">' . $this->l('Show products from subcategories') . '</td>
						<td style="text-align: center;">
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_full_tree" value="1" ' . (Configuration::get('PS_LAYERED_FULL_TREE') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_full_tree" value="0" ' . (!Configuration::get('PS_LAYERED_FULL_TREE') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr style="text-align: center;">
						<td style="text-align: right;">' . $this->l('Category filter depth (0 for no limits, 1 by default)') . '</td>
						<td>
							<input type="text" name="ps_layered_filter_category_depth" value="' . (Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH') !== false ? Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH') : 1) . '" />
						</td>
					</tr>
					<tr style="text-align: center;">
						<td style="text-align: right;">' . $this->l('Use tax to filter price') . '</td>
						<td>
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_filter_price_usetax" value="1" ' . (Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_filter_price_usetax" value="0" ' . (!Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr style="text-align: center;">
						<td style="text-align: right;">' . $this->l('Allow indexing robots (google, yahoo, bing, ...) to use condition filter') . '</td>
						<td>
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_filter_index_condition" value="1" ' . (Configuration::get('PS_LAYERED_FILTER_INDEX_CDT') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_filter_index_condition" value="0" ' . (!Configuration::get('PS_LAYERED_FILTER_INDEX_CDT') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr style="text-align: center;">
						<td style="text-align: right;">' . $this->l('Allow indexing robots (google, yahoo, bing, ...) to use availability filter') . '</td>
						<td>
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_filter_index_availability" value="1" ' . (Configuration::get('PS_LAYERED_FILTER_INDEX_QTY') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_filter_index_availability" value="0" ' . (!Configuration::get('PS_LAYERED_FILTER_INDEX_QTY') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr style="text-align: center;">
						<td style="text-align: right;">' . $this->l('Allow indexing robots (google, yahoo, bing, ...) to use manufacturer filter') . '</td>
						<td>
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_filter_index_manufacturer" value="1" ' . (Configuration::get('PS_LAYERED_FILTER_INDEX_MNF') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_filter_index_manufacturer" value="0" ' . (!Configuration::get('PS_LAYERED_FILTER_INDEX_MNF') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr style="text-align: center;">
						<td style="text-align: right;">' . $this->l('Allow indexing robots (google, yahoo, bing, ...) to use category filter') . '</td>
						<td>
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_filter_index_category" value="1" ' . (Configuration::get('PS_LAYERED_FILTER_INDEX_CAT') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_filter_index_category" value="0" ' . (!Configuration::get('PS_LAYERED_FILTER_INDEX_CAT') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
				</table>
				<p style="text-align: center;"><input type="submit" class="button" name="submitLayeredSettings" value="' . $this->l('Save configuration') . '" /></p>
			</form>
		</fieldset>';
        return $html;
    }
Example #26
0
 public function getMediaLink($filepath)
 {
     return Tools::getProtocol() . Tools::getMediaServer($filepath) . $filepath;
 }
<?php

include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/blocklayered.php';
if (substr(Tools::encrypt('blocklayered/index'), 0, 10) != Tools::getValue('token') || !Module::isInstalled('blocklayered')) {
    die('Bad token');
}
if (!Tools::getValue('ajax')) {
    // Case of nothing to do but showing a message (1)
    if (Tools::getValue('return_message') !== false) {
        echo '1';
        die;
    }
    // Return a content without waiting the end of index execution
    header('Location: ' . Tools::getProtocol() . Tools::getHttpHost() . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php?token=' . Tools::getValue('token') . '&return_message=' . (int) Tools::getValue('cursor'));
    flush();
}
if (Tools::getValue('full')) {
    echo BlockLayered::fullPricesIndexProcess((int) Tools::getValue('cursor'), (int) Tools::getValue('ajax'), true);
} else {
    echo BlockLayered::pricesIndexProcess((int) Tools::getValue('cursor'), (int) Tools::getValue('ajax'));
}
    public function getContent()
    {
        global $cookie, $currentIndex;
        if (Tools::isSubmit('submitBirthday')) {
            Configuration::updateValue('BIRTHDAY_ACTIVE', (int) Tools::getValue('bp_active'));
            Configuration::updateValue('BIRTHDAY_DISCOUNT_TYPE', (int) Tools::getValue('id_discount_type'));
            Configuration::updateValue('BIRTHDAY_DISCOUNT_VALUE', (double) Tools::getValue('discount_value'));
            Configuration::updateValue('BIRTHDAY_MINIMAL_ORDER', (double) Tools::getValue('minimal_order'));
            Tools::redirectAdmin($currentIndex . '&configure=birthdaypresent&token=' . Tools::getValue('token') . '&conf=4');
        }
        $this->_html = '
		<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->displayName . '</legend>
			<p>' . $this->l('Create a voucher for customers celebrating their birthday and having at least one valid order') . '</p>
			<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" style="margin-top: 15px;">
				<label>' . $this->l('Active') . '</label>
				<div class="margin-form">
					<img src="../img/admin/enabled.gif" /> <input type="radio" name="bp_active" value="1"' . (Configuration::get('BIRTHDAY_ACTIVE') ? ' checked="checked"' : '') . ' />
					<img src="../img/admin/disabled.gif" /> <input type="radio" name="bp_active" value="0"' . (!Configuration::get('BIRTHDAY_ACTIVE') ? ' checked="checked"' : '') . ' />
					<p style="clear: both;">' . $this->l('Additionally, you have to set a CRON rule which calls the file') . '<br />' . Tools::getProtocol() . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/birthdaypresent/cron.php ' . $this->l('every day') . '</p>
				</div>
				<label>' . $this->l('Type') . '</label>
				<div class="margin-form">
					<select name="id_discount_type">';
        $discountTypes = Discount::getDiscountTypes((int) $cookie->id_lang);
        foreach ($discountTypes as $discountType) {
            $this->_html .= '<option value="' . (int) $discountType['id_discount_type'] . '"' . (Configuration::get('BIRTHDAY_DISCOUNT_TYPE') == $discountType['id_discount_type'] ? ' selected="selected"' : '') . '>' . $discountType['name'] . '</option>';
        }
        $this->_html .= '
					</select>
				</div>
				<label>' . $this->l('Value') . '</label>
				<div class="margin-form">
					<input type="text" size="15" name="discount_value" value="' . Configuration::get('BIRTHDAY_DISCOUNT_VALUE') . '" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\'); " />
					<p style="clear: both;">' . $this->l('Either the monetary amount or the %, depending on Type selected above') . '</p>
				</div>
				<label>' . $this->l('Minimum order') . '</label>
				<div class="margin-form">
					<input type="text" size="15" name="minimal_order" value="' . Configuration::get('BIRTHDAY_MINIMAL_ORDER') . '" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\'); " />
					<p style="clear: both;">' . $this->l('The minimum order amount needed to use the voucher') . '</p>
				</div>
				<div class="clear center">
					<input type="submit" value="' . $this->l('   Save   ') . '" name="submitBirthday" class="button" />
				</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</form>
		</fieldset><br />
		<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/comment.gif" /> ' . $this->l('Guide') . '</legend>
			<h2>' . $this->l('Develop clients\' loyalty') . '</h2>
			<p>' . $this->l('Offering a present to a client is a means of securing their loyalty.') . '</p>
			<h3>' . $this->l('What should you do?') . '</h3>
			<p>
				' . $this->l('Keeping a client is more profitable than capturing a new one. Thus, it is necessary to develop their loyalty, in other words to make them want to come back to your webshop.') . ' <br />
				' . $this->l('Word of mouth is also a means to get new satisfied clients; a dissatisfied one won\'t attract new clients.') . '<br />
				' . $this->l('In order to achieve this goal you can organize: ') . '
				<ul>
					<li>' . $this->l('Punctual operations: commercial rewards (personalized special offers, product or service offered), non commercial rewards (priority handling of an order or a product), pecuniary rewards (bonds, discount coupons, payback...).') . '</li>
					<li>' . $this->l('Sustainable operations: loyalty or points cards, which not only justify communication between merchant and client, but also offer advantages to clients (private offers, discounts).') . '</li>
				</ul>
				' . $this->l('These operations encourage clients to buy and also to come back to your webshop regularly.') . ' <br />
			</p>
		</fieldset>';
        return $this->_html;
    }
Example #29
0
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/WishList.php';
$context = Context::getContext();
// Instance of module class for translations
$module = new BlockWishList();
if (Configuration::get('PS_TOKEN_ENABLE') == 1 and strcmp(Tools::getToken(false), Tools::getValue('token')) and $context->customer->isLogged() === true) {
    exit($module->l('invalid token', 'sendwishlist'));
}
if ($context->customer->isLogged()) {
    $id_wishlist = (int) Tools::getValue('id_wishlist');
    if (empty($id_wishlist) === true) {
        exit($module->l('Invalid wishlist', 'sendwishlist'));
    }
    for ($i = 1; empty($_POST['email' . strval($i)]) === false; ++$i) {
        $to = Tools::getValue('email' . $i);
        $wishlist = WishList::exists($id_wishlist, $context->customer->id, true);
        if ($wishlist === false) {
            exit($module->l('Invalid wishlist', 'sendwishlist'));
        }
        if (WishList::addEmail($id_wishlist, $to) === false) {
            exit($module->l('Wishlist send error', 'sendwishlist'));
        }
        $toName = strval(Configuration::get('PS_SHOP_NAME'));
        $customer = $context->customer;
        if (Validate::isLoadedObject($customer)) {
            Mail::Send($context->language->id, 'wishlist', sprintf(Mail::l('Message from %1$s %2$s', $context->language->id), $customer->lastname, $customer->firstname), array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{wishlist}' => $wishlist['name'], '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist['token']), $to, $toName, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, dirname(__FILE__) . '/mails/');
        }
    }
}
Example #30
0
    public function getContent()
    {
        global $cookie;
        $output = '
		<p><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo-mb.gif" alt="Moneybookers" /></p><br />';
        $errors = array();
        /* Validate account */
        if (isset($_POST['SubmitValidation'])) {
            if (isset($_POST['mb_email_to_validate']) and !empty($_POST['mb_email_to_validate'])) {
                $fp = fopen('http://moneybookers.prestashop.com/email_check.php?email=' . $_POST['mb_email_to_validate'] . '&url=' . Tools::getProtocol() . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__, 'r');
                if (!$fp) {
                    $errors[] = $this->l('Unable to contact activation server, please try again later.');
                } else {
                    $response = trim(strtolower(fgets($fp, 4096)));
                    if (!strstr('ok', $response)) {
                        $errors[] = $this->l('Account validation failed, please check your e-mail.');
                    } else {
                        Configuration::updateValue('MB_PAY_TO_EMAIL', $_POST['mb_email_to_validate']);
                        Configuration::updateValue('MB_PARAMETERS', 1);
                        $output .= '
						<ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;">
							<li>' . $this->l('E-mail activation successful, you can now validate your secret word.') . '<img src="http://www.prestashop.com/modules/moneybookers.png?email=' . urlencode($_POST['mb_email_to_validate']) . '" style="float:right" /></li>
						</ul>';
                    }
                    fclose($fp);
                }
            } else {
                $errors[] = $this->l('E-mail field is required');
            }
        }
        /* Validate secret word */
        if (isset($_POST['SubmitSecret'])) {
            if (isset($_POST['mb_sw_to_validate']) and !empty($_POST['mb_sw_to_validate'])) {
                $fp = fopen('http://moneybookers.prestashop.com/email_check.php?email=' . Configuration::get('MB_PAY_TO_EMAIL') . '&url=' . Tools::getProtocol() . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . '&sw=1&secret_word=' . md5($_POST['mb_sw_to_validate']), 'r');
                if (!$fp) {
                    $errors[] = $this->l('Unable to contact activation server, please try again later.');
                } else {
                    $response = trim(strtolower(fgets($fp, 4096)));
                    if (strstr('velocity_check_exceeded', $response)) {
                        $errors[] = $this->l('Secret word validation failed, exceeded max tries (3 per hour)');
                    } elseif (!strstr('ok', $response)) {
                        $errors[] = $this->l('Secret word validation failed, please check your secret word.');
                    } else {
                        Configuration::updateValue('MB_SECRET_WORD', $_POST['mb_sw_to_validate']);
                        Configuration::updateValue('MB_PARAMETERS_2', 1);
                        $output .= '
						<ul style="color: green; font-weight: bold; margin-bottom: 30px; width: 506px; background: #E1FFE9; border: 1px dashed #BBB; padding: 10px;">
							<li>' . $this->l('Account activation successful, secret word OK') . '</li>
						</ul>';
                    }
                    fclose($fp);
                }
            } else {
                $errors[] = $this->l('Secret word field is required');
            }
        }
        /* Update configuration variables */
        if (isset($_POST['submitMoneyBookers'])) {
            if (!isset($_POST['mb_hide_login'])) {
                $_POST['mb_hide_login'] = 0;
            }
            Configuration::updateValue('MB_CANCEL_URL', $_POST['mb_cancel_url']);
            Configuration::updateValue('MB_HIDE_LOGIN', (int) $_POST['mb_hide_login']);
            $local = '';
            $inter = '';
            foreach ($_POST as $key => $value) {
                if (strstr($key, 'mb_local_')) {
                    preg_match('/mb_local_([0-9]+)/', $key, $matches);
                    if (isset($matches[1])) {
                        $local .= $matches[1] . '|';
                    }
                } elseif (strstr($key, 'mb_inter_')) {
                    preg_match('/mb_inter_([0-9]+)/', $key, $matches);
                    if (isset($matches[1])) {
                        $inter .= $matches[1] . '|';
                    }
                }
            }
            $local = rtrim($local, '|');
            $inter = rtrim($inter, '|');
            Configuration::updateValue('MB_LOCAL_METHODS', $local);
            Configuration::updateValue('MB_INTER_METHODS', $inter);
            Configuration::updateValue('MB_DISPLAY_MODE', (int) $_POST['mb_display_mode']);
        }
        /* Display errors */
        if (sizeof($errors)) {
            $output .= '<ul style="color: red; font-weight: bold; margin-bottom: 30px; width: 506px; background: #FFDFDF; border: 1px dashed #BBB; padding: 10px;">';
            foreach ($errors as $error) {
                $output .= '<li>' . $error . '</li>';
            }
            $output .= '</ul>';
        }
        $lang = new Language((int) $cookie->id_lang);
        $iso_img = $lang->iso_code;
        if ($lang->iso_code != 'fr' and $lang->iso_code != 'en') {
            $iso_img = 'en';
        }
        $manual_links = array('en' => 'http://www.prestashop.com/partner/Activation_Manual_Prestashop_EN.pdf', 'es' => 'http://www.prestashop.com/partner/Manual%20de%20Activacion%20Prestashop_ES.pdf', 'fr' => 'http://www.prestashop.com/partner/Manuel_Activation_Prestashop_FR.pdf');
        $iso_manual = $lang->iso_code;
        if (!array_key_exists($lang->iso_code, $manual_links)) {
            $iso_manual = 'en';
        }
        /* Display settings form */
        $output .= '
		<b>' . $this->l('About Moneybookers') . '</b><br /><br /><p style="font-size: 11px;">' . $this->l('Take advantage of the special fees offered by Moneybookers to PrestaShop merchants !') . '<br /><br />' . $this->l('Moneybookers, controlled by Skrill Holdings, is one of the biggest online payment systems in Europe, and proposes more than 100 payment options and 41 currencies in more than 200 countries and territories. More than 80,000 merchants already use this solution among which eBay.com, Skype and Thomas Cook.') . '<br /><br />' . $this->l('With more than 17 million users and more than 15,000 new accounts created per day, Moneybookers also offers one of the biggest electronic wallet in the world. Your customers can also pay by using their e-mail and password thanks to the e-Wallet solution.') . '<br /><br />' . $this->l('Moneybookers changes its name and becomes Skrill!') . '<br /><br />
                <div style="clear: both;"></div>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-opening">
			<fieldset class="width2" style="margin: 20px 0; width: 800px;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Open Account') . '</legend>
				' . $this->l('Start by opening a') . ' <b>' . $this->l('free account') . '</b> ' . $this->l('with Moneybookers:') . '
				<p><a href="http://www.moneybookers.com/partners/prestashop/' . ($lang->iso_code == 'fr' ? '' : strtolower($lang->iso_code) . '/') . '"><img src="../modules/moneybookers/prestashop_mb_' . $iso_img . '.gif" alt="PrestaShop & Moneybookers" /></a><br /><br />
				<p style="margin: 0;">
					' . $this->l('Then click here:') . ' <input type="button" class="button" value="' . $this->l('I already have a Moneybookers account') . '" style="margin: 0 auto;" onclick="$(\'#form-activation\').show(1500);" />
					<hr size="1" style="margin: 0 0 15px 0;" noshade />
				</p>
				<span style="color: #CC0000; font-weight: bold; line-height: 20px;"><img src="../img/admin/gold.gif" alt="" /> ' . $this->l('Thanks to the PrestaShop/Moneybookers partnership,') . ' ' . $this->l('you will get a preferential commission rate!') . '</span></p>

<br /><br />
<style>
.tdMBL { border-left: 1px solid black; border-top: 1px solid black; }
.tdMBR { border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; }
.tdMBLast { border-top: 1px solid black; border-right: 1px solid black; }
</style>
<table cellpadding="2" cellspacing="0" style="width: 750px;">
 <tr><td class="tdMBL" style="background-color: grey;"><b>PrestaShop</b></td><td colspan="2" class="tdMBR" style="background-color: grey;"><b>' . $this->l('Online payment solution by Moneybookers') . '</b></td></tr>
 <tr><td class="tdMBL">' . $this->l('Monthly volume for payments made via Moneybookers') . '</td><td class="tdMBL">Quick Checkout Moneybookers ***</td><td class="tdMBR">Moneybookers eWallet **</td></tr>
 <tr><td class="tdMBL">€ 0 - € 1,000</td><td class="tdMBR">2.9% + 0.19€</td><td rowspan="5" class="tdMBLast">0.9% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 1,000.01 - € 10,000</td><td class="tdMBR">1.8% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 10,000.01 - € 50,000</td><td class="tdMBR">1.6% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 50,000.01 - € 100,000</td><td class="tdMBR">1.4% + 0.19€</td></tr>
 <tr><td class="tdMBL">€ 100,000</td><td class="tdMBR">1.2% + 0.19€</td></tr>
 <tr><td colspan="3" style="border-top: 1px solid black;"><small>' . $this->l('For merchants over €100,000 fees can be negotiated.') . ' Contact: ecommerce@moneybookers.com</small></td></tr>
</table>

<p align="left">
** ' . $this->l('Moneybookers eWallet') . '<br />
*** ' . $this->l('Quick Checkout Moneybookers') . '
</p>

			</fieldset>
		</form>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-activation"' . ((!Configuration::get('MB_PARAMETERS') and !isset($_POST['SubmitValidation'])) ? ' style="display: none;"' : '') . '>
			<fieldset class="width2" style="margin: 20px 0; width: 800px;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Account validation') . '</legend>
				' . (Configuration::get('MB_PARAMETERS') == 1 ? '<p style="font-weight: bold; color: green;"><img src="../img/admin/ok.gif" alt="" /> ' . $this->l('Your account has been activated') . '</p>' : '') . '
				<p style="line-height: 20px;">' . $this->l('You need to') . ' <b>' . $this->l('validate your account') . '</b>.<br />' . $this->l('Beware ! Be sure that you replaced the test e-mail « testmerchant@moneybookers.com » by your e-mail used to open your Moneybookers account :') . '<br /><br />
				<input type="text" name="mb_email_to_validate" value="' . Configuration::get('MB_PAY_TO_EMAIL') . '" style="width: 250px;" />
				<input type="submit" name="SubmitValidation" class="button" value="' . $this->l('Validate my account') . '" /></p>
				<p style="font-size: 14px;"><a href="' . $manual_links[$iso_manual] . '" target="_blank"><img src="../img/admin/pdf.gif" alt="" /></a><a href="' . $manual_links[$iso_manual] . '" target="_blank"><b>' . $this->l('For help, refer to the activation manual.') . '</b></a></p>
			</fieldset>
		</form>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-secret"' . ((!Configuration::get('MB_PARAMETERS') and !isset($_POST['SubmitSecret'])) ? ' style="display: none;"' : '') . '>
			<fieldset class="width2" style="margin: 20px 0; width: 800px;">
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Secret word validation') . '</legend>
				' . (Configuration::get('MB_PARAMETERS_2') == 1 ? '<p style="font-weight: bold; color: green;"><img src="../img/admin/ok.gif" alt="" /> ' . $this->l('Your secret word has been activated') . '</p>' : '') . '
				<p style="line-height: 20px;">' . $this->l('You need to') . ' <b>' . $this->l('validate your secret word') . '</b>, ' . $this->l('Please enter the secret word entered on your Moneybookers account:') . '<br /><br />
				<input type="password" name="mb_sw_to_validate" value="' . Configuration::get('MB_SECRET_WORD') . '" style="width: 250px;" />
				<input type="submit" name="SubmitSecret" class="button" value="' . $this->l('Validate my secret word') . '" /></p>

				<br />
				<p><b>' . $this->l('What is the secret word ?') . '</b></p>
				<p>' . $this->l('The secret word is different from the password. It is used by Moneybookers to securely encrypt the transmission from your server.') . '</p>
				<p><b>' . $this->l('Why a secret word different from the password ?') . '</b></p>
				<p>' . $this->l('The secret word is used to reinforce the payment security.') . '</p>
				<p>' . $this->l('The password is only used to securely connect to your Moneybookers account. If the password changes, it won\'t affect your secret word. So it is recommended to have your password different from your secret word.') . '</p>
				<p><b>' . $this->l('Where can I find my secret word ?') . '</b></p>
				<p>' . $this->l('Once your account has been validated, go to your account in the "Merchant Tools" section. There, you will be able to define your secret word.') . '</p>


			</fieldset>
		</form>

		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '" id="form-settings"' . (!Configuration::get('MB_PARAMETERS') ? ' style="display: none;"' : '') . '>
			<style type="text/css">
				label {
					width: 300px;
					margin-right: 10px;
					font-size: 12px;
				}
			</style>
			<fieldset style="width: 800px;">';
        $interActivated = Configuration::get('MB_INTER_METHODS') != '' ? explode('|', Configuration::get('MB_INTER_METHODS')) : array();
        $localActivated = Configuration::get('MB_LOCAL_METHODS') != '' ? explode('|', Configuration::get('MB_LOCAL_METHODS')) : array();
        $output .= '
				<p>' . $this->l('Click the') . ' <b>' . $this->l('international payment methods') . '</b> ' . $this->l('that you would like to enable:') . '</p>
				<div style="width: 200px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 0; $i != 3; $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 250px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 3; $i != 6; $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 200px; float: left; line-height: 75px;">';
        for ($i = 6; $i != sizeof($this->_internationalPaymentMethods); $i++) {
            $output .= '<input type="checkbox" name="mb_inter_' . (int) $i . '" value="1"' . (in_array($i, $interActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/international/' . $this->_internationalPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="clear: both;"></div>
				<hr size="1" noshade />
				<p>' . $this->l('Click the') . ' <b>' . $this->l('local payment methods') . '</b> ' . $this->l('that you would like to enable:') . '</p>
				<div style="width: 200px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 0; $i != 7; $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 250px; float: left; margin-right: 25px; line-height: 75px;">';
        for ($i = 8; $i != 15; $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="width: 200px; float: left; line-height: 75px;">';
        for ($i = 16; $i != sizeof($this->_localPaymentMethods); $i++) {
            $output .= '<input type="checkbox" name="mb_local_' . (int) $i . '" value="1"' . (in_array($i, $localActivated) ? ' checked="checked"' : '') . ' /> <img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logos/local/' . $this->_localPaymentMethods[$i]['file'] . '.gif" alt="" style="vertical-align: middle;" /><br />';
        }
        $output .= '
				</div>
				<div style="clear: both;"></div>

				<hr size="1" noshade />
				<legend><img src="' . __PS_BASE_URI__ . 'modules/moneybookers/logo.gif" alt="" />' . $this->l('Settings and payment methods') . '</legend>
				<label>' . $this->l('Page displayed after payment cancellation:') . '</label>
				<div class="margin-form">
					<input type="text" name="mb_cancel_url" value="' . Configuration::get('MB_CANCEL_URL') . '" style="width: 300px;" />
				</div>
				<div style="clear: both;"></div>
				<label>' . $this->l('Hide the login form on Moneybookers page') . '</label>
				<div class="margin-form">
					<input type="checkbox" name="mb_hide_login" value="1" ' . (Configuration::get('MB_HIDE_LOGIN') ? 'checked="checked"' : '') . ' style="margin-top: 4px;" />
				</div>
				<div style="clear: both;"></div>
				<label>' . $this->l('Display mode:') . '</label>
				<div class="margin-form">
					<input type="radio" name="mb_display_mode" value="0" ' . (!Configuration::get('MB_DISPLAY_MODE') ? 'checked="checked"' : '') . ' style="vertical-align: text-bottom;" /> ' . $this->l('All logos in 1 block') . '
					<input type="radio" name="mb_display_mode" value="1" ' . (Configuration::get('MB_DISPLAY_MODE') ? 'checked="checked"' : '') . ' style="vertical-align: text-bottom; margin-left: 10px;" /> ' . $this->l('1 block for each logo') . '
				</div>
				<div style="clear: both;"></div>

				<center><input type="submit" class="button" name="submitMoneyBookers" value="' . $this->l('Save settings') . '" style="margin-top: 25px;" /></center>
			</fieldset>
		</form>';
        return $output;
    }