/**
  * Update the Main Configuration vars, executed by the main module object once its uninstallation
  *
  * @return bool success or false
  */
 public function save()
 {
     if (!$this->web_site_id || !$this->store_code_id || !$this->default_profile_id) {
         return false;
     }
     return Configuration::updateValue('PREDIGGO_WEB_SITE_ID', Tools::htmlentitiesUTF8($this->web_site_id, ENT_QUOTES)) && Configuration::updateValue('PREDIGGO_STORE_CODE_ID', Tools::htmlentitiesUTF8($this->store_code_id, ENT_QUOTES)) && Configuration::updateValue('PREDIGGO_DEFAULT_PROFILE_ID', (int) $this->default_profile_id);
 }
    public static function displayHelp($label, $iso_lang, $country, $ps_version)
    {
        $infos = HelpAccess::retrieveInfos($label, $iso_lang, $country, $ps_version);
        if (array_key_exists('image', $infos) && $infos['image'] != 'none') {
            echo '
			        <a class="help-button" href="#" onclick="showHelp(\'' . HelpAccess::URL . '\',\'' . $label . '\',\'' . $iso_lang . '\',\'' . $ps_version . '\',\'' . $infos['version'] . '\',\'' . $country . '\');" title="' . Tools::htmlentitiesUTF8($infos['tooltip']) . '">
			        <img id="help-' . $label . '" src="../img/admin/' . Tools::htmlentitiesUTF8($infos['image']) . '" alt="" class="middle" style="margin-top: -5px"/> ' . Tools::displayError('HELP') . '
			        </a>

		          ';
            if (!empty($infos['tooltip'])) {
                echo ' <script type="text/javascript">
			            $(document).ready(function() {
              			      $("a.help-button").cluetip({
				              	splitTitle: "|",
				              	cluetipClass: "help-button",
				                showTitle: false,
				                arrows: true,
				                dropShadow: false,
				                positionBy: "auto"
			                  });
			            });
		              </script>';
            }
        }
    }
 public function hookHeader($params)
 {
     global $smarty, $protocol_link, $rewrited_url;
     $canonicalUrl = Configuration::get('CANONICAL_URL');
     $ps_request = str_replace(__PS_BASE_URI__, '', $_SERVER['REQUEST_URI']);
     if (strlen(Configuration::get('CANONICAL_URL')) > 0) {
         $smarty->assign('canonical_url', $protocol_link . $canonicalUrl . Tools::htmlentitiesUTF8(rawurldecode($_SERVER['REQUEST_URI'])));
     }
     return $this->display(__FILE__, 'canonicalurl.tpl');
 }
function smartyTruncate($params, &$smarty)
{
    $text = isset($params['strip']) ? strip_tags($params['text']) : $params['text'];
    $length = $params['length'];
    $sep = isset($params['sep']) ? $params['sep'] : '...';
    if (Tools::strlen($text) > $length + Tools::strlen($sep)) {
        $text = substr($text, 0, $length) . $sep;
    }
    return isset($params['encode']) ? Tools::htmlentitiesUTF8($text, ENT_NOQUOTES) : $text;
}
    private function _displayForm()
    {
        $this->_html .= '<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset>
				<table border="0" width="500" cellpadding="0" cellspacing="0" id="form">
					<tr><td colspan="2">' . $this->l('Saisir votre identifiant') . '.<br /><br /></td></tr>
					<tr><td width="130" style="height: 35px;">' . $this->l('Seller id') . '</td><td><input type="text" name="seller_id" value="' . Tools::htmlentitiesUTF8(Tools::getValue('seller_id', $this->_seller_id)) . '" style="width: 300px;" /></td></tr>
					<tr><td colspan="2" align="center"><br /><input class="button" name="btnSubmit" value="' . $this->l('Update settings') . '" type="submit" /></td></tr>
				</table>
			</fieldset>
		</form>';
    }
Example #6
0
 public function process()
 {
     $payu = new PayU();
     $response = $payu->interpretIPN($_POST);
     if (isset($response['date'], $response['hash'])) {
         echo '<EPAYMENT>' . $response['date'] . '|' . $response['hash'] . '</EPAYMENT>';
     } elseif (isset($response['error'])) {
         echo '<EPAYMENT_ERROR>' . Tools::htmlentitiesUTF8($response['error']) . '</EPAYMENT_ERROR>';
     } else {
         echo '<EPAYMENT_ERROR>Unknown error</EPAYMENT_ERROR>';
     }
     exit;
 }
Example #7
0
 public function pagination($total_products = null)
 {
     if (!self::$initialized) {
         $this->init();
     } elseif (!$this->context) {
         $this->context = Context::getContext();
     }
     // Retrieve the default number of products per page and the other available selections
     $default_products_per_page = max(1, (int) Configuration::get('PS_PRODUCTS_PER_PAGE'));
     $nArray = array($default_products_per_page, $default_products_per_page * 2, $default_products_per_page * 3, $default_products_per_page * 5, $default_products_per_page * 8, $default_products_per_page * 16);
     if ((int) Tools::getValue('n') && (int) $total_products > 0) {
         $nArray[] = $total_products;
     }
     // Retrieve the current number of products per page (either the default, the GET parameter or the one in the cookie)
     $this->n = $default_products_per_page;
     if (isset($this->context->cookie->nb_item_per_page) && in_array($this->context->cookie->nb_item_per_page, $nArray)) {
         $this->n = (int) $this->context->cookie->nb_item_per_page;
     }
     if ((int) Tools::getValue('n') && in_array((int) Tools::getValue('n'), $nArray)) {
         $this->n = (int) Tools::getValue('n');
     }
     // Retrieve the page number (either the GET parameter or the first page)
     $this->p = (int) Tools::getValue('p', 1);
     // If the parameter is not correct then redirect (do not merge with the previous line, the redirect is required in order to avoid duplicate content)
     if (!is_numeric($this->p) || $this->p < 1) {
         Tools::redirect(self::$link->getPaginationLink(false, false, $this->n, false, 1, false));
     }
     // Remove the page parameter in order to get a clean URL for the pagination template
     $current_url = preg_replace('/(\\?)?(&amp;)?p=\\d+/', '$1', Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']));
     if ($this->n != $default_products_per_page || isset($this->context->cookie->nb_item_per_page)) {
         $this->context->cookie->nb_item_per_page = $this->n;
     }
     $pages_nb = ceil($total_products / (int) $this->n);
     if ($this->p > $pages_nb && $total_products != 0) {
         Tools::redirect(self::$link->getPaginationLink(false, false, $this->n, false, $pages_nb, false));
     }
     $range = 2;
     /* how many pages around page selected */
     $start = (int) ($this->p - $range);
     if ($start < 1) {
         $start = 1;
     }
     $stop = (int) ($this->p + $range);
     if ($stop > $pages_nb) {
         $stop = (int) $pages_nb;
     }
     $this->context->smarty->assign(array('nb_products' => $total_products, 'products_per_page' => $this->n, 'pages_nb' => $pages_nb, 'p' => $this->p, 'n' => $this->n, 'nArray' => $nArray, 'range' => $range, 'start' => $start, 'stop' => $stop, 'current_url' => $current_url));
 }
Example #8
0
    public function getContent()
    {
        if (Tools::isSubmit('submit')) {
            // Запись логина ключа и № формы в конфиг из формы в админке
            Configuration::updateValue('ONPAY_LOGIN', Tools::getValue('ONPAY_LOGIN'));
            Configuration::updateValue('ONPAY_API_IN_KEY', Tools::getValue('ONPAY_API_IN_KEY'));
            Configuration::updateValue('ONPAY_FORM', Tools::getValue('ONPAY_FORM'));
        }
        //код отображения в админке
        return '
		<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
		<fieldset style="width: 300px;float:right;margin-left:15px;">
	<legend><img src="../img/admin/manufacturers.gif" /> ' . $this->l('Информация') . '</legend>
	<div id="dev_div">
		<span><b>' . $this->l('Версия') . ':</b> ' . $this->version . '</span><br>
		<span><b>' . $this->l('Лицензия') . ':</b> <a class="link" href="http://www.opensource.org/licenses/osl-3.0.php" target="_blank">OSL 3.0</a></span><br>
		<span><b>' . $this->l('Разработчик') . ':</b> <a class="link" href="mailto:mbpresta@rambler.ru" target="_blank">psstore.org</a><br>
                <span><b>' . $this->l('Обсудить') . ':</b> <a class="link" href="http://prestashop-planet.org/" target="_blank">prestashop-planet.org</a><br>
	</div>
</fieldset>
			<fieldset><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Settings') . '</legend>
				<label for="wmr">' . $this->l('LOGIN:'******'</label>
				<div class="margin-form">
					<input type="text" size="25" maxlength="13" name="ONPAY_LOGIN" value="' . Tools::getValue('ONPAY_LOGIN', Configuration::get('ONPAY_LOGIN')) . '" />
				</div>
				<div class="clear">&nbsp;</div>
				<label for="wmz">' . $this->l('API IN KEY:') . '</label>
				<div class="margin-form">
					<input type="text" size="25" maxlength="13" name="ONPAY_API_IN_KEY" value="' . Tools::getValue('ONPAY_API_IN_KEY', Configuration::get('ONPAY_API_IN_KEY')) . '" />
				</div>
				<div class="clear">&nbsp;</div>
				<label for="key">' . $this->l('ONPAY FORM:') . '</label>
				<div class="margin-form">
					<input type="text" size="2" name="ONPAY_FORM" value="' . Tools::getValue('ONPAY_FORM', Configuration::get('ONPAY_FORM')) . '" />
				</div>
				<div class="clear">&nbsp;</div>
				<label for="key">' . $this->l('URL API(не изменяется)') . '</label>
				<div class="margin-form">
					<input type="text" size="75" name="ap" value="http://' . $_SERVER['HTTP_HOST'] . $this->_path . 'validation.php" />
				</div>
				<div class="clear">&nbsp;</div>
				<center><input type="submit" name="submit" value="' . $this->l('Update settings') . '" class="button" /></center>
			</fieldset>
		</form>
		
		<div class="clear">&nbsp;</div>';
    }
Example #9
0
 public static function assignVars()
 {
     $technical_settings = array();
     $technical_settings['SYSPAY_LIVE_MID'] = Configuration::get('SYSPAY_LIVE_MID');
     $technical_settings['SYSPAY_LIVE_SHA1_PRIVATE'] = Configuration::get('SYSPAY_LIVE_SHA1_PRIVATE');
     $technical_settings['SYSPAY_TEST_MID'] = Configuration::get('SYSPAY_TEST_MID');
     $technical_settings['SYSPAY_TEST_SHA1_PRIVATE'] = Configuration::get('SYSPAY_TEST_SHA1_PRIVATE');
     $technical_settings['SYSPAY_MODE'] = Configuration::get('SYSPAY_MODE');
     $technical_settings['SYSPAY_ERRORS'] = Configuration::get('SYSPAY_ERRORS');
     $technical_settings['SYSPAY_CAPTURE_OS'] = Configuration::get('SYSPAY_CAPTURE_OS');
     $technical_settings['SYSPAY_AUTHORIZED_PAYMENT'] = Configuration::get('SYSPAY_AUTHORIZED_PAYMENT');
     $technical_settings['SYSPAY_REBILL'] = Configuration::get('SYSPAY_REBILL');
     $technical_settings['SYSPAY_WEBSITE_ID'] = Configuration::get('SYSPAY_WEBSITE_ID');
     $technical_settings['formTarget'] = Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']);
     $context = Context::getContext();
     $context->smarty->assign('settings', $technical_settings);
 }
 public function process()
 {
     parent::process();
     $hasProduct = false;
     $product_list = Tools::getValue('compare_product_list');
     $postProducts = isset($product_list) ? rtrim($product_list, '|') : '';
     if (!Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
         return Tools::redirect('404.php');
     }
     if ($postProducts) {
         $ids = array_unique(explode('|', $postProducts));
         if (sizeof($ids) > 0) {
             if (sizeof($ids) > Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
                 $ids = array_slice($ids, 0, Configuration::get('PS_COMPARATOR_MAX_ITEM'));
             }
             $listProducts = array();
             $listFeatures = array();
             foreach ($ids as $id) {
                 $curProduct = new Product((int) $id, true, (int) self::$cookie->id_lang);
                 if (!Validate::isLoadedObject($curProduct)) {
                     continue;
                 }
                 if (!$curProduct->active) {
                     unset($ids[$k]);
                     continue;
                 }
                 foreach ($curProduct->getFrontFeatures(self::$cookie->id_lang) as $feature) {
                     $listFeatures[$curProduct->id][$feature['id_feature']] = $feature['value'];
                 }
                 $cover = Product::getCover((int) $id);
                 $curProduct->id_image = Tools::htmlentitiesUTF8(Product::defineProductImage(array('id_image' => $cover['id_image'], 'id_product' => $id), self::$cookie->id_lang));
                 $curProduct->allow_oosp = Product::isAvailableWhenOutOfStock($curProduct->out_of_stock);
                 $listProducts[] = $curProduct;
             }
             if (sizeof($listProducts) > 0) {
                 $width = 80 / sizeof($listProducts);
                 $hasProduct = true;
                 $ordered_features = Feature::getFeaturesForComparison($ids, self::$cookie->id_lang);
                 self::$smarty->assign(array('ordered_features' => $ordered_features, 'product_features' => $listFeatures, 'products' => $listProducts, 'link' => new Link(), 'width' => $width, 'homeSize' => Image::getSize('home')));
                 self::$smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Module::hookExec('extraProductComparison', array('list_ids_product' => $ids)));
             }
         }
     }
     self::$smarty->assign('hasProduct', $hasProduct);
 }
