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

This commit is contained in:
François Gaillard
2012-12-10 11:39:11 +01:00
7 changed files with 44 additions and 9 deletions
@@ -24,7 +24,20 @@
*} *}
{extends file="helpers/form/form.tpl"} {extends file="helpers/form/form.tpl"}
{block name="input"}
{if $input.name == "link_rewrite"}
<script type="text/javascript">
{if isset($PS_ALLOW_ACCENTED_CHARS_URL) && $PS_ALLOW_ACCENTED_CHARS_URL}
var PS_ALLOW_ACCENTED_CHARS_URL = 1;
{else}
var PS_ALLOW_ACCENTED_CHARS_URL = 0;
{/if}
</script>
{$smarty.block.parent}
{else}
{$smarty.block.parent}
{/if}
{/block}
{block name="script"} {block name="script"}
$(document).ready(function() { $(document).ready(function() {
if (btn_submit.length > 0) if (btn_submit.length > 0)
@@ -24,7 +24,20 @@
*} *}
{extends file="helpers/form/form.tpl"} {extends file="helpers/form/form.tpl"}
{block name="input"}
{if $input.name == "link_rewrite"}
<script type="text/javascript">
{if isset($PS_ALLOW_ACCENTED_CHARS_URL) && $PS_ALLOW_ACCENTED_CHARS_URL}
var PS_ALLOW_ACCENTED_CHARS_URL = 1;
{else}
var PS_ALLOW_ACCENTED_CHARS_URL = 0;
{/if}
</script>
{$smarty.block.parent}
{else}
{$smarty.block.parent}
{/if}
{/block}
{block name="input"} {block name="input"}
{if $input.type == 'select_category'} {if $input.type == 'select_category'}
<select name="id_parent"> <select name="id_parent">
+2 -1
View File
@@ -20,6 +20,7 @@
* *
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA * @copyright 2007-2012 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -34,7 +35,7 @@ class PrestaShopExceptionCore extends Exception
*/ */
public function displayMessage() public function displayMessage()
{ {
if (_PS_MODE_DEV_) if (_PS_MODE_DEV_ || defined('_PS_ADMIN_DIR_'))
{ {
// Display error message // Display error message
echo '<style> echo '<style>
@@ -302,7 +302,7 @@ class AdminCmsCategoriesControllerCore extends AdminController
'class' => 'button' 'class' => 'button'
) )
); );
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
return parent::renderForm(); return parent::renderForm();
} }
} }
+2 -2
View File
@@ -180,9 +180,9 @@ class AdminCmsControllerCore extends AdminController
} }
$this->tpl_form_vars = array( $this->tpl_form_vars = array(
'active' => $this->object->active 'active' => $this->object->active,
'PS_ALLOW_ACCENTED_CHARS_URL', (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL')
); );
return parent::renderForm(); return parent::renderForm();
} }
+6 -1
View File
@@ -340,6 +340,7 @@ class AdminModulesControllerCore extends AdminController
protected function extractArchive($file, $redirect = true) protected function extractArchive($file, $redirect = true)
{ {
$pathinfo = pathinfo($file);
$success = false; $success = false;
if (substr($file, -4) == '.zip') if (substr($file, -4) == '.zip')
{ {
@@ -356,9 +357,13 @@ class AdminModulesControllerCore extends AdminController
else else
$this->errors[] = Tools::displayError('Error while extracting module (file may be corrupted).'); $this->errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
} }
//check if it's a real module
if (!Module::getInstanceByName($pathinfo['filename']))
$this->errors[] = Tools::displayError('The Zip file you uploaded is not a module');
@unlink($file); @unlink($file);
if ($success && $redirect) if (!count($this->errors) && $success && $redirect)
Tools::redirectAdmin(self::$currentIndex.'&conf=8'.'&token='.$this->token); Tools::redirectAdmin(self::$currentIndex.'&conf=8'.'&token='.$this->token);
} }
+3
View File
@@ -52,6 +52,9 @@ function str2url(str,encoding,ucfirst)
function copy2friendlyURL() function copy2friendlyURL()
{ {
if (typeof(id_product) == 'undefined')
id_product = false;
if (!$('#link_rewrite_' + id_language).val().length || !id_product)//check if user didn't type anything in rewrite field, to prevent overwriting if (!$('#link_rewrite_' + id_language).val().length || !id_product)//check if user didn't type anything in rewrite field, to prevent overwriting
{ {
$('#link_rewrite_' + id_language).val(str2url($('#name_' + id_language).val().replace(/^[0-9]+\./, ''), 'UTF-8').replace('%', '')); $('#link_rewrite_' + id_language).val(str2url($('#name_' + id_language).val().replace(/^[0-9]+\./, ''), 'UTF-8').replace('%', ''));