Skip to content

Commit

Permalink
Merge branch '1.6' of https://github.com/PrestaShop/PrestaShop into 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Shipow committed Mar 19, 2014
2 parents e05cb60 + 15c436b commit cf09d46
Show file tree
Hide file tree
Showing 20 changed files with 203 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{extends file="helpers/view/view.tpl"}

{block name="override_tpl"}
{if !$smarty.const._PS_HOST_MODE_}
{if !$host_mode}
<script type="text/javascript">
$(document).ready(function()
{
Expand Down Expand Up @@ -227,7 +227,7 @@
</div>
</div>
</div>
{if !$smarty.const._PS_HOST_MODE_}
{if !$host_mode}
<div class="panel">
<h3>
<i class="icon-info"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</a>
</li>
{/if}
{if $add_permission eq '1' && !$smarty.const._PS_HOST_MODE_}
{if $add_permission eq '1' && !$host_mode}
<li>
<a id="desc-module-new" class="toolbar_btn" href="#module_install" onclick="$('#module_install').slideToggle();" title="{l s='Add a new module'}">
<i class="process-icon-new" ></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
{l s='%s at least, or you will have to edit the translation files manually.' sprintf=$limit_warning['needed_limit']}
</div>
{else}
<div class="alert alert-info">
{l s='Some sentences to translate use this syntax: "Word %s word". These "%s" are variables, and PrestaShop takes care of replacing them before displaying your translation. You must leave these in your translations, and place them appropriately in your sentence.' sprintf='%d, %s, %1$s, %2$d'}
</div>
<div class="panel">
<p>{l s='Expressions to translate:'} <span class="badge">{l s='%d' sprintf=$count}</span></p>
<p>{l s='Total missing expressions:'} <span class="badge">{l s='%d' sprintf=$missing_translations|array_sum}</p>
Expand All @@ -67,13 +64,14 @@
<div id="BoxUseSpecialSyntax">
<div class="alert alert-warning">
<p>
{l s='Some of these expressions use this special syntax:'} <span>%d.</span><br />
{l s='You MUST use this syntax in your translations. Here are several examples:'}
{l s='Some of these expressions use this special syntax: %s.' sprintf='%d'}
<br />
{l s='You MUST use this syntax in your translations. Here are a few examples:'}
</p>
<ul>
<li>"There are <strong>%d</strong> products": "<strong>%d</strong>" {l s='will be replaced by a number.'}).</li>
<li>"List of pages in <strong>%s</strong>": "<strong>%s</strong>" {l s='will be replaced by a string.'}).</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": "<strong>n$</strong>" {l s='helps you reorder the arguments when necessary.'}).</li>
<li>"There are <strong>%d</strong> products": {l s='"%s" will be replaced by a number.' sprintf='%d'}</li>
<li>"List of pages in <strong>%s</strong>": {l s='"%s" will be replaced by a string.' sprintf='%s'}</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": {l s='The numbers enable you to reorder the variables when necessary.'}</li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@
{else}