Example #11
0
function includeDatepicker($id, $time = false)
{
    global $cookie;
    echo '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery-ui-1.8.10.custom.min.js"></script>';
    $iso = Db::getInstance()->getValue('SELECT iso_code FROM ' . _DB_PREFIX_ . 'lang WHERE `id_lang` = ' . (int) $cookie->id_lang);
    if ($iso != 'en') {
        echo '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/datepicker/ui/i18n/ui.datepicker-' . Tools::htmlentitiesUTF8($iso) . '.js"></script>';
    }
    echo '<script type="text/javascript">';
    if (is_array($id)) {
        foreach ($id as $id2) {
            bindDatepicker($id2, $time);
        }
    } else {
        bindDatepicker($id, $time);
    }
    echo '</script>';
}
Example #12
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;
    }
function smartyTranslate($params, &$smarty)
{
    global $_LANG;
    if (!isset($params['js'])) {
        $params['js'] = 0;
    }
    if (!isset($params['pdf'])) {
        $params['pdf'] = false;
    }
    if (!isset($params['mod'])) {
        $params['mod'] = false;
    }
    if (!isset($params['sprintf'])) {
        $params['sprintf'] = null;
    }
    $string = str_replace('\'', '\\\'', $params['s']);
    $filename = !isset($smarty->compiler_object) || !is_object($smarty->compiler_object->template) ? $smarty->template_resource : $smarty->compiler_object->template->getTemplateFilepath();
    $basename = basename($filename, '.tpl');
    $key = $basename . '_' . md5($string);
    if (isset($smarty->source) && strpos($smarty->source->filepath, DIRECTORY_SEPARATOR . 'override' . DIRECTORY_SEPARATOR) !== false) {
        $key = 'override_' . $key;
    }
    if ($params['mod']) {
        return Translate::getModuleTranslation($params['mod'], $params['s'], $basename, $params['sprintf']);
    } else {
        if ($params['pdf']) {
            return Translate::getPdfTranslation($params['s']);
        }
    }
    if ($_LANG != null && isset($_LANG[$key])) {
        $msg = $_LANG[$key];
    } elseif ($_LANG != null && isset($_LANG[Tools::strtolower($key)])) {
        $msg = $_LANG[Tools::strtolower($key)];
    } else {
        $msg = $params['s'];
    }
    if ($msg != $params['s']) {
        $msg = $params['js'] ? addslashes($msg) : stripslashes($msg);
    }
    if ($params['sprintf'] !== null) {
        $msg = Translate::checkAndReplaceArgs($msg, $params['sprintf']);
    }
    return $params['js'] ? $msg : Tools::htmlentitiesUTF8($msg);
}
Example #14
0
function validOrder()
{
    global $cookie, $cart, $ppPayment;
    if (!$cookie->isLogged()) {
        die('Not logged');
    } elseif (!$cart->getOrderTotalLC(true, 3)) {
        die('Empty cart');
    }
    if (!($token = Tools::htmlentitiesUTF8(strval(Tools::getValue('token'))))) {
        die('Invalid token');
    }
    if ($token != strval($cookie->paypal_token)) {
        die('Invalid cookie token');
    }
    if (!($payerID = Tools::htmlentitiesUTF8(strval(Tools::getValue('PayerID'))))) {
        die('Invalid payerID');
    }
    $ppPayment->validOrder($cookie, $cart, $cookie->id_currency, $payerID, 'payment');
}
Example #15
0
    public function getContent()
    {
        $html = '';
        if (Tools::isSubmit('submitStatsData')) {
            Configuration::updateValue('PS_STATSDATA_CUSTOMER_PAGESVIEWS', (int) Tools::getValue('PS_STATSDATA_CUSTOMER_PAGESVIEWS'));
            Configuration::updateValue('PS_STATSDATA_PAGESVIEWS', (int) Tools::getValue('PS_STATSDATA_PAGESVIEWS'));
            Configuration::updateValue('PS_STATSDATA_PLUGINS', (int) Tools::getValue('PS_STATSDATA_PLUGINS'));
            $html .= '<div class="conf">' . $this->l('Configuration updated') . '</div>';
        }
        $html .= '<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
		<fieldset><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Settings') . '</legend>
			<label>' . $this->l('Save page views for each customer') . '</label>
			<div class="margin-form">
				<input type="radio" name="PS_STATSDATA_CUSTOMER_PAGESVIEWS" id="PS_STATSDATA_CUSTOMER_PAGESVIEWS_on" value="1" ' . (Tools::getValue('PS_STATSDATA_CUSTOMER_PAGESVIEWS', Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS')) ? 'checked="checked"' : '') . ' />
				<label class="t" for="PS_STATSDATA_CUSTOMER_PAGESVIEWS_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" /></label>
				<input type="radio" name="PS_STATSDATA_CUSTOMER_PAGESVIEWS" id="PS_STATSDATA_CUSTOMER_PAGESVIEWS_off" value="0" ' . (Tools::getValue('PS_STATSDATA_CUSTOMER_PAGESVIEWS', Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS')) ? '' : 'checked="checked"') . ' />
				<label class="t" for="PS_STATSDATA_CUSTOMER_PAGESVIEWS_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" /></label>
				<p>' . $this->l('Stored customer page views uses a lot of CPU resources and database space.') . '</p>
			</div>
			<div class="clear">&nbsp;</div>
			<label>' . $this->l('Save global page views.') . '</label>
			<div class="margin-form">
				<input type="radio" name="PS_STATSDATA_PAGESVIEWS" id="PS_STATSDATA_PAGESVIEWS_on" value="1" ' . (Tools::getValue('PS_STATSDATA_PAGESVIEWS', Configuration::get('PS_STATSDATA_PAGESVIEWS')) ? 'checked="checked"' : '') . ' />
				<label class="t" for="PS_STATSDATA_PAGESVIEWS_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" /></label>
				<input type="radio" name="PS_STATSDATA_PAGESVIEWS" id="PS_STATSDATA_PAGESVIEWS_off" value="0" ' . (Tools::getValue('PS_STATSDATA_PAGESVIEWS', Configuration::get('PS_STATSDATA_PAGESVIEWS')) ? '' : 'checked="checked"') . ' />
				<label class="t" for="PS_STATSDATA_PAGESVIEWS_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" /></label>
				<p>' . $this->l('Global page views uses fewer resources than customer\'s, but it uses resources nonetheless.') . '</p>
			</div>
			<div class="clear">&nbsp;</div>
			<label>' . $this->l('Plugins detection') . '</label>
			<div class="margin-form">
				<input type="radio" name="PS_STATSDATA_PLUGINS" id="PS_STATSDATA_PLUGINS_on" value="1" ' . (Tools::getValue('PS_STATSDATA_PLUGINS', Configuration::get('PS_STATSDATA_PLUGINS')) ? 'checked="checked"' : '') . ' />
				<label class="t" for="PS_STATSDATA_PLUGINS_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" /></label>
				<input type="radio" name="PS_STATSDATA_PLUGINS" id="PS_STATSDATA_PLUGINS_off" value="0" ' . (Tools::getValue('PS_STATSDATA_PLUGINS', Configuration::get('PS_STATSDATA_PLUGINS')) ? '' : 'checked="checked"') . ' />
				<label class="t" for="PS_STATSDATA_PLUGINS_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" /></label>
				<p>' . $this->l('Plugins detection loads an extra 20kb javascript file for new visitors.') . '</p>
			</div>
			<div class="clear">&nbsp;</div>
			<input type="submit" class="button" name="submitStatsData" value="' . $this->l('Update') . '" />
		</fieldset>';
        return $html;
    }
 public function ajaxProcessSendMailTest()
 {
     if ($this->tabAccess['view'] === '1') {
         $smtpChecked = trim(Tools::getValue('mailMethod')) == 'smtp';
         $smtpServer = Tools::getValue('smtpSrv');
         $content = urldecode(Tools::getValue('testMsg'));
         $content = utf8_encode(html_entity_decode($content));
         $subject = urldecode(Tools::getValue('testSubject'));
         $type = 'text/html';
         $to = Tools::getValue('testEmail');
         $from = Configuration::get('PS_SHOP_EMAIL');
         $smtpLogin = Tools::getValue('smtpLogin');
         $smtpPassword = Tools::getValue('smtpPassword');
         $smtpPassword = !empty($smtpPassword) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD');
         $smtpPort = Tools::getValue('smtpPort');
         $smtpEncryption = Tools::getValue('smtpEnc');
         $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
         die($result === true ? 'ok' : $result);
     }
 }
