[-] BO : #PSTEST-667 - Fix bug with favicon and stores icon and multishop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13062 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-02-07 10:10:40 +00:00
parent de4928b0fd
commit 1785529ea6
7 changed files with 31 additions and 19 deletions
+4 -1
View File
@@ -540,6 +540,7 @@ class FrontControllerCore extends Controller
if (!in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))
{
header('HTTP/1.1 503 temporarily overloaded');
$this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON'));
$this->context->smarty->display(_PS_THEME_DIR_.'maintenance.tpl');
exit;
}
@@ -549,6 +550,7 @@ class FrontControllerCore extends Controller
protected function displayRestrictedCountryPage()
{
header('HTTP/1.1 503 temporarily overloaded');
$this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON'));
$this->context->smarty->display(_PS_THEME_DIR_.'restricted-country.tpl');
exit;
}
@@ -671,7 +673,8 @@ class FrontControllerCore extends Controller
'logo_image_height' => Configuration::get('SHOP_LOGO_HEIGHT'),
'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_,
'content_only' => (int)Tools::getValue('content_only'),
'logo_url' => _PS_IMG_.Configuration::get('PS_LOGO').'?'.Configuration::get('PS_IMG_UPDATE_TIME')
'logo_url' => _PS_IMG_.Configuration::get('PS_LOGO').'?'.Configuration::get('PS_IMG_UPDATE_TIME'),
'favicon_url' => _PS_IMG_.Configuration::get('PS_FAVICON'),
));
}
@@ -355,7 +355,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
case 'store_icon':
if (in_array($this->wsObject->method, array('GET','HEAD','PUT')))
{
$path = _PS_IMG_DIR_.'logo_stores.gif';
$path = _PS_IMG_DIR_.Configuration::get('PS_STORES_ICON');
$this->imgExtension = 'gif';
}
else
+21 -12
View File
@@ -96,12 +96,6 @@ class AdminThemesControllerCore extends AdminController
{
parent::init();
// Thumbnails filenames depend on multishop activation
if (Shop::isFeatureActive())
$shop_suffix = '-'.(int)Context::getContext()->shop->getID();
else
$shop_suffix = '';
$this->options = array(
'appearance' => array(
'title' => $this->l('Appearance'),
@@ -110,8 +104,8 @@ class AdminThemesControllerCore extends AdminController
'PS_LOGO' => array('title' => $this->l('Header logo:'), 'desc' => $this->l('Will appear on main page'), 'type' => 'file', 'thumb' => _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()),
'PS_LOGO_MAIL' => array('title' => $this->l('Mail logo:'), 'desc' => $this->l('Will appear on e-mail headers, if undefined the Header logo will be used'), 'type' => 'file', 'thumb' => (file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL'))) ? _PS_IMG_.Configuration::get('PS_LOGO_MAIL').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()),
'PS_LOGO_INVOICE' => array('title' => $this->l('Invoice logo:'), 'desc' => $this->l('Will appear on invoices headers, if undefined the Header logo will be used'), 'type' => 'file', 'thumb' => file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_INVOICE')) ? _PS_IMG_.Configuration::get('PS_LOGO_INVOICE').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()),
'PS_FAVICON' => array('title' => $this->l('Favicon:'), 'desc' => $this->l('Will appear in the address bar of your web browser'), 'type' => 'file', 'thumb' => _PS_IMG_.'favicon'.$shop_suffix.'.ico?date='.time()),
'PS_STORES_ICON' => array('title' => $this->l('Store icon:'), 'desc' => $this->l('Will appear on the store locator (inside Google Maps)').'<br />'.$this->l('Suggested size: 30x30, Transparent GIF'), 'type' => 'file', 'thumb' => _PS_IMG_.'logo_stores'.$shop_suffix.'.gif?date='.time()),
'PS_FAVICON' => array('title' => $this->l('Favicon:'), 'desc' => $this->l('Will appear in the address bar of your web browser'), 'type' => 'file', 'thumb' => _PS_IMG_.Configuration::get('PS_FAVICON').'?date='.time()),
'PS_STORES_ICON' => array('title' => $this->l('Store icon:'), 'desc' => $this->l('Will appear on the store locator (inside Google Maps)').'<br />'.$this->l('Suggested size: 30x30, Transparent GIF'), 'type' => 'file', 'thumb' => _PS_IMG_.Configuration::get('PS_STORES_ICON').'?date='.time()),
'PS_NAVIGATION_PIPE' => array('title' => $this->l('Navigation pipe:'), 'desc' => $this->l('Used for navigation path inside categories/product'), 'cast' => 'strval', 'type' => 'text', 'size' => 20),
),
'submit' => array('title' => $this->l(' Save '), 'class' => 'button')
@@ -523,16 +517,31 @@ class AdminThemesControllerCore extends AdminController
$tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS_STORES_ICON');
if (!$tmp_name || !move_uploaded_file($_FILES['PS_STORES_ICON']['tmp_name'], $tmp_name))
return false;
if ($id_shop = Configuration::get('PS_SHOP_DEFAULT') && !@ImageManager::resize($tmp_name, _PS_IMG_DIR_.'logo_stores.gif'))
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT') && !@ImageManager::resize($tmp_name, _PS_IMG_DIR_.'logo_stores.gif'))
$this->errors[] = Tools::displayError('An error occurred during logo copy.');
if (!@ImageManager::resize($tmp_name, _PS_IMG_DIR_.'logo_stores-'.(int)$id_shop.'.gif'))
$this->errors[] = Tools::displayError('An error occurred during logo copy.');
else
Configuration::updateValue('PS_STORES_ICON', 'logo_stores-'.(int)$id_shop.'.gif');
Configuration::updateGlobalValue('PS_STORES_ICON', 'logo_stores.gif');
unlink($tmp_name);
}
if ($id_shop = Configuration::get('PS_SHOP_DEFAULT'))
}
/**
* Update PS_FAVICON
*/
public function updateOptionPsFavicon()
{
$id_shop = Context::getContext()->shop->getID();
if ($id_shop == Configuration::get('PS_SHOP_DEFAULT'))
$this->uploadIco('PS_FAVICON', _PS_IMG_DIR_.'favicon.ico');
$this->uploadIco('PS_FAVICON', _PS_IMG_DIR_.'favicon-'.(int)$id_shop.'.ico');
if ($this->uploadIco('PS_FAVICON', _PS_IMG_DIR_.'favicon-'.(int)$id_shop.'.ico'))
Configuration::updateValue('PS_FAVICON', 'favicon-'.(int)$id_shop.'.ico');
Configuration::updateGlobalValue('PS_FAVICON', 'favicon.ico');
}
protected function uploadIco($name, $dest)
+1 -1
View File
@@ -158,7 +158,7 @@ class StoresControllerCore extends FrontController
*/
protected function assignStores()
{
$this->context->smarty->assign('hasStoreIcon', file_exists(dirname(__FILE__).'/../img/logo_stores.gif'));
$this->context->smarty->assign('hasStoreIcon', file_exists(dirname(__FILE__).'/../img/'.Configuration::get('PS_STORES_ICON')));
$distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
if (!in_array($distanceUnit, array('km', 'mi')))
+2 -2
View File
@@ -37,8 +37,8 @@
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<meta name="generator" content="PrestaShop" />
<meta name="robots" content="{if isset($nobots)}no{/if}index,follow" />
<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_ps_dir}favicon.ico?{$img_update_time}" />
<link rel="shortcut icon" type="image/x-icon" href="{$img_ps_dir}favicon.ico?{$img_update_time}" />
<link rel="icon" type="image/vnd.microsoft.icon" href="{$favicon_url}?{$img_update_time}" />
<link rel="shortcut icon" type="image/x-icon" href="{$favicon_url}?{$img_update_time}" />
<script type="text/javascript">
var baseDir = '{$content_dir}';
var static_token = '{$static_token}';
+1 -1
View File
@@ -36,7 +36,7 @@
<meta name="keywords" content="{$meta_keywords|escape:'htmlall':'UTF-8'}" />
{/if}
<meta name="robots" content="{if isset($nobots)}no{/if}index,follow" />
<link rel="shortcut icon" href="{$img_ps_dir}favicon.ico" />
<link rel="shortcut icon" href="{$favicon_url}" />
<link href="{$css_dir}maintenance.css" rel="stylesheet" type="text/css" />
</head>
<body>
+1 -1
View File
@@ -36,7 +36,7 @@
<meta name="keywords" content="{$meta_keywords|escape:'htmlall':'UTF-8'}" />
{/if}
<meta name="robots" content="{if isset($nobots)}no{/if}index,follow" />
<link rel="shortcut icon" href="{$img_ps_dir}favicon.ico" />
<link rel="shortcut icon" href="{$favicon_url}" />
<link href="{$css_dir}restricted-country.css" rel="stylesheet" type="text/css" />
</head>
<body>