<div class="alert alert-info">
<ul>
<li>{l s='Click on titles to open fieldsets'}.</li>
<li>{l s='Some sentences to translate use this syntax: "Word %%s word". These "%%s" are variables, and PrestaShop takes care of replacing them before displaying your translation. You must leave these in your translations, and place them appropriately in your sentence.'}</li>
</ul>
<p>
{l s='Click on the title of a section to open its fieldsets.'}
</p>
</div>
<div class="panel">
<p>{l s='Expressions to translate:'} <span class="badge">{l s='%d' sprintf=$count}</span></p>
Expand All @@ -77,13 +76,14 @@
<div id="BoxUseSpecialSyntax">
<div class="alert alert-warning">
<p>
{l s='Some of these expressions use this special syntax:'} <strong>%d.</strong>
{l s='Some of these expressions use this special syntax: %s.' sprintf='%d'}
<br />
{l s='You MUST use this syntax in your translations. Here are several examples:'}
</p>
<ul>
<li>"There are <strong>%d</strong> products": "<strong>%d</strong>" {l s='will be replaced by a number.'}).</li>
<li>"List of pages in <strong>%s</strong>": "<strong>%s</strong>" {l s='will be replaced by a string.'}).</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": "<strong>n$</strong>" {l s='helps you reorder the arguments when necessary.'}).</li>
<li>"There are <strong>%d</strong> products": {l s='"%s" will be replaced by a number.' sprintf='%d'}</li>
<li>"List of pages in <strong>%s</strong>": {l s='"%s" will be replaced by a string.' sprintf='%s'}</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": {l s='The numbers enable you to reorder the variables when necessary.'}</li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@
<div id="BoxUseSpecialSyntax">
<div class="alert alert-warning">
<p>
{l s='Some of these expressions use this special syntax:'} <strong>%d</strong><br><br>
{l s='Some of these expressions use this special syntax: %s.' sprintf='%d'}
<br />
{l s='You MUST use this syntax in your translations. Here are several examples:'}
</p>
<ul>
<li>"There are <strong>%d</strong> products": "<strong>%d</strong>" {l s='will be replaced by a number.'}).</li>
<li>"List of pages in <strong>%s</strong>": "<strong>%s</strong>" {l s='will be replaced by a string.'}).</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": "<strong>n$</strong>" {l s='helps you reorder the arguments when necessary.'}).</li>
<li>"There are <strong>%d</strong> products": {l s='"%s" will be replaced by a number.' sprintf='%d'}</li>
<li>"List of pages in <strong>%s</strong>": {l s='"%s" will be replaced by a string.' sprintf='%s'}</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": {l s='The numbers enable you to reorder the variables when necessary.'}</li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@
{else}
<div class="alert alert-info">
<p>
{l s='Some sentences to translate use this syntax: "You have %%s items...". These "%s" are variables, and PrestaShop takes care of replacing them before displaying your translation.' sprintf='%d, %s, %1$s, %2$d'}<br>
<strong>{l s='You must leave these in your translations, and place them appropriately in your sentence.'}</strong>
</p>
<p>
{l s='Click on titles to open fieldsets'}.
{l s='Click on the title of a section to open its fieldsets.'}
</p>
</div>
<div class="panel">
Expand All @@ -69,13 +65,14 @@
<div id="BoxUseSpecialSyntax">
<div class="alert alert-warning">
<p>
{l s='Some of these expressions use this special syntax:'} <span>%d.</span><br />
{l s='Some of these expressions use this special syntax: %s.' sprintf='%d'}
<br />
{l s='You MUST use this syntax in your translations. Here are several examples:'}
</p>
<ul>
<li>"There are <strong>%d</strong> products": "<strong>%d</strong>" {l s='will be replaced by a number.'}).</li>
<li>"List of pages in <strong>%s</strong>": "<strong>%s</strong>" {l s='will be replaced by a string.'}).</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": "<strong>n$</strong>" {l s='helps you reorder the arguments when necessary.'}).</li>
<li>"There are <strong>%d</strong> products": {l s='"%s" will be replaced by a number.' sprintf='%d'}</li>
<li>"List of pages in <strong>%s</strong>": {l s='"%s" will be replaced by a string.' sprintf='%s'}</li>
<li>"Feature: <strong>%1$s</strong> (<strong>%2$d</strong> values)": {l s='The numbers enable you to reorder the variables when necessary.'}</li>
</ul>
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions classes/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ public static function minifyCSS($css_content, $fileuri = false, &$import_url =
$css_content = str_replace(array(':0px', ':0em', ':0pt', ':0%'), ':0', $css_content);
$css_content = str_replace(array(' 0px', ' 0em', ' 0pt', ' 0%'), ' 0', $css_content);
$css_content = str_replace('\'images_ie/', '\'images/', $css_content);
$css_content = preg_replace_callback('#(AlphaImageLoader\(src=\')([^\']*\',)#s', array('Tools', 'replaceByAbsoluteURL'), $css_content);

$css_content = preg_replace_callback('#(AlphaImageLoader\(src=\')([^\']*\',)#s', array('Tools', 'replaceByAbsoluteURL'), $css_content);
// Store all import url
preg_match_all('#@import .*?;#i', $css_content, $m);
preg_match_all('#@(import|charset) .*?;#i', $css_content, $m);
for ($i = 0, $total = count($m[0]); $i < $total; $i++)
{
$import_url[] = $m[0][$i];
if (isset($m[1][$i]) && $m[1][$i] == 'import')
$import_url[] = $m[0][$i];
$css_content = str_replace($m[0][$i], '', $css_content);
}

Expand Down Expand Up @@ -524,6 +524,7 @@ public static function cccCss($css_files)
else
$content = $compressed_css_files[$media];

$content = '@charset "UTF-8";'."\n".$content;
$content = implode('', $import_url).$content;
file_put_contents($cache_filename, $content);
chmod($cache_filename, 0777);
Expand Down
16 changes: 11 additions & 5 deletions classes/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ class TabCore extends ObjectModel
/** @var integer position */
public $position;

/** @var integer active */
/** @var boolean active */
public $active = true;

/** @var integer hide_host_mode */
public $hide_host_mode = false;

const TAB_MODULE_LIST_URL = 'api.prestashop.com/xml/tab_modules_list.xml';

/**
Expand All @@ -58,12 +61,13 @@ class TabCore extends ObjectModel
'module' => array('type' => self::TYPE_STRING, 'validate' => 'isTabName', 'size' => 64),
'class_name' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 64),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'hide_host_mode' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),

// Lang fields
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => true, 'validate' => 'isTabName', 'size' => 64),
),
);

protected static $_getIdFromClassName = null;

/**
Expand Down Expand Up @@ -98,8 +102,8 @@ public function add($autodate = true, $null_values = false)
// Add tab
if (parent::add($autodate, $null_values))
{
//forces cache to be reloaded
self::$_getIdFromClassName = null;
//forces cache to be reloaded
self::$_getIdFromClassName = null;
return Tab::initAccess($this->id);
}
return false;
Expand Down Expand Up @@ -205,7 +209,7 @@ public static function getTab($id_lang, $id_tab)
FROM `'._DB_PREFIX_.'tab` t
LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl
ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)$id_lang.')
WHERE t.`id_tab` = '.(int)$id_tab
WHERE t.`id_tab` = '.(int)$id_tab.(defined('_PS_HOST_MODE_') ? ' AND `hide_host_mode` = 0' : '')
);
Cache::store($cache_id, $result);
}
Expand Down Expand Up @@ -248,6 +252,7 @@ public static function getTabs($id_lang, $id_parent = null)
SELECT t.*, tl.name
FROM `'._DB_PREFIX_.'tab` t
LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)$id_lang.')
WHERE 1 '.(defined('_PS_HOST_MODE_') ? ' AND `hide_host_mode` = 0' : '').'
ORDER BY t.`position` ASC');
foreach ($result as $row)
{
Expand Down Expand Up @@ -517,6 +522,7 @@ public static function getTabByIdProfile($id_parent, $id_profile)
AND a.`delete` = 1
AND a.`add` = 1
AND t.`id_parent` != 0 AND t.`id_parent` != -1
'.(defined('_PS_HOST_MODE_') ? ' AND `hide_host_mode` = 0' : '').'
ORDER BY t.`id_parent` ASC
');
}
Expand Down
9 changes: 5 additions & 4 deletions classes/db/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,12 @@ public static function getInstance($master = true)
if (!self::$_servers)
self::$_servers = array(
array('server' => _DB_SERVER_, 'user' => _DB_USER_, 'password' => _DB_PASSWD_, 'database' => _DB_NAME_), /* MySQL Master server */
// Add here your slave(s) server(s)
// array('server' => '192.168.0.15', 'user' => 'rep', 'password' => '123456', 'database' => 'rep'),
// array('server' => '192.168.0.3', 'user' => 'myuser', 'password' => 'mypassword', 'database' => 'mydatabase'),
);