Example #17
0
    private function _displayForm()
    {
        $this->_html .= '<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset>
			<legend><img src="../img/admin/contact.gif" />' . $this->l('Contact details') . '</legend>
				<table border="0" width="500" cellpadding="0" cellspacing="0" id="form">
					<tr><td colspan="2">' . $this->l('Please specify the Oplata account details for customers') . '.<br /><br /></td></tr>

					<tr>
						<td width="130" style="height: 35px;">' . $this->l('Merchant') . '</td>
						<td><input type="text" name="merchant" value="' . $this->getOption("merchant") . '" style="width: 300px;" /></td>
					</tr>
					<tr>
						<td width="130" style="height: 35px;">' . $this->l('Secret key') . '</td>
						<td><input type="text" name="secret_key" value="' . $this->getOption("secret_key") . '" style="width: 300px;" /></td>
					</tr>
					<tr><td colspan="2" align="center"><input class="button" name="btnSubmit" value="' . $this->l('Update settings') . '" type="submit" /></td></tr>
				</table>
			</fieldset>
		</form>';
    }
Example #18
0
    private function _displayForm()
    {
        $this->_html .= '<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
			<div style="margin:0 0 20px 0;">
				<input type="checkbox" name="GSITEMAP_ALL_PRODUCTS" id="GSITEMAP_ALL_PRODUCTS" style="vertical-align: middle;" value="1" ' . (Configuration::get('GSITEMAP_ALL_PRODUCTS') ? 'checked="checked"' : '') . ' /> <label class="t" for="GSITEMAP_ALL_PRODUCTS">' . $this->l('Sitemap also includes products from inactive categories') . '</label>
			</div>
			<div style="margin:0 0 20px 0;">
				<input type="checkbox" name="GSITEMAP_ALL_CMS" id="GSITEMAP_ALL_CMS" style="vertical-align: middle;" value="1" ' . (Configuration::get('GSITEMAP_ALL_CMS') ? 'checked="checked"' : '') . ' /> <label class="t" for="GSITEMAP_ALL_CMS">' . $this->l('Sitemap also includes CMS pages which are not in a CMS block') . '</label>
			</div>
			<input name="btnSubmit" class="button" type="submit"
			value="' . (!file_exists(GSITEMAP_FILE) ? $this->l('Generate sitemap file') : $this->l('Update sitemap file')) . '" />
		</form>';
    }
 private function _displayFormOld()
 {
     $order_states = array();
     foreach (OrderState::getOrderStates($this->context->cookie->id_lang) as $state) {
         array_push($order_states, array('id_option' => $state['id_order_state'], 'name' => $state['name']));
     }
     $this->context->smarty->assign(array('form_url' => Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']), 'api_version' => htmlentities(Configuration::get('VT_API_VERSION'), ENT_COMPAT, 'UTF-8'), 'api_versions' => array(1 => 'v1', 2 => 'v2'), 'client_key' => htmlentities(Configuration::get('VT_CLIENT_KEY'), ENT_COMPAT, 'UTF-8'), 'server_key' => htmlentities(Configuration::get('VT_SERVER_KEY'), ENT_COMPAT, 'UTF-8'), 'environments' => array(false => 'Development', true => 'Production'), 'environment' => htmlentities(Configuration::get('VT_ENVIRONMENT'), ENT_COMPAT, 'UTF-8'), 'enable_3d_secure' => htmlentities(Configuration::get('VT_3D_SECURE'), ENT_COMPAT, 'UTF-8'), 'enable_sanitized' => htmlentities(Configuration::get('VT_SANITIZED'), ENT_COMPAT, 'UTF-8'), 'enabled_cimb' => htmlentities(Configuration::get('ENABLED_CIMB'), ENT_COMPAT, 'UTF-8'), 'enabled_mandiri' => htmlentities(Configuration::get('ENABLED_MANDIRI'), ENT_COMPAT, 'UTF-8'), 'enabled_permatava' => htmlentities(Configuration::get('ENABLED_PERMATAVA'), ENT_COMPAT, 'UTF-8'), 'enabled_indomaret' => htmlentities(Configuration::get('ENABLED_INDOMARET'), ENT_COMPAT, 'UTF-8'), 'enabled_indosat_dompetku' => htmlentities(Configuration::get('ENABLED_INDOSAT_DOMPETKU'), ENT_COMPAT, 'UTF-8'), 'enabled_mandiri_ecash' => htmlentities(Configuration::get('ENABLED_MANDIRI_ECASH'), ENT_COMPAT, 'UTF-8'), 'statuses' => $order_states, 'payment_success_status_map' => htmlentities(Configuration::get('VT_PAYMENT_SUCCESS_STATUS_MAP'), ENT_COMPAT, 'UTF-8'), 'payment_challenge_status_map' => htmlentities(Configuration::get('VT_PAYMENT_CHALLENGE_STATUS_MAP'), ENT_COMPAT, 'UTF-8'), 'payment_failure_status_map' => htmlentities(Configuration::get('VT_PAYMENT_FAILURE_STATUS_MAP'), ENT_COMPAT, 'UTF-8'), 'kurs' => htmlentities(Configuration::get('VT_KURS', $this->veritrans_kurs), ENT_COMPAT, 'UTF-8'), 'convenience_fee' => htmlentities(Configuration::get('VT_CONVENIENCE_FEE', $this->veritrans_convenience_fee), ENT_COMPAT, 'UTF-8'), 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/'));
     $output = $this->context->smarty->fetch(__DIR__ . '/views/templates/hook/admin_retro.tpl');
     $this->_html .= $output;
 }
