Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
vAugagneur
2013-04-29 16:21:51 +02:00
12 changed files with 42 additions and 20 deletions
+6 -3
View File
@@ -1055,6 +1055,9 @@ class ValidateCore
{
return (bool)(is_string($name) && preg_match('/^[0-9a-zA-Z-_]*$/u', $name));
}
}
public static function isPrestaShopVersion($version)
{
return (preg_match('/^[0-1]\.[0-9]{1,2}(\.[0-9]{1,2}){0,2}$/', $version) && ip2long($version));
}
}
+1 -1
View File
@@ -209,7 +209,7 @@ class AdminCartsControllerCore extends AdminController
if (!$this->context->cart->id_customer)
$this->context->cart->id_customer = $id_customer;
if ($this->context->cart->OrderExists())
if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists())
return;
if (!$this->context->cart->secure_key)
$this->context->cart->secure_key = $this->context->customer->secure_key;
+9 -10
View File
@@ -475,19 +475,21 @@ class AdminLanguagesControllerCore extends AdminController
public function ajaxProcessCheckLangPack()
{
$this->json = true;
if (empty($_GET['iso_lang']))
if (!Tools::getValue('iso_lang') || !Validate::isLanguageIsoCode(Tools::getValue('iso_lang')))
{
$this->status = 'error';
$this->errors[] = '[TECHNICAL ERROR] iso_lang not set or empty';
$this->errors[] = $this->l('Iso code is not valid');
return;
}
if (empty($_GET['ps_version']))
if (!Tools::getValue('ps_version') || !Validate::isPrestaShopVersion(Tools::getValue('ps_version')))
{
$this->status = 'error';
$this->errors[] = '[TECHNICAL ERROR] ps_version not set or empty';
$this->errors[] = $this->l('Technical Error: ps_version is not valid');
return;
}
// Get all iso code available
if($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.(string)$_GET['ps_version'].'&iso_lang='.(string)$_GET['iso_lang']))
if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.Tools::getValue('ps_version').'&iso_lang='.Tools::getValue('iso_lang')))
{
$result = Tools::jsonDecode($lang_packs);
if ($lang_packs !== '' && $result && !isset($result->error))
@@ -498,16 +500,13 @@ class AdminLanguagesControllerCore extends AdminController
else
{
$this->status = 'error';
$msg = $this->l('Wrong ISO code, or the selected language pack is unavailable.');
if ($result)
$msg = $result->msg;
$this->errors[] = $msg;
$this->errors[] = $this->l('Wrong ISO code, or the selected language pack is unavailable.');
}
}
else
{
$this->status = 'error';
$this->errors[] = '[TECHNICAL ERROR] Server unreachable';
$this->errors[] = $this->l('Technical Error: translation server unreachable');
}
}
@@ -1454,6 +1454,8 @@ class AdminTranslationsControllerCore extends AdminController
$path = $arr_mail_path[$group_name];
if ($module_name)
$path = str_replace('{module}', $module_name, $path);
if (!file_exists($path) && !mkdir($path, 0777, true))
throw new PrestaShopException(sprintf(Tools::displayError('Directory "%s" cannot be created'), dirname($file_path)));
file_put_contents($path.$mail_name.'.'.$type_content, $content);
}
else
@@ -2453,6 +2455,9 @@ class AdminTranslationsControllerCore extends AdminController
protected function writeSubjectTranslationFile($sub, $path)
{
if (!Tools::file_exists_cache(dirname(path)))
if (!mkdir(dirname(path), 0700))
throw new PrestaShopException('Directory '.dirname(path).' cannot be created.');
if ($fd = @fopen($path, 'w'))
{
$tab = 'LANGMAIL';
+1 -1
View File
@@ -498,7 +498,7 @@ select optgroup option {
background: #FFBABA url(../img/admin/icon-cancel.png) no-repeat scroll 6px 6px;
border: 1px solid #CC0000;
color:#D8000C;
padding:20px;
padding:20px 40px;
position:fixed;
bottom:0;
width:100%;
+1 -1
View File
@@ -33,7 +33,7 @@
"link": "{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|addslashes|replace:'\\\'':'\''}",
"quantity": {$product.cart_quantity},
"priceByLine": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
"name": "{$product.name|html_entity_decode:2:'UTF-8'|escape:'htmlall'|truncate:15:'...':true}",
"name": "{$product.name|html_entity_decode:2:'UTF-8'|truncate:15:'...':true|escape:'htmlall'}",
"price": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}",
"price_float": "{$product.total}",
"idCombination": {if isset($product.attributes_small)}{$productAttributeId}{else}0{/if},
+1 -1
View File
@@ -100,7 +100,7 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
<li name="customization">
<div class="deleteCustomizableProduct" id="deleteCustomizableProduct_{$id_customization|intval}_{$product.id_product|intval}_{$product.id_product_attribute|intval}_{$product.id_address_delivery|intval}"><a class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete=1&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;token={$static_token}", true)}" rel="nofollow"> </a></div>
<span class="quantity-formated"><span class="quantity">{$customization.quantity}</span>x</span>{if isset($customization.datas.$CUSTOMIZE_TEXTFIELD.0)}
{$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"<br />":" "|truncate:28}
{$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|replace:"<br />":" "|truncate:28:'...'|escape:html:'UTF-8'}
{else}
{l s='Customization #%d:' sprintf=$id_customization|intval mod='blockcart'}
{/if}
@@ -38,6 +38,8 @@
$('#center_column').attr('id', 'old_center_column');
$('#old_center_column').after('<div id="center_column" class="' + $('#old_center_column').attr('class') + '">'+data+'</div>');
$('#old_center_column').hide();
// Button override
ajaxCart.overrideButtonsInThePage();
$("#instant_search_results a.close").click(function() {
$("#search_query_{$blocksearch_type}").val('');
return tryToCloseInstantSearch();
+13
View File
@@ -57,6 +57,19 @@ class BlockSupplier extends Module
return true;
}
public function uninstall()
{
if (!parent::uninstall())
return false;
/* remove the configuration variable */
$result = Configuration::deleteByName('SUPPLIER_DISPLAY_TEXT');
$result &= Configuration::deleteByName('SUPPLIER_DISPLAY_TEXT_NB');
$result &= Configuration::deleteByName('SUPPLIER_DISPLAY_FORM');
return $result;
}
function hookDisplayLeftColumn($params)
{
$id_lang = (int)Context::getContext()->language->id;
@@ -100,7 +100,7 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
<li name="customization">
<div class="deleteCustomizableProduct" id="deleteCustomizableProduct_{$id_customization|intval}_{$product.id_product|intval}_{$product.id_product_attribute|intval}_{$product.id_address_delivery|intval}"><a class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete=1&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;token={$static_token}", true)}" rel="nofollow"> </a></div>
<span class="quantity-formated"><span class="quantity">{$customization.quantity}</span>x</span>{if isset($customization.datas.$CUSTOMIZE_TEXTFIELD.0)}
{$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"<br />":" "|truncate:28}
{$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|replace:"<br />":" "|truncate:28:'...'|escape:html:'UTF-8'}
{else}
{l s='Customization #%d:' sprintf=$id_customization|intval mod='blockcart'}
{/if}
+1 -1
View File
@@ -118,7 +118,7 @@
<td class="price" id="total_shipping">{l s='Free Shipping!'}</td>
</tr>
{else}
{if $use_taxes}
{if $use_taxes && $total_shipping_tax_exc != $total_shipping}
{if $priceDisplay}
<tr class="cart_total_delivery" {if $shippingCost <= 0} style="display:none"{/if}>
<td colspan="5">{if $display_tax_label}{l s='Total shipping (tax excl.)'}{else}{l s='Total shipping'}{/if}</td>
+1 -1
View File
@@ -126,7 +126,7 @@
<td colspan="2" class="price" id="total_shipping">{l s='Free Shipping!'}</td>
</tr>
{else}
{if $use_taxes}
{if $use_taxes && $total_shipping_tax_exc != $total_shipping}
{if $priceDisplay}
<tr class="cart_total_delivery" {if $total_shipping_tax_exc <= 0} style="display:none;"{/if}>
<td colspan="5">{if $display_tax_label}{l s='Total shipping (tax excl.)'}{else}{l s='Total shipping'}{/if}</td>