Compare commits

..

2 Commits

Author SHA1 Message Date
Francois Gaillard 6c0867f314 // Release branch merged 2013-08-29 18:47:19 +02:00
Gregory Roussac 4bf773af65 Update .gitignore 2013-08-06 15:10:39 +02:00
391 changed files with 18142 additions and 107795 deletions
+19 -20
View File
@@ -2,45 +2,44 @@ README
====== ======
![PrestaShop](http://www.prestashop.com/images/banners/general/prestashop_728x90.png "PrestaShop") ![PrestaShop](http://www.prestashop.com/images/banners/general/prestashop_728x90.png "PrestaShop")
ABOUT PREPARATION
-------- --------
PrestaShop is a free and open-source e-commerce web application, committed to providing the best shopping cart experience for both merchants and consumers. To install PrestaShop, you need a remote web server or on your computer (MAMP), with access to a database like MySQL.
You'll need access to phpMyAdmin to create a database and to indicate the information in the database in the installer.
SERVER CONFIGURATION
--------
To install PrestaShop, you need a web server running PHP5 and any flavor of MySQL5 (MySQL, MariaDB, Percona Server...).
You will also need a database administration tool, such as phpMyAdmin, in order to create a database for PrestaShop.
We recommend the Apache or Nginx web servers.
If your host does not offer PHP5 by default, here are a few [explanations][2] about PHP5 or the .htaccess file for certain hosting services (1&1, Free, Lycos, OVH, Infomaniak, Amen, GoDaddy, etc).
If you want your online store ready to go, visit [http://www.prestabox.com][1]: it lets you create your online store in less than 10 minutes without any technical knowledge.
If you do not host and unable to create your store, we offer a turnkey store, which lets you create your online store in less than 10 minutes without any technical knowledge.
We invite you to visit: [http://www.prestabox.com][1]
INSTALLATION INSTALLATION
-------- --------
With your web browser, go to the root of your PrestaShop directory, and the installer will start. Follow the instructions until PrestaShop is installed. Simply go to your PrestaShop web directory and use installer :-)
If you have any PHP error, perhaps you don't have PHP5 or you need to activate it on your web host. See the page linked above. If you have any PHP error, perhaps you don't have PHP5 or you need to activate it on your web host.
If you don't find any solution to start the installer, please post on [the PrestaShop forums][3]. Please go to our forum to find pre-installation settings (PHP 5, htaccess) for certain hosting services (1&1, Free, Lycos, OVH, Infomaniak, Amen, GoDaddy, etc).
English webhost [specifics settings][2]
If you don't find any solution to launch installer, please post on [our forum][3]
There are always solutions for your issues ;-)
DOCUMENTATION DOCUMENTATION
-------- --------
The official PrestaShop documentation is available online [on its own website][4]. For any extra documentation (how-to), please read our [Online documentation][4]
FORUMS FORUMS
-------- --------
You can discuss, help and contribute with PrestaShop community on [the PrestaShop forums][5]. You can also discuss, help and contribute with PrestaShop community on [our forums][5]
Thank you for downloading and using PrestaShop e-commerce Open-source solution!
Thanks for downloading and using PrestaShop e-commerce Open-source solution!
[1]: http://www.prestabox.com [1]: http://www.prestabox.com
[2]: http://www.prestashop.com/forums/topic/2946-pre-installation-settings-php-5-htaccess-for-certain-hosting-services/ [2]: http://www.prestashop.com/forums/topic/2946-pre-installation-settings-php-5-htaccess-for-certain-hosting-services/
+92 -1
View File
@@ -26,12 +26,45 @@
define('_PS_ADMIN_DIR_', getcwd()); define('_PS_ADMIN_DIR_', getcwd());
include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Getting cookie or logout */ /* Getting cookie or logout */
require_once(_PS_ADMIN_DIR_.'/init.php'); require_once(_PS_ADMIN_DIR_.'/init.php');
$context = Context::getContext(); $context = Context::getContext();
if (Tools::isSubmit('changeParentUrl'))
echo '<script type="text/javascript">parent.parent.document.location.href = "'.addslashes(urldecode(Tools::getValue('changeParentUrl'))).'";</script>';
if (Tools::isSubmit('installBoughtModule'))
{
$file = false;
while ($file === false OR file_exists(_PS_MODULE_DIR_.$file))
$file = uniqid();
$file = _PS_MODULE_DIR_.$file.'.zip';
$sourceFile = 'http://addons.prestashop.com/iframe/getboughtfile.php?id_order_detail='.Tools::getValue('id_order_detail').'&token='.Tools::getValue('token');
if (!copy($sourceFile, $file))
{
if (!($content = file_get_contents($sourceFile)))
die(displayJavascriptAlert('Access denied: Please download your module directly from PrestaShop Addons website'));
elseif (!file_put_contents($file, $content))
die(displayJavascriptAlert('Local error: your module directory is not writable'));
}
$first6 = fread($fd = fopen($file, 'r'), 6);
if (!strncmp($first6, 'Error:', 6))
{
$displayJavascriptAlert = displayJavascriptAlert(fread($fd, 1024));
fclose($fd);
unlink($file);
die($displayJavascriptAlert);
}
fclose($fd);
if (!Tools::ZipExtract($file, _PS_MODULE_DIR_))
{
unlink($file);
die(displayJavascriptAlert('Cannot unzip file'));
}
unlink($file);
die(displayJavascriptAlert('Module copied to disk'));
}
if (Tools::isSubmit('ajaxReferrers')) if (Tools::isSubmit('ajaxReferrers'))
{ {
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php'); require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
@@ -68,6 +101,39 @@ if (Tools::isSubmit('ajaxProductPackItems'))
die('['.implode(',', $jsonArray).']'); die('['.implode(',', $jsonArray).']');
} }
if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
{
$states = Db::getInstance()->executeS('
SELECT s.id_state, s.name
FROM '._DB_PREFIX_.'state s
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
ORDER BY s.`name` ASC');
if (is_array($states) AND !empty($states))
{
$list = '';
if (Tools::getValue('no_empty') != true)
{
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
}
foreach ($states AS $state)
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
}
else
$list = 'false';
die($list);
}
if (Tools::getValue('form_language_id'))
{
if (!($context->cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
die ('Error while updating cookie.');
die ('Form language updated.');
}
if (Tools::isSubmit('submitTrackClickOnHelp')) if (Tools::isSubmit('submitTrackClickOnHelp'))
{ {
@@ -78,6 +144,15 @@ if (Tools::isSubmit('submitTrackClickOnHelp'))
HelpAccess::trackClick($label, $version); HelpAccess::trackClick($label, $version);
} }
if (Tools::isSubmit('toggleScreencast'))
{
if (Validate::isLoadedObject($context->employee))
{
$context->employee->bo_show_screencast = !$context->employee->bo_show_screencast;
$context->employee->update();
}
}
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent')) if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent'))
{ {
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context')); $children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
@@ -125,6 +200,17 @@ if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('
die(Tools::jsonEncode($output)); die(Tools::jsonEncode($output));
} }
/* Update attribute */
if (Tools::isSubmit('ajaxUpdateTaxRule'))
{
$id_tax_rule = Tools::getValue('id_tax_rule');
$tax_rules = new TaxRule((int)$id_tax_rule);
$output = array();
foreach ($tax_rules as $key => $result)
$output[$key] = $result;
die(Tools::jsonEncode($output));
}
if (Tools::isSubmit('getZones')) if (Tools::isSubmit('getZones'))
{ {
$zones = Zone::getZones(); $zones = Zone::getZones();
@@ -137,3 +223,8 @@ if (Tools::isSubmit('getZones'))
$array = array('hasError' => false, 'errors' => '', 'data' => $html); $array = array('hasError' => false, 'errors' => '', 'data' => $html);
die(Tools::jsonEncode($html)); die(Tools::jsonEncode($html));
} }
function displayJavascriptAlert($s)
{
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
}
-2
View File
@@ -30,7 +30,6 @@ select[disabled="disabled"], input[disabled="disabled"],textarea[disabled="disab
/*BUTTON*/ /*BUTTON*/
.button{ .button{
cursor: pointer;
background: #e3e3e3 url('../img/bg-button-degrade.png') repeat-x scroll left top; background: #e3e3e3 url('../img/bg-button-degrade.png') repeat-x scroll left top;
background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent; background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
background: -webkit-gradient(linear, center top ,center bottom, from(#F9F9F9), to(#E3E3E3)) repeat scroll 0 0 transparent; background: -webkit-gradient(linear, center top ,center bottom, from(#F9F9F9), to(#E3E3E3)) repeat scroll 0 0 transparent;
@@ -232,7 +231,6 @@ a.module_toggle_all{color: #268CCD;}
.toolbarBox .process-icon-save-and-preview { background-image: url('../img/process-icon-preview.png');} .toolbarBox .process-icon-save-and-preview { background-image: url('../img/process-icon-preview.png');}
.toolbarBox .process-icon-import { background-image: url('../img/process-icon-export-csv.png');} .toolbarBox .process-icon-import { background-image: url('../img/process-icon-export-csv.png');}
.toolbarBox .process-icon-export { background-image: url('../img/process-icon-export-csv.png');} .toolbarBox .process-icon-export { background-image: url('../img/process-icon-export-csv.png');}
.toolbarBox .process-icon-export-excel { background-image: url('../img/process-icon-export-csv.png');}
.toolbarBox .process-icon-export-all { background-image: url('../img/process-icon-export-csv-details.png');} .toolbarBox .process-icon-export-all { background-image: url('../img/process-icon-export-csv-details.png');}
.toolbarBox .process-icon-export-stock-state-quantities-csv { background-image: url('../img/process-icon-export-csv.png');} .toolbarBox .process-icon-export-stock-state-quantities-csv { background-image: url('../img/process-icon-export-csv.png');}
.toolbarBox .process-icon-export-stock-state-prices-csv { background-image: url('../img/process-icon-export-csv-details.png');} .toolbarBox .process-icon-export-stock-state-prices-csv { background-image: url('../img/process-icon-export-csv-details.png');}
@@ -66,8 +66,7 @@
{ {
if (msg) if (msg)
{ {
var infos = msg.infos.replace("\\'", "'").split('_'); var infos = msg.infos.split('_');
$('input[name=firstname]').val(infos[0]); $('input[name=firstname]').val(infos[0]);
$('input[name=lastname]').val(infos[1]); $('input[name=lastname]').val(infos[1]);
$('input[name=company]').val(infos[2]); $('input[name=company]').val(infos[2]);
@@ -48,11 +48,11 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("#group_discount_category").fancybox({ $("#group_discount_category").fancybox({
beforeLoad: function () { onStart: function () {
$('#group_discount_category_fancybox').show(); $('#group_discount_category_fancybox').show();
initFancyBox(); initFancyBox();
}, },
beforeClose: function () { onClosed: function () {
$('#group_discount_category_fancybox').hide(); $('#group_discount_category_fancybox').hide();
} }
}); });
@@ -58,7 +58,6 @@
</ul> </ul>
</fieldset> </fieldset>
<h2>{l s='Members of this customer group'}</h2> <h2>{l s='Members of this customer group'}</h2>
<p>{l s='Limited to the 100th first customers.'} {l s='Please use filters to narrow your search.'}</p>
{$customerList} {$customerList}
{/block} {/block}
@@ -110,14 +110,14 @@ $(document).ready(function() {
</ul> </ul>
<div id="partner_preactivation"> <div id="partner_preactivation">
<p class="center"><img src="../img/loader.gif" alt="" /> {l s='Loading...'}</p> <p class="center"><img src="../img/loader.gif" alt="" /></p>
</div> </div>
<div class="separation"></div> <div class="separation"></div>
{$tips_optimization} {$tips_optimization}
<div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" /> {l s='Loading...'}</p></div> <div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
{hook h="displayAdminHomeInfos"} {hook h="displayAdminHomeInfos"}
{hook h="displayBackOfficeHome"} {*old name of the hook*} {hook h="displayBackOfficeHome"} {*old name of the hook*}
@@ -212,7 +212,7 @@ $(document).ready(function() {
{ {
// don't show/hide screencast if it's deactivated // don't show/hide screencast if it's deactivated
{if $employee->bo_show_screencast} {if $employee->bo_show_screencast}
$('#adminpresentation').fadeOut('slow'); $('#adminpresentation').fadeOut('slow');
{/if} {/if}
$('#partner_preactivation').fadeOut('slow'); $('#partner_preactivation').fadeOut('slow');
$('#discover_prestashop').fadeOut('slow'); $('#discover_prestashop').fadeOut('slow');
@@ -1,8 +1,8 @@
{* {*
* 2007-2013 PrestaShop * 2007-2013 PrestaShop
** *
* NOTICE OF LICENSE * NOTICE OF LICENSE
** *
* This source file is subject to the Academic Free License (AFL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
@@ -10,25 +10,72 @@
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
** *
* DISCLAIMER * DISCLAIMER
** *
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
** *
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA * @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title} {include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
<div class="leadin">{block name="leadin"}{/block}</div> <div class="leadin">{block name="leadin"}{/block}</div>
{if $module_confirmation} {if $module_confirmation}
<div class="module_confirmation conf confirm"> <div class="module_confirmation conf confirm">
{l s='Your .CSV file has been sucessfully imported into your shop.'} {l s='Your .CSV file has been sucessfully imported into your shop.'}
</div> </div>
{/if} {/if}
<script type="text/javascript">
var truncateAuthorized = {$truncateAuthorized|intval};
$(document).ready(function(){
activeClueTip();
$("a#upload_file_import_link").fancybox({
'titleShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});
$('#preview_import').submit(function(e) {
if ($('#truncate').get(0).checked)
{
console.log(truncateAuthorized);
if (truncateAuthorized)
{
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?'))
{
e.preventDefault();
}
}
else
{
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js=1}');
return false;
}
}
});
});
function activeClueTip()
{
$('.info_import').cluetip({
splitTitle: '|',
showTitle: false
});
};
</script>
{**
* Upload fancybox
*}
<div style="display: none"> <div style="display: none">
<div id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7"> <div id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7">
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
@@ -50,16 +97,28 @@
</form> </form>
</div> </div>
</div> </div>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<form id="preview_import" action="{$current}&token={$token}" method="post" style="display:inline" enctype="multipart/form-data" class="clear">
{**
* Import fieldset
*}
<form id="preview_import"
action="{$current}&token={$token}"
method="post"
style="display:inline"
enctype="multipart/form-data"
class="clear">
<fieldset style="float: left; margin: 0pt 20px 0pt 0pt; width: 70%;"> <fieldset style="float: left; margin: 0pt 20px 0pt 0pt; width: 70%;">
<legend><img src="../img/admin/import.gif" />{l s='Import '}</legend> <legend><img src="../img/admin/import.gif" />{l s='Import '}</legend>
<label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=count($files_to_import)}{else}{l s='Your CSV file (%d file):' sprintf=count($files_to_import)}{/if}</label> <label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=count($files_to_import)}{else}{l s='Your CSV file (%d file):' sprintf=count($files_to_import)}{/if}</label>
<div class="margin-form"> <div class="margin-form">
{if count($files_to_import)} {if count($files_to_import)}
<select name="csv"> <select name="csv">
{foreach $files_to_import AS $filename} {foreach $files_to_import AS $filename}
<option value="{$filename}"{if $csv_selected == $filename} selected="selected"{/if}>{$filename}</option> <option value="{$filename}">{$filename}</option>
{/foreach} {/foreach}
</select> </select>
{/if} {/if}
@@ -87,12 +146,13 @@
<div class="margin-form"> <div class="margin-form">
<select name="entity" id="entity"> <select name="entity" id="entity">
{foreach $entities AS $entity => $i} {foreach $entities AS $entity => $i}
<option value="{$i}"{if $entity_selected == $i} selected="selected"{/if}> <option value="{$i}" {if $entity == $i}selected="selected"{/if}>
{$entity} {$entity}
</option> </option>
{/foreach} {/foreach}
</select> </select>
</div> </div>
<label class="clear">{l s='Language of the file'}</label> <label class="clear">{l s='Language of the file'}</label>
<div class="margin-form"> <div class="margin-form">
<select name="iso_lang"> <select name="iso_lang">
@@ -120,18 +180,14 @@
<div class="margin-form"> <div class="margin-form">
<input name="truncate" id="truncate" type="checkbox"/> <input name="truncate" id="truncate" type="checkbox"/>
</div> </div>
<label for="regenerate" class="clear">{l s='No thumbnails regeneration'}</label> <label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label>
<div class="margin-form"> <div class="margin-form">
<input name="regenerate" id="regenerate" type="checkbox" /> <input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/>
</div> </div>
<label for="forceIDs" class="clear">{l s='Force all ID\'s during import?'} </label> <label for="forceIDs" class="clear">{l s='Force all ID\'s during import?'} </label>
<div class="margin-form"> <div class="margin-form">
<input name="forceIDs" id="forceIDs" type="checkbox"/> {l s='If you don\'t use this option, all ID\'s will be auto-incremented.'} <input name="forceIDs" id="forceIDs" type="checkbox"/> {l s='If you don\'t use this option, all ID\'s will be auto-incremented.'}
</div> </div>
<label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label>
<div class="margin-form">
<input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/>
</div>
<div class="space margin-form"> <div class="space margin-form">
<input type="submit" name="submitImportFile" value="{l s='Next step'}" class="button" {if empty($files_to_import)}disabled{/if}/> <input type="submit" name="submitImportFile" value="{l s='Next step'}" class="button" {if empty($files_to_import)}disabled{/if}/>
{if empty($files_to_import)}<span style="color:red;">{l s='You must upload a file in order to proceed to the next step'}</span>{/if} {if empty($files_to_import)}<span style="color:red;">{l s='You must upload a file in order to proceed to the next step'}</span>{/if}
@@ -154,10 +210,13 @@
{/if} {/if}
</fieldset> </fieldset>
</form> </form>
<fieldset style="display:block;"> <fieldset style="display:block;">
<legend> <legend>
<img src="../img/admin/import.gif" />{l s='Available fields'} <img src="../img/admin/import.gif" />{l s='Available fields'}
</legend> </legend>
<div id="availableFields"> <div id="availableFields">
{$available_fields} {$available_fields}
</div> </div>
@@ -165,88 +224,74 @@
<div class="clear"> <div class="clear">
<br /><br />{l s='* Required field'} <br /><br />{l s='* Required field'}
</div> </div>
</fieldset> </fieldset>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $("select#entity").change( function() {
var truncateAuthorized = {$truncateAuthorized|intval};
activeClueTip();
$("a#upload_file_import_link").fancybox({
'titleShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});
$('#preview_import').submit(function(e){ if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8)
if ($('#truncate').get(0).checked)
if (truncateAuthorized)
{
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?'))
e.preventDefault();
}
else
{
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js=1}');
return false;
}
});
$("select#entity").change(function(){
if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8)
$("label[for=truncate],#truncate").hide();
else
$("label[for=truncate],#truncate").show();
if ($("#entity > option:selected").val() == 8)
{
$(".import_supply_orders_details").show();
$('input[name=multiple_value_separator]').val('|');
}
else
{
$(".import_supply_orders_details").hide();
$('input[name=multiple_value_separator]').val(',');
}
if ($("#entity > option:selected").val() == 1)
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").show();
else
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").hide();
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
$(".import_products_categories, label[for=regenerate], #regenerate").show();
else
$(".import_products_categories, label[for=regenerate], #regenerate").hide();
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$("label[for=forceIDs], #forceIDs").show();
else
$("label[for=forceIDs], #forceIDs").hide();
$("#entitie").html($("#entity > option:selected").text().toLowerCase());
$.ajax({
url: 'ajax.php',
data: {
getAvailableFields:1,
entity: $("#entity").val()
},
dataType: 'json',
success: function(j){
var fields = "";
$("#availableFields").empty();
for (var i = 0; i < j.length; i++)
fields += j[i].field;
$("#availableFields").html(fields);
activeClueTip();
},
error: function(j){}
});
});
$("select#entity").trigger('change');
function activeClueTip()
{ {
$('.info_import').cluetip({ $("label[for=truncate],#truncate").hide();
splitTitle: '|', }
showTitle: false else
}); $("label[for=truncate],#truncate").show();
};
if ($("#entity > option:selected").val() == 8)
{
$(".import_supply_orders_details").show();
$('input[name=multiple_value_separator]').val('|');
}
else
{
$(".import_supply_orders_details").hide();
$('input[name=multiple_value_separator]').val(',');
}
if ($("#entity > option:selected").val() == 1)
{
$("label[for=match_ref],#match_ref").show();
}
else
$("label[for=match_ref],#match_ref").hide();
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
{
$(".import_products_categories").show();
}
else
$(".import_products_categories").hide();
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$("label[for=forceIDs],#forceIDs").show();
else
$("label[for=forceIDs],#forceIDs").hide();
$("#entitie").html($("#entity > option:selected").text().toLowerCase());
$.ajax({
url: 'ajax.php',
data: {
getAvailableFields:1,
entity: $("#entity").val()
},
dataType: 'json',
success: function(j) {
var fields = "";
$("#availableFields").empty();
for (var i = 0; i < j.length; i++)
fields += j[i].field;
$("#availableFields").html(fields);
activeClueTip();
},
error: function(j) {
}
});
}); });
</script> </script>
@@ -22,52 +22,20 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{extends file="helpers/view/view.tpl"} {extends file="helpers/view/view.tpl"}
{block name="override_tpl"} {block name="override_tpl"}
<script type="text/javascript"> <script type="text/javascript">
var errorEmpty = '{l s='Please name your matching configuration to save.' js='1'}'; var errorEmpty = "{l s='Please name your matching configuration to save.'}"
var token = '{$token}'; var token = '{$token}';
var current = 0;
function showTable(nb)
{
$('#btn_left').disabled = null;
$('#btn_right').disabled = null;
if (nb <= 0)
{
nb = 0;
$('#btn_left').disabled = 'true';
}
if (nb >= {$nb_table} - 1)
{
nb = {$nb_table} - 1;
$('#btn_right').disabled = 'true';
}
$('#table' + current).hide();
current = nb;
$('#table' + current).show();
}
$(document).ready(function(){
var btn_save_import = $('span[class~="process-icon-save-import"]').parent();
var btn_submit_import = $('#import');
if (btn_save_import.length > 0 && btn_submit_import.length > 0)
{
btn_submit_import.hide();
btn_save_import.find('span').removeClass('process-icon-save-import');
btn_save_import.find('span').addClass('process-icon-save');
btn_save_import.click(function(){
btn_submit_import.before('<input type="hidden" name="' + btn_submit_import.attr("name") + '" value="1" />');
$('#import_form').submit();
});
}
showTable(current);
});
</script> </script>
<div id="container-customer"> <div id="container-customer">
<h2>{l s='View your data'}</h2> <h2>{l s='View your data'}</h2>
<div> <div>
<b>{l s='Save and load your configuration for importing files'} : </b><br/><br/> <b>{l s='Save and load your configuration for importing files'} : </b><br><br>
<input type="text" name="newImportMatchs" id="newImportMatchs" /> <input type="text" name="newImportMatchs" id="newImportMatchs">
<a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br /><br /> <a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br><br>
<div id="selectDivImportMatchs" {if !$import_matchs}style="display:none"{/if}> <div id="selectDivImportMatchs" {if !$import_matchs}style="display:none"{/if}>
<select id="valueImportMatchs"> <select id="valueImportMatchs">
{foreach $import_matchs as $match} {foreach $import_matchs as $match}
@@ -78,18 +46,21 @@
<a class="button" id="deleteImportMatchs" href="#">{l s='Delete'}</a> <a class="button" id="deleteImportMatchs" href="#">{l s='Delete'}</a>
</div> </div>
</div> </div>
<h3>{l s='Please set the value type of each column'}</h3> <h3>{l s='Please set the value type of each column'}</h3>
<div id="error_duplicate_type" class="warning warn" style="display:none;"> <div id="error_duplicate_type" class="warning warn" style="display:none;">
<h3>{l s='Columns cannot have the same value type'}</h3> <h3>{l s='Columns cannot have the same value type'}</h3>
</div> </div>
<div id="required_column" class="warning warn" style="display:none;"> <div id="required_column" class="warning warn" style="display:none;">
<h3>{l s='Column'} <span id="missing_column">&nbsp;</span> {l s='must be set'}</h3> <h3>{l s='Column'} <span id="missing_column">&nbsp;</span> {l s='must be set'}</h3>
</div> </div>
<form action="{$current}&token={$token}" method="post" id="import_form" name="import_form"> <form action="{$current}&token={$token}" method="post" id="import_form" name="import_form">
{l s='Skip'} <input type="text" size="2" name="skip" value="1" /> {l s='lines'} {l s='Skip'} <input type="text" size="2" name="skip" value="1" /> {l s='lines'}
<input type="hidden" name="csv" value="{$fields_value.csv}" /> <input type="hidden" name="csv" value="{$fields_value.csv}" />
<input type="hidden" name="convert" value="{$fields_value.convert}" /> <input type="hidden" name="convert" value="{$fields_value.convert}" />
<input type="hidden" name="regenerate" value="{$fields_value.regenerate}" />
<input type="hidden" name="entity" value="{$fields_value.entity}" /> <input type="hidden" name="entity" value="{$fields_value.entity}" />
<input type="hidden" name="iso_lang" value="{$fields_value.iso_lang}" /> <input type="hidden" name="iso_lang" value="{$fields_value.iso_lang}" />
{if $fields_value.truncate} {if $fields_value.truncate}
@@ -101,8 +72,49 @@
{if $fields_value.match_ref} {if $fields_value.match_ref}
<input type="hidden" name="match_ref" value="1" /> <input type="hidden" name="match_ref" value="1" />
{/if} {/if}
<input type="hidden" name="separator" value="{$fields_value.separator}" /> <input type="hidden" name="separator" value="{$fields_value.separator}">
<input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}" /> <input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}">
<script type="text/javascript">
var current = 0;
function showTable(nb)
{
getE('btn_left').disabled = null;
getE('btn_right').disabled = null;
if (nb <= 0)
{
nb = 0;
getE('btn_left').disabled = 'true';
}
if (nb >= {$nb_table} - 1)
{
nb = {$nb_table} - 1;
getE('btn_right').disabled = 'true';
}
toggle(getE('table'+current), false);
current = nb;
toggle(getE('table'+current), true);
}
$(function() {
var btn_save_import = $('span[class~="process-icon-save-import"]').parent();
var btn_submit_import = $('#import');
if (btn_save_import.length > 0 && btn_submit_import.length > 0)
{
btn_submit_import.hide();
btn_save_import.find('span').removeClass('process-icon-save-import');
btn_save_import.find('span').addClass('process-icon-save');
btn_save_import.click(function() {
btn_submit_import.before('<input type="hidden" name="'+btn_submit_import.attr("name")+'" value="1" />');
$('#import_form').submit();
});
}
});
</script>
<table> <table>
<tr> <tr>
<td colspan="3" align="center"> <td colspan="3" align="center">
@@ -111,7 +123,7 @@
</tr> </tr>
<tr> <tr>
<td valign="top" align="center"> <td valign="top" align="center">
<input id="btn_left" value="{l s='<<'}" type="button" class="button" onclick="showTable(current - 1);" /> <input id="btn_left" value="{l s='<<'}" type="button" class="button" onclick="showTable(current - 1)" />
</td> </td>
<td align="left"> <td align="left">
{section name=nb_i start=0 loop=$nb_table step=1} {section name=nb_i start=0 loop=$nb_table step=1}
@@ -120,10 +132,12 @@
{/section} {/section}
</td> </td>
<td valign="top" align="center"> <td valign="top" align="center">
<input id="btn_right" value="{l s='>>'}" type="button" class="button" onclick="showTable(current + 1);" /> <input id="btn_right" value="{l s='>>'}" type="button" class="button" onclick="showTable(current + 1)" />
</td> </td>
</tr> </tr>
</table> </table>
<script type="text/javascript">showTable(current);</script>
</form> </form>
</div> </div>
{/block} {/block}
@@ -24,9 +24,9 @@
*} *}
<div class="width4"> <div class="width4">
{if isset($localization_form)}{$localization_form}{/if} {$localization_form}
</div> </div>
<br /> <br />
<div class="width4"> <div class="width4">
{if isset($localization_options)}{$localization_options}{/if} {$localization_options}
</div> </div>
@@ -117,7 +117,7 @@
$('#vouchers_err').hide(); $('#vouchers_err').hide();
var mytab = new Array(); var mytab = new Array();
for (var i = 0; i < data.vouchers.length; i++) for (var i = 0; i < data.vouchers.length; i++)
mytab[mytab.length] = { data: data.vouchers[i], value: data.vouchers[i].name + (data.vouchers[i].code.length > 0 ? ' - ' + data.vouchers[i].code : '')}; mytab[mytab.length] = { data: data.vouchers[i], value: data.vouchers[i].name+' - '+data.vouchers[i].description };
return mytab; return mytab;
}, },
extraParams: { extraParams: {
@@ -694,15 +694,17 @@
function updateCartVouchers(vouchers) function updateCartVouchers(vouchers)
{ {
var vouchers_html = ''; var vouchers_html = '';
if (typeof(vouchers) == 'object') if (vouchers.length > 0)
$.each(vouchers, function(){ {
$.each(vouchers, function() {
vouchers_html += '<tr><td>'+this.name+'</td><td>'+this.description+'</td><td>'+this.value_real+'</td><td><a href="#" class="delete_discount" rel="'+this.id_discount+'"><img src="../img/admin/delete.gif" /></a></td></tr>'; vouchers_html += '<tr><td>'+this.name+'</td><td>'+this.description+'</td><td>'+this.value_real+'</td><td><a href="#" class="delete_discount" rel="'+this.id_discount+'"><img src="../img/admin/delete.gif" /></a></td></tr>';
}); });
$('#voucher_list tbody').html($.trim(vouchers_html));
if ($('#voucher_list tbody').html().length == 0)
$('#voucher_list').hide();
else
$('#voucher_list').show(); $('#voucher_list').show();
}
else
$('#voucher_list').hide();
$('#voucher_list tbody').html(vouchers_html);
} }
function updateCartPaymentList(payment_list) function updateCartPaymentList(payment_list)
@@ -153,7 +153,7 @@
<br /> <br />
<fieldset> <fieldset>
<legend><img src="../img/admin/tab-customers.gif" /> {l s='Customer information'}</legend> <legend><img src="../img/admin/tab-customers.gif" /> {l s='Customer information'}</legend>
<span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}"> {$gender->name|escape:'htmlall':'UTF-8'} {$customer->firstname} {$customer->lastname}</a></span> ({l s='#'}{$customer->id})<br /> <span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}"> {$customer->firstname} {$customer->lastname}</a></span> ({l s='#'}{$customer->id})<br />
(<a href="mailto:{$customer->email}">{$customer->email}</a>)<br /><br /> (<a href="mailto:{$customer->email}">{$customer->email}</a>)<br /><br />
{if ($customer->isGuest())} {if ($customer->isGuest())}
{l s='This order has been placed by a guest.'} {l s='This order has been placed by a guest.'}
@@ -41,7 +41,7 @@
{/if} {/if}
{$smarty.block.parent} {$smarty.block.parent}
{if $input.type == 'radio' && $input.name == 'smarty_cache'} {if $input.type == 'radio' && $input.name == 'smarty_cache'}
<a href="{$current}&token={$token}&empty_smarty_cache=1" class="clear button" href="">{l s='Clear Smarty cache & Autoload cache'}</a> <a href="{$current}&token={$token}&empty_smarty_cache=1" class="clear button" href="">{l s='Clear Smarty cache'}</a>
{/if} {/if}
{/block} {/block}
@@ -166,7 +166,7 @@
</tr> </tr>
<tr class="redirect_product_options" style="display:none"> <tr class="redirect_product_options" style="display:none">
<td class="col-left"> <td class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="redirect_type" type="radio" onclick=""} {include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
<label class="text">{l s='Redirect:'}</label> <label class="text">{l s='Redirect:'}</label>
</td> </td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
@@ -184,7 +184,7 @@
</tr> </tr>
<tr class="redirect_product_options redirect_product_options_product_choise" style="display:none"> <tr class="redirect_product_options redirect_product_options_product_choise" style="display:none">
<td class="col-left"> <td class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="id_product_redirected" type="radio" onclick=""} {include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
<label class="text">{l s='Related product:'}</label> <label class="text">{l s='Related product:'}</label>
</td> </td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
@@ -29,7 +29,7 @@
<input size="30" type="text" id="{$input_name}_{$language.id_lang}" <input size="30" type="text" id="{$input_name}_{$language.id_lang}"
name="{$input_name}_{$language.id_lang}" name="{$input_name}_{$language.id_lang}"
value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}" value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}"
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();" onblur="updateLinkRewrite();"/> onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"/>
</div> </div>
{/foreach} {/foreach}
</div> </div>
@@ -178,7 +178,7 @@ $(document).ready(function () {
</tr> </tr>
<tr {if !$ps_use_ecotax} style="display:none;"{/if}> <tr {if !$ps_use_ecotax} style="display:none;"{/if}>
<td class="col-left"> <td class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="ecotax" type="default"} {include file="controllers/products/multishop/checkbox.tpl" field="ecot" type="default"}
<label>{l s='Eco-tax (tax incl.):'}</label> <label>{l s='Eco-tax (tax incl.):'}</label>
</td> </td>
<td> <td>
@@ -45,7 +45,7 @@
{l s='The field `request_uri` is the URL from which the customers come to your website.'}<br /> {l s='The field `request_uri` is the URL from which the customers come to your website.'}<br />
{l s='For example, if the visitor accesses a product page, the URL will be'} "{$uri}music-ipods/1-ipod-nano.html".<br /> {l s='For example, if the visitor accesses a product page, the URL will be'} "{$uri}music-ipods/1-ipod-nano.html".<br />
{l s='This is helpful because you can add tags or tokens in the links pointing to your website.'} {l s='This is helpful because you can add tags or tokens in the links pointing to your website.'}
{l s='For example, you can post a link "%1$sindex.php?prestashop" in the forum and get statistics by entering "%%prestashop" in the field `request_uri`. ' sprintf=[$uri]} {l s='For example, you can post a link "%dindex.php?prestashop" in the forum and get statistics by entering "%prestashop" in the field `request_uri`. '}
{l s='This method is more reliable than the `http_referer`, but there is one disadvantage. If a search engine references a page with your link, then it will be displayed in the search results and you will not only have visitors from the forum, but also those from the search engine.'} {l s='This method is more reliable than the `http_referer`, but there is one disadvantage. If a search engine references a page with your link, then it will be displayed in the search results and you will not only have visitors from the forum, but also those from the search engine.'}
</li> </li>
<br /> <br />
@@ -30,9 +30,9 @@
function ajaxStoreStates(id_state_selected) function ajaxStoreStates(id_state_selected)
{ {
$.ajax({ $.ajax({
url: "index.php", url: "ajax.php",
cache: false, cache: false,
data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(), data: "ajaxStates=1&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(),
success: function(html) success: function(html)
{ {
if (html == 'false') if (html == 'false')
@@ -60,9 +60,9 @@
$("#states-label").hide(); $("#states-label").hide();
} else { } else {
$.ajax({ $.ajax({
url: "index.php", url: "ajax.php",
cache: false, cache: false,
data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}", data: "ajaxStates=1&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}",
success: function(html){ success: function(html){
if (html == "false") if (html == "false")
{ {
@@ -88,10 +88,10 @@
{ {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: 'index.php', url: 'ajax.php',
async: true, async: true,
dataType: 'json', dataType: 'json',
data: 'ajax=1&tab=AdminTaxRulesGroup&token={getAdminToken tab='AdminTaxRulesGroup'}&ajaxStates=1&action=updateTaxRule&id_tax_rule='+id_tax_rule, data: 'ajaxStates=1&ajaxUpdateTaxRule=1&id_tax_rule='+id_tax_rule,
success: function(data){ success: function(data){
$('#tax_rule_form').show(); $('#tax_rule_form').show();
$('#id_tax_rule').val(data.id); $('#id_tax_rule').val(data.id);
@@ -33,22 +33,22 @@
{/if} {/if}
<form method="post" action="{$currentIndex}&{$identifier}&token={$token}&id_tax_rules_group={$id_tax_rules_group}&updatetax_rules_group#{$table}" class="form"> <form method="post" action="{$currentIndex}&{$identifier}&token={$token}&id_tax_rules_group={$id_tax_rules_group}&updatetax_rules_group#{$table}" class="form">
<input type="hidden" id="submitFilter{$list_id}" name="submitFilter{$list_id}" value="0"/> <input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
<table class="table_grid"> <table class="table_grid">
<tr> <tr>
<td style="vertical-align: bottom;"> <td style="vertical-align: bottom;">
<span style="float: left;"> <span style="float: left;">
{if $page > 1} {if $page > 1}
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$list_id}').value=1"/>&nbsp; <input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$table}').value=1"/>&nbsp;
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$list_id}').value={$page - 1}"/> <input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$table}').value={$page - 1}"/>
{/if} {/if}
{l s='Page'} <b>{$page}</b> / {$total_pages} {l s='Page'} <b>{$page}</b> / {$total_pages}
{if $page < $total_pages} {if $page < $total_pages}
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$list_id}').value={$page + 1};"/>&nbsp; <input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$table}').value={$page + 1};"/>&nbsp;
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$list_id}').value={$total_pages}"/> <input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$table}').value={$total_pages}"/>
{/if} {/if}
| {l s='Display'} | {l s='Display'}
<select name="{$list_id}_pagination" onchange="submit()"> <select name="pagination" onchange="submit()">
{* Choose number of results per page *} {* Choose number of results per page *}
{foreach $pagination AS $value} {foreach $pagination AS $value}
<option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option> <option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option>
@@ -57,7 +57,7 @@
/ {$list_total} {l s='result(s)'} / {$list_total} {l s='result(s)'}
</span> </span>
<span style="float: right;"> <span style="float: right;">
<input type="submit" name="submitReset{$list_id}" value="{l s='Reset'}" class="button" /> <input type="submit" name="submitReset{$table}" value="{l s='Reset'}" class="button" />
</span> </span>
<span class="clear"></span> <span class="clear"></span>
</td> </td>
@@ -66,7 +66,7 @@
<td> <td>
<table <table
{if $table_id} id={$table_id}{/if} {if $table_id} id={$table_id}{/if}
class="table {if $table_dnd}tableDnD{/if} {$list_id}" class="table {if $table_dnd}tableDnD{/if} {$table}"
cellpadding="0" cellspacing="0" cellpadding="0" cellspacing="0"
style="width: 100%; margin-bottom:10px;" style="width: 100%; margin-bottom:10px;"
> >
@@ -84,7 +84,7 @@
<tr class="nodrag nodrop"> <tr class="nodrag nodrop">
<th class="center"> <th class="center">
{if $has_bulk_actions} {if $has_bulk_actions}
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$list_id}Box[]', this.checked)" /> <input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$table}Box[]', this.checked)" />
{/if} {/if}
</th> </th>
{foreach $fields_display AS $key => $params} {foreach $fields_display AS $key => $params}
@@ -30,7 +30,7 @@
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if} {if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
{block name="defaultForm"} {block name="defaultForm"}
<form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{if $table == null}configuration_form{else}{$table}_form{/if}{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}> <form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{$table}_form{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}>
{if $form_id} {if $form_id}
<input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" /> <input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" />
{/if} {/if}
@@ -432,8 +432,7 @@
}; };
{/foreach} {/foreach}
// we need allowEmployeeFormLang var in ajax request // we need allowEmployeeFormLang var in ajax request
allowEmployeeFormLang = {$allowEmployeeFormLang|intval}; allowEmployeeFormLang = {$allowEmployeeFormLang};
employee_token = '{getAdminToken tab='AdminEmployees'}';
displayFlags(languages, id_language, allowEmployeeFormLang); displayFlags(languages, id_language, allowEmployeeFormLang);
$(document).ready(function() { $(document).ready(function() {
@@ -455,7 +454,6 @@
}); });
}); });
state_token = '{getAdminToken tab='AdminStates'}';
{block name="script"}{/block} {block name="script"}{/block}
</script> </script>
{/if} {/if}
@@ -34,7 +34,7 @@
{block name="defaultOptions"} {block name="defaultOptions"}
<form action="{$current}&token={$token}" <form action="{$current}&token={$token}"
id="{if $table == null}configuration_form{else}{$table}_form{/if}" id="{$table}_form"
{if isset($categoryData['name'])} name={$categoryData['name']}{/if} {if isset($categoryData['name'])} name={$categoryData['name']}{/if}
{if isset($categoryData['id'])} id={$categoryData['id']} {/if} {if isset($categoryData['id'])} id={$categoryData['id']} {/if}
method="post" method="post"
@@ -36,7 +36,7 @@
{if $k == 'modules-list'} {if $k == 'modules-list'}
<div id="modules_list_container" style="display:none"> <div id="modules_list_container" style="display:none">
<div style="float:right;margin:5px"> <div style="float:right;margin:5px">
<a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png" /></a> <a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png"></a>
</div> </div>
<div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0" /></div> <div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0" /></div>
<div id="modules_list_container_tab" style="display:none;"></div> <div id="modules_list_container_tab" style="display:none;"></div>
+1 -1
View File
@@ -1303,7 +1303,7 @@ abstract class AdminTabCore
} }
$asso = Shop::getAssoTable($this->table); $asso = Shop::getAssoTable($this->table);
if ($asso !== false && $asso['type'] == 'shop') if ($asso !== false && $assos['type'] == 'shop')
{ {
$filterKey = $asso['type']; $filterKey = $asso['type'];
$idenfierShop = Shop::getContextListShopID(); $idenfierShop = Shop::getContextListShopID();
+13 -9
View File
@@ -54,8 +54,6 @@ class Autoload
$this->root_dir = dirname(dirname(__FILE__)).'/'; $this->root_dir = dirname(dirname(__FILE__)).'/';
if (file_exists($this->root_dir.Autoload::INDEX_FILE)) if (file_exists($this->root_dir.Autoload::INDEX_FILE))
$this->index = include($this->root_dir.Autoload::INDEX_FILE); $this->index = include($this->root_dir.Autoload::INDEX_FILE);
else
$this->generateIndex();
} }
/** /**
@@ -82,8 +80,9 @@ class Autoload
if (strpos(strtolower($classname), 'smarty_') === 0) if (strpos(strtolower($classname), 'smarty_') === 0)
return; return;
// regenerate the class index if the requested file doesn't exists // regenerate the class index if the requested class is not found in the index or if the requested file doesn't exists
if ((isset($this->index[$classname]) && $this->index[$classname] && !is_file($this->root_dir.$this->index[$classname])) if (!isset($this->index[$classname])
|| ($this->index[$classname] && !is_file($this->root_dir.$this->index[$classname]))
|| (isset($this->index[$classname.'Core']) && $this->index[$classname.'Core'] && !is_file($this->root_dir.$this->index[$classname.'Core']))) || (isset($this->index[$classname.'Core']) && $this->index[$classname.'Core'] && !is_file($this->root_dir.$this->index[$classname.'Core'])))
$this->generateIndex(); $this->generateIndex();
@@ -139,14 +138,18 @@ class Autoload
{ {
$filename_tmp = tempnam(dirname($filename), basename($filename.'.')); $filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
if($filename_tmp !== FALSE and file_put_contents($filename_tmp, $content, LOCK_EX) !== FALSE) if($filename_tmp !== FALSE and file_put_contents($filename_tmp, $content, LOCK_EX) !== FALSE)
{ {
@rename($filename_tmp, $filename); rename($filename_tmp, $filename);
@chmod($filename, 0666); @chmod($filename, 0664);
} }
else else
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die. {
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated),
// no need to die.
error_log('Cannot write temporary file '.$filename_tmp); error_log('Cannot write temporary file '.$filename_tmp);
}
} }
$this->index = $classes; $this->index = $classes;
} }
@@ -189,3 +192,4 @@ class Autoload
return isset($this->index[$classname]) ? $this->index[$classname] : null; return isset($this->index[$classname]) ? $this->index[$classname] : null;
} }
} }
+4 -4
View File
@@ -775,11 +775,11 @@ class CarrierCore extends ObjectModel
if ($delete) if ($delete)
Db::getInstance()->execute(' Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'delivery` DELETE FROM `'._DB_PREFIX_.'delivery`
WHERE '.(is_null($values['id_shop']) ? 'ISNULL(`id_shop`) ' : 'id_shop = '.(int)$values['id_shop']).' WHERE id_shop = '.(int)$values['id_shop'].'
AND '.(is_null($values['id_shop_group']) ? 'ISNULL(`id_shop`) ' : 'id_shop_group='.(int)$values['id_shop_group']).' AND id_shop_group='.(int)$values['id_shop_group'].'
AND id_carrier='.(int)$values['id_carrier']. AND id_carrier='.(int)$values['id_carrier'].
($values['id_range_price'] !== null ? ' AND id_range_price='.(int)$values['id_range_price'] : ' AND (ISNULL(`id_range_price`) OR `id_range_price` = 0)'). ($values['id_range_price'] !== null ? ' AND id_range_price='.(int)$values['id_range_price'] : '').
($values['id_range_weight'] !== null ? ' AND id_range_weight='.(int)$values['id_range_weight'] : ' AND (ISNULL(`id_range_weight`) OR `id_range_weight` = 0)').' ($values['id_range_weight'] !== null ? ' AND id_range_weight='.(int)$values['id_range_weight'] : '').'
AND id_zone='.(int)$values['id_zone'] AND id_zone='.(int)$values['id_zone']
); );
+5 -15
View File
@@ -762,11 +762,10 @@ class CartCore extends ObjectModel
{ {
// You can't add a cart rule that does not exist // You can't add a cart rule that does not exist
$cartRule = new CartRule($id_cart_rule, Context::getContext()->language->id); $cartRule = new CartRule($id_cart_rule, Context::getContext()->language->id);
if (!Validate::isLoadedObject($cartRule)) if (!Validate::isLoadedObject($cartRule))
return false; return false;
if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart_rule = '.(int)$id_cart_rule.' AND id_cart = '.(int)$this->id)) if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$this->id))
return false; return false;
// Add the cart rule to the cart // Add the cart rule to the cart
@@ -3416,7 +3415,6 @@ class CartCore extends ObjectModel
*/ */
public function setNoMultishipping() public function setNoMultishipping()
{ {
$emptyCache = $result = false;
if (Configuration::get('PS_ALLOW_MULTISHIPPING')) if (Configuration::get('PS_ALLOW_MULTISHIPPING'))
{ {
// Upgrading quantities // Upgrading quantities
@@ -3435,9 +3433,7 @@ class CartCore extends ObjectModel
AND `id_shop` = '.(int)$this->id_shop.' AND `id_shop` = '.(int)$this->id_shop.'
AND id_product = '.$product['id_product'].' AND id_product = '.$product['id_product'].'
AND id_product_attribute = '.$product['id_product_attribute']; AND id_product_attribute = '.$product['id_product_attribute'];
$result = Db::getInstance()->execute($sql); Db::getInstance()->execute($sql);
if ($result)
$emptyCache = true;
} }
// Merging multiple lines // Merging multiple lines
@@ -3455,17 +3451,14 @@ class CartCore extends ObjectModel
} }
// Update delivery address for each product line // Update delivery address for each product line
$sql = 'UPDATE `'._DB_PREFIX_.'cart_product` Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'cart_product`
SET `id_address_delivery` = ( SET `id_address_delivery` = (
SELECT `id_address_delivery` FROM `'._DB_PREFIX_.'cart` SELECT `id_address_delivery` FROM `'._DB_PREFIX_.'cart`
WHERE `id_cart` = '.(int)$this->id.' AND `id_shop` = '.(int)$this->id_shop.' WHERE `id_cart` = '.(int)$this->id.' AND `id_shop` = '.(int)$this->id_shop.'
) )
WHERE `id_cart` = '.(int)$this->id.' WHERE `id_cart` = '.(int)$this->id.'
'.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : ''); '.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : ''));
$result = Db::getInstance()->execute($sql);
if ($result)
$emptyCache = true;
if (Customization::isFeatureActive()) if (Customization::isFeatureActive())
Db::getInstance()->execute(' Db::getInstance()->execute('
@@ -3475,9 +3468,6 @@ class CartCore extends ObjectModel
WHERE `id_cart` = '.(int)$this->id.' WHERE `id_cart` = '.(int)$this->id.'
) )
WHERE `id_cart` = '.(int)$this->id); WHERE `id_cart` = '.(int)$this->id);
if ($emptyCache)
$this->_products = null;
} }
/** /**
+3 -8
View File
@@ -464,7 +464,7 @@ class CartRuleCore extends ObjectModel
// Check if the products chosen by the customer are usable with the cart rule // Check if the products chosen by the customer are usable with the cart rule
if ($this->product_restriction) if ($this->product_restriction)
{ {
$r = $this->checkProductRestrictions($context, false, $display_error, $alreadyInCart); $r = $this->checkProductRestrictions($context, false, $display_error);
if ($r !== false && $display_error) if ($r !== false && $display_error)
return $r; return $r;
elseif (!$r && !$display_error) elseif (!$r && !$display_error)
@@ -523,7 +523,6 @@ class CartRuleCore extends ObjectModel
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart'); return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
if ($otherCartRule['gift_product']) if ($otherCartRule['gift_product'])
--$nb_products; --$nb_products;
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id) if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
{ {
$combinable = Db::getInstance()->getValue(' $combinable = Db::getInstance()->getValue('
@@ -551,7 +550,7 @@ class CartRuleCore extends ObjectModel
return true; return true;
} }
protected function checkProductRestrictions(Context $context, $return_products = false, $display_error = true, $alreadyInCart = false) protected function checkProductRestrictions(Context $context, $return_products = false, $display_error = true)
{ {
$selectedProducts = array(); $selectedProducts = array();
@@ -586,8 +585,6 @@ class CartRuleCore extends ObjectModel
if (in_array($cartAttribute['id_attribute'], $productRule['values'])) if (in_array($cartAttribute['id_attribute'], $productRule['values']))
{ {
$countMatchingProducts += $cartAttribute['quantity']; $countMatchingProducts += $cartAttribute['quantity'];
if ($alreadyInCart && $this->gift_product == $cartProduct['id_product']&& $this->gift_product_attribute == $cartProduct['id_product_attribute'])
--$countMatchingProducts;
$matchingProductsList[] = $cartAttribute['id_product'].'-'.$cartAttribute['id_product_attribute']; $matchingProductsList[] = $cartAttribute['id_product'].'-'.$cartAttribute['id_product_attribute'];
} }
if ($countMatchingProducts < $productRuleGroup['quantity']) if ($countMatchingProducts < $productRuleGroup['quantity'])
@@ -606,8 +603,6 @@ class CartRuleCore extends ObjectModel
if (in_array($cartProduct['id_product'], $productRule['values'])) if (in_array($cartProduct['id_product'], $productRule['values']))
{ {
$countMatchingProducts += $cartProduct['quantity']; $countMatchingProducts += $cartProduct['quantity'];
if ($alreadyInCart && $this->gift_product == $cartProduct['id_product'])
--$countMatchingProducts;
$matchingProductsList[] = $cartProduct['id_product'].'-0'; $matchingProductsList[] = $cartProduct['id_product'].'-0';
} }
if ($countMatchingProducts < $productRuleGroup['quantity']) if ($countMatchingProducts < $productRuleGroup['quantity'])
@@ -1190,7 +1185,7 @@ class CartRuleCore extends ObjectModel
SELECT cr.*, crl.* SELECT cr.*, crl.*
FROM '._DB_PREFIX_.'cart_rule cr FROM '._DB_PREFIX_.'cart_rule cr
LEFT JOIN '._DB_PREFIX_.'cart_rule_lang crl ON (cr.id_cart_rule = crl.id_cart_rule AND crl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'cart_rule_lang crl ON (cr.id_cart_rule = crl.id_cart_rule AND crl.id_lang = '.(int)$id_lang.')
WHERE code LIKE \'%'.pSQL($name).'%\' OR name LIKE \'%'.pSQL($name).'%\' WHERE code LIKE \'%'.pSQL($name).'%\'
'); ');
} }
} }
+1 -19
View File
@@ -58,8 +58,7 @@ class ConfigurationTestCore
'theme_cache_dir' => 'themes/'._THEME_NAME_.'/cache/', 'theme_cache_dir' => 'themes/'._THEME_NAME_.'/cache/',
'translations_dir' => 'translations', 'translations_dir' => 'translations',
'customizable_products_dir' => 'upload', 'customizable_products_dir' => 'upload',
'virtual_products_dir' => 'download', 'virtual_products_dir' => 'download'
'files' => false
); );
} }
@@ -319,21 +318,4 @@ class ConfigurationTestCore
{ {
return extension_loaded('Dom'); return extension_loaded('Dom');
} }
public static function test_files()
{
$files = array(
'/cache/smarty/compile/index.php',
'/classes/log/index.php',
'/classes/cache/index.php',
'/config/index.php',
'/tools/tar/Archive_Tar.php',
'/tools/pear/PEAR.php',
'/index.php'
);
foreach ($files as $file)
if (!file_exists(rtrim(_PS_ROOT_DIR_, DIRECTORY_SEPARATOR).str_replace('/', DIRECTORY_SEPARATOR, $file)))
return false;
return true;
}
} }
+3 -3
View File
@@ -97,7 +97,7 @@ class ConnectionCore extends ObjectModel
'id_connections' => (int)$cookie->id_connections, 'id_connections' => (int)$cookie->id_connections,
'id_page' => (int)$id_page, 'id_page' => (int)$id_page,
'time_start' => $time_start 'time_start' => $time_start
), false, true, Db::INSERT_IGNORE); ));
// This array is serialized and used by the ajax request to identify the page // This array is serialized and used by the ajax request to identify the page
return array( return array(
@@ -114,7 +114,7 @@ class ConnectionCore extends ObjectModel
// This is a bot and we have to retrieve its connection ID // This is a bot and we have to retrieve its connection ID
$sql = 'SELECT `id_connections` FROM `'._DB_PREFIX_.'connections` $sql = 'SELECT `id_connections` FROM `'._DB_PREFIX_.'connections`
WHERE ip_address = '.ip2long(Tools::getRemoteAddr()).' WHERE ip_address = '.ip2long(Tools::getRemoteAddr()).'
AND `date_add` > \''.pSQL(date('Y-m-d H:i:00', time() - 1800)).'\' AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
ORDER BY `date_add` DESC'; ORDER BY `date_add` DESC';
if ($id_connections = Db::getInstance()->getValue($sql)) if ($id_connections = Db::getInstance()->getValue($sql))
@@ -128,7 +128,7 @@ class ConnectionCore extends ObjectModel
$sql = 'SELECT `id_guest` $sql = 'SELECT `id_guest`
FROM `'._DB_PREFIX_.'connections` FROM `'._DB_PREFIX_.'connections`
WHERE `id_guest` = '.(int)$cookie->id_guest.' WHERE `id_guest` = '.(int)$cookie->id_guest.'
AND `date_add` > \''.pSQL(date('Y-m-d H:i:00', time() - 1800)).'\' AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
ORDER BY `date_add` DESC'; ORDER BY `date_add` DESC';
$result = Db::getInstance()->getRow($sql); $result = Db::getInstance()->getRow($sql);
+1 -20
View File
@@ -81,7 +81,6 @@ class CurrencyCore extends ObjectModel
/** @var array Currency cache */ /** @var array Currency cache */
static protected $currencies = array(); static protected $currencies = array();
protected static $countActiveCurrencies = array();
protected $webserviceParameters = array( protected $webserviceParameters = array(
'objectsNodeName' => 'currencies', 'objectsNodeName' => 'currencies',
@@ -415,23 +414,5 @@ class CurrencyCore extends ObjectModel
self::$currencies[(int)($id)] = new Currency($id); self::$currencies[(int)($id)] = new Currency($id);
return self::$currencies[(int)($id)]; return self::$currencies[(int)($id)];
} }
public static function countActiveCurrencies($id_shop = null)
{
if ($id_shop === null)
$id_shop = (int)Context::getContext()->shop->id;
if (!isset(self::$countActiveCurrencies[$id_shop]))
self::$countActiveCurrencies[$id_shop] = Db::getInstance()->getValue('
SELECT COUNT(DISTINCT c.id_currency) FROM `'._DB_PREFIX_.'currency` c
LEFT JOIN '._DB_PREFIX_.'currency_shop cs ON (cs.id_currency = c.id_currency AND cs.id_shop = '.(int)$id_shop.')
WHERE c.`active` = 1
');
return self::$countActiveCurrencies[$id_shop];
}
public static function isMultiCurrencyActivated($id_shop = null)
{
return (Currency::countActiveCurrencies($id_shop) > 1);
}
} }
+4 -4
View File
@@ -369,7 +369,7 @@ class DispatcherCore
// If there are several languages, get language from uri // If there are several languages, get language from uri
if ($this->use_routes && Language::isMultiLanguageActivated()) if ($this->use_routes && Language::isMultiLanguageActivated())
if (preg_match('#^/([a-z]{2})/?#', $this->request_uri, $m)) if (preg_match('#^/([a-z]{2})/#', $this->request_uri, $m))
{ {
$_GET['isolang'] = $m[1]; $_GET['isolang'] = $m[1];
$this->request_uri = substr($this->request_uri, 3); $this->request_uri = substr($this->request_uri, 3);
@@ -549,7 +549,7 @@ class DispatcherCore
if ($id_shop === null) if ($id_shop === null)
$id_shop = (int)Context::getContext()->shop->id; $id_shop = (int)Context::getContext()->shop->id;
if (!isset($this->routes[$id_shop])) if ($this->use_routes && !isset($this->routes[$id_shop]))
$this->loadRoutes($id_shop); $this->loadRoutes($id_shop);
if (!isset($this->routes[$id_shop]) || !isset($this->routes[$id_shop][$id_lang]) || !isset($this->routes[$id_shop][$id_lang][$route_id])) if (!isset($this->routes[$id_shop]) || !isset($this->routes[$id_shop][$id_lang]) || !isset($this->routes[$id_shop][$id_lang][$route_id]))
@@ -594,14 +594,14 @@ class DispatcherCore
if ($id_shop === null) if ($id_shop === null)
$id_shop = (int)Context::getContext()->shop->id; $id_shop = (int)Context::getContext()->shop->id;
if (!isset($this->routes[$id_shop])) if ($this->use_routes && !isset($this->routes[$id_shop]))
$this->loadRoutes($id_shop); $this->loadRoutes($id_shop);
if (!isset($this->routes[$id_shop][$id_lang][$route_id])) if (!isset($this->routes[$id_shop][$id_lang][$route_id]))
{ {
$query = http_build_query($params, '', '&'); $query = http_build_query($params, '', '&');
$index_link = $this->use_routes ? '' : 'index.php'; $index_link = $this->use_routes ? '' : 'index.php';
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((trim($route_id) == '') ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor; return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : 'index.php?controller='.$route_id.(($query) ? '&'.$query : '').$anchor;
} }
$route = $this->routes[$id_shop][$id_lang][$route_id]; $route = $this->routes[$id_shop][$id_lang][$route_id];
// Check required fields // Check required fields
+8 -14
View File
@@ -120,22 +120,16 @@ class ImageCore extends ObjectModel
* *
* @param integer $id_lang Language ID * @param integer $id_lang Language ID
* @param integer $id_product Product ID * @param integer $id_product Product ID
* @param integer $id_product_attribute Product Attribute ID
* @return array Images * @return array Images
*/ */
public static function getImages($id_lang, $id_product, $id_product_attribute = NULL) public static function getImages($id_lang, $id_product)
{ {
$attribute_filter = ($id_product_attribute ? ' AND ai.`id_product_attribute` = '.(int)$id_product_attribute : ''); return Db::getInstance()->executeS('
$sql = 'SELECT * SELECT *
FROM `'._DB_PREFIX_.'image` i FROM `'._DB_PREFIX_.'image` i
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)'; LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)
WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang.'
if ($id_product_attribute) ORDER BY i.`position` ASC');
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` ai ON (i.`id_image` = ai.`id_image`)';
$sql .= ' WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang . $attribute_filter.'
ORDER BY i.`position` ASC';
return Db::getInstance()->executeS($sql);
} }
/** /**
@@ -650,7 +644,7 @@ class ImageCore extends ObjectModel
*/ */
public static function testFileSystem() public static function testFileSystem()
{ {
$safe_mode = Tools::getSafeModeStatus(); $safe_mode = ini_get('safe_mode');
if ($safe_mode) if ($safe_mode)
return false; return false;
$folder1 = _PS_PROD_IMG_DIR_.'testfilesystem/'; $folder1 = _PS_PROD_IMG_DIR_.'testfilesystem/';
+37 -45
View File
@@ -111,22 +111,18 @@ class LanguageCore extends ObjectModel
$iso_code = $newIso ? $newIso : $this->iso_code; $iso_code = $newIso ? $newIso : $this->iso_code;
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code)) if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
{ mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
if (@mkdir(_PS_TRANSLATIONS_DIR_.$iso_code))
@chmod(_PS_TRANSLATIONS_DIR_.$iso_code, 0777);
}
foreach ($this->translationsFilesAndVars as $file => $var) foreach ($this->translationsFilesAndVars as $file => $var)
{ {
$path_file = _PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php'; $path_file = _PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php';
if (!file_exists($path_file)) if (!file_exists($path_file))
if ($file != 'tabs') if ($file != 'tabs')
@file_put_contents($path_file, '<?php file_put_contents($path_file, '<?php
global $'.$var.'; global $'.$var.';
$'.$var.' = array(); $'.$var.' = array();
?>'); ?>');
else else
@file_put_contents($path_file, '<?php file_put_contents($path_file, '<?php
$'.$var.' = array(); $'.$var.' = array();
return $'.$var.'; return $'.$var.';
?>'); ?>');
@@ -196,7 +192,7 @@ class LanguageCore extends ObjectModel
public function add($autodate = true, $nullValues = false, $only_add = false) public function add($autodate = true, $nullValues = false, $only_add = false)
{ {
if (!parent::add($autodate, $nullValues)) if (!parent::add($autodate))
return false; return false;
if ($only_add) if ($only_add)
@@ -206,9 +202,10 @@ class LanguageCore extends ObjectModel
$this->_generateFiles(); $this->_generateFiles();
// @todo Since a lot of modules are not in right format with their primary keys name, just get true ... // @todo Since a lot of modules are not in right format with their primary keys name, just get true ...
$this->loadUpdateSQL(); $resUpdateSQL = $this->loadUpdateSQL();
$resUpdateSQL = true;
return Tools::generateHtaccess(); Tools::generateHtaccess();
return $resUpdateSQL;
} }
public function toggleStatus() public function toggleStatus()
@@ -464,8 +461,7 @@ class LanguageCore extends ObjectModel
} }
closedir($handle); closedir($handle);
} }
if (is_writable($dir)) rmdir($dir);
rmdir($dir);
} }
public function delete() public function delete()
@@ -492,8 +488,7 @@ class LanguageCore extends ObjectModel
// Files deletion // Files deletion
foreach (Language::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file) foreach (Language::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
if (file_exists($key)) if (file_exists($key))
unlink($key); unlink($key);
$modList = scandir(_PS_MODULE_DIR_); $modList = scandir(_PS_MODULE_DIR_);
foreach ($modList as $mod) foreach ($modList as $mod)
{ {
@@ -515,32 +510,37 @@ class LanguageCore extends ObjectModel
Language::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code); Language::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code);
if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code)) if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
Language::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code); Language::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
$images = array(
'.jpg',
'-default-'.ImageType::getFormatedName('thickbox').'.jpg',
'-default-'.ImageType::getFormatedName('home').'.jpg',
'-default-'.ImageType::getFormatedName('large').'.jpg',
'-default-'.ImageType::getFormatedName('medium').'.jpg',
'-default-'.ImageType::getFormatedName('small').'.jpg'
);
$images_directories = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
foreach ($images_directories as $image_directory)
foreach ($images as $image)
{
if (file_exists($image_directory.$this->iso_code.$image))
unlink($image_directory.$this->iso_code.$image);
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
unlink(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg');
}
} }
if (!parent::delete()) if (!parent::delete())
return false; return false;
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
// delete images
$files_copy = array(
'/en.jpg',
'/en-default-'.ImageType::getFormatedName('thickbox').'.jpg',
'/en-default-'.ImageType::getFormatedName('home').'.jpg',
'/en-default-'.ImageType::getFormatedName('large').'.jpg',
'/en-default-'.ImageType::getFormatedName('medium').'.jpg',
'/en-default-'.ImageType::getFormatedName('small').'.jpg'
);
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
foreach ($tos as $to)
foreach ($files_copy as $file)
{
$name = str_replace('/en', ''.$this->iso_code, $file);
if (file_exists($to.$name))
unlink($to.$name);
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
unlink(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg');
}
}
return Tools::generateHtaccess(); return Tools::generateHtaccess();
} }
public function deleteSelection($selection) public function deleteSelection($selection)
{ {
if (!is_array($selection)) if (!is_array($selection))
@@ -549,10 +549,11 @@ class LanguageCore extends ObjectModel
$result = true; $result = true;
foreach ($selection as $id) foreach ($selection as $id)
{ {
$language = new Language($id); $this->id = (int)($id);
$result = $result && $language->delete(); $result = $result && $this->delete();
} }
Tools::generateHtaccess();
return $result; return $result;
} }
@@ -788,22 +789,13 @@ class LanguageCore extends ObjectModel
$lang_pack_ok = false; $lang_pack_ok = false;
$errors = array(); $errors = array();
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip'; $file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower($iso))) if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower($iso)))
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.'); $errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link)) elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.'); $errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip'))) elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip')))
if (!@file_put_contents($file, $content)) if (!@file_put_contents($file, $content))
{ $errors[] = Tools::displayError('Server does not have permissions for writing.');
if (is_writable(dirname($file)))
{
@unlink($file);
@file_put_contents($file, $content);
}
elseif (!is_writable($file))
$errors[] = Tools::displayError('Server does not have permissions for writing.').' ('.$file.')';
}
if (file_exists($file)) if (file_exists($file))
{ {
$gz = new Archive_Tar($file, true); $gz = new Archive_Tar($file, true);
+53 -34
View File
@@ -91,8 +91,12 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
$shop = new Shop($id_shop);
else
$shop = Context::getContext()->shop;
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); $url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($product)) if (!is_object($product))
{ {
@@ -159,7 +163,11 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($category)) if (!is_object($category))
$category = new Category($category, $id_lang); $category = new Category($category, $id_lang);
@@ -198,7 +206,11 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($cms_category)) if (!is_object($cms_category))
@@ -227,12 +239,19 @@ class LinkCore
* @param int $id_lang * @param int $id_lang
* @return string * @return string
*/ */
public function getCMSLink($cms, $alias = null, $ssl = null, $id_lang = null, $id_shop = null) public function getCMSLink($cms, $alias = null, $ssl = false, $id_lang = null, $id_shop = null)
{ {
$base = (($ssl && $this->ssl_enable) ? 'https://' : 'http://');
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
$url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop); if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = $base.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($cms)) if (!is_object($cms))
@@ -271,8 +290,11 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if ($id_shop === null)
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); $shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($supplier)) if (!is_object($supplier))
@@ -305,7 +327,11 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($manufacturer)) if (!is_object($manufacturer))
@@ -334,12 +360,18 @@ class LinkCore
* @param int $id_lang * @param int $id_lang
* @return string * @return string
*/ */
public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = null, $id_lang = null, $id_shop = null) public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = false, $id_lang = null, $id_shop = null)
{ {
$base = (($ssl && $this->ssl_enable) ? 'https://' : 'http://');
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
$url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop); if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = $base.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
// If the module has its own route ... just use it ! // If the module has its own route ... just use it !
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop)) if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop))
@@ -421,9 +453,10 @@ class LinkCore
* *
* @return string Page link * @return string Page link
*/ */
public function getPageLink($controller, $ssl = null, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null) public function getPageLink($controller, $ssl = false, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null)
{ {
$controller = Tools::strReplaceFirst('.php', '', $controller); $controller = Tools::strReplaceFirst('.php', '', $controller);
if (!$id_lang) if (!$id_lang)
$id_lang = (int)Context::getContext()->language->id; $id_lang = (int)Context::getContext()->language->id;
@@ -436,9 +469,16 @@ class LinkCore
parse_str($request, $request); parse_str($request, $request);
} }
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop); if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
return $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/'); $uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop);
$url = ($ssl && $this->ssl_enable) ? 'https://' : 'http://';
$url .= $shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/');
return $url;
} }
public function getCatImageLink($name, $id_category, $type = null) public function getCatImageLink($name, $id_category, $type = null)
@@ -602,26 +642,5 @@ class LinkCore
return Language::getIsoById($id_lang).'/'; return Language::getIsoById($id_lang).'/';
} }
protected function getBaseLink($id_shop = null, $ssl = null)
{
static $force_ssl = null;
if ($ssl === null)
{
if ($force_ssl === null)
$force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'));
$ssl = $force_ssl;
}
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
$shop = new Shop($id_shop);
else
$shop = Context::getContext()->shop;
$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
return $base.$shop->getBaseURI();
}
} }
-5
View File
@@ -150,11 +150,6 @@ class LoggerCore extends ObjectModel
return $this->hash; return $this->hash;
} }
public static function eraseAllLogs()
{
return Db::getInstance()->execute('TRUNCATE TABLE '._DB_PREFIX_.'log');
}
/** /**
* check if this log message already exists in database. * check if this log message already exists in database.
* *
+5 -82
View File
@@ -50,11 +50,9 @@ class MailCore
* @param bool $modeSMTP * @param bool $modeSMTP
* @param string $template_path * @param string $template_path
* @param bool $die * @param bool $die
* @param string $bcc Bcc recipient
*/ */
public static function Send($id_lang, $template, $subject, $template_vars, $to, public static function Send($id_lang, $template, $subject, $template_vars, $to,
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null)
{ {
$configuration = Configuration::getMultiple(array( $configuration = Configuration::getMultiple(array(
'PS_SHOP_EMAIL', 'PS_SHOP_EMAIL',
@@ -128,9 +126,9 @@ class MailCore
} }
/* Construct multiple recipients list if needed */ /* Construct multiple recipients list if needed */
$to_list = new Swift_RecipientList();
if (is_array($to) && isset($to)) if (is_array($to) && isset($to))
{ {
$to_list = new Swift_RecipientList();
foreach ($to as $key => $addr) foreach ($to as $key => $addr)
{ {
$to_name = null; $to_name = null;
@@ -148,26 +146,17 @@ class MailCore
if ($to_name == null) if ($to_name == null)
$to_name = $addr; $to_name = $addr;
/* Encode accentuated chars */ /* Encode accentuated chars */
if (function_exists('mb_encode_mimeheader')) $to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?=');
$to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8'));
else
$to_list->addTo($addr, self::mimeEncode($to_name));
} }
$to_plugin = $to[0]; $to_plugin = $to[0];
$to = $to_list;
} else { } else {
/* Simple recipient, one address */ /* Simple recipient, one address */
$to_plugin = $to; $to_plugin = $to;
if ($to_name == null) if ($to_name == null)
$to_name = $to; $to_name = $to;
if (function_exists('mb_encode_mimeheader')) $to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?=');
$to_list->addTo($to, mb_encode_mimeheader($to_name, 'utf-8'));
else
$to_list->addTo($to, self::mimeEncode($to_name));
} }
if(isset($bcc)) {
$to_list->addBcc($bcc);
}
$to = $to_list;
try { try {
/* Connect with the appropriate configuration */ /* Connect with the appropriate configuration */
if ($configuration['PS_MAIL_METHOD'] == 2) if ($configuration['PS_MAIL_METHOD'] == 2)
@@ -241,8 +230,6 @@ class MailCore
/* Create mail and attach differents parts */ /* Create mail and attach differents parts */
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject); $message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
$message->setCharset('utf-8');
/* Set Message-ID - getmypid() is blocked on some hosting */ /* Set Message-ID - getmypid() is blocked on some hosting */
$message->setId(Mail::generateId()); $message->setId(Mail::generateId());
@@ -385,68 +372,4 @@ class MailCore
return vsprintf("<%s.%d.%s@%s>", $midparams); return vsprintf("<%s.%d.%s@%s>", $midparams);
} }
public static function isMultibyte($data)
{
$length = strlen($data);
for ($i = 0; $i < $length; $i++)
{
$result = ord(($data[$i]));
if ($result > 128)
{
return true;
}
}
return false;
}
public static function mimeEncode($string, $charset = 'UTF-8', $newline = "\r\n")
{
if (!self::isMultibyte($string) && strlen($string) < 75)
{
return $string;
}
$charset = strtoupper($charset);
$start = '=?' . $charset . '?B?';
$end = '?=';
$sep = $end . $newline . ' ' . $start;
$length = 75 - strlen($start) - strlen($end);
$length = $length - ($length % 4);
if ($charset === 'UTF-8')
{
$parts = array();
$maxchars = floor(($length * 3) / 4);
$stringLength = strlen($string);
while ($stringLength > $maxchars)
{
$i = (int)$maxchars;
$result = ord($string[$i]);
while ($result >= 128 && $result <= 191)
{
$i--;
$result = ord($string[$i]);
}
$parts[] = base64_encode(substr($string, 0, $i));
$string = substr($string, $i);
$stringLength = strlen($string);
}
$parts[] = base64_encode($string);
$string = implode($sep, $parts);
}
else
{
$string = chunk_split(base64_encode($string), $length, $sep);
$string = preg_replace('/' . preg_quote($sep) . '$/', '', $string);
}
return $start . $string . $end;
}
} }
+1 -1
View File
@@ -79,7 +79,7 @@ class ManufacturerCore extends ObjectModel
// Lang fields // Lang fields
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'), 'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'), 'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 254),
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128), 'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255), 'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'), 'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
+2 -2
View File
@@ -39,7 +39,7 @@ class MediaCore
'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), 'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position','ui.button'), 'theme' => true), 'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true), 'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true), 'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true),
@@ -201,7 +201,7 @@ class MediaCore
if (!preg_match('/^http(s?):\/\//i', $file_uri) && !@filemtime($file_uri)) if (!preg_match('/^http(s?):\/\//i', $file_uri) && !@filemtime($file_uri))
return false; return false;
if (Context::getContext()->controller->controller_type == 'admin' && !array_key_exists('host', $url_data)) if (Context::getContext()->controller->controller_type == 'admin')
{ {
$js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri); $js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri);
$js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri; $js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri;
+2 -5
View File
@@ -68,11 +68,8 @@ class MetaCore extends ObjectModel
{ {
if ($file != 'index.php' && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages)) if ($file != 'index.php' && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages))
{ {
$class_name = str_replace('.php', '', $file); $reflection = new ReflectionClass(str_replace('.php', '', $file));
if (class_exists($class_name)) $properties = $reflection->getDefaultProperties();
$reflection = new ReflectionClass(str_replace('.php', '', $file));
if (isset($reflection) && $reflection)
$properties = $reflection->getDefaultProperties();
if (isset($properties['php_self'])) if (isset($properties['php_self']))
$selected_pages[$properties['php_self']] = $properties['php_self']; $selected_pages[$properties['php_self']] = $properties['php_self'];
else if (preg_match('/^[a-z0-9_.-]*\.php$/i', $file)) else if (preg_match('/^[a-z0-9_.-]*\.php$/i', $file))
+10 -11
View File
@@ -2468,9 +2468,8 @@ class ProductCore extends ObjectModel
if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product)) if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product))
die(Tools::displayError()); die(Tools::displayError());
// Initializations // Initializations
$id_group = (int)Group::getCurrent()->id; $id_group = (isset($context->customer) ? $context->customer->id_default_group : (int)Configuration::get('PS_CUSTOMER_GROUP'));
// If there is cart in context or if the specified id_cart is different from the context cart id // If there is cart in context or if the specified id_cart is different from the context cart id
if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart)) if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart))
@@ -2915,7 +2914,7 @@ class ProductCore extends ObjectModel
* @param Shop $shop * @param Shop $shop
* @return string * @return string
*/ */
public static function sqlStock($product_alias, $product_attribute = null, $inner_join = false, Shop $shop = null) public static function sqlStock($product_alias, $product_attribute = 0, $inner_join = false, Shop $shop = null)
{ {
$id_shop = ($shop !== null ? (int)$shop->id : null); $id_shop = ($shop !== null ? (int)$shop->id : null);
$sql = (($inner_join) ? ' INNER ' : ' LEFT ').' $sql = (($inner_join) ? ' INNER ' : ' LEFT ').'
@@ -3056,18 +3055,18 @@ class ProductCore extends ObjectModel
if (!Combination::isFeatureActive()) if (!Combination::isFeatureActive())
return array(); return array();
$sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name,
a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`,
IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`,
product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`, product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`,
product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type` pa.`minimal_quantity`, pa.`available_date`, ag.`group_type`
FROM `'._DB_PREFIX_.'product_attribute` pa FROM `'._DB_PREFIX_.'product_attribute` pa
'.Shop::addSqlAssociation('product_attribute', 'pa').' '.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Product::sqlStock('pa', 'pa').' '.Product::sqlStock('pa', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`) LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`) LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`) LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`) LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`) LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group`
'.Shop::addSqlAssociation('attribute', 'a').' '.Shop::addSqlAssociation('attribute', 'a').'
WHERE pa.`id_product` = '.(int)$this->id.' WHERE pa.`id_product` = '.(int)$this->id.'
AND al.`id_lang` = '.(int)$id_lang.' AND al.`id_lang` = '.(int)$id_lang.'
+4 -4
View File
@@ -299,10 +299,10 @@ class ProductDownloadCore extends ObjectModel
*/ */
public static function getNewFilename() public static function getNewFilename()
{ {
do { $ret = sha1(microtime());
$filename = sha1(microtime()); if (file_exists(_PS_DOWNLOAD_DIR_.$ret))
} while (file_exists(_PS_DOWNLOAD_DIR_.$filename)); $ret = ProductDownload::getNewFilename();
return $filename; return $ret;
} }
/** /**
+28 -25
View File
@@ -140,33 +140,36 @@ class SearchCore
$string = implode(' ', $processed_words); $string = implode(' ', $processed_words);
} }
// If the language is constituted with symbol and there is no "words", then split every chars if ($indexation)
if (in_array($iso_code, array('zh', 'tw', 'ja')) && function_exists('mb_strlen'))
{ {
// Cut symbols from letters // If the language is constituted with symbol and there is no "words", then split every chars
$symbols = ''; if (in_array($iso_code, array('zh', 'tw', 'ja')) && function_exists('mb_strlen'))
$letters = '';
foreach (explode(' ', $string) as $mb_word)
if (strlen(Tools::replaceAccentedChars($mb_word)) == mb_strlen(Tools::replaceAccentedChars($mb_word)))
$letters .= $mb_word.' ';
else
$symbols .= $mb_word.' ';
if (preg_match_all('/./u', $symbols, $matches))
$symbols = implode(' ', $matches[0]);
$string = $letters.$symbols;
}
elseif ($indexation)
{
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN');
if ($minWordLen > 1)
{ {
$minWordLen -= 1; // Cut symbols from letters
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}(?=\s)/Su', ' ', $string); $symbols = '';
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}(?=\s)/Su', '', $string); $letters = '';
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}$/Su', '', $string); foreach (explode(' ', $string) as $mb_word)
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}$/Su', '', $string); if (strlen(Tools::replaceAccentedChars($mb_word)) == mb_strlen(Tools::replaceAccentedChars($mb_word)))
$letters .= $mb_word.' ';
else
$symbols .= $mb_word.' ';
if (preg_match_all('/./u', $symbols, $matches))
$symbols = implode(' ', $matches[0]);
$string = $letters.$symbols;
}
else
{
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN');
if ($minWordLen > 1)
{
$minWordLen -= 1;
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}(?=\s)/Su', ' ', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}(?=\s)/Su', '', $string);
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
}
} }
} }
+1 -1
View File
@@ -72,7 +72,7 @@ class SupplierCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields // Lang fields
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'), 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128), 'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255), 'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255), 'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+88 -59
View File
@@ -1260,13 +1260,6 @@ class ToolsCore
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1); return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
} }
public static function ucwords($str)
{
if (function_exists('mb_convert_case'))
return mb_convert_case($str, MB_CASE_TITLE);
return ucwords(strtolower($str));
}
public static function orderbyPrice(&$array, $order_way) public static function orderbyPrice(&$array, $order_way)
{ {
foreach ($array as &$row) foreach ($array as &$row)
@@ -1408,9 +1401,26 @@ class ToolsCore
public static function copy($source, $destination, $stream_context = null) public static function copy($source, $destination, $stream_context = null)
{ {
if (is_null($stream_context) && !preg_match('/^https?:\/\//', $source)) if ($stream_context == null && preg_match('/^https?:\/\//', $source))
return @copy($source, $destination); $stream_context = @stream_context_create(array('http' => array('timeout' => 10)));
return @file_put_contents($destination, Tools::file_get_contents($source, false, $stream_context));
if (in_array(@ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $source))
return @copy($source, $destination, $stream_context);
elseif (function_exists('curl_init'))
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $source);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$opts = stream_context_get_options($stream_context);
$content = curl_exec($curl);
curl_close($curl);
return file_put_contents($destination, $content);
}
else
return false;
} }
/** /**
@@ -1586,8 +1596,7 @@ class ToolsCore
if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1))) if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
return constant('_MEDIA_SERVER_'.$id_media_server.'_'); return constant('_MEDIA_SERVER_'.$id_media_server.'_');
return Tools::getShopDomain();
return Tools::usingSecureMode() ? Tools::getShopDomainSSL() : Tools::getShopDomain();
} }
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null) public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
@@ -1667,9 +1676,6 @@ class ToolsCore
// RewriteEngine // RewriteEngine
fwrite($write_fd, "<IfModule mod_rewrite.c>\n"); fwrite($write_fd, "<IfModule mod_rewrite.c>\n");
// Ensure HTTP_MOD_REWRITE variable is set in environment
fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n");
// Disable multiviews ? // Disable multiviews ?
if ($disable_multiviews) if ($disable_multiviews)
fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n"); fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
@@ -2472,66 +2478,89 @@ exit;
return preg_replace('/\\\[px]\{[a-z]\}{1,2}|(\/[a-z]*)u([a-z]*)$/i', "$1$2", $pattern); return preg_replace('/\\\[px]\{[a-z]\}{1,2}|(\/[a-z]*)u([a-z]*)$/i', "$1$2", $pattern);
} }
protected static $is_addons_up = true;
public static function addonsRequest($request, $params = array()) public static function addonsRequest($request, $params = array())
{ {
if (!self::$is_addons_up) $addons_url = 'api.addons.prestashop.com';
return false; $postData = '';
$postDataArray = array(
$postData = http_build_query(array(
'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_, 'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_,
'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code), 'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code),
'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))), 'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
'shop_url' => isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain(), 'shop_url' => urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain()),
'mail' => isset($params['email']) ? $params['email'] : Configuration::get('email') 'mail' => urlencode(isset($params['email']) ? $params['email'] : Configuration::get('email'))
)); );
foreach ($postDataArray as $postDataKey => $postDataValue)
$postData .= '&'.$postDataKey.'='.$postDataValue;
$postData = ltrim($postData, '&');
$protocols = array('https'); // Config for each request
switch ($request) if ($request == 'native')
{ {
case 'native': // Define protocol accepted and post data values for this request
$protocols[] = 'http'; $protocolsList = array('https://' => 443, 'http://' => 80);
$postData .= '&method=listing&action=native'; $postData .= '&method=listing&action=native';
break; }
case 'must-have': if ($request == 'must-have')
$protocols[] = 'http'; {
$postData .= '&method=listing&action=must-have'; // Define protocol accepted and post data values for this request
break; $protocolsList = array('https://' => 443, 'http://' => 80);
case 'customer': $postData .= '&method=listing&action=must-have';
$postData .= '&method=listing&action=customer&username='.urlencode(trim(Context::getContext()->cookie->username_addons)).'&password='.urlencode(trim(Context::getContext()->cookie->password_addons)); }
break; if ($request == 'customer')
case 'check_customer': {
$postData .= '&method=check_customer&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']); // Define protocol accepted and post data values for this request
break; $protocolsList = array('https://' => 443);
case 'module': $postData .= '&method=listing&action=customer&username='.urlencode(trim(Context::getContext()->cookie->username_addons)).'&password='.urlencode(trim(Context::getContext()->cookie->password_addons));
}
if ($request == 'check_customer')
{
// Define protocol accepted and post data values for this request
$protocolsList = array('https://' => 443);
$postData .= '&method=check_customer&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
}
if ($request == 'module')
{
// Define protocol accepted and post data values for this request
if (isset($params['username_addons']) && isset($params['password_addons']))
{
$protocolsList = array('https://' => 443);
$postData .= '&method=module&id_module='.urlencode($params['id_module']).'&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
}
else
{
$protocolsList = array('https://' => 443, 'http://' => 80);
$postData .= '&method=module&id_module='.urlencode($params['id_module']); $postData .= '&method=module&id_module='.urlencode($params['id_module']);
if (isset($params['username_addons']) && isset($params['password_addons'])) }
$postData .= '&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
else
$protocols[] = 'http';
break;
case 'install-modules':
$protocols[] = 'http';
$postData .= '&method=listing&action=install-modules';
break;
default:
return false;
} }
$context = stream_context_create(array( if ($request == 'install-modules')
'http' => array( {
// Define protocol accepted and post data values for this request
$protocolsList = array('https://' => 443, 'http://' => 80);
$postData .= '&method=listing&action=install-modules';
}
// Make the request
$opts = array(
'http'=>array(
'method'=> 'POST', 'method'=> 'POST',
'content' => $postData, 'content' => $postData,
'header' => 'Content-type: application/x-www-form-urlencoded', 'header' => 'Content-type: application/x-www-form-urlencoded',
'timeout' => 5, 'timeout' => 5,
) )
)); );
foreach ($protocols as $protocol) $context = stream_context_create($opts);
if ($content = Tools::file_get_contents($protocol.'://api.addons.prestashop.com', false, $context)) foreach ($protocolsList as $protocol => $port)
return $content; {
$content = Tools::file_get_contents($protocol.$addons_url, false, $context);
self::$is_addons_up = false; // If content returned, we cache it
if ($content)
return $content;
}
// No content, return false
return false; return false;
} }
+1 -1
View File
@@ -592,7 +592,7 @@ class ValidateCore
*/ */
public static function isOrderBy($order) public static function isOrderBy($order)
{ {
return preg_match('/^[a-zA-Z0-9.!_-]+$/', $order); return preg_match('/^[a-zA-Z0-9._-]+$/', $order);
} }
/** /**
+2 -5
View File
@@ -34,12 +34,9 @@ class CacheApcCore extends Cache
public function __construct() public function __construct()
{ {
$this->keys = array(); $this->keys = array();
$cache_info = apc_cache_info((extension_loaded('apcu') === true )? '' : 'user' ); $cache_info = apc_cache_info('user');
foreach ($cache_info['cache_list'] as $entry) foreach ($cache_info['cache_list'] as $entry)
if ( extension_loaded('apcu') === true ) $this->keys[$entry['info']] = $entry['ttl'];
$this->keys[$entry['key']] = $entry['ttl'];
else
$this->keys[$entry['info']] = $entry['ttl'];
} }
/** /**
+1 -1
View File
@@ -49,7 +49,7 @@ class CacheMemcacheCore extends Cache
if(is_array($servers) && count($servers) > 0) if(is_array($servers) && count($servers) > 0)
{ {
$this->keys = @$this->memcache->get(_COOKIE_IV_); $this->keys = $this->memcache->get(_COOKIE_IV_);
if (!is_array($this->keys)) if (!is_array($this->keys))
$this->keys = array(); $this->keys = array();
} }
+28 -105
View File
@@ -45,7 +45,7 @@ class AdminControllerCore extends Controller
public $template = 'content.tpl'; public $template = 'content.tpl';
/** @var string Associated table name */ /** @var string Associated table name */
public $table = 'configuration'; public $table;
public $list_id; public $list_id;
@@ -387,7 +387,7 @@ class AdminControllerCore extends Controller
$filter = ''; $filter = '';
foreach ($this->fields_list AS $field => $t) foreach ($this->fields_list AS $field => $t)
{ {
if ($val = Tools::getValue($this->table.'Filter_'.$field)) if ($val = htmlspecialchars(Tools::getValue($this->table.'Filter_'.$field), ENT_QUOTES, 'UTF-8'))
{ {
if(!is_array($val) && !empty($val)) if(!is_array($val) && !empty($val))
$filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : '; $filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : ';
@@ -395,13 +395,13 @@ class AdminControllerCore extends Controller
if (isset($t['type']) && $t['type'] == 'bool') if (isset($t['type']) && $t['type'] == 'bool')
$filter .= ((bool)$val) ? $this->l('yes') : $this->l('no'); $filter .= ((bool)$val) ? $this->l('yes') : $this->l('no');
elseif(is_string($val)) elseif(is_string($val))
$filter .= htmlspecialchars($val, ENT_QUOTES, 'UTF-8'); $filter .= $val;
elseif(is_array($val)) elseif(is_array($val))
{ {
$tmp = ''; $tmp = '';
foreach($val as $v) foreach($val as $v)
if(is_string($v) && !empty($v)) if(is_string($v) && !empty($v))
$tmp .= ' - '.htmlspecialchars($v, ENT_QUOTES, 'UTF-8'); $tmp .= ' - '.$v;
if(Tools::strlen($tmp)) if(Tools::strlen($tmp))
{ {
$tmp = ltrim($tmp, ' - '); $tmp = ltrim($tmp, ' - ');
@@ -658,69 +658,6 @@ class AdminControllerCore extends Controller
$this->layout = 'layout-export.tpl'; $this->layout = 'layout-export.tpl';
} }
public function processExportExcel()
{
// clean buffer
if (ob_get_level() && ob_get_length() > 0)
ob_clean();
$this->getList($this->context->language->id);
if (!count($this->_list))
return;
if (!extension_loaded('zip')) {
$this->displayWarning($this->l('Module php_zip must be enabled in order to use Excel export feature.'));
return;
}
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8');
header('Cache-Control: no-store, no-cache');
header('Content-disposition: attachment; filename="'.$this->table.'_'.date('Y-m-d_His').'.xlsx"');
$headers = array();
foreach ($this->fields_list as $datas)
$headers[] = Tools::htmlentitiesDecodeUTF8($datas['title']);
$content = array();
foreach ($this->_list as $i => $row)
{
$content[$i] = array();
$path_to_image = false;
foreach ($this->fields_list as $key => $params)
{
$field_value = isset($row[$key]) ? Tools::htmlentitiesDecodeUTF8($row[$key]) : '';
if ($key == 'image')
{
if ($params['image'] != 'p' || Configuration::get('PS_LEGACY_IMAGES'))
$path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.$row['id_'.$this->table].(isset($row['id_image']) ? '-'.(int)$row['id_image'] : '').'.'.$this->imageType;
else
$path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.Image::getImgFolderStatic($row['id_image']).(int)$row['id_image'].'.'.$this->imageType;
if ($path_to_image)
$field_value = $path_to_image;
}
$content[$i][] = $field_value;
}
}
require_once(_PS_ROOT_DIR_.'/tools/phpexcel/PHPExcel.php');
/** Create a new PHPExcel Object **/
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getSheet(0);
$worksheet->fromArray(
$headers, // The data to set
NULL, // Array values with this value will not be set
'A1' // Top left coordinate of the worksheet range where
// we want to set these values (default is A1)
);
$worksheet->fromArray(
$content,
NULL,
'A2'
);
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save('php://output');
die();
}
/** /**
* Object Delete * Object Delete
*/ */
@@ -789,8 +726,6 @@ class AdminControllerCore extends Controller
*/ */
public function processAdd() public function processAdd()
{ {
if (!isset($this->className) || empty($this->className))
return false;
/* Checking fields validity */ /* Checking fields validity */
$this->validateRules(); $this->validateRules();
if (count($this->errors) <= 0) if (count($this->errors) <= 0)
@@ -1189,16 +1124,11 @@ class AdminControllerCore extends Controller
'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token, 'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token,
'desc' => $this->l('Add new') 'desc' => $this->l('Add new')
); );
if ($this->allow_export) { if ($this->allow_export)
$this->toolbar_btn['export'] = array( $this->toolbar_btn['export'] = array(
'href' => self::$currentIndex.'&amp;export'.$this->table.'&amp;token='.$this->token, 'href' => self::$currentIndex.'&amp;export'.$this->table.'&amp;token='.$this->token,
'desc' => $this->l('Export') 'desc' => $this->l('Export')
); );
$this->toolbar_btn['export-excel'] = array(
'href' => self::$currentIndex.'&amp;export-excel'.$this->table.'&amp;token='.$this->token,
'desc' => $this->l('Export (Excel)')
);
}
} }
$this->addToolBarModulesListButton(); $this->addToolBarModulesListButton();
} }
@@ -1212,8 +1142,6 @@ class AdminControllerCore extends Controller
*/ */
protected function loadObject($opt = false) protected function loadObject($opt = false)
{ {
if (!isset($this->className) || empty($this->className))
return true;
$id = (int)Tools::getValue($this->identifier); $id = (int)Tools::getValue($this->identifier);
if ($id && Validate::isUnsignedId($id)) if ($id && Validate::isUnsignedId($id))
{ {
@@ -1607,23 +1535,21 @@ class AdminControllerCore extends Controller
protected function addToolBarModulesListButton() protected function addToolBarModulesListButton()
{ {
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400)) if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400))
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native')); file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
$country_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST); $country_module_list_xml = simplexml_load_file(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST);
if (!empty($country_module_list) && $country_module_list_xml = simplexml_load_string($country_module_list)) $country_module_list = array();
{
$country_module_list_array = array();
foreach ($country_module_list_xml->module as $k => $m) foreach ($country_module_list_xml->module as $k => $m)
$country_module_list_array[] = (string)$m->name; $country_module_list[] = (string)$m->name;
$this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $country_module_list_array); $this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $country_module_list);
}
if (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list'])) if (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list']))
$this->toolbar_btn['modules-list'] = array( $this->toolbar_btn['modules-list'] = array(
'href' => '#', 'href' => '#',
'desc' => $this->l('Modules List') 'desc' => $this->l('Modules List')
); );
} }
/** /**
@@ -2125,11 +2051,6 @@ class AdminControllerCore extends Controller
if ($this->tabAccess['view'] === '1') if ($this->tabAccess['view'] === '1')
$this->action = 'export'; $this->action = 'export';
} }
elseif (isset($_GET['export-excel'.$this->table]))
{
if ($this->tabAccess['view'] === '1')
$this->action = 'exportExcel';
}
/* Cancel all filters for this tab */ /* Cancel all filters for this tab */
elseif (isset($_POST['submitReset'.$this->list_id])) elseif (isset($_POST['submitReset'.$this->list_id]))
$this->action = 'reset_filters'; $this->action = 'reset_filters';
@@ -2232,11 +2153,8 @@ class AdminControllerCore extends Controller
|| !Validate::isUnsignedId($id_lang)) || !Validate::isUnsignedId($id_lang))
throw new PrestaShopException('get list params is not valid'); throw new PrestaShopException('get list params is not valid');
if (!isset($this->fields_list[$order_by]['order_key']) && isset($this->fields_list[$order_by]['filter_key'])) if (isset($this->fields_list[$order_by]) && isset($this->fields_list[$order_by]['filter_key']))
$this->fields_list[$order_by]['order_key'] = $this->fields_list[$order_by]['filter_key']; $order_by = $this->fields_list[$order_by]['filter_key'];
if (isset($this->fields_list[$order_by]) && isset($this->fields_list[$order_by]['order_key']))
$order_by = $this->fields_list[$order_by]['order_key'];
/* Determine offset from current page */ /* Determine offset from current page */
if ((isset($_POST['submitFilter'.$this->list_id]) || if ((isset($_POST['submitFilter'.$this->list_id]) ||
@@ -2248,14 +2166,15 @@ class AdminControllerCore extends Controller
/* Cache */ /* Cache */
$this->_lang = (int)$id_lang; $this->_lang = (int)$id_lang;
$this->_orderBy = $order_by;
if (preg_match('/[.!]/', $order_by)) if (preg_match('/[.!]/', $order_by))
{ {
$order_by_split = preg_split('/[.!]/', $order_by); $order_by_split = preg_split('/[.!]/', $order_by);
$order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`'; $order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`';
$this->_orderBy = (isset($order_by_split) && isset($order_by_split[1])) ? $order_by_split[1] : $order_by;
} }
else
$this->_orderBy = $order_by;
$this->_orderWay = Tools::strtoupper($order_way); $this->_orderWay = Tools::strtoupper($order_way);
/* SQL table : orders, but class name is Order */ /* SQL table : orders, but class name is Order */
@@ -2482,7 +2401,7 @@ class AdminControllerCore extends Controller
public function getFieldValue($obj, $key, $id_lang = null) public function getFieldValue($obj, $key, $id_lang = null)
{ {
if ($id_lang) if ($id_lang)
$default_value = (isset($obj->id) && $obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false; $default_value = ($obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false;
else else
$default_value = isset($obj->{$key}) ? $obj->{$key} : false; $default_value = isset($obj->{$key}) ? $obj->{$key} : false;
@@ -3021,17 +2940,21 @@ class AdminControllerCore extends Controller
public function isFresh($file, $timeout = 604800000) public function isFresh($file, $timeout = 604800000)
{ {
if (file_exists(_PS_ROOT_DIR_.$file) && filesize(_PS_ROOT_DIR_.$file) > 0) if (file_exists(_PS_ROOT_DIR_.$file))
{
if (filesize(_PS_ROOT_DIR_.$file) < 1)
return false;
return ((time() - filemtime(_PS_ROOT_DIR_.$file)) < $timeout); return ((time() - filemtime(_PS_ROOT_DIR_.$file)) < $timeout);
return false; }
else
return false;
} }
protected static $is_prestashop_up = true;
public function refresh($file_to_refresh, $external_file) public function refresh($file_to_refresh, $external_file)
{ {
if (self::$is_prestashop_up && $content = Tools::file_get_contents($external_file)) $content = Tools::file_get_contents($external_file);
if ($content)
return (bool)file_put_contents(_PS_ROOT_DIR_.$file_to_refresh, $content); return (bool)file_put_contents(_PS_ROOT_DIR_.$file_to_refresh, $content);
self::$is_prestashop_up = false;
return false; return false;
} }
+4 -8
View File
@@ -65,9 +65,6 @@ class FrontControllerCore extends Controller
parent::__construct(); parent::__construct();
if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'))
$this->ssl = true;
if (isset($useSSL)) if (isset($useSSL))
$this->ssl = $useSSL; $this->ssl = $useSSL;
else else
@@ -148,6 +145,8 @@ class FrontControllerCore extends Controller
// @TODO This method must be moved into switchLanguage // @TODO This method must be moved into switchLanguage
Tools::setCookieLanguage($this->context->cookie); Tools::setCookieLanguage($this->context->cookie);
$currency = Tools::setCurrency($this->context->cookie);
$protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://'; $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; $useSSL = ((isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED')) || Tools::usingSecureMode()) ? true : false;
$protocol_content = ($useSSL) ? 'https://' : 'http://'; $protocol_content = ($useSSL) ? 'https://' : 'http://';
@@ -168,8 +167,6 @@ class FrontControllerCore extends Controller
if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault)) if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault))
$this->context->country = $newDefault; $this->context->country = $newDefault;
$currency = Tools::setCurrency($this->context->cookie);
if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id))) if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id)))
{ {
$this->context->customer->logout(); $this->context->customer->logout();
@@ -515,7 +512,7 @@ class FrontControllerCore extends Controller
if (Configuration::get('PS_CSS_THEME_CACHE')) if (Configuration::get('PS_CSS_THEME_CACHE'))
$this->css_files = Media::cccCSS($this->css_files); $this->css_files = Media::cccCSS($this->css_files);
//JS compressor management //JS compressor management
if (Configuration::get('PS_JS_THEME_CACHE') && !$this->context->getMobileDevice()) if (Configuration::get('PS_JS_THEME_CACHE'))
$this->js_files = Media::cccJs($this->js_files); $this->js_files = Media::cccJs($this->js_files);
} }
@@ -600,7 +597,7 @@ class FrontControllerCore extends Controller
if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit')) if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit'))
return; return;
$match_url = (Configuration::get('PS_SSL_ENABLED') && ($this->ssl || Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $match_url = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$match_url = rawurldecode($match_url); $match_url = rawurldecode($match_url);
if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonical_url), '/').'([&?].*)?$/', $match_url)) if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonical_url), '/').'([&?].*)?$/', $match_url))
{ {
@@ -670,7 +667,6 @@ class FrontControllerCore extends Controller
} }
} }
} }
if (isset($this->context->cookie->iso_code_country) && $this->context->cookie->iso_code_country && !Validate::isLanguageIsoCode($this->context->cookie->iso_code_country)) if (isset($this->context->cookie->iso_code_country) && $this->context->cookie->iso_code_country && !Validate::isLanguageIsoCode($this->context->cookie->iso_code_country))
$this->context->cookie->iso_code_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')); $this->context->cookie->iso_code_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
if (isset($this->context->cookie->iso_code_country) && ($id_country = Country::getByIso(strtoupper($this->context->cookie->iso_code_country)))) if (isset($this->context->cookie->iso_code_country) && ($id_country = Country::getByIso(strtoupper($this->context->cookie->iso_code_country))))
+2 -2
View File
@@ -35,10 +35,10 @@ class HelperFormCore extends Helper
/** @var array of forms fields */ /** @var array of forms fields */
protected $fields_form = array(); protected $fields_form = array();
/** @var array values of form fields */ /** @var array values of form fields */
public $fields_value = array(); public $fields_value = array();
public $table = 'configuration'; public $table;
public $name_controller = ''; public $name_controller = '';
/** @var string if not null, a title will be added on that list */ /** @var string if not null, a title will be added on that list */
+4 -4
View File
@@ -136,9 +136,6 @@ class HelperListCore extends Helper
$this->_list = $list; $this->_list = $list;
$this->fields_list = $fields_display; $this->fields_list = $fields_display;
$this->orderBy = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderBy);
$this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay);
// Display list header (filtering, pagination and column names) // Display list header (filtering, pagination and column names)
$tpl_vars['header'] = $this->displayListHeader(); $tpl_vars['header'] = $this->displayListHeader();
@@ -459,7 +456,7 @@ class HelperListCore extends Helper
); );
if ($this->specificConfirmDelete !== false) if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\'')); $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\'');
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data)); $tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
@@ -525,6 +522,9 @@ class HelperListCore extends Helper
isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null
); );
// Cleaning links
if (Tools::getValue($this->table.'Orderby') && Tools::getValue($this->table.'Orderway'))
$this->currentIndex = preg_replace('/&'.$this->table.'Orderby=([a-z _]*)&'.$this->table.'Orderway=([a-z]*)/i', '', $this->currentIndex);
if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1)) if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1))
$table_id = substr($this->identifier, 3, strlen($this->identifier)); $table_id = substr($this->identifier, 3, strlen($this->identifier));
+61 -100
View File
@@ -119,9 +119,6 @@ abstract class ModuleCore
/** @var Smarty_Data */ /** @var Smarty_Data */
protected $smarty; protected $smarty;
/** @var currentSmartySubTemplate */
protected $current_subtemplate = null;
const CACHE_FILE_MODULES_LIST = '/config/xml/modules_list.xml'; const CACHE_FILE_MODULES_LIST = '/config/xml/modules_list.xml';
@@ -302,7 +299,7 @@ abstract class ModuleCore
$this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left'); $this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left');
} }
if (isset($upgrade_detail['duplicate']) && $upgrade_detail['duplicate']) if ($upgrade_detail['duplicate'])
$this->_errors[] = sprintf(Tools::displayError('Module %s cannot be upgraded this time: please refresh this page to update it.'), $this->name); $this->_errors[] = sprintf(Tools::displayError('Module %s cannot be upgraded this time: please refresh this page to update it.'), $this->name);
else else
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off'); $this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
@@ -938,7 +935,7 @@ abstract class ModuleCore
public static function configXmlStringFormat($string) public static function configXmlStringFormat($string)
{ {
return Tools::htmlentitiesDecodeUTF8($string); return str_replace('\'', '\\\'', Tools::htmlentitiesDecodeUTF8($string));
} }
@@ -1630,18 +1627,15 @@ abstract class ModuleCore
protected function getCacheId($name = null) protected function getCacheId($name = null)
{ {
$cache_array = array(); $cache_array = array(
$cache_array[] = $name !== null ? $name : $this->name; $name !== null ? $name : $this->name,
if (Configuration::get('PS_SSL_ENABLED')) (int)Tools::usingSecureMode(),
$cache_array[] = (int)Tools::usingSecureMode(); (int)$this->context->shop->id,
if (Shop::isFeatureActive()) (int)Group::getCurrent()->id,
$cache_array[] = (int)$this->context->shop->id; (int)$this->context->language->id,
$cache_array[] = (int)Group::getCurrent()->id; (int)$this->context->currency->id,
if (Language::isMultiLanguageActivated()) (int)$this->context->country->id
$cache_array[] = (int)$this->context->language->id; );
if (Currency::isMultiCurrencyActivated())
$cache_array[] = (int)$this->context->currency->id;
$cache_array[] = (int)$this->context->country->id;
return implode('|', $cache_array); return implode('|', $cache_array);
} }
@@ -1659,36 +1653,21 @@ abstract class ModuleCore
if ($cacheId !== null) if ($cacheId !== null)
Tools::enableCache(); Tools::enableCache();
$result = $this->getCurrentSubTemplate($template, $cacheId, $compileId)->fetch(); $smarty_subtemplate = $this->context->smarty->createTemplate(
$this->getTemplatePath($template),
$cacheId,
$compileId,
$this->smarty
);
$result = $smarty_subtemplate->fetch();
if ($cacheId !== null) if ($cacheId !== null)
Tools::restoreCacheSettings(); Tools::restoreCacheSettings();
$this->resetCurrentSubTemplate($template, $cacheId, $compileId);
return $result; return $result;
} }
} }
protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null)
{
if (!isset($this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id]))
{
$this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id] = $this->context->smarty->createTemplate(
$this->getTemplatePath($template),
$cache_id,
$compile_id,
$this->smarty
);
}
return $this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id];
}
protected function resetCurrentSubTemplate($template, $cache_id, $compile_id)
{
$this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id] = null;
}
/** /**
* Get realpath of a template of current module (check if template is overriden too) * Get realpath of a template of current module (check if template is overriden too)
* *
@@ -1704,12 +1683,10 @@ abstract class ModuleCore
if ($overloaded) if ($overloaded)
return $overloaded; return $overloaded;
elseif (file_exists(_PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template)) else if (file_exists(_PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template))
return _PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template; return _PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template;
elseif (file_exists(_PS_MODULE_DIR_.$this->name.'/'.$template))
return _PS_MODULE_DIR_.$this->name.'/'.$template;
else else
return null; return _PS_MODULE_DIR_.$this->name.'/'.$template;
} }
protected function _getApplicableTemplateDir($template) protected function _getApplicableTemplateDir($template)
@@ -1719,8 +1696,10 @@ abstract class ModuleCore
public function isCached($template, $cacheId = null, $compileId = null) public function isCached($template, $cacheId = null, $compileId = null)
{ {
$context = Context::getContext();
Tools::enableCache(); Tools::enableCache();
$is_cached = $this->getCurrentSubTemplate($this->getTemplatePath($template), $cacheId, $compileId)->isCached($this->getTemplatePath($template), $cacheId, $compileId); $is_cached = $context->smarty->isCached($this->getTemplatePath($template), $cacheId, $compileId);
Tools::restoreCacheSettings(); Tools::restoreCacheSettings();
return $is_cached; return $is_cached;
@@ -1729,8 +1708,6 @@ abstract class ModuleCore
protected function _clearCache($template, $cache_id = null, $compile_id = null) protected function _clearCache($template, $cache_id = null, $compile_id = null)
{ {
Tools::enableCache(); Tools::enableCache();
if ($cache_id === null)
$cache_id = Module::getCacheId($this->name);
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath($template), $cache_id, $compile_id); Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath($template), $cache_id, $compile_id);
Tools::restoreCacheSettings(); Tools::restoreCacheSettings();
} }
@@ -1749,15 +1726,7 @@ abstract class ModuleCore
<need_instance>'.(int)$this->need_instance.'</need_instance>'.(isset($this->limited_countries) ? "\n\t".'<limited_countries>'.(count($this->limited_countries) == 1 ? $this->limited_countries[0] : '').'</limited_countries>' : '').' <need_instance>'.(int)$this->need_instance.'</need_instance>'.(isset($this->limited_countries) ? "\n\t".'<limited_countries>'.(count($this->limited_countries) == 1 ? $this->limited_countries[0] : '').'</limited_countries>' : '').'
</module>'; </module>';
if (is_writable(_PS_MODULE_DIR_.$this->name.'/')) if (is_writable(_PS_MODULE_DIR_.$this->name.'/'))
{ file_put_contents(_PS_MODULE_DIR_.$this->name.'/config.xml', $xml);
$file = _PS_MODULE_DIR_.$this->name.'/config.xml';
if (!@file_put_contents($file, $xml))
if (!is_writable($file))
{
@unlink($file);
@file_put_contents($file, $xml);
}
}
} }
/** /**
@@ -1982,43 +1951,7 @@ abstract class ModuleCore
$path = Autoload::getInstance()->getClassPath($classname.'Core'); $path = Autoload::getInstance()->getClassPath($classname.'Core');
// Check if there is already an override file, if not, we just need to copy the file // Check if there is already an override file, if not, we just need to copy the file
if (Autoload::getInstance()->getClassPath($classname)) if (!($classpath = Autoload::getInstance()->getClassPath($classname)))
{
// Check if override file is writable
$override_path = _PS_ROOT_DIR_.'/'.Autoload::getInstance()->getClassPath($classname);
if ((!file_exists($override_path) && !is_writable(dirname($override_path))) || (file_exists($override_path) && !is_writable($override_path)))
throw new Exception(sprintf(Tools::displayError('file (%s) not writable'), $override_path));
// Get a uniq id for the class, because you can override a class (or remove the override) twice in the same session and we need to avoid redeclaration
do $uniq = uniqid();
while (class_exists($classname.'OverrideOriginal_remove', false));
// Make a reflection of the override class and the module override class
$override_file = file($override_path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal'.$uniq), implode('', $override_file)));
$override_class = new ReflectionClass($classname.'OverrideOriginal'.$uniq);
$module_file = file($this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override'.$uniq), implode('', $module_file)));
$module_class = new ReflectionClass($classname.'Override'.$uniq);
// Check if none of the methods already exists in the override class
foreach ($module_class->getMethods() as $method)
if ($override_class->hasMethod($method->getName()))
throw new Exception(sprintf(Tools::displayError('The method %1$s in the class %2$s is already overriden.'), $method->getName(), $classname));
// Check if none of the properties already exists in the override class
foreach ($module_class->getProperties() as $property)
if ($override_class->hasProperty($property->getName()))
throw new Exception(sprintf(Tools::displayError('The property %1$s in the class %2$s is already defined.'), $property->getName(), $classname));
// Insert the methods from module override in override
$copy_from = array_slice($module_file, $module_class->getStartLine() + 1, $module_class->getEndLine() - $module_class->getStartLine() - 2);
array_splice($override_file, $override_class->getEndLine() - 1, 0, $copy_from);
$code = implode('', $override_file);
file_put_contents($override_path, $code);
}
else
{ {
$override_src = $this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path; $override_src = $this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path;
$override_dest = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'override'.DIRECTORY_SEPARATOR.$path; $override_dest = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'override'.DIRECTORY_SEPARATOR.$path;
@@ -2027,7 +1960,39 @@ abstract class ModuleCore
copy($override_src, $override_dest); copy($override_src, $override_dest);
// Re-generate the class index // Re-generate the class index
Autoload::getInstance()->generateIndex(); Autoload::getInstance()->generateIndex();
return true;
} }
// Check if override file is writable
$override_path = _PS_ROOT_DIR_.'/'.Autoload::getInstance()->getClassPath($classname);
if ((!file_exists($override_path) && !is_writable(dirname($override_path))) || (file_exists($override_path) && !is_writable($override_path)))
throw new Exception(sprintf(Tools::displayError('file (%s) not writable'), $override_path));
// Make a reflection of the override class and the module override class
$override_file = file($override_path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal'), implode('', $override_file)));
$override_class = new ReflectionClass($classname.'OverrideOriginal');
$module_file = file($this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override'), implode('', $module_file)));
$module_class = new ReflectionClass($classname.'Override');
// Check if none of the methods already exists in the override class
foreach ($module_class->getMethods() as $method)
if ($override_class->hasMethod($method->getName()))
throw new Exception(sprintf(Tools::displayError('The method %1$s in the class %2$s is already overriden.'), $method->getName(), $classname));
// Check if none of the properties already exists in the override class
foreach ($module_class->getProperties() as $property)
if ($override_class->hasProperty($property->getName()))
throw new Exception(sprintf(Tools::displayError('The property %1$s in the class %2$s is already defined.'), $property->getName(), $classname));
// Insert the methods from module override in override
$copy_from = array_slice($module_file, $module_class->getStartLine() + 1, $module_class->getEndLine() - $module_class->getStartLine() - 2);
array_splice($override_file, $override_class->getEndLine() - 1, 0, $copy_from);
$code = implode('', $override_file);
file_put_contents($override_path, $code);
return true; return true;
} }
@@ -2049,18 +2014,14 @@ abstract class ModuleCore
if (!is_writable($override_path)) if (!is_writable($override_path))
return false; return false;
// Get a uniq id for the class, because you can override a class (or remove the override) twice in the same session and we need to avoid redeclaration
do $uniq = uniqid();
while (class_exists($classname.'OverrideOriginal_remove', false));
// Make a reflection of the override class and the module override class // Make a reflection of the override class and the module override class
$override_file = file($override_path); $override_file = file($override_path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal_remove'.$uniq), implode('', $override_file))); eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal_remove'), implode('', $override_file)));
$override_class = new ReflectionClass($classname.'OverrideOriginal_remove'.$uniq); $override_class = new ReflectionClass($classname.'OverrideOriginal_remove');
$module_file = file($this->getLocalPath().'override/'.$path); $module_file = file($this->getLocalPath().'override/'.$path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override_remove'.$uniq), implode('', $module_file))); eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override_remove'), implode('', $module_file)));
$module_class = new ReflectionClass($classname.'Override_remove'.$uniq); $module_class = new ReflectionClass($classname.'Override_remove');
// Remove methods from override file // Remove methods from override file
$override_file = file($override_path); $override_file = file($override_path);
+1
View File
@@ -716,6 +716,7 @@ class OrderCore extends ObjectModel
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'order_cart_rule` ocr FROM `'._DB_PREFIX_.'order_cart_rule` ocr
LEFT JOIN `'._DB_PREFIX_.'cart_rule` cr ON cr.`id_cart_rule` = ocr.`id_cart_rule`
WHERE ocr.`id_order` = '.(int)$this->id); WHERE ocr.`id_order` = '.(int)$this->id);
} }
+1 -5
View File
@@ -47,9 +47,6 @@ class OrderCartRuleCore extends ObjectModel
/** @var float value (tax excl.) of voucher */ /** @var float value (tax excl.) of voucher */
public $value_tax_excl; public $value_tax_excl;
/** @var boolean value : voucher gives free shipping or not */
public $free_shipping;
/** /**
* @see ObjectModel::$definition * @see ObjectModel::$definition
*/ */
@@ -62,8 +59,7 @@ class OrderCartRuleCore extends ObjectModel
'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true), 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true),
'value' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true), 'value' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'value_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true), 'value_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true)
'free_shipping' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool')
) )
); );
+13
View File
@@ -129,6 +129,19 @@ class OrderSlipCore extends ObjectModel
{ {
$products[$key] = $product; $products[$key] = $product;
$products[$key]['product_quantity'] = $slip_quantity[$product['id_order_detail']]; $products[$key]['product_quantity'] = $slip_quantity[$product['id_order_detail']];
if (count($cart_rules))
{
$order->setProductPrices($product);
$realProductPrice = $products[$key]['product_price'];
// Todo : must be updated to use the cart rules
foreach ($cart_rules as $cart_rule)
{
if ($cart_rule['reduction_percent'])
$products[$key]['product_price'] -= $realProductPrice * ($cart_rule['reduction_percent'] / 100);
elseif ($cart_rule['reduction_amount'])
$products[$key]['product_price'] -= (($cart_rule['reduction_amount'] * ($product['product_price_wt'] / $order->total_products_wt)) / (1.00 + ($product['tax_rate'] / 100)));
}
}
} }
return $order->getProducts($products); return $order->getProducts($products);
} }
+2 -4
View File
@@ -363,12 +363,10 @@ class ShopCore extends ObjectModel
// Define some $_SERVER variables like HTTP_HOST if PHP is launched with php-cli // Define some $_SERVER variables like HTTP_HOST if PHP is launched with php-cli
if (Tools::isPHPCLI()) if (Tools::isPHPCLI())
{ {
if (!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST'])) if(!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
$_SERVER['HTTP_HOST'] = $shop->domain; $_SERVER['HTTP_HOST'] = $shop->domain;
if (!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME'])) if(!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
$_SERVER['SERVER_NAME'] = $shop->domain; $_SERVER['SERVER_NAME'] = $shop->domain;
if (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
} }
} }
else else
+4
View File
@@ -305,7 +305,11 @@ class StockAvailableCore extends ObjectModel
if (!Validate::isUnsignedId($id_product)) if (!Validate::isUnsignedId($id_product))
return false; return false;
if ($id_shop === null)
$id_shop = Context::getContext()->shop->id;
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop); $existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop);
if ($existing_id > 0) if ($existing_id > 0)
{ {
Db::getInstance()->update( Db::getInstance()->update(
+1 -1
View File
@@ -80,7 +80,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
if (!empty($this->address->postcode)) if (!empty($this->address->postcode))
$postcode = $this->address->postcode; $postcode = $this->address->postcode;
if (!isset(self::$cache_tax_calculator[(int)$this->address->id_country.'-'.$postcode.'-'.$this->type])) if (!isset(self::$cache_tax_calculator[$postcode.'-'.$this->type]))
{ {
$rows = Db::getInstance()->executeS(' $rows = Db::getInstance()->executeS('
SELECT * SELECT *
+27 -26
View File
@@ -1260,39 +1260,40 @@ class WebserviceRequestCore
if (!isset($this->urlFragments['display'])) if (!isset($this->urlFragments['display']))
$this->fieldsToDisplay = 'full'; $this->fieldsToDisplay = 'full';
// Check if Object is accessible for this/those id_shop
$assoc = Shop::getAssoTable($this->resourceConfiguration['retrieveData']['table']);
if ($assoc !== false)
{
$check_shop_group = false;
$sql = 'SELECT 1
FROM `'.bqSQL(_DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table']);
if ($assoc['type'] != 'fk_shop')
$sql .= '_'.$assoc['type'];
else
{
$def = ObjectModel::getDefinition($this->resourceConfiguration['retrieveData']['className']);
if (isset($def['fields']) && isset($def['fields']['id_shop_group']))
$check_shop_group = true;
}
$sql .= '`';
foreach (self::$shopIDs as $id_shop)
$OR[] = ' (id_shop = '.(int)$id_shop.($check_shop_group ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').') ';
$check = ' WHERE ('.implode('OR', $OR).') AND `'.bqSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.(int)$this->urlSegment[1];
if (!Db::getInstance()->getValue($sql.$check))
$this->setError(403, 'Bad id_shop : You are not allowed to access this '.$this->resourceConfiguration['retrieveData']['className'].' ('.(int)$this->urlSegment[1].')', 131);
}
//get entity details //get entity details
$object = new $this->resourceConfiguration['retrieveData']['className']((int)$this->urlSegment[1]); $object = new $this->resourceConfiguration['retrieveData']['className']((int)$this->urlSegment[1]);
if ($object->id) if ($object->id)
{ {
$objects[] = $object; $objects[] = $object;
// Check if Object is accessible for this/those id_shop
$assoc = Shop::getAssoTable($this->resourceConfiguration['retrieveData']['table']);
if ($assoc !== false)
{
$check_shop_group = false;
$sql = 'SELECT 1
FROM `'.bqSQL(_DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table']);
if ($assoc['type'] != 'fk_shop')
$sql .= '_'.$assoc['type'];
else
{
$def = ObjectModel::getDefinition($this->resourceConfiguration['retrieveData']['className']);
if (isset($def['fields']) && isset($def['fields']['id_shop_group']))
$check_shop_group = true;
}
$sql .= '`';
foreach (self::$shopIDs as $id_shop)
$OR[] = ' (id_shop = '.(int)$id_shop.($check_shop_group ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').') ';
$check = ' WHERE ('.implode('OR', $OR).') AND `'.bqSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.(int)$this->urlSegment[1];
if (!Db::getInstance()->getValue($sql.$check))
$this->setError(404, 'This '.$this->resourceConfiguration['retrieveData']['className'].' ('.(int)$this->urlSegment[1].') does not exists on this shop', 131);
}
return $objects; return $objects;
} }
if (!count($this->errors)) elseif (!count($this->errors))
{ {
$this->objOutput->setStatus(404); $this->objOutput->setStatus(404);
$this->_outputEnabled = false; $this->_outputEnabled = false;
@@ -77,7 +77,7 @@ class AdminAddressesControllerCore extends AdminController
parent::initToolbar(); parent::initToolbar();
if (!$this->display) if (!$this->display)
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=addresses', 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
@@ -54,7 +54,6 @@ class AdminAttributesGroupsControllerCore extends AdminController
'title' => $this->l('Values count'), 'title' => $this->l('Values count'),
'width' => 120, 'width' => 120,
'align' => 'center', 'align' => 'center',
'orderby' => false,
'search' => false 'search' => false
), ),
'position' => array( 'position' => array(
@@ -38,9 +38,6 @@ class AdminCarrierWizardControllerCore extends AdminController
$this->deleted = true; $this->deleted = true;
$this->step_number = 0; $this->step_number = 0;
$this->multishop_context = Shop::CONTEXT_ALL;
$this->context = Context::getContext();
$this->fieldImageSettings = array( $this->fieldImageSettings = array(
'name' => 'logo', 'name' => 'logo',
'dir' => 's' 'dir' => 's'
@@ -71,7 +68,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'title' => $this->l('Shipping locations and costs'), 'title' => $this->l('Shipping locations and costs'),
), ),
array( array(
'title' => $this->l('Size, weight, and group access'), 'title' => $this->l('Size, weight, and group access'),
), ),
array( array(
'title' => $this->l('Summary'), 'title' => $this->l('Summary'),
@@ -128,8 +125,8 @@ class AdminCarrierWizardControllerCore extends AdminController
array_splice($this->tpl_view_vars['wizard_contents']['contents'], 1, 0, array(0 => $this->renderStepTwo($carrier))); array_splice($this->tpl_view_vars['wizard_contents']['contents'], 1, 0, array(0 => $this->renderStepTwo($carrier)));
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'carrier_logo' => (Validate::isLoadedObject($carrier) && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg') ? _THEME_SHIP_DIR_.$carrier->id.'.jpg' : false) 'carrier_logo' => (Validate::isLoadedObject($carrier) && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg') ? _THEME_SHIP_DIR_.$carrier->id.'.jpg' : false)
)); ));
$this->content .= $this->createTemplate('logo.tpl')->fetch(); $this->content .= $this->createTemplate('logo.tpl')->fetch();
$this->addjQueryPlugin(array('ajaxfileupload')); $this->addjQueryPlugin(array('ajaxfileupload'));
@@ -308,6 +305,10 @@ class AdminCarrierWizardControllerCore extends AdminController
) )
) )
), ),
array(
'type' => 'zone',
'name' => 'zones'
),
array( array(
'type' => 'select', 'type' => 'select',
'label' => $this->l('Out-of-range behavior:'), 'label' => $this->l('Out-of-range behavior:'),
@@ -328,14 +329,9 @@ class AdminCarrierWizardControllerCore extends AdminController
), ),
'desc' => $this->l('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges)') 'desc' => $this->l('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges)')
) )
,
array(
'type' => 'zone',
'name' => 'zones'
), ),
),
)); ));
$tpl_vars = array(); $tpl_vars = array();
$tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT'); $tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
@@ -360,7 +356,8 @@ class AdminCarrierWizardControllerCore extends AdminController
'name' => 'max_height', 'name' => 'max_height',
'required' => false, 'required' => false,
'size' => 10, 'size' => 10,
'desc' => $this->l('Maximum height managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.') 'desc' => $this->l('Maximum height managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
.')
), ),
array( array(
'type' => 'text', 'type' => 'text',
@@ -368,7 +365,8 @@ class AdminCarrierWizardControllerCore extends AdminController
'name' => 'max_width', 'name' => 'max_width',
'required' => false, 'required' => false,
'size' => 10, 'size' => 10,
'desc' => $this->l('Maximum width managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.') 'desc' => $this->l('Maximum width managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
.')
), ),
array( array(
'type' => 'text', 'type' => 'text',
@@ -376,7 +374,8 @@ class AdminCarrierWizardControllerCore extends AdminController
'name' => 'max_depth', 'name' => 'max_depth',
'required' => false, 'required' => false,
'size' => 10, 'size' => 10,
'desc' => $this->l('Maximum depth managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.') 'desc' => $this->l('Maximum depth managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
.')
), ),
array( array(
'type' => 'text', 'type' => 'text',
@@ -405,7 +404,7 @@ class AdminCarrierWizardControllerCore extends AdminController
foreach ($carrier_groups as $carrier_group) foreach ($carrier_groups as $carrier_group)
$carrier_groups_ids[] = $carrier_group['id_group']; $carrier_groups_ids[] = $carrier_group['id_group'];
$groups = Group::getGroups($this->context->language->id); $groups = Group::getGroups($this->context->language->id);
foreach ($groups as $group) foreach ($groups as $group)
$fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids) || empty($carrier_groups_ids) && !$carrier->id)); $fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids) || empty($carrier_groups_ids) && !$carrier->id));
@@ -465,7 +464,7 @@ class AdminCarrierWizardControllerCore extends AdminController
foreach ($carrier_zones as $carrier_zone) foreach ($carrier_zones as $carrier_zone)
$carrier_zones_ids[] = $carrier_zone['id_zone']; $carrier_zones_ids[] = $carrier_zone['id_zone'];
$range_table = $carrier->getRangeTable(); $range_table = $carrier->getRangeTable();
$shipping_method = $carrier->getShippingMethod(); $shipping_method = $carrier->getShippingMethod();
$zones = Zone::getZones(false); $zones = Zone::getZones(false);
@@ -512,10 +511,10 @@ class AdminCarrierWizardControllerCore extends AdminController
$helper->id = (int)Tools::getValue('id_carrier'); $helper->id = (int)Tools::getValue('id_carrier');
$helper->identifier = $this->identifier; $helper->identifier = $this->identifier;
$helper->tpl_vars = array_merge(array( $helper->tpl_vars = array_merge(array(
'fields_value' => $fields_value, 'fields_value' => $fields_value,
'languages' => $this->getLanguages(), 'languages' => $this->getLanguages(),
'id_language' => $this->context->language->id 'id_language' => $this->context->language->id
), $tpl_vars); ), $tpl_vars);
$helper->override_folder = 'carrier_wizard/'; $helper->override_folder = 'carrier_wizard/';
return $helper->generateForm($fields_form); return $helper->generateForm($fields_form);
@@ -592,7 +591,7 @@ class AdminCarrierWizardControllerCore extends AdminController
$template->assign('change_ranges', 1); $template->assign('change_ranges', 1);
$template->assign('fields_value', $fields_value); $template->assign('fields_value', $fields_value);
$template->assign('input', array('type' => 'zone', 'name' => 'zones' )); $template->assign('input', array('type' => 'zone', 'name' => 'zones' ));
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$template->assign('currency_sign', $currency->sign); $template->assign('currency_sign', $currency->sign);
@@ -765,9 +764,9 @@ class AdminCarrierWizardControllerCore extends AdminController
$this->changeGroups((int)$new_carrier->id); $this->changeGroups((int)$new_carrier->id);
// Call of hooks // Call of hooks
Hook::exec('actionCarrierUpdate', array( Hook::exec('actionCarrierUpdate', array(
'id_carrier' => (int)$current_carrier->id, 'id_carrier' => (int)$current_carrier->id,
'carrier' => $new_carrier 'carrier' => $new_carrier
)); ));
$this->postImage($new_carrier->id); $this->postImage($new_carrier->id);
$this->changeZones($new_carrier->id); $this->changeZones($new_carrier->id);
$new_carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group')); $new_carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'));
@@ -867,11 +866,11 @@ class AdminCarrierWizardControllerCore extends AdminController
if (!isset($_POST['zone_'.$zone['id_zone']]) || !$_POST['zone_'.$zone['id_zone']]) if (!isset($_POST['zone_'.$zone['id_zone']]) || !$_POST['zone_'.$zone['id_zone']])
$return &= $carrier->deleteZone((int)$zone['id_zone']); $return &= $carrier->deleteZone((int)$zone['id_zone']);
} }
else else
if (isset($_POST['zone_'.$zone['id_zone']]) && $_POST['zone_'.$zone['id_zone']]) if (isset($_POST['zone_'.$zone['id_zone']]) && $_POST['zone_'.$zone['id_zone']])
$return &= $carrier->addZone((int)$zone['id_zone']); $return &= $carrier->addZone((int)$zone['id_zone']);
return $return; return $return;
} }
public static function getValidationRules() public static function getValidationRules()
@@ -905,7 +904,7 @@ class AdminCarrierWizardControllerCore extends AdminController
unset($rules[$key_r][$key_f]); unset($rules[$key_r][$key_f]);
} }
else if(!in_array($key_f, $step_fields[$step_number])) else if(!in_array($key_f, $step_fields[$step_number]))
unset($rules[$key_r][$key_f]); unset($rules[$key_r][$key_f]);
} }
return $rules; return $rules;
} }
@@ -246,7 +246,7 @@ class AdminCategoriesControllerCore extends AdminController
'desc' => $this->l('Add New') 'desc' => $this->l('Add New')
); );
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=categories', 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
+2 -2
View File
@@ -110,10 +110,10 @@ class AdminCmsControllerCore extends AdminController
'type' => 'text', 'type' => 'text',
'label' => $this->l('Meta title:'), 'label' => $this->l('Meta title:'),
'name' => 'meta_title', 'name' => 'meta_title',
'id' => 'name', // for copyMeta2friendlyURL compatibility 'id' => 'name', // for copy2friendlyUrl compatibility
'lang' => true, 'lang' => true,
'required' => true, 'required' => true,
'class' => 'copyMeta2friendlyURL', 'class' => 'copy2friendlyUrl',
'hint' => $this->l('Invalid characters:').' <>;=#{}', 'hint' => $this->l('Invalid characters:').' <>;=#{}',
'size' => 50 'size' => 50
), ),
@@ -380,7 +380,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$cm->id_employee = (int)$this->context->employee->id; $cm->id_employee = (int)$this->context->employee->id;
$cm->id_customer_thread = $ct->id; $cm->id_customer_thread = $ct->id;
$cm->message = Tools::getValue('reply_message'); $cm->message = Tools::htmlentitiesutf8(Tools::getValue('reply_message'));
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
if (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0) if (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0)
$this->errors[] = Tools::displayError('An error occurred during the file upload process.'); $this->errors[] = Tools::displayError('An error occurred during the file upload process.');
@@ -597,12 +597,11 @@ class AdminCustomerThreadsControllerCore extends AdminController
} }
$message['date_add'] = Tools::displayDate($message['date_add'], null, true); $message['date_add'] = Tools::displayDate($message['date_add'], null, true);
$message['user_agent'] = strip_tags($message['user_agent']); $message['user_agent'] = strip_tags($message['user_agent']);
$message['message'] = preg_replace( $message['message'] = preg_replace(
'/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui',
'<a href="\1">\1</a>\2', '<a href="\1">\1</a>\2',
html_entity_decode($message['message'], html_entity_decode($message['message'],
ENT_QUOTES, 'UTF-8') ENT_NOQUOTES, 'UTF-8')
); );
$tpl->assign(array( $tpl->assign(array(
@@ -190,7 +190,7 @@ class AdminCustomersControllerCore extends AdminController
else if (!$this->display) //display import button only on listing else if (!$this->display) //display import button only on listing
{ {
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=customers', 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
@@ -774,8 +774,7 @@ class AdminCustomersControllerCore extends AdminController
if ($customer_email != $this->object->email) if ($customer_email != $this->object->email)
{ {
$customer = new Customer(); $customer = new Customer();
if (Validate::isEmail($customer_email)) $customer->getByEmail($customer_email);
$customer->getByEmail($customer_email);
if ($customer->id) if ($customer->id)
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
} }
@@ -473,14 +473,6 @@ class AdminEmployeesControllerCore extends AdminController
return $res; return $res;
} }
protected function ajaxProcessFormLanguage()
{
$this->context->cookie->employee_form_lang = (int)Tools::getValue('form_language_id');
if (!$this->context->cookie->write())
die ('Error while updating cookie.');
die ('Form language updated.');
}
public function ajaxProcessGetTabByIdProfile() public function ajaxProcessGetTabByIdProfile()
{ {
$id_profile = Tools::getValue('id_profile'); $id_profile = Tools::getValue('id_profile');
+1 -1
View File
@@ -193,7 +193,7 @@ class AdminGroupsControllerCore extends AdminController
'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool') 'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool')
)); ));
$customer_list = $group->getCustomers(false, 0, 100, true); $customer_list = $group->getCustomers(false, 0, 0, true);
$helper = new HelperList(); $helper = new HelperList();
$helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false); $helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false);
+9 -16
View File
@@ -52,17 +52,8 @@ class AdminImagesControllerCore extends AdminController
'stores' => array('title' => $this->l('Stores'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false) 'stores' => array('title' => $this->l('Stores'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false)
); );
// No need to display the old image system migration tool except if product images are in _PS_PROD_IMG_DIR_ // No need to display the old image system if the install has been made later than 2013-03-26
$this->display_move = false; $this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
$dir = _PS_PROD_IMG_DIR_;
if (is_dir($dir))
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false && $this->display_move == false)
if (!is_dir($dir.DIRECTORY_SEPARATOR.$file) && $file[0] != '.' && is_numeric($file[0]))
$this->display_move = true;
closedir($dh);
}
$this->fields_options = array( $this->fields_options = array(
'images' => array( 'images' => array(
@@ -543,16 +534,18 @@ class AdminImagesControllerCore extends AdminController
protected function _regenerateNoPictureImages($dir, $type, $languages) protected function _regenerateNoPictureImages($dir, $type, $languages)
{ {
$errors = false; $errors = false;
foreach ($type as $image_type) foreach ($type as $imageType)
{
foreach ($languages as $language) foreach ($languages as $language)
{ {
$file = $dir.$language['iso_code'].'.jpg'; $file = $dir.$language['iso_code'].'.jpg';
if (!file_exists($file)) if (!file_exists($file))
$file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')).'.jpg'; $file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT'))).'.jpg';
if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($image_type['name']).'.jpg')) if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg'))
if (!ImageManager::resize($file, $dir.$language['iso_code'].'-default-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height'])) if (!ImageManager::resize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)$imageType['width'], (int)$imageType['height']))
$errors = true; $errors = true;
} }
}
return $errors; return $errors;
} }
@@ -650,7 +643,7 @@ class AdminImagesControllerCore extends AdminController
public function initMoveImages() public function initMoveImages()
{ {
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'safe_mode' => Tools::getSafeModeStatus(), 'safe_mode' => ini_get('safe_mode'),
'link_ppreferences' => 'index.php?tab=AdminPPreferences&token='.Tools::getAdminTokenLite('AdminPPreferences').'#PS_LEGACY_IMAGES_on', 'link_ppreferences' => 'index.php?tab=AdminPPreferences&token='.Tools::getAdminTokenLite('AdminPPreferences').'#PS_LEGACY_IMAGES_on',
)); ));
} }
+20 -37
View File
@@ -465,25 +465,11 @@ class AdminImportControllerCore extends AdminController
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen'); $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
$this->addJqueryPlugin(array('fancybox')); $this->addJqueryPlugin(array('fancybox'));
$entity_selected = 0;
if (isset($this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))]))
{
$entity_selected = $this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))];
$this->context->cookie->entity_selected = $entity_selected;
}
elseif (isset($this->context->cookie->entity_selected))
$entity_selected = (int)$this->context->cookie->entity_selected;
$csv_selected = '';
if (isset($this->context->cookie->csv_selected))
$csv_selected = pSQL($this->context->cookie->csv_selected);
$this->tpl_form_vars = array( $this->tpl_form_vars = array(
'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)), 'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)),
'path_import' => _PS_ADMIN_DIR_.'/import/', 'path_import' => _PS_ADMIN_DIR_.'/import/',
'entities' => $this->entities, 'entities' => $this->entities,
'entity_selected' => $entity_selected, 'entity' => Tools::getValue('entity'),
'csv_selected' => $csv_selected,
'files_to_import' => $files_to_import, 'files_to_import' => $files_to_import,
'languages' => Language::getLanguages(false), 'languages' => Language::getLanguages(false),
'id_language' => $this->context->language->id, 'id_language' => $this->context->language->id,
@@ -511,11 +497,6 @@ class AdminImportControllerCore extends AdminController
for ($i = 0; $i < $nb_table; $i++) for ($i = 0; $i < $nb_table; $i++)
$data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator); $data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator);
if ($entity_selected = (int)Tools::getValue('entity'))
$this->context->cookie->entity_selected = $entity_selected;
if ($csv_selected = Tools::getValue('csv'))
$this->context->cookie->csv_selected = $csv_selected;
$this->tpl_view_vars = array( $this->tpl_view_vars = array(
'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'), 'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'),
'fields_value' => array( 'fields_value' => array(
@@ -525,7 +506,6 @@ class AdminImportControllerCore extends AdminController
'iso_lang' => Tools::getValue('iso_lang'), 'iso_lang' => Tools::getValue('iso_lang'),
'truncate' => Tools::getValue('truncate'), 'truncate' => Tools::getValue('truncate'),
'forceIDs' => Tools::getValue('forceIDs'), 'forceIDs' => Tools::getValue('forceIDs'),
'regenerate' => Tools::getValue('regenerate'),
'match_ref' => Tools::getValue('match_ref'), 'match_ref' => Tools::getValue('match_ref'),
'separator' => $this->separator, 'separator' => $this->separator,
'multiple_value_separator' => $this->multiple_value_separator 'multiple_value_separator' => $this->multiple_value_separator
@@ -815,7 +795,7 @@ class AdminImportControllerCore extends AdminController
* @param string entity 'products' or 'categories' * @param string entity 'products' or 'categories'
* @return void * @return void
*/ */
protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products', $regenerate = true) protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products')
{ {
$tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import'); $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import');
$watermark_types = explode(',', Configuration::get('WATERMARK_TYPES')); $watermark_types = explode(',', Configuration::get('WATERMARK_TYPES'));
@@ -843,14 +823,11 @@ class AdminImportControllerCore extends AdminController
{ {
ImageManager::resize($tmpfile, $path.'.jpg'); ImageManager::resize($tmpfile, $path.'.jpg');
$images_types = ImageType::getImagesTypes($entity); $images_types = ImageType::getImagesTypes($entity);
foreach ($images_types as $image_type)
ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
if ($regenerate) if (in_array($image_type['id_image_type'], $watermark_types))
foreach ($images_types as $image_type) Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity));
{
ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
if (in_array($image_type['id_image_type'], $watermark_types))
Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity));
}
} }
else else
{ {
@@ -999,7 +976,7 @@ class AdminImportControllerCore extends AdminController
} }
//copying images of categories //copying images of categories
if (isset($category->image) && !empty($category->image)) if (isset($category->image) && !empty($category->image))
if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories', !Tools::getValue('regenerate')))) if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories')))
$this->warnings[] = $category->image.' '.Tools::displayError('cannot be copied.'); $this->warnings[] = $category->image.' '.Tools::displayError('cannot be copied.');
// If both failed, mysql error // If both failed, mysql error
if (!$res) if (!$res)
@@ -1461,7 +1438,7 @@ class AdminImportControllerCore extends AdminController
{ {
// associate image to selected shops // associate image to selected shops
$image->associateTo($shops); $image->associateTo($shops);
if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) if (!AdminImportController::copyImg($product->id, $image->id, $url))
{ {
$image->delete(); $image->delete();
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
@@ -1587,7 +1564,7 @@ class AdminImportControllerCore extends AdminController
if ($field_error === true && $lang_field_error === true && $image->add()) if ($field_error === true && $lang_field_error === true && $image->add())
{ {
$image->associateTo($id_shop_list); $image->associateTo($id_shop_list);
if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) if (!AdminImportController::copyImg($product->id, $image->id, $url))
{ {
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
$image->delete(); $image->delete();
@@ -2458,12 +2435,17 @@ class AdminImportControllerCore extends AdminController
$discount_rate = (float)$info['discount_rate']; $discount_rate = (float)$info['discount_rate'];
$tax_rate = (float)$info['tax_rate']; $tax_rate = (float)$info['tax_rate'];
// checks if one product/attribute is there only once // checks if one product is there only once
if (isset($products[$id_product][$id_product_attribute])) if (isset($product['id_product']))
$this->errors[] = sprintf($this->l('Product/Attribute (%d/%d) cannot be added twice (at line %d).'), $id_product, {
$id_product_attribute, $current_line + 1); if ($product['id_product'] == $id_product_attribute)
$this->errors[] = sprintf($this->l('Product (%d/%D) cannot be added twice (at line %d).'), $id_product,
$id_product_attribute, $current_line + 1);
else
$product['id_product'] = $id_product_attribute;
}
else else
$products[$id_product][$id_product_attribute] = $quantity_expected; $product['id_product'] = 0;
// checks parameters // checks parameters
if (false === ($supplier_reference = ProductSupplier::getProductSupplierReference($id_product, $id_product_attribute, $supply_order->id_supplier))) if (false === ($supplier_reference = ProductSupplier::getProductSupplierReference($id_product, $id_product_attribute, $supply_order->id_supplier)))
@@ -2743,6 +2725,7 @@ class AdminImportControllerCore extends AdminController
$this->clearSmartyCache(); $this->clearSmartyCache();
break; break;
case $this->entities[$import_type = $this->l('Products')]: case $this->entities[$import_type = $this->l('Products')]:
$import_type = $this->l('Categories');
$this->productImport(); $this->productImport();
$this->clearSmartyCache(); $this->clearSmartyCache();
break; break;
@@ -28,6 +28,9 @@ class AdminLocalizationControllerCore extends AdminController
{ {
public function __construct() public function __construct()
{ {
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct(); parent::__construct();
$this->fields_options = array( $this->fields_options = array(
-10
View File
@@ -65,19 +65,9 @@ class AdminLogsControllerCore extends AdminController
parent::__construct(); parent::__construct();
} }
public function processDelete()
{
return Logger::eraseAllLogs();
}
public function initToolbar() public function initToolbar()
{ {
parent::initToolbar(); parent::initToolbar();
$this->toolbar_btn['delete'] = array(
'short' => 'Erase',
'desc' => $this->l('Erase all'),
'js' => 'if (confirm(\''.$this->l('Are you sure?').'\')) document.location = \''.$this->context->link->getAdminLink('AdminLogs').'&amp;token='.$this->token.'&deletelog=1\';'
);
unset($this->toolbar_btn['new']); unset($this->toolbar_btn['new']);
} }
@@ -140,7 +140,7 @@ class AdminManufacturersControllerCore extends AdminController
'lastname' => array( 'lastname' => array(
'title' => $this->l('Last name'), 'title' => $this->l('Last name'),
'width' => 100, 'width' => 100,
'filter_key' => 'a!lastname' 'filter_key' => 'a!name'
), ),
'postcode' => array( 'postcode' => array(
'title' => $this->l('Zip Code/Postal Code'), 'title' => $this->l('Zip Code/Postal Code'),
@@ -256,7 +256,7 @@ class AdminManufacturersControllerCore extends AdminController
'lang' => true, 'lang' => true,
'cols' => 60, 'cols' => 60,
'rows' => 10, 'rows' => 10,
'autoload_rte' => 'rte', //Enable TinyMCE editor for short description 'class' => 'rte',
'hint' => $this->l('Invalid characters:').' <>;=#{}' 'hint' => $this->l('Invalid characters:').' <>;=#{}'
), ),
array( array(
@@ -266,7 +266,7 @@ class AdminManufacturersControllerCore extends AdminController
'lang' => true, 'lang' => true,
'cols' => 60, 'cols' => 60,
'rows' => 10, 'rows' => 10,
'autoload_rte' => 'rte', //Enable TinyMCE editor for description 'class' => 'rte',
'hint' => $this->l('Invalid characters:').' <>;=#{}' 'hint' => $this->l('Invalid characters:').' <>;=#{}'
), ),
array( array(
@@ -570,7 +570,7 @@ class AdminManufacturersControllerCore extends AdminController
default: default:
parent::initToolbar(); parent::initToolbar();
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=manufacturers', 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
+1 -11
View File
@@ -98,8 +98,6 @@ class AdminModulesControllerCore extends AdminController
$this->list_modules_categories['others']['name'] = $this->l('Other Modules'); $this->list_modules_categories['others']['name'] = $this->l('Other Modules');
$this->list_modules_categories['mobile']['name'] = $this->l('Mobile'); $this->list_modules_categories['mobile']['name'] = $this->l('Mobile');
uasort($this->list_modules_categories, array($this, 'checkCategoriesNames'));
// Set Id Employee, Iso Default Country and Filter Configuration // Set Id Employee, Iso Default Country and Filter Configuration
$this->id_employee = (int)$this->context->employee->id; $this->id_employee = (int)$this->context->employee->id;
$this->iso_default_country = $this->context->country->iso_code; $this->iso_default_country = $this->context->country->iso_code;
@@ -131,14 +129,6 @@ class AdminModulesControllerCore extends AdminController
$this->logged_on_addons = true; $this->logged_on_addons = true;
} }
public function checkCategoriesNames($a, $b)
{
if ($a['name'] === $this->l('Other Modules'))
return true;
return (bool)($a['name'] > $b['name']);
}
public function setMedia() public function setMedia()
{ {
parent::setMedia(); parent::setMedia();
@@ -778,7 +768,7 @@ class AdminModulesControllerCore extends AdminController
} }
if (isset($_GET['update'])) if (isset($_GET['update']))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '')); Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
} }
public function postProcess() public function postProcess()
@@ -308,6 +308,7 @@ class AdminModulesPositionsControllerCore extends AdminController
$dir = str_replace($admin_dir, '', dirname($_SERVER['SCRIPT_NAME'])); $dir = str_replace($admin_dir, '', dirname($_SERVER['SCRIPT_NAME']));
if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1) if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1)
$lang = Language::getIsoById($this->context->employee->id_lang).'/'; $lang = Language::getIsoById($this->context->employee->id_lang).'/';
$url = Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().$dir.$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params); $url = Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().$dir.$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params);
return $url; return $url;
} }
+3 -7
View File
@@ -110,8 +110,7 @@ class AdminOrdersControllerCore extends AdminController
'type' => 'select', 'type' => 'select',
'list' => $statuses_array, 'list' => $statuses_array,
'filter_key' => 'os!id_order_state', 'filter_key' => 'os!id_order_state',
'filter_type' => 'int', 'filter_type' => 'int'
'order_key' => 'osname'
), ),
'date_add' => array( 'date_add' => array(
'title' => $this->l('Date'), 'title' => $this->l('Date'),
@@ -507,7 +506,7 @@ class AdminOrdersControllerCore extends AdminController
if (Tools::isSubmit('generateDiscountRefund') && !count($this->errors)) if (Tools::isSubmit('generateDiscountRefund') && !count($this->errors))
{ {
$cart_rule = new CartRule(); $cart_rule = new CartRule();
$cart_rule->description = sprintf($this->l('Credit slip for order #%d'), $order->id); $cart_rule->description = sprintf($this->l('Credit card slip for order #%d'), $order->id);
$languages = Language::getLanguages(false); $languages = Language::getLanguages(false);
foreach ($languages as $language) foreach ($languages as $language)
// Define a temporary name // Define a temporary name
@@ -805,7 +804,7 @@ class AdminOrdersControllerCore extends AdminController
if (!Validate::isLoadedObject($order)) if (!Validate::isLoadedObject($order))
$this->errors[] = Tools::displayError('The order cannot be found'); $this->errors[] = Tools::displayError('The order cannot be found');
elseif (!Validate::isNegativePrice($amount) || !(float)$amount) elseif (!Validate::isNegativePrice($amount))
$this->errors[] = Tools::displayError('The amount is invalid.'); $this->errors[] = Tools::displayError('The amount is invalid.');
elseif (!Validate::isString(Tools::getValue('payment_method'))) elseif (!Validate::isString(Tools::getValue('payment_method')))
$this->errors[] = Tools::displayError('The selected payment method is invalid.'); $this->errors[] = Tools::displayError('The selected payment method is invalid.');
@@ -1342,14 +1341,11 @@ class AdminOrdersControllerCore extends AdminController
$product['warehouse_name'] = '--'; $product['warehouse_name'] = '--';
} }
$gender = new Gender((int)$customer->id_gender, $this->context->language->id);
// Smarty assign // Smarty assign
$this->tpl_view_vars = array( $this->tpl_view_vars = array(
'order' => $order, 'order' => $order,
'cart' => new Cart($order->id_cart), 'cart' => new Cart($order->id_cart),
'customer' => $customer, 'customer' => $customer,
'gender' => $gender,
'customer_addresses' => $customer->getAddresses($this->context->language->id), 'customer_addresses' => $customer->getAddresses($this->context->language->id),
'addresses' => array( 'addresses' => array(
'delivery' => $addressDelivery, 'delivery' => $addressDelivery,
@@ -213,7 +213,6 @@ class AdminPaymentControllerCore extends AdminController
if ($name_id == 'country' if ($name_id == 'country'
&& isset($module->limited_countries) && isset($module->limited_countries)
&& !empty($module->limited_countries) && !empty($module->limited_countries)
&& is_array($module->limited_countries)
&& !(in_array(strtoupper($item['iso_code']), array_map('strtoupper', $module->limited_countries)))) && !(in_array(strtoupper($item['iso_code']), array_map('strtoupper', $module->limited_countries))))
$list['items'][$key_item]['check_list'][$key_module] = null; $list['items'][$key_item]['check_list'][$key_module] = null;
} }
@@ -796,7 +796,6 @@ class AdminPerformanceControllerCore extends AdminController
{ {
$redirectAdmin = true; $redirectAdmin = true;
Tools::clearSmartyCache(); Tools::clearSmartyCache();
Autoload::getInstance()->generateIndex();
} }
if ($redirectAdmin && (!isset($this->errors) || !count($this->errors))) if ($redirectAdmin && (!isset($this->errors) || !count($this->errors)))
@@ -86,19 +86,6 @@ class AdminPreferencesControllerCore extends AdminController
'type' => 'bool', 'type' => 'bool',
'default' => '0' 'default' => '0'
), ),
);
if (Configuration::get('PS_SSL_ENABLED'))
$fields['PS_SSL_ENABLED_EVERYWHERE'] = array(
'title' => $this->l('Force the SSL on all the pages'),
'desc' => $this->l('Force all your store to use SSL'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'default' => '0'
);
$fields = array_merge($fields, array(
'PS_TOKEN_ENABLE' => array( 'PS_TOKEN_ENABLE' => array(
'title' => $this->l('Increase Front Office security'), 'title' => $this->l('Increase Front Office security'),
'desc' => $this->l('Enable or disable token in the Front Office to improve PrestaShop\'s security.'), 'desc' => $this->l('Enable or disable token in the Front Office to improve PrestaShop\'s security.'),
@@ -148,7 +135,7 @@ class AdminPreferencesControllerCore extends AdminController
'list' => $activities2, 'list' => $activities2,
'identifier' => 'value' 'identifier' => 'value'
), ),
)); );
// No HTTPS activation if you haven't already. // No HTTPS activation if you haven't already.
if (!Tools::usingSecureMode() && !Configuration::get('PS_SSL_ENABLED')) if (!Tools::usingSecureMode() && !Configuration::get('PS_SSL_ENABLED'))
+60 -8
View File
@@ -1736,7 +1736,27 @@ class AdminProductsControllerCore extends AdminController
// Save and preview // Save and preview
if (Tools::isSubmit('submitAddProductAndPreview')) if (Tools::isSubmit('submitAddProductAndPreview'))
$this->redirect_after = $this->getPreviewUrl($this->object); {
$preview_url = $this->context->link->getProductLink(
$this->getFieldValue($this->object, 'id'),
$this->getFieldValue($this->object, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($this->object, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
(bool)Configuration::get('PS_REWRITING_SETTINGS')
);
if (!$this->object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= '&adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$this->redirect_after = $preview_url;
}
// Save and stay on same form // Save and stay on same form
if ($this->display == 'edit') if ($this->display == 'edit')
@@ -1881,7 +1901,30 @@ class AdminProductsControllerCore extends AdminController
// Save and preview // Save and preview
if (Tools::isSubmit('submitAddProductAndPreview')) if (Tools::isSubmit('submitAddProductAndPreview'))
$this->redirect_after = $this->getPreviewUrl($object); {
$preview_url = $this->context->link->getProductLink(
$this->getFieldValue($object, 'id'),
$this->getFieldValue($object, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
(bool)Configuration::get('PS_REWRITING_SETTINGS')
);
if (!$object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
if (strpos($preview_url, '?') === false)
$preview_url .= '?';
else
$preview_url .= '&';
$preview_url .= 'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$this->redirect_after = $preview_url;
}
else else
{ {
// Save and stay on same form // Save and stay on same form
@@ -2437,7 +2480,7 @@ class AdminProductsControllerCore extends AdminController
} }
else else
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=products', 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
@@ -2573,8 +2616,6 @@ class AdminProductsControllerCore extends AdminController
public function getPreviewUrl(Product $product) public function getPreviewUrl(Product $product)
{ {
$id_lang = Configuration::get('PS_LANG_DEFAULT', null, null, Context::getContext()->shop->id);
if (!ShopUrl::getMainShopDomain()) if (!ShopUrl::getMainShopDomain())
return false; return false;
@@ -2582,19 +2623,30 @@ class AdminProductsControllerCore extends AdminController
$preview_url = $this->context->link->getProductLink( $preview_url = $this->context->link->getProductLink(
$product, $product,
$this->getFieldValue($product, 'link_rewrite', $this->context->language->id), $this->getFieldValue($product, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id), Category::getLinkRewrite($product->id_category_default, $this->context->language->id),
null, null,
$id_lang, null,
(int)Context::getContext()->shop->id, Context::getContext()->shop->id,
0, 0,
$is_rewrite_active $is_rewrite_active
); );
if (!$product->active) if (!$product->active)
{ {
$preview_url = $this->context->link->getProductLink(
$product,
$this->getFieldValue($product, 'link_rewrite', $this->default_form_language),
Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
$is_rewrite_active
);
$admin_dir = dirname($_SERVER['PHP_SELF']); $admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1); $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= ((strpos($preview_url, '?') === false) ? '?' : '&').'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id; $preview_url .= ((strpos($preview_url, '?') === false) ? '?' : '&').'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
} }
return $preview_url; return $preview_url;
+2 -30
View File
@@ -236,34 +236,6 @@ class AdminStatesControllerCore extends AdminController
else else
parent::postProcess(); parent::postProcess();
} }
protected function displayAjaxStates()
{
if ($this->tabAccess['view'] === '1')
{
$states = Db::getInstance()->executeS('
SELECT s.id_state, s.name
FROM '._DB_PREFIX_.'state s
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
ORDER BY s.`name` ASC');
if (is_array($states) AND !empty($states))
{
$list = '';
if (Tools::getValue('no_empty') != true)
{
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
}
foreach ($states AS $state)
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
}
else
$list = 'false';
die($list);
}
}
} }
+1 -11
View File
@@ -131,13 +131,8 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
$modules = $this->getModules(); $modules = $this->getModules();
$module_instance = array(); $module_instance = array();
foreach ($modules as $m => $module) foreach ($modules as $module)
{
$module_instance[$module['name']] = Module::getInstanceByName($module['name']); $module_instance[$module['name']] = Module::getInstanceByName($module['name']);
$modules[$m]['displayName'] = $module_instance[$module['name']]->displayName;
}
uasort($modules, array($this, 'checkModulesNames'));
$tpl->assign(array( $tpl->assign(array(
'current' => self::$currentIndex, 'current' => self::$currentIndex,
@@ -149,11 +144,6 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
return $tpl->fetch(); return $tpl->fetch();
} }
public function checkModulesNames($a, $b)
{
return (bool)($a['displayName'] > $b['displayName']);
}
protected function getModules() protected function getModules()
{ {
$sql = 'SELECT h.`name` AS hook, m.`name` $sql = 'SELECT h.`name` AS hook, m.`name`
@@ -136,7 +136,6 @@ class AdminStatusesControllerCore extends AdminController
{ {
$this->table = 'order_return_state'; $this->table = 'order_return_state';
$this->_defaultOrderBy = $this->identifier = 'id_order_return_state'; $this->_defaultOrderBy = $this->identifier = 'id_order_return_state';
$this->list_id = 'order_return_state';
$this->deleted = false; $this->deleted = false;
$this->_orderBy = null; $this->_orderBy = null;
@@ -71,7 +71,7 @@ class AdminStockInstantStateControllerCore extends AdminController
'valuation' => array( 'valuation' => array(
'title' => $this->l('Valuation'), 'title' => $this->l('Valuation'),
'width' => 150, 'width' => 150,
'orderby' => false, 'orderby' => true,
'search' => false, 'search' => false,
'type' => 'price', 'type' => 'price',
'currency' => true, 'currency' => true,
@@ -92,7 +92,7 @@ class AdminStockInstantStateControllerCore extends AdminController
'real_quantity' => array( 'real_quantity' => array(
'title' => $this->l('Real quantity'), 'title' => $this->l('Real quantity'),
'width' => 80, 'width' => 80,
'orderby' => false, 'orderby' => true,
'search' => false, 'search' => false,
'hint' => $this->l('Pysical quantity (usable) - Client orders + Supply Orders'), 'hint' => $this->l('Pysical quantity (usable) - Client orders + Supply Orders'),
), ),
+1 -20
View File
@@ -94,8 +94,7 @@ class AdminSuppliersControllerCore extends AdminController
'rows' => 10, 'rows' => 10,
'lang' => true, 'lang' => true,
'hint' => $this->l('Invalid characters:').' <>;=#{}', 'hint' => $this->l('Invalid characters:').' <>;=#{}',
'desc' => $this->l('Will appear in the supplier list'), 'desc' => $this->l('Will appear in the supplier list')
'autoload_rte' => 'rte' //Enable TinyMCE editor for short description
), ),
array( array(
'type' => 'text', 'type' => 'text',
@@ -262,24 +261,6 @@ class AdminSuppliersControllerCore extends AdminController
return parent::renderForm(); return parent::renderForm();
} }
/**
* AdminController::initToolbar() override
* @see AdminController::initToolbar()
*
*/
public function initToolbar()
{
switch ($this->display)
{
default:
parent::initToolbar();
$this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=suppliers',
'desc' => $this->l('Import')
);
}
}
public function renderView() public function renderView()
{ {
$products = $this->object->getProductsLite($this->context->language->id); $products = $this->object->getProductsLite($this->context->language->id);
@@ -754,7 +754,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
'orderby' => false, 'orderby' => false,
'filter' => false, 'filter' => false,
'search' => false, 'search' => false,
'hint' => $this->l('Note that you can see details on the receptions - per products'), 'hint' => 'Note that you can see details on the receptions - per products',
), ),
'quantity_expected' => array( 'quantity_expected' => array(
'title' => $this->l('Quantity expected'), 'title' => $this->l('Quantity expected'),
@@ -78,7 +78,6 @@ class AdminTaxRulesGroupControllerCore extends AdminController
public function initRulesList($id_group) public function initRulesList($id_group)
{ {
$this->table = 'tax_rule'; $this->table = 'tax_rule';
$this->list_id = 'tax_rule';
$this->identifier = 'id_tax_rule'; $this->identifier = 'id_tax_rule';
$this->className = 'TaxRule'; $this->className = 'TaxRule';
$this->lang = false; $this->lang = false;
@@ -507,18 +506,5 @@ class AdminTaxRulesGroupControllerCore extends AdminController
// TODO: check if the rule already exists // TODO: check if the rule already exists
return $tr->validateController(); return $tr->validateController();
} }
protected function displayAjaxUpdateTaxRule()
{
if ($this->tabAccess['view'] === '1')
{
$id_tax_rule = Tools::getValue('id_tax_rule');
$tax_rules = new TaxRule((int)$id_tax_rule);
$output = array();
foreach ($tax_rules as $key => $result)
$output[$key] = $result;
die(Tools::jsonEncode($output));
}
}
} }
@@ -460,9 +460,7 @@ class AdminTranslationsControllerCore extends AdminController
if (!$default_language || !Validate::isLanguageIsoCode($default_language)) if (!$default_language || !Validate::isLanguageIsoCode($default_language))
return false; return false;
// 1 - Scan mails files // 1 - Scan mails files
$mails = array(); $mails = scandir(_PS_MAIL_DIR_.$default_language.'/');
if (Tools::file_exists_cache(_PS_MAIL_DIR_.$default_language.'/'))
$mails = scandir(_PS_MAIL_DIR_.$default_language.'/');
$mails_new_lang = array(); $mails_new_lang = array();
@@ -581,9 +579,7 @@ class AdminTranslationsControllerCore extends AdminController
if (preg_match('#^translations\/'.$iso_code.'\/tabs.php#Ui', $file['filename'], $matches) && Validate::isLanguageIsoCode($iso_code)) if (preg_match('#^translations\/'.$iso_code.'\/tabs.php#Ui', $file['filename'], $matches) && Validate::isLanguageIsoCode($iso_code))
{ {
// Include array width new translations tabs // Include array width new translations tabs
$tabs = array(); $tabs = include _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename'];
if (Tools::file_exists_cache(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']))
$tabs = include_once(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']);
foreach ($tabs as $class_name => $translations) foreach ($tabs as $class_name => $translations)
{ {
-1
View File
@@ -425,7 +425,6 @@ class AuthControllerCore extends FrontController
if (Tools::isSubmit('newsletter')) if (Tools::isSubmit('newsletter'))
$this->processCustomerNewsletter($customer); $this->processCustomerNewsletter($customer);
$customer->firstname = Tools::ucwords($customer->firstname);
$customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']); $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
if (!Validate::isBirthDate($customer->birthday)) if (!Validate::isBirthDate($customer->birthday))
$this->errors[] = Tools::displayError('Invalid date of birth.'); $this->errors[] = Tools::displayError('Invalid date of birth.');
+1 -4
View File
@@ -33,7 +33,7 @@ class CartControllerCore extends FrontController
protected $id_address_delivery; protected $id_address_delivery;
protected $customization_id; protected $customization_id;
protected $qty; protected $qty;
public $ssl = true; public $ssl = false;
protected $ajax_refresh = false; protected $ajax_refresh = false;
@@ -52,9 +52,6 @@ class CartControllerCore extends FrontController
{ {
parent::init(); parent::init();
// Send noindex to avoid ghost carts by bots
header("X-Robots-Tag: noindex, nofollow", true);
// Get page main parameters // Get page main parameters
$this->id_product = (int)Tools::getValue('id_product', null); $this->id_product = (int)Tools::getValue('id_product', null);
$this->id_product_attribute = (int)Tools::getValue('id_product_attribute', Tools::getValue('ipa')); $this->id_product_attribute = (int)Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
-8
View File
@@ -207,13 +207,5 @@ class CategoryControllerCore extends FrontController
$this->context->smarty->assign('nb_products', $this->nbProducts); $this->context->smarty->assign('nb_products', $this->nbProducts);
} }
/**
* Get instance of current category
*/
public function getCategory()
{
return $this->category;
}
} }
+1 -1
View File
@@ -144,7 +144,7 @@ class ContactControllerCore extends FrontController
{ {
$cm = new CustomerMessage(); $cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id; $cm->id_customer_thread = $ct->id;
$cm->message = $message; $cm->message = Tools::htmlentitiesUTF8($message);
if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename']))) if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename'])))
$cm->file_name = $fileAttachment['rename']; $cm->file_name = $fileAttachment['rename'];
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']); $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
+1 -1
View File
@@ -79,7 +79,7 @@ class IdentityControllerCore extends FrontController
if (!count($this->errors)) if (!count($this->errors))
{ {
$this->customer->id_default_group = (int)$prev_id_default_group; $this->customer->id_default_group = (int)$prev_id_default_group;
$this->customer->firstname = Tools::ucwords($this->customer->firstname); $this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname));
if (!isset($_POST['newsletter'])) if (!isset($_POST['newsletter']))
$this->customer->newsletter = 0; $this->customer->newsletter = 0;
@@ -134,12 +134,4 @@ class ManufacturerControllerCore extends FrontController
else else
$this->context->smarty->assign('nbManufacturers', 0); $this->context->smarty->assign('nbManufacturers', 0);
} }
/**
* Get instance of current manufacturer
*/
public function getManufacturer()
{
return $this->manufacturer;
}
} }
@@ -40,20 +40,6 @@ class PageNotFoundControllerCore extends FrontController
if (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('png', 'jpg', 'gif'))) if (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('png', 'jpg', 'gif')))
{ {
if ((bool)Configuration::get('PS_REWRITING_SETTINGS'))
preg_match('#([0-9]+)(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/(.+)\.(png|jpg|gif)$#', $_SERVER['REQUEST_URI'], $matches);
if ((!isset($matches[2]) || empty($matches[2])) && !(bool)Configuration::get('PS_REWRITING_SETTINGS'))
preg_match('#/([0-9]+)(\-[_a-zA-Z]*)\.(png|jpg|gif)$#', $_SERVER['REQUEST_URI'], $matches);
if (is_array($matches) && !empty($matches[2]) && Tools::strtolower(substr($matches[2], -8)) != '_default' && is_numeric($matches[1]))
{
$matches[2] = substr($matches[2], 1, Tools::strlen($matches[2])).'_default';
if (!isset($matches[4]))
$matches[4] = '';
header('Location: '.$this->context->link->getImageLink($matches[4], $matches[1], $matches[2]), true, 302);
exit;
}
header('Content-Type: image/gif'); header('Content-Type: image/gif');
readfile(_PS_IMG_DIR_.'404.gif'); readfile(_PS_IMG_DIR_.'404.gif');
exit; exit;
+2 -3
View File
@@ -40,7 +40,6 @@ class PasswordControllerCore extends FrontController
$this->errors[] = Tools::displayError('Invalid email address.'); $this->errors[] = Tools::displayError('Invalid email address.');
else else
{ {
$customer = new Customer(); $customer = new Customer();
$customer->getByemail($email); $customer->getByemail($email);
if (!Validate::isLoadedObject($customer)) if (!Validate::isLoadedObject($customer))
@@ -58,7 +57,7 @@ class PasswordControllerCore extends FrontController
'{url}' => $this->context->link->getPageLink('password', true, null, 'token='.$customer->secure_key.'&id_customer='.(int)$customer->id) '{url}' => $this->context->link->getPageLink('password', true, null, 'token='.$customer->secure_key.'&id_customer='.(int)$customer->id)
); );
if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mail_params, $customer->email, $customer->firstname.' '.$customer->lastname)) if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mail_params, $customer->email, $customer->firstname.' '.$customer->lastname))
$this->context->smarty->assign(array('confirmation' => 2, 'customer_email' => $customer->email)); $this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
else else
$this->errors[] = Tools::displayError('An error occurred while sending the email.'); $this->errors[] = Tools::displayError('An error occurred while sending the email.');
} }
@@ -91,7 +90,7 @@ class PasswordControllerCore extends FrontController
'{passwd}' => $password '{passwd}' => $password
); );
if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname.' '.$customer->lastname)) if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname.' '.$customer->lastname))
$this->context->smarty->assign(array('confirmation' => 1, 'customer_email' => $customer->email)); $this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
else else
$this->errors[] = Tools::displayError('An error occurred while sending the email.'); $this->errors[] = Tools::displayError('An error occurred while sending the email.');
} }
-5
View File
@@ -660,9 +660,4 @@ class ProductControllerCore extends FrontController
} }
return $specific_prices; return $specific_prices;
} }
public function getProduct()
{
return $this->product;
}
} }
-2
View File
@@ -332,8 +332,6 @@ select optgroup option {
.lab_modules_positions img { .lab_modules_positions img {
float:left; float:left;
width:32px;
height:32px;
} }
+6 -2
View File
@@ -696,12 +696,16 @@ class InstallXmlLoader
if (is_null($tables)) if (is_null($tables))
{ {
$sql = 'SHOW TABLES';
$tables = array(); $tables = array();
foreach (Db::getInstance()->executeS('SHOW TABLES') as $row) foreach (Db::getInstance()->executeS($sql) as $row)
{ {
$table = current($row); $table = current($row);
if (preg_match('#^'._DB_PREFIX_.'(.+?)(_lang)?$#i', $table, $m)) if (preg_match('#^'._DB_PREFIX_.'(.+?)(_lang)?$#i', $table, $m))
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false; if (preg_match('#^'._DB_PREFIX_.'(.+?)_shop$#i', $table, $m2) && !isset($tables[$m2[1]]))
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false;
else
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false;
} }
} }

Some files were not shown because too many files have changed in this diff Show More