Example #20
0
 /**
  * Get a valid URL to use from BackOffice
  *
  * @param string $url An URL to use in BackOffice
  * @param boolean $entites Set to true to use htmlentities function on URL param
  */
 public static function getAdminUrl($url = null, $entities = false)
 {
     $link = Tools::getHttpHost(true) . __PS_BASE_URI__;
     if (isset($url)) {
         $link .= $entities ? Tools::htmlentitiesUTF8($url) : $url;
     }
     return $link;
 }
Example #21
0
    public function getContent()
    {
        $output = '<h2>' . $this->displayName . '</h2>';
        if (!is_callable('curl_init')) {
            $output .= parent::displayError('You need to enable Curl library to use this module');
        } elseif (Tools::isSubmit('submitFianet')) {
            $output .= self::getProcess();
        }
        $output .= '
		<fieldset style="width:80%"><legend>' . $this->displayName . '</legend>
			<img src="../modules/' . $this->name . '/logo.jpg" style="float:right;margin:5px 10px 5px 0" />
			<blockquote style="margin-left:5px"><b>« Le Sceau de Confiance FIA-NET, leader de la confiance sur le web, influence la décision d’achat de 83 % des internautes (*)</b></blockquote>
			<p style="margin-left:30px"><br />
			Le Sceau de Confiance FIA-NET, le plus connu en France, fait la preuve de vos performances. Il restitue les avis de vos clients grâce à l’envoi <b>de deux questionnaires de satisfaction</b> après l’achat et après la livraison.<br /><br />
			<b>L’extranet, un outil d’analyse de performance unique</b>, exploite les réponses de vos clients à ces questionnaires. Une aide inestimable qui vous permet de mieux connaitre vos clients et de piloter votre politique marketing et communication.<br />
			<br />
				<span style="font-size:0.8em;font-style:italic;">(*Etude FIA-NET – Novembre 2009 – 836 répondants)</span> »</p>
			<p>' . $this->l('To sign in, check out: ') . ' <u><a href="https://www.fia-net.com/marchands/devispartenaire.php?p=185" target="_blank">' . $this->l('Fia-net Website') . '</a></u></p>
		</fieldset><p class="clear">&nbsp;</p>';
        $output .= '
		<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset class="width2">
				<legend><img src="' . $this->_path . 'logo.gif" alt="" class="middle" />' . $this->l('Settings') . '</legend>
				<label>' . $this->l('Your site ID') . '</label>
				<div class="margin-form">
					<input type="text" name="FIANET_SCEAU_SITEID" value="' . Configuration::get('FIANET_SCEAU_SITEID') . '" />
					<p class="clear">' . $this->l('Sample:') . ' site_id = \'<b>XXXXX</b>\' ' . $this->l('(numbers only)') . '</p>
				</div>
				<label>' . $this->l('Private Key') . '</label>
				<div class="margin-form">
					<input type="text" name="FIANET_SCEAU_PRIVATEKEY" value="' . Configuration::get('FIANET_SCEAU_PRIVATEKEY') . '" />
					<p class="clear">' . $this->l('Private key communicated by Fia-Net') . '</p>
				</div>
				<label>' . $this->l('Mode') . '</label>
				<div class="margin-form">
					<span style="display:block;float:left;margin-top:3px;">
					<input type="radio" id="test" name="fia_net_mode" value="0" style="vertical-align:middle;display:block;float:left;margin-top:2px;margin-right:3px;"
						' . (!Configuration::get('FIA_NET_SEAL_MODE') ? 'checked' : '') . '/>
					<label for="test" style="color:#900;display:block;float:left;text-align:left;width:60px;">' . $this->l('Test') . '</label>&nbsp;</span>
					<span style="display:block;float:left;margin-top:3px;">
					<input type="radio" id="production" name="fia_net_mode" value="1" style="vertical-align:middle;display:block;float:left;margin-top:2px;margin-right:3px;"
						' . (Configuration::get('FIA_NET_SEAL_MODE') ? 'checked' : '') . '/>
					<label for="production" style="color:#080;display:block;float:left;text-align:left;width:85px;">' . $this->l('Production') . '</label></span>
				</div>
				<p class="clear">&nbsp;</p>
				<input type="submit" name="submitFianet" value="' . $this->l('Update settings') . '" class="button" />	
			</fieldset>
		</form>';
        return $output;
    }
 public function searchIP()
 {
     if (!ip2long(trim($this->query))) {
         $this->errors[] = Tools::displayError('This is not a valid IP address:') . ' ' . Tools::htmlentitiesUTF8($this->query);
         return;
     }
     $this->_list['customers'] = Customer::searchByIp($this->query);
 }
Example #23
0
/**
 * for retrocompatibility with old AdminTab, old index.php
 *
 * @return void
 */
