// small change in blockstore logo name

This commit is contained in:
Rémi Gaillard
2013-08-26 10:33:25 +02:00
parent 9e9eb37978
commit a23772dfb7
+5 -3
View File
@@ -92,13 +92,15 @@ class BlockStore extends Module
return $this->displayError($this->l('Invalid image'));
else
{
if (!move_uploaded_file($_FILES['store_img']['tmp_name'], dirname(__FILE__).'/'.$_FILES['store_img']['name']))
$ext = substr($_FILES['store_img']['name'], strrpos($_FILES['store_img']['name'], '.') + 1);
$file_name = md5($_FILES['store_img']['name']).'.'.$ext;
if (!move_uploaded_file($_FILES['store_img']['tmp_name'], dirname(__FILE__).'/'.$file_name))
return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
else
{
if (Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::getContext()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name'])
if (Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::getContext()) && Configuration::get('BLOCKSTORE_IMG') != $file_name)
@unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG'));
Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']);
Configuration::updateValue('BLOCKSTORE_IMG', $file_name);
$this->_clearCache('blockstore.tpl');
return $this->displayConfirmation($this->l('The settings have been updated.'));
}