// Add here your slave(s) server(s) in this file
if (file_exists(_PS_ROOT_DIR_.'/config/db_slave_server.inc.php'))
self::$_servers = array_merge(self::$_servers, include_once(_PS_ROOT_DIR_.'/config/db_slave_server.inc.php'));

$total_servers = count(self::$_servers);
if ($master || $total_servers == 1)
$id_server = 0;
Expand Down
35 changes: 35 additions & 0 deletions config/db_slave_server.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* 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
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/


/*
return array(
array('server' => '192.168.0.15', 'user' => 'rep', 'password' => '123456', 'database' => 'rep'),
array('server' => '192.168.0.3', 'user' => 'myuser', 'password' => 'mypassword', 'database' => 'mydatabase'),
);
*/

return array();
2 changes: 1 addition & 1 deletion controllers/admin/AdminEmployeesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public function validateRules($class_name = false)
public function postProcess()
{
/* PrestaShop demo mode */
if ((Tools::isSubmit('deleteemployee') || Tools::isSubmit('status') || Tools::isSubmit('statusemployee') || Tools::isSubmit('submitAddemployee')) && _PS_MODE_DEMO_)
if ((Tools::isSubmit('submitBulkdeleteemployee') || Tools::isSubmit('submitBulkdisableSelectionemployee') || Tools::isSubmit('deleteemployee') || Tools::isSubmit('status') || Tools::isSubmit('statusemployee') || Tools::isSubmit('submitAddemployee')) && _PS_MODE_DEMO_)
{
$this->errors[] = Tools::displayError('This functionality has been disabled.');
return;
Expand Down
3 changes: 3 additions & 0 deletions controllers/admin/AdminThemesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,9 @@ public function processUpdate()

$theme->product_per_page = $nb_product_per_page;

if ($this->context->shop->id_theme == (int)Tools::getValue('id_theme'))
Configuration::updateValue('PS_PRODUCTS_PER_PAGE', $nb_product_per_page);

if (isset($_FILES['image_preview']) && $_FILES['image_preview']['error'] == 0)
{
if (@getimagesize($_FILES['image_preview']['tmp_name']) && !ImageManager::validateUpload($_FILES['image_preview'], 300000))
Expand Down
1 change: 1 addition & 0 deletions install-dev/data/db_structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,7 @@ CREATE TABLE `PREFIX_tab` (
`module` varchar(64) NULL,
`position` int(10) unsigned NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT 1,
`hide_host_mode` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id_tab`),
KEY `class_name` (`class_name`),
KEY `id_parent` (`id_parent`)
Expand Down
Loading

0 comments on commit cf09d46

Please sign in to comment.