function runAdminTab($tab, $ajaxMode = false)
{
    $ajaxMode = (bool) $ajaxMode;
    require_once _PS_ADMIN_DIR_ . '/init.php';
    $cookie = Context::getContext()->cookie;
    if (empty($tab) && !sizeof($_POST)) {
        $tab = 'AdminDashboard';
        $_POST['tab'] = $tab;
        $_POST['token'] = Tools::getAdminTokenLite($tab);
    }
    // $tab = $_REQUEST['tab'];
    if ($adminObj = checkingTab($tab)) {
        Context::getContext()->controller = $adminObj;
        // init is different for new tabs (AdminController) and old tabs (AdminTab)
        if ($adminObj instanceof AdminController) {
            if ($ajaxMode) {
                $adminObj->ajax = true;
            }
            $adminObj->path = dirname($_SERVER["PHP_SELF"]);
            $adminObj->run();
        } else {
            if (!$ajaxMode) {
                require_once _PS_ADMIN_DIR_ . '/header.inc.php';
            }
            $isoUser = Context::getContext()->language->id;
            $tabs = array();
            $tabs = Tab::recursiveTab($adminObj->id, $tabs);
            $tabs = array_reverse($tabs);
            $bread = '';
            foreach ($tabs as $key => $item) {
                $bread .= ' <img src="../img/admin/separator_breadcrumb.png" style="margin-right:5px" alt="&gt;" />';
                if (count($tabs) - 1 > $key) {
                    $bread .= '<a href="?tab=' . $item['class_name'] . '&token=' . Tools::getAdminToken($item['class_name'] . intval($item['id_tab']) . (int) Context::getContext()->employee->id) . '">';
                }
                $bread .= $item['name'];
                if (count($tabs) - 1 > $key) {
                    $bread .= '</a>';
                }
            }
            if (!$ajaxMode && Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL && Context::getContext()->controller->multishop_context != Shop::CONTEXT_ALL) {
                echo '<div class="multishop_info">';
                if (Shop::getContext() == Shop::CONTEXT_GROUP) {
                    $shop_group = new ShopGroup((int) Shop::getContextShopGroupID());
                    printf(Translate::getAdminTranslation('You are configuring your store for group shop %s'), '<b>' . $shop_group->name . '</b>');
                } elseif (Shop::getContext() == Shop::CONTEXT_SHOP) {
                    printf(Translate::getAdminTranslation('You are configuring your store for shop %s'), '<b>' . Context::getContext()->shop->name . '</b>');
                }
                echo '</div>';
            }
            if (Validate::isLoadedObject($adminObj)) {
                if ($adminObj->checkToken()) {
                    if ($ajaxMode) {
                        // the differences with index.php is here
                        $adminObj->ajaxPreProcess();
                        $action = Tools::getValue('action');
                        // no need to use displayConf() here
                        if (!empty($action) && method_exists($adminObj, 'ajaxProcess' . Tools::toCamelCase($action))) {
                            $adminObj->{'ajaxProcess' . Tools::toCamelCase($action)}();
                        } else {
                            $adminObj->ajaxProcess();
                        }
                        // @TODO We should use a displayAjaxError
                        $adminObj->displayErrors();
                        if (!empty($action) && method_exists($adminObj, 'displayAjax' . Tools::toCamelCase($action))) {
                            $adminObj->{'displayAjax' . $action}();
                        } else {
                            $adminObj->displayAjax();
                        }
                    } else {
                        /* Filter memorization */
                        if (isset($_POST) && !empty($_POST) && isset($adminObj->table)) {
                            foreach ($_POST as $key => $value) {
                                if (is_array($adminObj->table)) {
                                    foreach ($adminObj->table as $table) {
                                        if (strncmp($key, $table . 'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
                                            $cookie->{$key} = !is_array($value) ? $value : serialize($value);
                                        }
                                    }
                                } elseif (strncmp($key, $adminObj->table . 'Filter_', 7) === 0 || strncmp($key, 'submitFilter', 12) === 0) {
                                    $cookie->{$key} = !is_array($value) ? $value : serialize($value);
                                }
                            }
                        }
                        if (isset($_GET) && !empty($_GET) && isset($adminObj->table)) {
                            foreach ($_GET as $key => $value) {
                                if (is_array($adminObj->table)) {
                                    foreach ($adminObj->table as $table) {
                                        if (strncmp($key, $table . 'OrderBy', 7) === 0 || strncmp($key, $table . 'Orderway', 8) === 0) {
                                            $cookie->{$key} = $value;
                                        }
                                    }
                                } elseif (strncmp($key, $adminObj->table . 'OrderBy', 7) === 0 || strncmp($key, $adminObj->table . 'Orderway', 12) === 0) {
                                    $cookie->{$key} = $value;
                                }
                            }
                        }
                        $adminObj->displayConf();
                        $adminObj->postProcess();
                        $adminObj->displayErrors();
                        $adminObj->display();
                        include _PS_ADMIN_DIR_ . '/footer.inc.php';
                    }
                } else {
                    if ($ajaxMode) {
                        // If this is an XSS attempt, then we should only display a simple, secure page
                        if (ob_get_level() && ob_get_length() > 0) {
                            ob_clean();
                        }
                        // ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
                        $url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}' . $adminObj->token . '$2', $_SERVER['REQUEST_URI']);
                        if (false === strpos($url, '?token=') && false === strpos($url, '&token=')) {
                            $url .= '&token=' . $adminObj->token;
                        }
                        // we can display the correct url
                        // die(Tools::jsonEncode(array(Translate::getAdminTranslation('Invalid security token'),$url)));
                        die(Tools::jsonEncode(Translate::getAdminTranslation('Invalid security token')));
                    } else {
                        // If this is an XSS attempt, then we should only display a simple, secure page
                        if (ob_get_level() && ob_get_length() > 0) {
                            ob_clean();
                        }
                        // ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
                        $url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}' . $adminObj->token . '$2', $_SERVER['REQUEST_URI']);
                        if (false === strpos($url, '?token=') && false === strpos($url, '&token=')) {
                            $url .= '&token=' . $adminObj->token;
                        }
                        $message = Translate::getAdminTranslation('Invalid security token');
                        echo '<html><head><title>' . $message . '</title></head><body style="font-family:Arial,Verdana,Helvetica,sans-serif;background-color:#EC8686">
							<div style="background-color:#FAE2E3;border:1px solid #000000;color:#383838;font-weight:700;line-height:20px;margin:0 0 10px;padding:10px 15px;width:500px">
								<img src="../img/admin/error2.png" style="margin:-4px 5px 0 0;vertical-align:middle">
								' . $message . '
							</div>';
                        echo '<a href="' . htmlentities($url) . '" method="get" style="float:left;margin:10px">
								<input type="button" value="' . Tools::htmlentitiesUTF8(Translate::getAdminTranslation('I understand the risks and I really want to display this page')) . '" style="height:30px;margin-top:5px" />
							</a>
							<a href="index.php" method="get" style="float:left;margin:10px">
								<input type="button" value="' . Tools::htmlentitiesUTF8(Translate::getAdminTranslation('Take me out of here!')) . '" style="height:40px" />
							</a>
						</body></html>';
                        die;
                    }
                }
            }
        }
    }
}
    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        $profiles = Profile::getProfiles((int) $cookie->id_lang);
        echo '<script type="text/javascript" src="' . _PS_JS_DIR_ . '/jquery/jquery-colorpicker.js"></script>
		 	 <script type="text/javascript">
				var employeePage = true;
		 	 </script>


		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . ((int) $this->tabAccess['view'] ? '' : '&updateemployee&id_employee=' . (int) $obj->id) . '" method="post" enctype="multipart/form-data" autocomplete="off">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
		' . ((int) $this->tabAccess['view'] ? '' : '<input type="hidden" name="back" value="' . $currentIndex . '&token=' . $this->token . '&updateemployee&id_employee=' . (int) $obj->id . '" />') . '
			<fieldset class="width3"><legend><img src="../img/admin/nav-user.gif" />' . $this->l('Employees') . '</legend>
				<label>' . $this->l('Last name:') . ' </label>
				<div class="margin-form">
					<input type="text" size="33" name="lastname" value="' . htmlentities($this->getFieldValue($obj, 'lastname'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
				</div>
				<label>' . $this->l('First name:') . ' </label>
				<div class="margin-form">
					<input type="text" size="33" name="firstname" value="' . htmlentities($this->getFieldValue($obj, 'firstname'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
				</div>
				<label>' . $this->l('Password:'******' </label>
				<div class="margin-form">
					<input type="password" size="33" name="passwd" value="" /> <sup>*</sup>
					<p>' . ($obj->id ? $this->l('Leave blank if you do not want to change your password') : $this->l('Min. 8 characters; use only letters, numbers or') . ' -_') . '</p>
				</div>
				<label>' . $this->l('E-mail address:') . ' </label>
				<div class="margin-form">
					<input type="text" size="33" name="email" value="' . htmlentities($this->getFieldValue($obj, 'email'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
				</div><div class="clear">&nbsp;</div>
				<label>' . $this->l('Back office color:') . ' </label>
				<div class="margin-form">';
        // Note : width= fix Firefox 4 display bug related to colorpicker librarie
        echo '<input type="color" width="50px" data-hex="true" class="color mColorPickerInput" name="bo_color" value="' . htmlentities($this->getFieldValue($obj, 'bo_color'), ENT_COMPAT, 'UTF-8') . '" />
					<p>' . $this->l('Back office background will be displayed in this color. HTML colors only (e.g.,') . ' "lightblue", "#CC6600")</p>
				</div><div class="clear">&nbsp;</div>
				<label>' . $this->l('Language:') . ' </label>
				<div class="margin-form">
					<select name="id_lang">';
        foreach (Language::getLanguages() as $lang) {
            echo '		<option value="' . (int) $lang['id_lang'] . '" ' . ($this->getFieldValue($obj, 'id_lang') == $lang['id_lang'] ? 'selected="selected"' : '') . '>' . Tools::htmlentitiesUTF8($lang['name']) . '</option>';
        }
        echo '		</select> <sup>*</sup>
				</div><div class="clear">&nbsp;</div>
				<label>' . $this->l('Theme:') . ' </label>
				<div class="margin-form">
					<select name="bo_theme">';
        $path = dirname(__FILE__) . '/../themes/';
        foreach (scandir($path) as $theme) {
            if ($theme[0] != '.' and is_dir($path . $theme) and file_exists($path . $theme . '/admin.css')) {
                echo '	<option value="' . Tools::htmlentitiesUTF8($theme) . '" ' . ($this->getFieldValue($obj, 'bo_theme') == $theme ? 'selected="selected"' : '') . '>' . Tools::htmlentitiesUTF8($theme) . '</option>';
            }
        }
        echo '		</select> <sup>*</sup>
				</div>';
        if ((int) $this->tabAccess['edit']) {
            echo '<div class="clear">&nbsp;</div>
				<label>' . $this->l('UI mode:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="bo_uimode" id="uimode_on" value="hover" ' . ($this->getFieldValue($obj, 'bo_uimode') == 'hover' ? 'checked="checked" ' : '') . '/>
					<label class="t" for="uimode_on">' . $this->l('Hover on tabs') . '</label>
					<input type="radio" name="bo_uimode" id="uimode_off" value="click" ' . ($this->getFieldValue($obj, 'bo_uimode') == 'click' ? 'checked="checked" ' : '') . '/>
					<label class="t" for="uimode_off">' . $this->l('Click on tabs') . '</label>
				</div><div class="clear">&nbsp;</div>
				<label>' . $this->l('Show screencast:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="bo_show_screencast" id="bo_show_screencast_on" value="1" ' . ($this->getFieldValue($obj, 'bo_show_screencast') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
					<input type="radio" name="bo_show_screencast" id="bo_show_screencast_off" value="0" ' . (!$this->getFieldValue($obj, 'bo_show_screencast') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
					<p>' . $this->l('Show the welcome video on the dashbord of the back office') . '</p>
				</div>
				<label>' . $this->l('Status:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
					<input type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
					<p>' . $this->l('Allow or disallow this employee to log into this Back Office') . '</p>
				</div>
				<label>' . $this->l('Profile:') . ' </label>
				<div class="margin-form">
					<select name="id_profile">
						<option value="">' . $this->l('-- Choose --') . '</option>';
            foreach ($profiles as $profile) {
                echo '<option value="' . $profile['id_profile'] . '"' . ($profile['id_profile'] === $this->getFieldValue($obj, 'id_profile') ? ' selected="selected"' : '') . '>' . $profile['name'] . '</option>';
            }
            echo '</select> <sup>*</sup>
				</div>';
        }
        echo '<div class="clear">&nbsp;</div>
				<center>
					<input type="submit" value="' . $this->l('   Save   ') . '" name="submitAdd' . $this->table . '" class="button" />
				</center><div class="clear">&nbsp;</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</fieldset>
		</form>';
    }
