// revert from r11699

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11702 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
aFolletete
2011-12-22 21:56:00 +00:00
parent 16861c4d03
commit d2f89e79ba
19 changed files with 170 additions and 167 deletions
+18 -21
View File
@@ -95,29 +95,29 @@ class FileUploaderCore
/** /**
* Handle file uploads via XMLHttpRequest * Handle file uploads via XMLHttpRequest
*/ */
class qqUploadedFileXhr class qqUploadedFileXhr
{ {
/** /**
* Save the file to the specified path * Save the file to the specified path
* @return boolean TRUE on success * @return boolean TRUE on success
*/ */
function upload($path) function upload($path)
{ {
$input = fopen("php://input", "r"); $input = fopen("php://input", "r");
$temp = tmpfile(); $temp = tmpfile();
$realSize = stream_copy_to_stream($input, $temp); $realSize = stream_copy_to_stream($input, $temp);
fclose($input); fclose($input);
if ($realSize != $this->getSize()) if ($realSize != $this->getSize())
return false; return false;
$target = fopen($path, "w"); $target = fopen($path, "w");
fseek($temp, 0, SEEK_SET); fseek($temp, 0, SEEK_SET);
stream_copy_to_stream($temp, $target); stream_copy_to_stream($temp, $target);
fclose($target); fclose($target);
return true; return true;
} }
function save() function save()
{ {
$product = new Product($_GET['id_product']); $product = new Product($_GET['id_product']);
if (!Validate::isLoadedObject($product)) if (!Validate::isLoadedObject($product))
@@ -134,12 +134,12 @@ class qqUploadedFileXhr
if (!$image->add()) if (!$image->add())
return array('error' => Tools::displayError('Error while creating additional image')); return array('error' => Tools::displayError('Error while creating additional image'));
else else
{ {
return $this->copyImage($product->id, $image->id); return $this->copyImage($product->id, $image->id);
} }
} }
} }
public function copyImage($id_product, $id_image, $method = 'auto') public function copyImage($id_product, $id_image, $method = 'auto')
{ {
$image = new Image($id_image); $image = new Image($id_image);
@@ -154,11 +154,8 @@ class qqUploadedFileXhr
{ {
$imagesTypes = ImageType::getImagesTypes('products'); $imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes AS $k => $imageType) foreach ($imagesTypes AS $k => $imageType)
{ if (!imageResize($tmpName, $new_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format))
$theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
if (!imageResize($tmpName, $new_path.'-'.stripslashes($imageType['name']).$theme.'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format))
return array('error' => Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name'])); return array('error' => Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']));
}
} }
unlink($tmpName); unlink($tmpName);
Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_product)); Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_product));
@@ -169,17 +166,17 @@ class qqUploadedFileXhr
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover); $img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover);
return array("success" => $img); return array("success" => $img);
} }
function getName() function getName()
{ {
return $_GET['qqfile']; return $_GET['qqfile'];
} }
function getSize() function getSize()
{ {
if (isset($_SERVER["CONTENT_LENGTH"])) if (isset($_SERVER["CONTENT_LENGTH"]))
return (int)$_SERVER["CONTENT_LENGTH"]; return (int)$_SERVER["CONTENT_LENGTH"];
else else
throw new Exception('Getting content length is not supported.'); throw new Exception('Getting content length is not supported.');
} }
} }
+5 -8
View File
@@ -238,13 +238,12 @@ class ImageCore extends ObjectModel
$new_path = $image_new->getPathForCreation(); $new_path = $image_new->getPathForCreation();
foreach ($images_types as $image_type) foreach ($images_types as $image_type)
{ {
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].'.jpg'))
if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].$theme.'.jpg'))
{ {
if (!Configuration::get('PS_LEGACY_IMAGES')) if (!Configuration::get('PS_LEGACY_IMAGES'))
$image_new->createImgFolder(); $image_new->createImgFolder();
copy(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].$theme.'.jpg', copy(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'-'.$image_type['name'].'.jpg',
$new_path.'-'.$image_type['name'].$theme.'.jpg'); $new_path.'-'.$image_type['name'].'.jpg');
} }
} }
if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg')) if (file_exists(_PS_PROD_IMG_DIR_.$image_old->getExistingImgPath().'.jpg'))
@@ -402,10 +401,8 @@ class ImageCore extends ObjectModel
// Delete auto-generated images // Delete auto-generated images
$image_types = ImageType::getImagesTypes(); $image_types = ImageType::getImagesTypes();
foreach ($image_types as $image_type) foreach ($image_types as $image_type)
{ $files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-'.$image_type['name'].'.'.$this->image_format;
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
$files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-'.$image_type['name'].$theme.'.'.$this->image_format;
}
// Delete watermark image // Delete watermark image
$files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-watermark.'.$this->image_format; $files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-watermark.'.$this->image_format;
// delete index.php // delete index.php
+9 -14
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -29,9 +29,6 @@ class ImageTypeCore extends ObjectModel
{ {
public $id; public $id;
/** @var string id_theme */
public $id_theme;
/** @var string Name */ /** @var string Name */
public $name; public $name;
@@ -55,7 +52,7 @@ class ImageTypeCore extends ObjectModel
/** @var integer Apply to scenes */ /** @var integer Apply to scenes */
public $scenes; public $scenes;
/** @var integer Apply to store */ /** @var integer Apply to store */
public $stores; public $stores;
@@ -66,7 +63,6 @@ class ImageTypeCore extends ObjectModel
'table' => 'image_type', 'table' => 'image_type',
'primary' => 'id_image_type', 'primary' => 'id_image_type',
'fields' => array( 'fields' => array(
'id_theme' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isImageTypeName', 'required' => true, 'size' => 16), 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isImageTypeName', 'required' => true, 'size' => 16),
'width' => array('type' => self::TYPE_INT, 'validate' => 'isImageSize', 'required' => true), 'width' => array('type' => self::TYPE_INT, 'validate' => 'isImageSize', 'required' => true),
'height' => array('type' => self::TYPE_INT, 'validate' => 'isImageSize', 'required' => true), 'height' => array('type' => self::TYPE_INT, 'validate' => 'isImageSize', 'required' => true),
@@ -83,7 +79,7 @@ class ImageTypeCore extends ObjectModel
* @var array Image types cache * @var array Image types cache
*/ */
protected static $images_types_cache = array(); protected static $images_types_cache = array();
protected $webserviceParameters = array(); protected $webserviceParameters = array();
/** /**
@@ -92,17 +88,16 @@ class ImageTypeCore extends ObjectModel
* @param string|null Image type * @param string|null Image type
* @return array Image type definitions * @return array Image type definitions
*/ */
public static function getImagesTypes($type = NULL, $id_theme = false) public static function getImagesTypes($type = NULL)
{ {
if (!isset(self::$images_types_cache[$type.($id_theme ? '-'.$id_theme : '')])) if (!isset(self::$images_types_cache[$type]))
{ {
$where = 'WHERE 1';
if ($id_theme)
$where .= ' AND id_theme='.(int)$id_theme;
if (!empty($type)) if (!empty($type))
$where .= ' AND ' . pSQL($type) . ' = 1 '; $where = 'WHERE ' . pSQL($type) . ' = 1 ';
else
$where = '';
$query = 'SELECT * FROM `'._DB_PREFIX_.'image_type`'.$where.' ORDER BY `name` ASC'; $query = 'SELECT * FROM `'._DB_PREFIX_.'image_type`'.$where.'ORDER BY `name` ASC';
self::$images_types_cache[$type] = Db::getInstance()->executeS($query); self::$images_types_cache[$type] = Db::getInstance()->executeS($query);
} }
+8 -10
View File
@@ -306,26 +306,24 @@ class LinkCore
public function getImageLink($name, $ids, $type = null) public function getImageLink($name, $ids, $type = null)
{ {
// legacy mode or default image // legacy mode or default image
$theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : '');
if ((Configuration::get('PS_LEGACY_IMAGES') if ((Configuration::get('PS_LEGACY_IMAGES')
&& (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg'))) && (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'.jpg')))
|| strpos($ids, 'default') !== false) || strpos($ids, 'default') !== false)
{ {
if ($this->allow == 1) if ($this->allow == 1)
$uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; $uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').'/'.$name.'.jpg';
else
$uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg';
}
else else
$uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').'.jpg';
}else
{ {
// if ids if of the form id_product-id_image, we want to extract the id_image part // if ids if of the form id_product-id_image, we want to extract the id_image part
$split_ids = explode('-', $ids); $split_ids = explode('-', $ids);
$id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]); $id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]);
$theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : '');
if ($this->allow == 1) if ($this->allow == 1)
$uri_path = __PS_BASE_URI__.$id_image.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; $uri_path = __PS_BASE_URI__.$id_image.($type ? '-'.$type : '').'/'.$name.'.jpg';
else else
$uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg'; $uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').'.jpg';
} }
return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path; return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path;
+17 -17
View File
@@ -42,7 +42,7 @@ class ToolsCore
{ {
switch ($flag) switch ($flag)
{ {
case 'NUMERIC': case 'NUMERIC':
$str = '0123456789'; $str = '0123456789';
break; break;
case 'NO_NUMERIC': case 'NO_NUMERIC':
@@ -52,7 +52,7 @@ class ToolsCore
$str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break; break;
} }
for ($i = 0, $passwd = ''; $i < $length; $i++) for ($i = 0, $passwd = ''; $i < $length; $i++)
$passwd .= self::substr($str, mt_rand(0, self::strlen($str) - 1), 1); $passwd .= self::substr($str, mt_rand(0, self::strlen($str) - 1), 1);
return $passwd; return $passwd;
@@ -367,7 +367,7 @@ class ToolsCore
$context = Context::getContext(); $context = Context::getContext();
if ($id_lang = (int)(self::getValue('id_lang')) AND Validate::isUnsignedId($id_lang)) if ($id_lang = (int)(self::getValue('id_lang')) AND Validate::isUnsignedId($id_lang))
$context->cookie->id_lang = $id_lang; $context->cookie->id_lang = $id_lang;
$language = new Language($id_lang); $language = new Language($id_lang);
if (Validate::isLoadedObject($language)) if (Validate::isLoadedObject($language))
$context->language = $language; $context->language = $language;
@@ -558,10 +558,10 @@ class ToolsCore
{ {
if (!$date || !($time = strtotime($date))) if (!$date || !($time = strtotime($date)))
return $date; return $date;
if ($date == '0000-00-00 00:00:00' || $date == '0000-00-00') if ($date == '0000-00-00 00:00:00' || $date == '0000-00-00')
return ''; return '';
if (!Validate::isDate($date) || !Validate::isBool($full)) if (!Validate::isDate($date) || !Validate::isBool($full))
throw new PrestashopException('Invalid date'); throw new PrestashopException('Invalid date');
@@ -636,7 +636,7 @@ class ToolsCore
if (is_null($context)) if (is_null($context))
$context = Context::getContext(); $context = Context::getContext();
@include_once(_PS_TRANSLATIONS_DIR_.$context->language->iso_code.'/errors.php'); @include_once(_PS_TRANSLATIONS_DIR_.$context->language->iso_code.'/errors.php');
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $string == 'Fatal error') if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $string == 'Fatal error')
@@ -1566,8 +1566,8 @@ class ToolsCore
fwrite($write_fd, "# Images\n"); fwrite($write_fd, "# Images\n");
if (Configuration::get('PS_LEGACY_IMAGES')) if (Configuration::get('PS_LEGACY_IMAGES'))
{ {
fwrite($write_fd, 'RewriteRule (*UTF8)^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)(-[0-9]+)?/[_a-zA-Z0-9-\pL]*\.jpg$ '._PS_PROD_IMG_.'$1-$2$3$4.jpg [L]'."\n"); fwrite($write_fd, 'RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-\pL]*\.jpg$ '._PS_PROD_IMG_.'$1-$2$3.jpg [L]'."\n");
fwrite($write_fd, 'RewriteRule (*UTF8)^([0-9]+)\-([0-9]+)(-[0-9]+)?/[_a-zA-Z0-9-\pL]*\.jpg$ '._PS_PROD_IMG_.'$1-$2$3.jpg [L]'."\n"); fwrite($write_fd, 'RewriteRule ^([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-\pL]*\.jpg$ '._PS_PROD_IMG_.'$1-$2.jpg [L]'."\n");
} }
// Rewrite product images < 100 millions // Rewrite product images < 100 millions
@@ -1580,10 +1580,10 @@ class ToolsCore
$img_name .= '$'.$j; $img_name .= '$'.$j;
} }
$img_name .= '$'.$j; $img_name .= '$'.$j;
fwrite($write_fd, 'RewriteRule (*UTF8)^'.str_repeat('([0-9])', $i).'(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/[_a-zA-Z0-9-\pL]*\.jpg$ '._PS_PROD_IMG_.$img_path.$img_name.'$'.($j+1).".jpg [L]\n"); fwrite($write_fd, 'RewriteRule ^'.str_repeat('([0-9])', $i).'(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-\pL]*\.jpg$ '._PS_PROD_IMG_.$img_path.$img_name.".jpg [L]\n");
} }
fwrite($write_fd, 'RewriteRule (*UTF8)^c/([0-9]+)(\-[_a-zA-Z0-9-\pL]*)(-[0-9]+)?/[_a-zA-Z0-9-]*\.jpg$ img/c/$1$2$3.jpg [L]'."\n"); fwrite($write_fd, 'RewriteRule ^c/([0-9]+)(\-[_a-zA-Z0-9-\pL]*)/[_a-zA-Z0-9-]*\.jpg$ img/c/$1$2.jpg [L]'."\n");
fwrite($write_fd, 'RewriteRule (*UTF8)^c/([a-zA-Z-]+)(-[0-9]+)?/[a-zA-Z0-9-\pL]+\.jpg$ img/c/$1$2.jpg [L]'."\n"); fwrite($write_fd, 'RewriteRule ^c/([a-zA-Z-]+)/[a-zA-Z0-9-\pL]+\.jpg$ img/c/$1.jpg [L]'."\n");
} }
// Redirections to dispatcher // Redirections to dispatcher
@@ -1702,7 +1702,7 @@ FileETag INode MTime Size
$error = 'Parameter <b>'.$parameter.'</b> in function <b>'.$callee['function'].'()</b> is deprecated in <b>'.$callee['file'].'</b> on line <b>'.$callee['Line'].'</b><br />'; $error = 'Parameter <b>'.$parameter.'</b> in function <b>'.$callee['function'].'()</b> is deprecated in <b>'.$callee['file'].'</b> on line <b>'.$callee['Line'].'</b><br />';
$message = 'The parameter '.$parameter.' in function '.$callee['function'].' (Line '.$callee['Line'].') is deprecated and will be removed in the next major version.'; $message = 'The parameter '.$parameter.' in function '.$callee['function'].' (Line '.$callee['Line'].') is deprecated and will be removed in the next major version.';
trigger_error($message, E_WARNING); trigger_error($message, E_WARNING);
$class = isset($callee['class']) ? $callee['class'] : null; $class = isset($callee['class']) ? $callee['class'] : null;
self::throwDeprecated($error, $message, $class); self::throwDeprecated($error, $message, $class);
} }
@@ -2092,7 +2092,7 @@ FileETag INode MTime Size
return false; return false;
} }
/** /**
* @params string $path Path to scan * @params string $path Path to scan
@@ -2108,15 +2108,15 @@ FileETag INode MTime Size
$files = scandir($real_path); $files = scandir($real_path);
if (!$files) if (!$files)
return array(); return array();
$filtered_files = array(); $filtered_files = array();
$real_ext = ''; $real_ext = '';
if (!empty($ext)) if (!empty($ext))
$real_ext = '.' . $ext; $real_ext = '.' . $ext;
$real_ext_length = strlen($real_ext); $real_ext_length = strlen($real_ext);
foreach ($files as $file) foreach ($files as $file)
if (strpos($file, $real_ext) && strpos($file, $real_ext) == (strlen($file) - $real_ext_length)) if (strpos($file, $real_ext) && strpos($file, $real_ext) == (strlen($file) - $real_ext_length))
$filtered_files[] = $dir . '/' . $file; $filtered_files[] = $dir . '/' . $file;
@@ -982,11 +982,8 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
{ {
$imagesTypes = ImageType::getImagesTypes('products'); $imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes AS $imageType) foreach ($imagesTypes AS $imageType)
{ if (!imageResize($tmpName, _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-'.stripslashes($imageType['name']).'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format))
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
if (!imageResize($tmpName, _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-'.stripslashes($imageType['name']).$theme.'.'.$image->image_format, $imageType['width'], $imageType['height'], $image->image_format))
$this->_errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']); $this->_errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
}
} }
@unlink($tmpName); @unlink($tmpName);
$this->imgToDisplay = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$image->image_format; $this->imgToDisplay = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$image->image_format;
@@ -1007,4 +1004,4 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
else else
throw new WebserviceException('Method '.$this->wsObject->method.' is not allowed for an image resource', array(77, 405)); throw new WebserviceException('Method '.$this->wsObject->method.' is not allowed for an image resource', array(77, 405));
} }
} }
@@ -89,7 +89,7 @@ class AdminCategoriesControllerCore extends AdminController
parent::__construct(); parent::__construct();
} }
public function setMedia() public function setMedia()
{ {
parent::setMedia(); parent::setMedia();
@@ -425,14 +425,11 @@ class AdminCategoriesControllerCore extends AdminController
{ {
$images_types = ImageType::getImagesTypes('categories'); $images_types = ImageType::getImagesTypes('categories');
foreach ($images_types as $k => $image_type) foreach ($images_types as $k => $image_type)
{
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
imageResize( imageResize(
_PS_CAT_IMG_DIR_.$id_category.'.jpg', _PS_CAT_IMG_DIR_.$id_category.'.jpg',
_PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).$theme.'.jpg', _PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($image_type['name']).'.jpg',
(int)$image_type['width'], (int)$image_type['height'] (int)$image_type['width'], (int)$image_type['height']
); );
}
} }
return $ret; return $ret;
} }
+4 -18
View File
@@ -69,13 +69,6 @@ class AdminImagesControllerCore extends AdminController
'title' => $this->l('Images'), 'title' => $this->l('Images'),
'image' => '../img/admin/picture.gif' 'image' => '../img/admin/picture.gif'
), ),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Theme:'),
'name' => 'theme',
),
'input' => array( 'input' => array(
array( array(
'type' => 'text', 'type' => 'text',
@@ -370,8 +363,6 @@ class AdminImagesControllerCore extends AdminController
if (preg_match('/^[0-9]*\.jpg$/', $image)) if (preg_match('/^[0-9]*\.jpg$/', $image))
foreach ($type AS $k => $imageType) foreach ($type AS $k => $imageType)
{ {
$theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
// Customizable writing dir // Customizable writing dir
$newDir = $dir; $newDir = $dir;
if ($imageType['name'] == 'thumb_scene') if ($imageType['name'] == 'thumb_scene')
@@ -379,7 +370,7 @@ class AdminImagesControllerCore extends AdminController
if (!file_exists($newDir)) if (!file_exists($newDir))
continue; continue;
if (!file_exists($newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg')) if (!file_exists($newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg'))
if (!imageResize($dir.$image, $newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height']))) if (!imageResize($dir.$image, $newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
$errors = true; $errors = true;
if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server
return 'timeout'; return 'timeout';
@@ -394,16 +385,14 @@ class AdminImagesControllerCore extends AdminController
if (file_exists($dir.$imageObj->getExistingImgPath().'.jpg')) if (file_exists($dir.$imageObj->getExistingImgPath().'.jpg'))
foreach ($type AS $k => $imageType) foreach ($type AS $k => $imageType)
{ {
$theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
if (!file_exists($dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg')) if (!file_exists($dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg'))
if (!imageResize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height']))) if (!imageResize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
$errors = true; $errors = true;
if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server
return 'timeout'; return 'timeout';
} }
}
} }
}
return $errors; return $errors;
} }
@@ -412,18 +401,15 @@ class AdminImagesControllerCore extends AdminController
{ {
$errors = false; $errors = false;
foreach ($type AS $k => $imageType) foreach ($type AS $k => $imageType)
{
$theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
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($imageType['name']).'.jpg')) if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg'))
if (!imageResize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height']))) if (!imageResize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
$errors = true; $errors = true;
} }
}
return $errors; return $errors;
} }
+1 -4
View File
@@ -700,10 +700,7 @@ class AdminImportControllerCore extends AdminController
imageResize($tmpfile, $path.'.jpg'); imageResize($tmpfile, $path.'.jpg');
$images_types = ImageType::getImagesTypes($entity); $images_types = ImageType::getImagesTypes($entity);
foreach ($images_types as $k => $image_type) foreach ($images_types as $k => $image_type)
{ imageResize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
imageResize($tmpfile, $path.'-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height']);
}
if (in_array($image_type['id_image_type'], $watermark_types)) if (in_array($image_type['id_image_type'], $watermark_types))
Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_entity)); Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_entity));
} }
@@ -433,12 +433,11 @@ class AdminLanguagesControllerCore extends AdminController
$images_types = ImageType::getImagesTypes('products'); $images_types = ImageType::getImagesTypes('products');
foreach ($images_types as $k => $image_type) foreach ($images_types as $k => $image_type)
{ {
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); if (!imageResize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'-default-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']))
if (!imageResize($tmp_name, _PS_IMG_DIR_.'p/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height']))
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your product directory.'); $this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your product directory.');
if (!imageResize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height'])) if (!imageResize($tmp_name, _PS_IMG_DIR_.'c/'.$language.'-default-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']))
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your category directory.'); $this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your category directory.');
if (!imageResize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'-default-'.stripslashes($image_type['name']).$theme.'.jpg', $image_type['width'], $image_type['height'])) if (!imageResize($tmp_name, _PS_IMG_DIR_.'m/'.$language.'-default-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']))
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.'); $this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.');
} }
} }
@@ -683,15 +683,12 @@ class AdminManufacturersControllerCore extends AdminController
{ {
$images_types = ImageType::getImagesTypes('manufacturers'); $images_types = ImageType::getImagesTypes('manufacturers');
foreach ($images_types as $k => $image_type) foreach ($images_types as $k => $image_type)
{
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
imageResize( imageResize(
_PS_MANU_IMG_DIR_.$id_manufacturer.'.jpg', _PS_MANU_IMG_DIR_.$id_manufacturer.'.jpg',
_PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($image_type['name']).$theme.'.jpg', _PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($image_type['name']).'.jpg',
(int)$image_type['width'], (int)$image_type['width'],
(int)$image_type['height'] (int)$image_type['height']
); );
}
} }
} }
} }
@@ -92,7 +92,7 @@ class AdminProductsControllerCore extends AdminController
$this->_defaultOrderBy = 'position'; $this->_defaultOrderBy = 'position';
$this->max_file_size = (Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1000000); $this->max_file_size = (Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1000000);
$this->max_image_size = (Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000); $this->max_image_size = (Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
$categoriesArray = array(); $categoriesArray = array();
$categories = Category::getSimpleCategories($this->context->language->id); $categories = Category::getSimpleCategories($this->context->language->id);
@@ -1370,11 +1370,8 @@ class AdminProductsControllerCore extends AdminController
{ {
$imagesTypes = ImageType::getImagesTypes('products'); $imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes as $k => $image_type) foreach ($imagesTypes as $k => $image_type)
{ if (!imageResize($tmpName, $new_path.'-'.stripslashes($image_type['name']).'.'.$image->image_format, $image_type['width'], $image_type['height'], $image->image_format))
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
if (!imageResize($tmpName, $new_path.'-'.stripslashes($image_type['name']).$theme.'.'.$image->image_format, $image_type['width'], $image_type['height'], $image->image_format))
$this->_errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($image_type['name']); $this->_errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($image_type['name']);
}
} }
@unlink($tmpName); @unlink($tmpName);
+4 -5
View File
@@ -74,11 +74,10 @@ class AdminScenesControllerCore extends AdminController
$images_types = ImageType::getImagesTypes('scenes'); $images_types = ImageType::getImagesTypes('scenes');
foreach ($images_types as $k => $image_type) foreach ($images_types as $k => $image_type)
{ {
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
if ($image_type['name'] == 'large_scene' && isset($_FILES['image'])) if ($image_type['name'] == 'large_scene' && isset($_FILES['image']))
imageResize( imageResize(
$_FILES['image']['tmp_name'], $_FILES['image']['tmp_name'],
_PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg', _PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg',
(int)$image_type['width'], (int)$image_type['width'],
(int)$image_type['height'] (int)$image_type['height']
); );
@@ -90,7 +89,7 @@ class AdminScenesControllerCore extends AdminController
$tmp_name = $_FILES['image']['tmp_name']; $tmp_name = $_FILES['image']['tmp_name'];
imageResize( imageResize(
$tmp_name, $tmp_name,
_PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).$theme.'.jpg', _PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg',
(int)$image_type['width'], (int)$image_type['width'],
(int)$image_type['height'] (int)$image_type['height']
); );
@@ -190,7 +189,7 @@ class AdminScenesControllerCore extends AdminController
.(Tools::getMaxUploadSize() / 1024).''.$this->l('KB max.').' ' .(Tools::getMaxUploadSize() / 1024).''.$this->l('KB max.').' '
.$this->l('If larger than the image size setting, the image will be reduced to ') .$this->l('If larger than the image size setting, the image will be reduced to ')
.' '.$large_scene_image_type['width'].'x'.$large_scene_image_type['height'].'px ' .' '.$large_scene_image_type['width'].'x'.$large_scene_image_type['height'].'px '
.$this->l('(width x height). If smaller than the image-size setting, a white background will be added in order to achieve the .$this->l('(width x height). If smaller than the image-size setting, a white background will be added in order to achieve the
correct image size.').'.<br />'. correct image size.').'.<br />'.
$this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).'); $this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).');
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg')) if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg'))
@@ -204,7 +203,7 @@ class AdminScenesControllerCore extends AdminController
$image_to_map_desc .= ' $image_to_map_desc .= '
<div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;"> <div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;">
'.$this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:').' '.$this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:').'
<br /><input type="text" value="" id="product_autocomplete_input" /> <br /><input type="text" value="" id="product_autocomplete_input" />
<input type="button" class="button" value="'.$this->l('OK').'" onclick="$(this).prev().search();" /> <input type="button" class="button" value="'.$this->l('OK').'" onclick="$(this).prev().search();" />
<input type="button" class="button" value="'.$this->l('Delete').'" onclick="undoEdit();" /> <input type="button" class="button" value="'.$this->l('Delete').'" onclick="undoEdit();" />
</div> </div>
+1 -4
View File
@@ -373,13 +373,10 @@ class AdminStoresControllerCore extends AdminController
{ {
$images_types = ImageType::getImagesTypes('stores'); $images_types = ImageType::getImagesTypes('stores');
foreach ($images_types as $k => $image_type) foreach ($images_types as $k => $image_type)
{
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : '');
imageResize(_PS_STORE_IMG_DIR_.$id_store.'.jpg', imageResize(_PS_STORE_IMG_DIR_.$id_store.'.jpg',
_PS_STORE_IMG_DIR_.$id_store.'-'.stripslashes($image_type['name']).$theme.'.jpg', _PS_STORE_IMG_DIR_.$id_store.'-'.stripslashes($image_type['name']).'.jpg',
(int)$image_type['width'], (int)$image_type['height'] (int)$image_type['width'], (int)$image_type['height']
); );
}
} }
return $ret; return $ret;
} }
@@ -306,8 +306,7 @@ class AdminSuppliersControllerCore extends AdminController
foreach ($images_types as $k => $image_type) foreach ($images_types as $k => $image_type)
{ {
$file = _PS_SUPP_IMG_DIR_.$id_supplier.'.jpg'; $file = _PS_SUPP_IMG_DIR_.$id_supplier.'.jpg';
$theme = (Shop::isFeatureActive() ? '-'.$image_type['id_theme'] : ''); imageResize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height']);
imageResize($file, _PS_SUPP_IMG_DIR_.$id_supplier.'-'.stripslashes($image_type['name']).$theme.'.jpg', (int)$image_type['width'], (int)$image_type['height']);
} }
} }
} }
+1 -2
View File
@@ -867,7 +867,6 @@ CREATE TABLE `PREFIX_image_lang` (
CREATE TABLE `PREFIX_image_type` ( CREATE TABLE `PREFIX_image_type` (
`id_image_type` int(10) unsigned NOT NULL auto_increment, `id_image_type` int(10) unsigned NOT NULL auto_increment,
`id_theme` INT(11) unsigned NOT NULL,
`name` varchar(16) NOT NULL, `name` varchar(16) NOT NULL,
`width` int(10) unsigned NOT NULL, `width` int(10) unsigned NOT NULL,
`height` int(10) unsigned NOT NULL, `height` int(10) unsigned NOT NULL,
@@ -878,7 +877,7 @@ CREATE TABLE `PREFIX_image_type` (
`scenes` tinyint(1) NOT NULL default '1', `scenes` tinyint(1) NOT NULL default '1',
`stores` tinyint(1) NOT NULL default '1', `stores` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id_image_type`), PRIMARY KEY (`id_image_type`),
UNIQUE KEY `image_type_name` (`id_theme`, `name`) KEY `image_type_name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_lang` ( CREATE TABLE `PREFIX_lang` (
+66 -25
View File
@@ -339,7 +339,11 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
(162, 'PS_UNIDENTIFIED_GROUP', '1', NOW(), NOW()), (162, 'PS_UNIDENTIFIED_GROUP', '1', NOW(), NOW()),
(163, 'PS_GUEST_GROUP', '2', NOW(), NOW()), (163, 'PS_GUEST_GROUP', '2', NOW(), NOW()),
(164, 'PS_CUSTOMER_GROUP', '3', NOW(), NOW()), (164, 'PS_CUSTOMER_GROUP', '3', NOW(), NOW()),
(165, 'PS_SMARTY_CONSOLE', 0, NOW(), NOW()); (165, 'PS_SMARTY_CONSOLE', 0, NOW(), NOW()),
(166, 'PS_B2B_ENABLE', '0', NOW(), NOW()),
(167, 'PS_INVOICE_MODEL', 'invoice', NOW(), NOW()),
(168, 'PS_LIMIT_UPLOAD_IMAGE_VALUE', '2', NOW(), NOW()),
(169, 'PS_LIMIT_UPLOAD_FILE_VALUE', '2', NOW(), NOW());
INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES
(36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()), (36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()),
@@ -904,15 +908,15 @@ INSERT INTO `PREFIX_currency` (`name`, `iso_code`, `iso_code_num`, `sign`, `blan
('Singapour Dollar', 'SGD', '702', '$', 1, 1.77, 2, 0, 0), ('Baht', 'THB', '764', '฿', 1, 40.96, 2, 0, 0), ('Rand', 'ZAR', '710', 'R', 1, 9.38, 2, 0, 0);*/ ('Singapour Dollar', 'SGD', '702', '$', 1, 1.77, 2, 0, 0), ('Baht', 'THB', '764', '฿', 1, 40.96, 2, 0, 0), ('Rand', 'ZAR', '710', 'R', 1, 9.38, 2, 0, 0);*/
INSERT INTO `PREFIX_currency_shop` (`id_currency`, `id_shop`) VALUES (1,1), (2,1), (3,1); INSERT INTO `PREFIX_currency_shop` (`id_currency`, `id_shop`) VALUES (1,1), (2,1), (3,1);
INSERT INTO `PREFIX_image_type` (`id_image_type`, `id_theme`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`, `stores`) VALUES INSERT INTO `PREFIX_image_type` (`id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`, `stores`) VALUES
(1, 1, 'small', 45, 45, 1, 1, 1, 1, 0, 0), (1, 'small', 45, 45, 1, 1, 1, 1, 0, 0),
(2, 1, 'medium', 58, 58, 1, 1, 1, 1, 0, 1), (2, 'medium', 58, 58, 1, 1, 1, 1, 0, 1),
(3, 1, 'large', 264, 264, 1, 1, 1, 1, 0, 0), (3, 'large', 264, 264, 1, 1, 1, 1, 0, 0),
(4, 1, 'thickbox', 600, 600, 1, 0, 0, 0, 0, 0), (4, 'thickbox', 600, 600, 1, 0, 0, 0, 0, 0),
(5, 1, 'category', 500, 150, 0, 1, 0, 0, 0, 0), (5, 'category', 500, 150, 0, 1, 0, 0, 0, 0),
(6, 1, 'home', 124, 124, 1, 0, 0, 0, 0, 0), (6, 'home', 124, 124, 1, 0, 0, 0, 0, 0),
(7, 1, 'large_scene', 556, 200, 0, 0, 0, 0, 1, 0), (7, 'large_scene', 556, 200, 0, 0, 0, 0, 1, 0),
(8, 1, 'thumb_scene', 161, 58, 0, 0, 0, 0, 1, 0); (8, 'thumb_scene', 161, 58, 0, 0, 0, 0, 1, 0);
INSERT INTO `PREFIX_contact_shop` (`id_contact`, `id_shop`) VALUES (1,1), (2,1); INSERT INTO `PREFIX_contact_shop` (`id_contact`, `id_shop`) VALUES (1,1), (2,1);
@@ -931,11 +935,12 @@ INSERT INTO `PREFIX_contact_lang` (`id_contact`, `id_lang`, `name`, `description
INSERT INTO `PREFIX_profile` (`id_profile`) VALUES (1); INSERT INTO `PREFIX_profile` (`id_profile`) VALUES (1);
INSERT INTO `PREFIX_profile_lang` (`id_profile`, `id_lang`, `name`) VALUES (1, 1, 'SuperAdmin'),(1, 2, 'SuperAdmin'),(1, 3, 'SuperAdmin'),(1, 4, 'SuperAdmin'),(1, 5, 'SuperAdmin'); INSERT INTO `PREFIX_profile_lang` (`id_profile`, `id_lang`, `name`) VALUES (1, 1, 'SuperAdmin'),(1, 2, 'SuperAdmin'),(1, 3, 'SuperAdmin'),(1, 4, 'SuperAdmin'),(1, 5, 'SuperAdmin');
/* Active tabs */
INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUES (1, 'AdminCatalog', 0, 1),(2, 'AdminCustomers', 0, 2),(3, 'AdminOrders', 0, 3), INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUES (1, 'AdminCatalog', 0, 1),(2, 'AdminCustomers', 0, 2),(3, 'AdminOrders', 0, 3),
(4, 'AdminPayment', 0, 4),(5, 'AdminShipping', 0, 5),(6, 'AdminStats', 0, 6),(7, 'AdminModules', 0, 7),(29, 'AdminEmployees', 0, 8),(8, 'AdminPreferences', 0, 9), (4, 'AdminPayment', 0, 4),(5, 'AdminShipping', 0, 5),(6, 'AdminStats', 0, 6),(7, 'AdminModules', 0, 7),(29, 'AdminEmployees', 0, 8),(8, 'AdminPreferences', 0, 9),
(9, 'AdminTools', 0, 10),(82, 'AdminStores', 9, 11),(60, 'AdminTracking', 1, 3),(10, 'AdminManufacturers', 1, 4),(34, 'AdminSuppliers', 1, 5),(11, 'AdminAttributesGroups', 1, 6), (9, 'AdminTools', 0, 10),(82, 'AdminStores', 9, 11),(60, 'AdminTracking', 1, 3),(10, 'AdminManufacturers', 1, 4),(34, 'AdminSuppliers', 1, 5),(11, 'AdminAttributesGroups', 1, 6),
(36, 'AdminFeatures', 1, 7),(58, 'AdminScenes', 1, 8),(66, 'AdminTags', 1, 9),(68, 'AdminAttachments', 1, 10),(12, 'AdminAddresses', 2, 1),(63, 'AdminGroups', 2, 2), (36, 'AdminFeatures', 1, 7),(58, 'AdminScenes', 1, 8),(66, 'AdminTags', 1, 9),(68, 'AdminAttachments', 1, 10),(12, 'AdminAddresses', 2, 1),(63, 'AdminGroups', 2, 2),
(65, 'AdminCarts', 2, 3),(42, 'AdminInvoices', 3, 1),(55, 'AdminDeliverySlip', 3, 2),(47, 'AdminReturn', 3, 3),(49, 'AdminSlip', 3, 4),(59, 'AdminMessages', 3, 5), (65, 'AdminCarts', 2, 3),(42, 'AdminInvoices', 3, 1),(55, 'AdminDeliverySlip', 3, 2),(47, 'AdminReturn', 3, 3),(49, 'AdminSlip', 3, 4),
(13, 'AdminStatuses', 3, 6),(54, 'AdminOrderMessage', 3, 7),(14, 'AdminCartRules', 4, 4),(15, 'AdminCurrencies', 4, 1),(16, 'AdminTaxes', 4, 2), (13, 'AdminStatuses', 3, 6),(54, 'AdminOrderMessage', 3, 7),(14, 'AdminCartRules', 4, 4),(15, 'AdminCurrencies', 4, 1),(16, 'AdminTaxes', 4, 2),
(17, 'AdminCarriers', 5, 1),(46, 'AdminStates', 5, 2),(18, 'AdminCountries', 5, 3),(19, 'AdminZones', 5, 5),(20, 'AdminRangePrice', 5, 6), (17, 'AdminCarriers', 5, 1),(46, 'AdminStates', 5, 2),(18, 'AdminCountries', 5, 3),(19, 'AdminZones', 5, 5),(20, 'AdminRangePrice', 5, 6),
(21, 'AdminRangeWeight', 5, 7),(61, 'AdminSearchEngines', 6, 2),(62, 'AdminReferrers', 6, 3), (21, 'AdminRangeWeight', 5, 7),(61, 'AdminSearchEngines', 6, 2),(62, 'AdminReferrers', 6, 3),
@@ -961,11 +966,14 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
(103, 'AdminAccountingManagement', 102, 1), (103, 'AdminAccountingManagement', 102, 1),
(104, 'AdminAccountingExport', 102, 2), (104, 'AdminAccountingExport', 102, 2),
(105, 'AdminCmsCategories', -1, 0), (105, 'AdminCmsCategories', -1, 0),
(106, 'AdminCms', -1, 0), (106, 'AdminCms', -1, 0),
(107, 'AdminLogin', -1 , 0), (107, 'AdminLogin', -1 , 0),
(108, 'AdminStockConfiguration', 95, 7), (108, 'AdminStockConfiguration', 95, 7),
(109, 'AdminSpecificPriceRule', 1, 11); (109, 'AdminSpecificPriceRule', 1, 11);
/* Inactive tabs */
INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`, `active`) VALUES (110, 'AdminOutstanding', 2, 5, 0);
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM `PREFIX_tab`); INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM `PREFIX_tab`);
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
@@ -997,7 +1005,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(1, 105, 'CMS categories'), (1, 105, 'CMS categories'),
(1, 106, 'CMS pages'), (1, 106, 'CMS pages'),
(1, 108, 'Configuration'), (1, 108, 'Configuration'),
(1, 109, 'Catalog price rules'); (1, 109, 'Catalog price rules'),
(1, 110, 'Outstanding');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'), (2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'),
@@ -1028,7 +1037,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 105, 'Catégories CMS'), (2, 105, 'Catégories CMS'),
(2, 106, 'Pages CMS'), (2, 106, 'Pages CMS'),
(2, 108, 'Configuration'), (2, 108, 'Configuration'),
(2, 109, 'Règles de prix catalogue'); (2, 109, 'Règles de prix catalogue'),
(2, 110, 'Encours');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'), (3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'),
@@ -1058,7 +1068,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 105, 'CMS categories'), (3, 105, 'CMS categories'),
(3, 106, 'CMS pages'), (3, 106, 'CMS pages'),
(3, 108, 'Configuration'), (3, 108, 'Configuration'),
(3, 110, 'Catalog price rules'); (3, 109, 'Catalog price rules'),
(3, 110, 'Outstanding');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'), (4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
@@ -1089,7 +1100,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 105, 'CMS categories'), (4, 105, 'CMS categories'),
(4, 106, 'CMS pages'), (4, 106, 'CMS pages'),
(4, 108, 'Configuration'), (4, 108, 'Configuration'),
(4, 109, 'Catalog price rules'); (4, 109, 'Catalog price rules'),
(4, 110, 'Outstanding');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'), (5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
@@ -1120,7 +1132,8 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 105, 'CMS categories'), (5, 105, 'CMS categories'),
(5, 106, 'CMS pages'), (5, 106, 'CMS pages'),
(5, 108, 'Configuration'), (5, 108, 'Configuration'),
(5, 109, 'Catalog price rules'); (5, 109, 'Catalog price rules'),
(5, 110, 'Outstanding');
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`) INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
(SELECT `id_tab`, id_lang, (SELECT tl.`name` (SELECT `id_tab`, id_lang, (SELECT tl.`name`
@@ -1452,7 +1465,7 @@ INSERT INTO `PREFIX_timezone` (`name`) VALUES ('Africa/Abidjan'),('Africa/Accra'
INSERT INTO `PREFIX_group` (`id_group`, `reduction`, `date_add`, `date_upd`) VALUES (1, 0, NOW(), NOW()), (2, 0, NOW(), NOW()), (3, 0, NOW(), NOW()); INSERT INTO `PREFIX_group` (`id_group`, `reduction`, `date_add`, `date_upd`) VALUES (1, 0, NOW(), NOW()), (2, 0, NOW(), NOW()), (3, 0, NOW(), NOW());
INSERT INTO `PREFIX_group_lang` (`id_group`, `id_lang`, `name`) VALUES INSERT INTO `PREFIX_group_lang` (`id_group`, `id_lang`, `name`) VALUES
(1, 1, 'Unidentified'),(1, 2, 'Non identifié'),(1, 3, 'Unidentified'),(1, 4, 'Unidentified'),(1, 5, 'Unidentified'), (1, 1, 'Unidentified'),(1, 2, 'Non identifié'),(1, 3, 'Unidentified'),(1, 4, 'Unidentified'),(1, 5, 'Unidentified'),
(2, 1, 'Guest'),(2, 2, 'Invité'),(2, 3, 'Guest'),(2, 4, 'Guest'),(2, 5, 'Guest'), (2, 1, 'Guest'),(2, 2, 'Invité'),(2, 3, 'Guest'),(2, 4, 'Guest'),(2, 5, 'Guest'),
(3, 1, 'Default'),(3, 2, 'Défaut'),(3, 3, 'Predeterminado'),(3, 4, 'Default'),(3, 5, 'Default'); (3, 1, 'Default'),(3, 2, 'Défaut'),(3, 3, 'Predeterminado'),(3, 4, 'Default'),(3, 5, 'Default');
@@ -1461,13 +1474,13 @@ INSERT INTO `PREFIX_group_group_shop` (`id_group`, `id_group_shop`) (SELECT `id_
INSERT INTO `PREFIX_category_group` (`id_category`, `id_group`) (SELECT 1, `id_group` FROM `PREFIX_group`); INSERT INTO `PREFIX_category_group` (`id_category`, `id_group`) (SELECT 1, `id_group` FROM `PREFIX_group`);
INSERT INTO `PREFIX_stock_mvt_reason` (`id_stock_mvt_reason`, `sign`, `date_add`, `date_upd`) VALUES INSERT INTO `PREFIX_stock_mvt_reason` (`id_stock_mvt_reason`, `sign`, `date_add`, `date_upd`) VALUES
(1, 1, NOW(), NOW()), (1, 1, NOW(), NOW()),
(2, -1, NOW(), NOW()), (2, -1, NOW(), NOW()),
(3, -1, NOW(), NOW()), (3, -1, NOW(), NOW()),
(4, -1, NOW(), NOW()), (4, -1, NOW(), NOW()),
(5, 1, NOW(), NOW()), (5, 1, NOW(), NOW()),
(6, -1, NOW(), NOW()), (6, -1, NOW(), NOW()),
(7, 1, NOW(), NOW()), (7, 1, NOW(), NOW()),
(8, 1, NOW(), NOW()); (8, 1, NOW(), NOW());
INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`) VALUES INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`) VALUES
@@ -1606,3 +1619,31 @@ INSERT INTO `PREFIX_supply_order_state_lang` (`id_supply_order_state`, `id_lang`
(6, 3, 'order fenced'), (6, 3, 'order fenced'),
(6, 4, 'order fenced'), (6, 4, 'order fenced'),
(6, 5, 'order fenced'); (6, 5, 'order fenced');
INSERT INTO `PREFIX_risk` (`id_risk`, `percent`, `color`) VALUES
(1, 0, 'LimeGreen'),
(2, 35, 'DarkOrange'),
(3, 75, 'Crimson'),
(4, 100, '#ec2e15');
INSERT INTO `PREFIX_risk_lang` (`id_risk`, `id_lang`, `name`) VALUES
(1, 1, 'None'),
(2, 1, 'Low'),
(3, 1, 'Middle'),
(4, 1, 'Hight'),
(1, 2, 'Aucun'),
(2, 2, 'Faible'),
(3, 2, 'Moyen'),
(4, 2, 'Élevé'),
(1, 3, 'None'),
(2, 3, 'Low'),
(3, 3, 'Middle'),
(4, 3, 'Hight'),
(1, 4, 'None'),
(2, 4, 'Low'),
(3, 4, 'Middle'),
(4, 4, 'Hight'),
(1, 5, 'None'),
(2, 5, 'Low'),
(3, 5, 'Middle'),
(4, 5, 'Hight');
-4
View File
@@ -420,10 +420,6 @@ WHERE `class_name` = 'AdminAccounting';
ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount` `amount_tax_excl` DECIMAL( 10, 2 ) default NULL; ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount` `amount_tax_excl` DECIMAL( 10, 2 ) default NULL;
ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount_tax_incl` DECIMAL(10,2) default NULL AFTER `amount_tax_excl`; ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount_tax_incl` DECIMAL(10,2) default NULL AFTER `amount_tax_excl`;
ALTER TABLE `PREFIX_image_type` DROP INDEX `name`;
ALTER TABLE `PREFIX_image_type` ADD `id_theme` INT(11) NOT NULL AFTER `id_image_type`;
ALTER TABLE `PREFIX_image_type` ADD UNIQUE (`id_theme` ,`name`);
UPDATE `PREFIX_image_type` SET `id_theme`=1;
CREATE TABLE `PREFIX_webservice_account_shop` ( CREATE TABLE `PREFIX_webservice_account_shop` (
`id_webservice_account` INT( 11 ) UNSIGNED NOT NULL, `id_webservice_account` INT( 11 ) UNSIGNED NOT NULL,
+25 -10
View File
@@ -323,7 +323,7 @@ class ThemeInstallator extends Module
if (_PS_MODE_DEMO_) if (_PS_MODE_DEMO_)
{ {
return '<div class="error">'.Tools::displayError('This functionnality has been disabled.').'</div>'; return '<div class="error">'.Tools::displayError('This functionnality has been disabled.').'</div>';
} }
self::init_defines(); self::init_defines();
if (!Tools::isSubmit('cancelExport') AND $this->page == 'exportPage') if (!Tools::isSubmit('cancelExport') AND $this->page == 'exportPage')
@@ -392,14 +392,30 @@ class ThemeInstallator extends Module
} }
} }
private function updateImages($id_theme) private function updateImages()
{ {
foreach ($this->xml->images->image as $row) foreach ($this->xml->images->image as $row)
{ {
$foo = Db::getInstance()->getRow('
Db::getInstance()->execute(' SELECT name FROM `'._DB_PREFIX_.'image_type` i
INSERT INTO `'._DB_PREFIX_.'image_type` (`id_theme`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`) WHERE i.name LIKE \''.pSQL($row['name']).'\'');
VALUES ('.(int)$id_theme.', if ((int)(Tools::getValue('imagesConfig')) == 1 AND $foo)
continue ;
if ($foo)
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'image_type` i
SET `width` = '.(int)($row['width']).',
`height` = '.(int)($row['height']).',
`products` = '.($row['products'] == 'true' ? 1 : 0).',
`categories` = '.($row['categories'] == 'true' ? 1 : 0).',
`manufacturers` = '.($row['manufacturers'] == 'true' ? 1 : 0).',
`suppliers` = '.($row['suppliers'] == 'true' ? 1 : 0).',
`scenes` = '.($row['scenes'] == 'true' ? 1 : 0).'
WHERE i.name LIKE \''.pSQL($row['name']).'\'');
else
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'image_type` (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`)
VALUES (
\''.pSQL($row['name']).'\', \''.pSQL($row['name']).'\',
'.(int)($row['width']).', '.(int)($row['width']).',
'.(int)($row['height']).', '.(int)($row['height']).',
@@ -524,13 +540,12 @@ class ThemeInstallator extends Module
} }
} }
} }
if ((int)(Tools::getValue('imagesConfig')) != 3 AND self::updateImages())
$msg .= '<br /><b>'.$this->l('Images have been correctly updated in database').'</b><br />';
$theme = new Theme(); $theme = new Theme();
$theme->name = (string)$this->xml['name']; $theme->name = (string)$this->xml['name'];
$theme->add(); $theme->add();
if ((int)(Tools::getValue('imagesConfig')) != 3 AND self::updateImages((int)$theme->id))
$msg .= '<br /><b>'.$this->l('Images have been correctly updated in database').'</b><br />';
$this->_msg .= parent::displayConfirmation($msg); $this->_msg .= parent::displayConfirmation($msg);
$this->_html .= ' $this->_html .= '
<input type="submit" class="button" name="submitThemes" value="'.$this->l('Previous').'" /> <input type="submit" class="button" name="submitThemes" value="'.$this->l('Previous').'" />