Example #25
0
    protected function _generateConfigXml()
    {
        $xml = '<?xml version="1.0" encoding="UTF-8" ?>
<module>
	<name>' . $this->name . '</name>
	<displayName><![CDATA[' . Tools::htmlentitiesUTF8($this->displayName) . ']]></displayName>
	<version><![CDATA[' . $this->version . ']]></version>
	<description><![CDATA[' . Tools::htmlentitiesUTF8($this->description) . ']]></description>
	<author><![CDATA[' . Tools::htmlentitiesUTF8($this->author) . ']]></author>
	<tab><![CDATA[' . Tools::htmlentitiesUTF8($this->tab) . ']]></tab>' . (isset($this->confirmUninstall) ? "\n\t" . '<confirmUninstall>' . $this->confirmUninstall . '</confirmUninstall>' : '') . '
	<is_configurable>' . (int) method_exists($this, 'getContent') . '</is_configurable>
	<need_instance>' . (int) $this->need_instance . '</need_instance>' . (isset($this->limited_countries) ? "\n\t" . '<limited_countries>' . (sizeof($this->limited_countries) == 1 ? $this->limited_countries[0] : '') . '</limited_countries>' : '') . '
</module>';
        if (is_writable(_PS_MODULE_DIR_ . $this->name . '/')) {
            file_put_contents(_PS_MODULE_DIR_ . $this->name . '/config.xml', $xml);
        }
    }
Example #26
0
    private function _displayForm()
    {
        $this->_html .= '<form action="' . Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset>
			<legend><img src="../img/admin/contact.gif" />' . $this->l('Contact details') . '</legend>
				<table border="0" width="500" cellpadding="0" cellspacing="0" id="form">
					<tr><td colspan="2">' . $this->l('Please specify the name and address to which customers must send their check.') . '.<br /><br /></td></tr>
					<tr><td width="130" style="height: 35px;">' . $this->l('To the order of') . '</td><td><input type="text" name="name" value="' . Tools::htmlentitiesUTF8(Tools::getValue('name', $this->chequeName)) . '" style="width: 300px;" /></td></tr>
					<tr>
						<td width="130" style="vertical-align: top;">' . $this->l('Address') . '</td>
						<td><textarea name="address" rows="3" cols="53">' . Tools::htmlentitiesUTF8(Tools::getValue('address', $this->address)) . '</textarea></td>
					</tr>
					<tr><td colspan="2" align="center"><br /><input class="button" name="btnSubmit" value="' . $this->l('Update settings') . '" type="submit" /></td></tr>
				</table>
			</fieldset>
		</form>';
    }
Example #27
0
 /**
  * @param Product $product to get the product properties
  * @param array $combination to get particular properties from a declination
  * @param int $lang id lang to take all text in good language
  * @param Link $link to set the link of the product and its images.
  * @param Carrier $carrier not used now, but usable for next version, needed for calculate the shipping cost,
  * 		  But for now it's not sure enough.
  * @return array with good value for the XML.
  */
 private function preparedValues(Product $product, $combination, $lang, Link $link, Carrier $carrier)
 {
     $arr_return = array();
     $str_features = array();
     $model = array();
     $version = str_replace('.', '', _PS_VERSION_);
     // To build description and model tags.
     if (isset($combination['attributes'])) {
         foreach ($combination['attributes'] as $attribut) {
             $str_features[] = $attribut['group_name'] . ' : ' . $attribut['name'];
             $model[] = $attribut['name'];
         }
     }
     if (isset($combination['weight']) && (int) $combination['weight'] !== 0) {
         $str_features[] = 'weight : ' . $combination['weight'];
     } elseif ($product->weight !== 0) {
         $str_features[] = 'weight : ' . $product->weight;
     }
     $features = $product->getFrontFeatures($lang);
     foreach ($features as $feature) {
         $str_features[] = $feature['name'] . ' : ' . $feature['value'];
     }
     // Category tag
     $category = new Category((int) $product->id_category_default, $lang);
     $category_path = (isset($category->id) and $category->id) ? Tools::getFullPath((int) $category->id, $product->name[$lang]) : Tools::getFullPath((int) $product->id_category_default, $product->name[$lang]);
     $category_path = Configuration::get('PS_NAVIGATION_PIPE') != false && Configuration::get('PS_NAVIGATION_PIPE') !== '>' ? str_replace(Configuration::get('PS_NAVIGATION_PIPE'), '>', $category_path) : $category_path;
     // image tag
     $id_image = isset($combination['id_image']) ? $combination['id_image'] : 0;
     if ($id_image === 0 || $id_image < 0) {
         $image = $product->getCover((int) $product->id);
         $id_image = $image['id_image'];
     }
     $quantity = Product::getQuantity($product->id, isset($combination['id_combination']) ? $combination['id_combination'] : NULL);
     $condition = '';
     if (strlen((string) $version) < 2) {
         $version = (string) $version . '0';
     }
     if ((int) substr($version, 0, 2) >= 14) {
         $condition = $product->condition === 'new' ? 0 : 1;
     }
     $price = $product->getPrice(true, isset($combination['id_combination']) ? $combination['id_combination'] : NULL, 2);
     $upc_ean = strlen((string) $product->ean13) == 13 ? $product->ean13 : '';
     $arr_return['product_url'] = $link->getProductLink((int) $product->id, $product->link_rewrite[$lang], $product->ean13, $lang);
     $arr_return['designation'] = Tools::htmlentitiesUTF8($product->name[$lang] . ' ' . Manufacturer::getNameById($product->id_manufacturer) . ' ' . implode(' ', $model));
     $arr_return['price'] = $price;
     $arr_return['category'] = Tools::htmlentitiesUTF8(strip_tags($category_path));
     if (substr(_PS_VERSION_, 0, 3) == '1.3') {
         if (!Configuration::get('PS_SHOP_DOMAIN')) {
             Configuration::updateValue('PS_SHOP_DOMAIN', $_SERVER['HTTP_HOST']);
         }
         $prefix = 'http://' . Configuration::get('PS_SHOP_DOMAIN') . '/';
         $arr_return['image_url'] = $prefix . $link->getImageLink('', $product->id . '-' . $id_image, 'large');
     } else {
         $arr_return['image_url'] = $link->getImageLink($product->link_rewrite[$lang], $product->id . '-' . $id_image, 'large');
     }
     // Must description added since Twenga-module v1.1
     $arr_return['description'] = is_array($product->description) ? strip_tags($product->description[$lang]) : strip_tags($product->description);
     $arr_return['description'] = trim($arr_return['description'] . ' ' . strip_tags(implode(', ', $str_features)));
     $arr_return['description'] = Tools::htmlentitiesUTF8($arr_return['description']);
     $arr_return['brand'] = Manufacturer::getNameById($product->id_manufacturer);
     $arr_return['merchant_id'] = $product->id;
     $arr_return['manufacturer_id'] = $product->id_manufacturer;
     $arr_return['shipping_cost'] = 'NC';
     $arr_return['in_stock'] = $quantity > 0 ? 'Y' : 'N';
     $arr_return['stock_detail'] = $quantity;
     $arr_return['condition'] = $condition;
     $arr_return['upc_ean'] = $upc_ean;
     $arr_return['eco_tax'] = $product->ecotax;
     // for prestashop 1.4 and previous version these fields are not managed.
     // So default values are set.
     $arr_return['product_type'] = '1';
     $arr_return['isbn'] = '';
     return $arr_return;
 }
Example #28
0
    public function getContent()
    {
        $html = '<h2>' . $this->l('Be really careful with this tool - There is no possible rollback!') . '</h2>';
        if (Tools::isSubmit('submitCheckAndFix')) {
            $logs = self::checkAndFix();
            if (count($logs)) {
                $conf = $this->l('The following queries successfuly fixed broken data:') . '<br /><ul>';
                foreach ($logs as $query => $entries) {
                    $conf .= '<li>' . Tools::htmlentitiesUTF8($query) . '<br />' . sprintf($this->l('%d line(s)'), $entries) . '</li>';
                }
                $conf .= '</ul>';
            } else {
                $conf = $this->l('Nothing that need to be fixed');
            }
            $html .= $this->displayConfirmation($conf);
        } elseif (Tools::isSubmit('submitCleanAndOptimize')) {
            $logs = self::cleanAndOptimize();
            if (count($logs)) {
                $conf = $this->l('The following queries successfuly cleaned your database:') . '<br /><ul>';
                foreach ($logs as $query => $entries) {
                    $conf .= '<li>' . Tools::htmlentitiesUTF8($query) . '<br />' . sprintf($this->l('%d line(s)'), $entries) . '</li>';
                }
                $conf .= '</ul>';
            } else {
                $conf = $this->l('Nothing that need to be cleaned');
            }
            $html .= $this->displayConfirmation($conf);
        } elseif (Tools::getValue('submitTruncateCatalog') && Tools::getValue('checkTruncateCatalog')) {
            self::truncate('catalog');
            $html .= $this->displayConfirmation($this->l('Catalog truncated'));
        } elseif (Tools::getValue('submitTruncateSales') && Tools::getValue('checkTruncateSales')) {
            self::truncate('sales');
            $html .= $this->displayConfirmation($this->l('Orders and customers truncated'));
        }
        $html .= '
		<script type="text/javascript">
			$(document).ready(function(){
				$("#submitTruncateCatalog").click(function(){
					if ($(\'#checkTruncateCatalog_on\').attr(\'checked\') != "checked")
					{
						alert(\'' . addslashes(html_entity_decode($this->l('Please read the disclaimer and click "Yes" above'))) . '\');
						return false;
					}
					if (confirm(\'' . addslashes(html_entity_decode($this->l('Are you sure that you want to delete all catalog data?'))) . '\'))
						return true;
					return false;
				});
				$("#submitTruncateSales").click(function(){
					if ($(\'#checkTruncateSales_on\').attr(\'checked\') != "checked")
					{
						alert(\'' . addslashes(html_entity_decode($this->l('Please read the disclaimer and click "Yes" above'))) . '\');
						return false;
					}
					if (confirm(\'' . addslashes(html_entity_decode($this->l('Are you sure that you want to delete all sales data?'))) . '\'))
						return true;
					return false;
				});
			});
		</script>';
        return $html . $this->renderForm();
    }
Example #29
0
 public function init()
 {
     /*
      * Globals are DEPRECATED as of version 1.5.
      * Use the Context to access objects instead.
      * Example: $this->context->cart
      */
     global $useSSL, $cookie, $smarty, $cart, $iso, $defaultCountry, $protocol_link, $protocol_content, $link, $css_files, $js_files, $currency;
     if (self::$initialized) {
         return;
     }
     self::$initialized = true;
     parent::init();
     // If current URL use SSL, set it true (used a lot for module redirect)
     if (Tools::usingSecureMode()) {
         $useSSL = true;
     }
     // For compatibility with globals, DEPRECATED as of version 1.5
     $css_files = $this->css_files;
     $js_files = $this->js_files;
     // If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol
     if (Configuration::get('PS_SSL_ENABLED') && $_SERVER['REQUEST_METHOD'] != 'POST' && $this->ssl != Tools::usingSecureMode()) {
         header('HTTP/1.1 301 Moved Permanently');
         header('Cache-Control: no-cache');
         if ($this->ssl) {
             header('Location: ' . Tools::getShopDomainSsl(true) . $_SERVER['REQUEST_URI']);
         } else {
             header('Location: ' . Tools::getShopDomain(true) . $_SERVER['REQUEST_URI']);
         }
         exit;
     }
     if ($this->ajax) {
         $this->display_header = false;
         $this->display_footer = false;
     }
     // if account created with the 2 steps register process, remove 'accoun_created' from cookie
     if (isset($this->context->cookie->account_created)) {
         $this->context->smarty->assign('account_created', 1);
         unset($this->context->cookie->account_created);
     }
     ob_start();
     // Init cookie language
     // @TODO This method must be moved into switchLanguage
     Tools::setCookieLanguage($this->context->cookie);
     $currency = Tools::setCurrency($this->context->cookie);
     $protocol_link = Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode() ? 'https://' : 'http://';
     $useSSL = isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode() ? true : false;
     $protocol_content = $useSSL ? 'https://' : 'http://';
     $link = new Link($protocol_link, $protocol_content);
     $this->context->link = $link;
     if ($id_cart = (int) $this->recoverCart()) {
         $this->context->cookie->id_cart = (int) $id_cart;
     }
     if ($this->auth && !$this->context->customer->isLogged($this->guestAllowed)) {
         Tools::redirect('index.php?controller=authentication' . ($this->authRedirection ? '&back=' . $this->authRedirection : ''));
     }
     /* Theme is missing */
     if (!is_dir(_PS_THEME_DIR_)) {
         die(sprintf(Tools::displayError('Current theme unavailable "%s". Please check your theme directory name and permissions.'), basename(rtrim(_PS_THEME_DIR_, '/\\'))));
     }
     if (Configuration::get('PS_GEOLOCATION_ENABLED')) {
         if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault)) {
             $this->context->country = $newDefault;
         }
     }
     if (isset($_GET['logout']) || $this->context->customer->logged && Customer::isBanned($this->context->customer->id)) {
         $this->context->customer->logout();
         Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null);
     } elseif (isset($_GET['mylogout'])) {
         $this->context->customer->mylogout();
         Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null);
     }
     /* Cart already exists */
     if ((int) $this->context->cookie->id_cart) {
         $cart = new Cart($this->context->cookie->id_cart);
         if ($cart->OrderExists()) {
             unset($this->context->cookie->id_cart, $cart, $this->context->cookie->checkedTOS);
             $this->context->cookie->check_cgv = false;
         } elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) && !in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) && $cart->nbProducts() && intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 && !FrontController::isInWhitelistForGeolocation() && !in_array($_SERVER['SERVER_NAME'], array('localhost', '127.0.0.1'))) {
             unset($this->context->cookie->id_cart, $cart);
         } elseif ($this->context->cookie->id_customer != $cart->id_customer || $this->context->cookie->id_lang != $cart->id_lang || $currency->id != $cart->id_currency) {
             if ($this->context->cookie->id_customer) {
                 $cart->id_customer = (int) $this->context->cookie->id_customer;
             }
             $cart->id_lang = (int) $this->context->cookie->id_lang;
             $cart->id_currency = (int) $currency->id;
             $cart->update();
         }
         /* Select an address if not set */
         if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 || !isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $this->context->cookie->id_customer) {
             $to_update = false;
             if (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0) {
                 $to_update = true;
                 $cart->id_address_delivery = (int) Address::getFirstCustomerAddressId($cart->id_customer);
             }
             if (!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) {
                 $to_update = true;
                 $cart->id_address_invoice = (int) Address::getFirstCustomerAddressId($cart->id_customer);
             }
             if ($to_update) {
                 $cart->update();
             }
         }
     }
     if (!isset($cart) || !$cart->id) {
         $cart = new Cart();
         $cart->id_lang = (int) $this->context->cookie->id_lang;
         $cart->id_currency = (int) $this->context->cookie->id_currency;
         $cart->id_guest = (int) $this->context->cookie->id_guest;
         $cart->id_shop_group = (int) $this->context->shop->id_shop_group;
         $cart->id_shop = $this->context->shop->id;
         if ($this->context->cookie->id_customer) {
             $cart->id_customer = (int) $this->context->cookie->id_customer;
             $cart->id_address_delivery = (int) Address::getFirstCustomerAddressId($cart->id_customer);
             $cart->id_address_invoice = $cart->id_address_delivery;
         } else {
             $cart->id_address_delivery = 0;
             $cart->id_address_invoice = 0;
         }
         // Needed if the merchant want to give a free product to every visitors
         $this->context->cart = $cart;
         CartRule::autoAddToCart($this->context);
     }
     /* get page name to display it in body id */
     // Are we in a payment module
     $module_name = '';
     if (Validate::isModuleName(Tools::getValue('module'))) {
         $module_name = Tools::getValue('module');
     }
     if (!empty($this->page_name)) {
         $page_name = $this->page_name;
     } elseif (!empty($this->php_self)) {
         $page_name = $this->php_self;
     } elseif (Tools::getValue('fc') == 'module' && $module_name != '' && Module::getInstanceByName($module_name) instanceof PaymentModule) {
         $page_name = 'module-payment-submit';
     } elseif (preg_match('#^' . preg_quote($this->context->shop->physical_uri, '#') . 'modules/([a-zA-Z0-9_-]+?)/(.*)$#', $_SERVER['REQUEST_URI'], $m)) {
         $page_name = 'module-' . $m[1] . '-' . str_replace(array('.php', '/'), array('', '-'), $m[2]);
     } else {
         $page_name = Dispatcher::getInstance()->getController();
         $page_name = preg_match('/^[0-9]/', $page_name) ? 'page_' . $page_name : $page_name;
     }
     $this->context->smarty->assign(Meta::getMetaTags($this->context->language->id, $page_name));
     $this->context->smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
     /* Breadcrumb */
     $navigationPipe = Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>';
     $this->context->smarty->assign('navigationPipe', $navigationPipe);
     // Automatically redirect to the canonical URL if needed
     if (!empty($this->php_self) && !Tools::getValue('ajax')) {
         $this->canonicalRedirection($this->context->link->getPageLink($this->php_self, $this->ssl, $this->context->language->id));
     }
     Product::initPricesComputation();
     $display_tax_label = $this->context->country->display_tax_label;
     if (isset($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) && $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) {
         $infos = Address::getCountryAndState((int) $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
         $country = new Country((int) $infos['id_country']);
         $this->context->country = $country;
         if (Validate::isLoadedObject($country)) {
             $display_tax_label = $country->display_tax_label;
         }
     }
     $languages = Language::getLanguages(true, $this->context->shop->id);
     $meta_language = array();
     foreach ($languages as $lang) {
         $meta_language[] = $lang['iso_code'];
     }
     $this->context->smarty->assign(array('mobile_device' => $this->context->getMobileDevice(), 'link' => $link, 'cart' => $cart, 'currency' => $currency, 'cookie' => $this->context->cookie, 'page_name' => $page_name, 'hide_left_column' => !$this->display_column_left, 'hide_right_column' => !$this->display_column_right, 'base_dir' => _PS_BASE_URL_ . __PS_BASE_URI__, 'base_dir_ssl' => $protocol_link . Tools::getShopDomainSsl() . __PS_BASE_URI__, 'content_dir' => $protocol_content . Tools::getHttpHost() . __PS_BASE_URI__, 'base_uri' => $protocol_content . Tools::getHttpHost() . __PS_BASE_URI__ . (!Configuration::get('PS_REWRITING_SETTINGS') ? 'index.php' : ''), 'tpl_dir' => _PS_THEME_DIR_, 'modules_dir' => _MODULE_DIR_, 'mail_dir' => _MAIL_DIR_, 'lang_iso' => $this->context->language->iso_code, 'come_from' => Tools::getHttpHost(true, true) . Tools::htmlentitiesUTF8(str_replace(array('\'', '\\'), '', urldecode($_SERVER['REQUEST_URI']))), 'cart_qties' => (int) $cart->nbProducts(), 'currencies' => Currency::getCurrencies(), 'languages' => $languages, 'meta_language' => implode('-', $meta_language), 'priceDisplay' => Product::getTaxCalculationMethod(), 'add_prod_display' => (int) Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'shop_name' => Configuration::get('PS_SHOP_NAME'), 'roundMode' => (int) Configuration::get('PS_PRICE_ROUND_MODE'), 'use_taxes' => (int) Configuration::get('PS_TAX'), 'show_taxes' => (int) (Configuration::get('PS_TAX_DISPLAY') == 1 && (int) Configuration::get('PS_TAX')), 'display_tax_label' => (bool) $display_tax_label, 'vat_management' => (int) Configuration::get('VATNUMBER_MANAGEMENT'), 'opc' => (bool) Configuration::get('PS_ORDER_PROCESS_TYPE'), 'PS_CATALOG_MODE' => (bool) Configuration::get('PS_CATALOG_MODE') || !(bool) Group::getCurrent()->show_prices, 'b2b_enable' => (bool) Configuration::get('PS_B2B_ENABLE'), 'request' => $link->getPaginationLink(false, false, false, true), 'PS_STOCK_MANAGEMENT' => Configuration::get('PS_STOCK_MANAGEMENT')));
     // Add the tpl files directory for mobile
     if ($this->context->getMobileDevice() != false) {
         $this->context->smarty->assign(array('tpl_mobile_uri' => _PS_THEME_MOBILE_DIR_));
     }
     // Deprecated
     $this->context->smarty->assign(array('id_currency_cookie' => (int) $currency->id, 'logged' => $this->context->customer->isLogged(), 'customerName' => $this->context->customer->logged ? $this->context->cookie->customer_firstname . ' ' . $this->context->cookie->customer_lastname : false));
     $assign_array = array('img_ps_dir' => _PS_IMG_, 'img_cat_dir' => _THEME_CAT_DIR_, 'img_lang_dir' => _THEME_LANG_DIR_, 'img_prod_dir' => _THEME_PROD_DIR_, 'img_manu_dir' => _THEME_MANU_DIR_, 'img_sup_dir' => _THEME_SUP_DIR_, 'img_ship_dir' => _THEME_SHIP_DIR_, 'img_store_dir' => _THEME_STORE_DIR_, 'img_col_dir' => _THEME_COL_DIR_, 'img_dir' => _THEME_IMG_DIR_, 'css_dir' => _THEME_CSS_DIR_, 'js_dir' => _THEME_JS_DIR_, 'pic_dir' => _THEME_PROD_PIC_DIR_);
     // Add the images directory for mobile
     if ($this->context->getMobileDevice() != false) {
         $assign_array['img_mobile_dir'] = _THEME_MOBILE_IMG_DIR_;
     }
     // Add the CSS directory for mobile
     if ($this->context->getMobileDevice() != false) {
         $assign_array['css_mobile_dir'] = _THEME_MOBILE_CSS_DIR_;
     }
     foreach ($assign_array as $assign_key => $assign_value) {
         if (substr($assign_value, 0, 1) == '/' || $protocol_content == 'https://') {
             $this->context->smarty->assign($assign_key, $protocol_content . Tools::getMediaServer($assign_value) . $assign_value);
         } else {
             $this->context->smarty->assign($assign_key, $assign_value);
         }
     }
     /*
      * These shortcuts are DEPRECATED as of version 1.5.
      * Use the Context to access objects instead.
      * Example: $this->context->cart
      */
     self::$cookie = $this->context->cookie;
     self::$cart = $cart;
     self::$smarty = $this->context->smarty;
     self::$link = $link;
     $defaultCountry = $this->context->country;
     $this->displayMaintenancePage();
     if ($this->restrictedCountry) {
         $this->displayRestrictedCountryPage();
     }
     if (Tools::isSubmit('live_edit') && !$this->checkLiveEditAccess()) {
         Tools::redirect('index.php?controller=404');
     }
     $this->iso = $iso;
     $this->context->cart = $cart;
     $this->context->currency = $currency;
 }
Example #30
0
    public function processExportTheme()
    {
        if (Tools::isSubmit('name')) {
            if ($this->checkPostedDatas()) {
                $filename = Tools::htmlentitiesUTF8($_FILES['documentation']['name']);
                $name = Tools::htmlentitiesUTF8(Tools::getValue('documentationName'));
                $this->user_doc = array($name . '¤doc/' . $filename);
                $table = Db::getInstance()->executeS('
			SELECT name, width, height, products, categories, manufacturers, suppliers, scenes
			FROM `' . _DB_PREFIX_ . 'image_type`');
                $this->image_list = array();
                foreach ($table as $row) {
                    $this->image_list[] = $row['name'] . ';' . $row['width'] . ';' . $row['height'] . ';' . ($row['products'] == 1 ? 'true' : 'false') . ';' . ($row['categories'] == 1 ? 'true' : 'false') . ';' . ($row['manufacturers'] == 1 ? 'true' : 'false') . ';' . ($row['suppliers'] == 1 ? 'true' : 'false') . ';' . ($row['scenes'] == 1 ? 'true' : 'false');
                }
                $id_shop = Db::getInstance()->getValue('SELECT `id_shop` FROM `' . _DB_PREFIX_ . 'shop` WHERE `id_theme` = ' . (int) Tools::getValue('id_theme_export'));
                // Select the list of module for this shop
                $this->module_list = Db::getInstance()->executeS('
				SELECT m.`id_module`, m.`name`, m.`active`, ms.`id_shop`
				FROM `' . _DB_PREFIX_ . 'module` m
				LEFT JOIN `' . _DB_PREFIX_ . 'module_shop` ms On (m.`id_module` = ms.`id_module`)
				WHERE ms.`id_shop` = ' . (int) $id_shop . '
			');
                // Select the list of hook for this shop
                $this->hook_list = Db::getInstance()->executeS('
				SELECT h.`id_hook`, h.`name` as name_hook, hm.`position`, hm.`id_module`, m.`name` as name_module, GROUP_CONCAT(hme.`file_name`, ",") as exceptions
				FROM `' . _DB_PREFIX_ . 'hook` h
				LEFT JOIN `' . _DB_PREFIX_ . 'hook_module` hm ON hm.`id_hook` = h.`id_hook`
				LEFT JOIN `' . _DB_PREFIX_ . 'module` m ON hm.`id_module` = m.`id_module`
				LEFT OUTER JOIN `' . _DB_PREFIX_ . 'hook_module_exceptions` hme ON (hme.`id_module` = hm.`id_module` AND hme.`id_hook` = h.`id_hook`)
				WHERE hm.`id_shop` = ' . (int) $id_shop . '
				GROUP BY `id_module`, `id_hook`
				ORDER BY `name_module`
			');
                $this->native_modules = $this->getNativeModule();
                foreach ($this->hook_list as &$row) {
                    $row['exceptions'] = trim(preg_replace('/(,,+)/', ',', $row['exceptions']), ',');
                }
                $this->to_install = array();
                $this->to_enable = array();
                $this->to_hook = array();
                foreach ($this->module_list as $array) {
                    if (!self::checkParentClass($array['name'])) {
                        continue;
                    }
                    if (in_array($array['name'], $this->native_modules)) {
                        if ($array['active'] == 1) {
                            $this->to_enable[] = $array['name'];
                        } else {
                            $this->to_disable[] = $array['name'];
                        }
                    } elseif ($array['active'] == 1) {
                        $this->to_install[] = $array['name'];
                    }
                }
                foreach ($this->native_modules as $str) {
                    $flag = 0;
                    if (!self::checkParentClass($str)) {
                        continue;
                    }
                    foreach ($this->module_list as $tmp) {
                        if (in_array($str, $tmp)) {
                            $flag = 1;
                            break;
                        }
                    }
                    if ($flag == 0) {
                        $this->to_disable[] = $str;
                    }
                }
                foreach ($_POST as $key => $value) {
                    if (strncmp($key, 'modulesToExport_module', strlen('modulesToExport_module')) == 0) {
                        $this->to_export[] = $value;
                    }
                }
                if ($this->to_install) {
                    foreach ($this->to_install as $string) {
                        foreach ($this->hook_list as $tmp) {
                            if ($tmp['name_module'] == $string) {
                                $this->to_hook[] = $string . ';' . $tmp['name_hook'] . ';' . $tmp['position'] . ';' . $tmp['exceptions'];
                            }
                        }
                    }
                }
                if ($this->to_enable) {
                    foreach ($this->to_enable as $string) {
                        foreach ($this->hook_list as $tmp) {
                            if ($tmp['name_module'] == $string) {
                                $this->to_hook[] = $string . ';' . $tmp['name_hook'] . ';' . $tmp['position'] . ';' . $tmp['exceptions'];
                            }
                        }
                    }
                }
                $theme_to_export = new Theme((int) Tools::getValue('id_theme_export'));
                $metas = $theme_to_export->getMetas();
                $this->generateXML($theme_to_export, $metas);
                $this->generateArchive();
            } else {
                $this->display = 'exporttheme';
            }
        } else {
            $this->display = 'exporttheme';
        }
    }