// fix norms

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10228 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-11-17 16:57:41 +00:00
parent 1ca36181db
commit 03194ce5c6
5 changed files with 379 additions and 116 deletions
+50 -42
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,10 +31,11 @@ class AdminGeneratorControllerCore extends AdminController
public function __construct()
{
$this->_htFile = dirname(__FILE__).'/../../.htaccess';
$this->_rbFile = dirname(__FILE__).'/../../robots.txt';
$this->_smFile = dirname(__FILE__).'/../../sitemap.xml';
$this->_rbData = $this->_getRobotsContent();
$this->ht_file = dirname(__FILE__).'/../../.htaccess';
$this->rb_file = dirname(__FILE__).'/../../robots.txt';
$this->sm_file = dirname(__FILE__).'/../../sitemap.xml';
$this->rb_data = $this->getRobotsContent();
return parent::__construct();
}
@@ -42,8 +43,8 @@ class AdminGeneratorControllerCore extends AdminController
{
$languages = Language::getLanguages(false);
$this->tpl_option_vars['checkConfiguration_ht'] = $this->_checkConfiguration($this->_htFile);
$this->tpl_option_vars['checkConfiguration_rb'] = $this->_checkConfiguration($this->_rbFile);
$this->tpl_option_vars['checkConfiguration_ht'] = $this->checkConfiguration($this->ht_file);
$this->tpl_option_vars['checkConfiguration_rb'] = $this->checkConfiguration($this->rb_file);
$this->tpl_option_vars['ps_htaccess_cache_control'] = Configuration::get('PS_HTACCESS_CACHE_CONTROL');
$this->tpl_option_vars['ps_rewriting_settings'] = Configuration::get('PS_REWRITING_SETTINGS');
$this->tpl_option_vars['ps_htaccess_disable_multiviews'] = Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS');
@@ -51,25 +52,29 @@ class AdminGeneratorControllerCore extends AdminController
parent::initContent();
}
public function _checkConfiguration($file)
public function checkConfiguration($file)
{
if (file_exists($file))
return is_writable($file);
return is_writable(dirname($file));
}
function postProcess()
public function postProcess()
{
if (Tools::isSubmit('submitHtaccess'))
{
if ($this->tabAccess['edit'] === '1')
{
{
Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', (int)Tools::getValue('PS_HTACCESS_CACHE_CONTROL'));
Configuration::updateValue('PS_REWRITING_SETTINGS', (int)Tools::getValue('PS_REWRITING_SETTINGS'));
Configuration::updateValue('PS_HTACCESS_DISABLE_MULTIVIEWS', (int)Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS'));
if (Tools::generateHtaccess($this->_htFile, Configuration::get('PS_REWRITING_SETTINGS'), Configuration::get('PS_HTACCESS_CACHE_CONTROL'), '', Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS')))
if (Tools::generateHtaccess(
$this->ht_file,
Configuration::get('PS_REWRITING_SETTINGS'),
Configuration::get('PS_HTACCESS_CACHE_CONTROL'), '',
Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS')))
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
$this->_errors[] = $this->l('Cannot write into file:').' <b>'.$this->_htFile.'</b><br />'.$this->l('Please check write permissions.');
$this->_errors[] = $this->l('Cannot write into file:').' <b>'.$this->ht_file.'</b><br />'.$this->l('Please check write permissions.');
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
@@ -79,48 +84,51 @@ class AdminGeneratorControllerCore extends AdminController
{
if ($this->tabAccess['edit'] === '1')
{
if (!$writeFd = @fopen($this->_rbFile, 'w'))
die ($this->l('Cannot write into file:').' <b>'.$this->_rbFile.'</b><br />'.$this->l('Please check write permissions.'));
if (!$write_fd = @fopen($this->rb_file, 'w'))
$this->_errors[] = sprintf(Tools::displayError('Cannot write into file: %s. Please check write permissions.'), $this->rb_file);
else
{
// PS Comments
fwrite($writeFd, "# robots.txt automaticaly generated by PrestaShop e-commerce open-source solution\n");
fwrite($writeFd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n");
fwrite($writeFd, "# This file is to prevent the crawling and indexing of certain parts\n");
fwrite($writeFd, "# of your site by web crawlers and spiders run by sites like Yahoo!\n");
fwrite($writeFd, "# and Google. By telling these \"robots\" where not to go on your site,\n");
fwrite($writeFd, "# you save bandwidth and server resources.\n");
fwrite($writeFd, "# For more information about the robots.txt standard, see:\n");
fwrite($writeFd, "# http://www.robotstxt.org/wc/robots.html\n");
fwrite($write_fd, "# robots.txt automaticaly generated by PrestaShop e-commerce open-source solution\n");
fwrite($write_fd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n");
fwrite($write_fd, "# This file is to prevent the crawling and indexing of certain parts\n");
fwrite($write_fd, "# of your site by web crawlers and spiders run by sites like Yahoo!\n");
fwrite($write_fd, "# and Google. By telling these \"robots\" where not to go on your site,\n");
fwrite($write_fd, "# you save bandwidth and server resources.\n");
fwrite($write_fd, "# For more information about the robots.txt standard, see:\n");
fwrite($write_fd, "# http://www.robotstxt.org/wc/robots.html\n");
//GoogleBot specific
fwrite($writeFd, "# GoogleBot specific\n");
fwrite($writeFd, "User-agent: Googlebot\n");
foreach ($this->_rbData['GB'] as $GB)
fwrite($writeFd, 'Disallow: '.__PS_BASE_URI__.$GB."\n");
fwrite($write_fd, "# GoogleBot specific\n");
fwrite($write_fd, "User-agent: Googlebot\n");
foreach ($this->rb_data['GB'] as $gb)
fwrite($write_fd, 'Disallow: '.__PS_BASE_URI__.$gb."\n");
// User-Agent
fwrite($writeFd, "# All bots\n");
fwrite($writeFd, "User-agent: *\n");
fwrite($write_fd, "# All bots\n");
fwrite($write_fd, "User-agent: *\n");
// Directories
fwrite($writeFd, "# Directories\n");
foreach ($this->_rbData['Directories'] as $dir)
fwrite($writeFd, 'Disallow: '.__PS_BASE_URI__.$dir."\n");
fwrite($write_fd, "# Directories\n");
foreach ($this->rb_data['Directories'] as $dir)
fwrite($write_fd, 'Disallow: '.__PS_BASE_URI__.$dir."\n");
// Files
fwrite($writeFd, "# Files\n");
foreach ($this->_rbData['Files'] as $file)
fwrite($writeFd, 'Disallow: '.__PS_BASE_URI__.$file."\n");
fwrite($write_fd, "# Files\n");
foreach ($this->rb_data['Files'] as $file)
fwrite($write_fd, 'Disallow: '.__PS_BASE_URI__.$file."\n");
// Sitemap
fwrite($writeFd, "# Sitemap\n");
if (file_exists($this->_smFile))
if (filesize($this->_smFile))
fwrite($writeFd, 'Sitemap: '.(Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].__PS_BASE_URI__.'sitemap.xml'."\n");
fwrite($writeFd, "\n");
fwrite($write_fd, "# Sitemap\n");
if (file_exists($this->sm_file))
if (filesize($this->sm_file))
fwrite(
$write_fd,
'Sitemap: '.(Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].__PS_BASE_URI__.'sitemap.xml'."\n"
);
fwrite($write_fd, "\n");
fclose($writeFd);
fclose($write_fd);
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
} else
@@ -128,7 +136,7 @@ class AdminGeneratorControllerCore extends AdminController
}
}
public function _getRobotsContent()
public function getRobotsContent()
{
$tab = array();
@@ -54,9 +54,9 @@ class AdminInformationControllerCore extends AdminController
'encryption' => Configuration::get('PS_MAIL_SMTP_ENCRYPTION'),
'port' => Configuration::get('PS_MAIL_SMTP_PORT'),
),
'user_agent' => $_SERVER["HTTP_USER_AGENT"],
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
));
$this->context->smarty->assign($this->getTestResult());
}
@@ -72,7 +72,7 @@ class AdminInformationControllerCore extends AdminController
$tests = ConfigurationTest::getDefaultTests();
$tests_op = ConfigurationTest::getDefaultTestsOp();
$testsErrors = array(
$tests_errors = array(
'phpversion' => $this->l('Update your PHP version'),
'upload' => $this->l('Configure your server to allow the upload file'),
'system' => $this->l('Configure your server to allow the creation of directories and write to files'),
@@ -93,15 +93,15 @@ class AdminInformationControllerCore extends AdminController
'gz' => $this->l('Enable GZIP compression on your server')
);
$paramsRequiredResults = ConfigurationTest::check($tests);
$paramsOptionalResults = ConfigurationTest::check($tests_op);
$params_required_results = ConfigurationTest::check($tests);
$params_optional_results = ConfigurationTest::check($tests_op);
return array(
'failRequired' => in_array('fail', $paramsRequiredResults),
'failOptional' => in_array('fail', $paramsOptionalResults),
'testsErrors' => $testsErrors,
'testsRequired' => $paramsRequiredResults,
'testsOptional' => $paramsOptionalResults,
'failRequired' => in_array('fail', $params_required_results),
'failOptional' => in_array('fail', $params_optional_results),
'testsErrors' => $tests_errors,
'testsRequired' => $params_required_results,
'testsOptional' => $params_optional_results,
);
}
}
@@ -40,10 +40,34 @@ class AdminLocalizationControllerCore extends AdminController
'width' => 'width2',
'icon' => 'localization',
'fields' => array(
'PS_WEIGHT_UNIT' => array('title' => $this->l('Weight unit:'), 'desc' => $this->l('The weight unit of your shop (eg. kg or lbs)'), 'validation' => 'isWeightUnit', 'required' => true, 'type' => 'text'),
'PS_DISTANCE_UNIT' => array('title' => $this->l('Distance unit:'), 'desc' => $this->l('The distance unit of your shop (eg. km or mi)'), 'validation' => 'isDistanceUnit', 'required' => true, 'type' => 'text'),
'PS_VOLUME_UNIT' => array('title' => $this->l('Volume unit:'), 'desc' => $this->l('The volume unit of your shop'), 'validation' => 'isWeightUnit', 'required' => true, 'type' => 'text'),
'PS_DIMENSION_UNIT' => array('title' => $this->l('Dimension unit:'), 'desc' => $this->l('The dimension unit of your shop (eg. cm or in)'), 'validation' => 'isDistanceUnit', 'required' => true, 'type' => 'text'),
'PS_WEIGHT_UNIT' => array(
'title' => $this->l('Weight unit:'),
'desc' => $this->l('The weight unit of your shop (eg. kg or lbs)'),
'validation' => 'isWeightUnit',
'required' => true,
'type' => 'text'
),
'PS_DISTANCE_UNIT' => array(
'title' => $this->l('Distance unit:'),
'desc' => $this->l('The distance unit of your shop (eg. km or mi)'),
'validation' => 'isDistanceUnit',
'required' => true,
'type' => 'text'
),
'PS_VOLUME_UNIT' => array(
'title' => $this->l('Volume unit:'),
'desc' => $this->l('The volume unit of your shop'),
'validation' => 'isWeightUnit',
'required' => true,
'type' => 'text'
),
'PS_DIMENSION_UNIT' => array(
'title' => $this->l('Dimension unit:'),
'desc' => $this->l('The dimension unit of your shop (eg. cm or in)'),
'validation' => 'isDistanceUnit',
'required' => true,
'type' => 'text'
)
),
'submit' => array('title' => $this->l(' Save '), 'class' => 'button')
),
@@ -52,8 +76,20 @@ class AdminLocalizationControllerCore extends AdminController
'width' => 'width2',
'icon' => 'localization',
'fields' => array(
'PS_LOCALE_LANGUAGE' => array('title' => $this->l('Language locale:'), 'desc' => $this->l('Your server\'s language locale.'), 'validation' => 'isLanguageIsoCode', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL),
'PS_LOCALE_COUNTRY' => array('title' => $this->l('Country locale:'), 'desc' => $this->l('Your server\'s country locale.'), 'validation' => 'isLanguageIsoCode', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL)
'PS_LOCALE_LANGUAGE' => array(
'title' => $this->l('Language locale:'),
'desc' => $this->l('Your server\'s language locale.'),
'validation' => 'isLanguageIsoCode',
'type' => 'text',
'visibility' => Shop::CONTEXT_ALL
),
'PS_LOCALE_COUNTRY' => array(
'title' => $this->l('Country locale:'),
'desc' => $this->l('Your server\'s country locale.'),
'validation' => 'isLanguageIsoCode',
'type' => 'text',
'visibility' => Shop::CONTEXT_ALL
)
),
'submit' => array('title' => $this->l(' Save '), 'class' => 'button')
),
@@ -64,21 +100,22 @@ class AdminLocalizationControllerCore extends AdminController
{
if (Tools::isSubmit('submitLocalizationPack'))
{
if (!$pack = @Tools::file_get_contents('http://www.prestashop.com/download/localization/'.Tools::getValue('iso_localization_pack').'.xml') AND !$pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml'))
if (!$pack = @Tools::file_get_contents('http://www.prestashop.com/download/localization/'.Tools::getValue('iso_localization_pack').'.xml') &&
!$pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml'))
$this->_errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
elseif (!$selection = Tools::getValue('selection'))
else if (!$selection = Tools::getValue('selection'))
$this->_errors[] = Tools::displayError('Please select at least one content item to import.');
else
{
foreach ($selection AS $selected)
foreach ($selection as $selected)
if (!Validate::isLocalizationPackSelection($selected))
{
$this->_errors[] = Tools::displayError('Invalid selection');
return ;
return;
}
$localizationPack = new LocalizationPack();
if (!$localizationPack->loadLocalisationPack($pack, $selection))
$this->_errors = array_merge($this->_errors, $localizationPack->getErrors());
$localization_pack = new LocalizationPack();
if (!$localization_pack->loadLocalisationPack($pack, $selection))
$this->_errors = array_merge($this->_errors, $localization_pack->getErrors());
else
Tools::redirectAdmin(self::$currentIndex.'&conf=23&token='.$this->token);
}
@@ -89,19 +126,19 @@ class AdminLocalizationControllerCore extends AdminController
public function initContent()
{
$localizations_pack = false;
$localizations_pack = false;
$this->tpl_option_vars['options_content'] = $this->initOptions();
$xml_localization = Tools::simplexml_load_file('http://www.prestashop.com/rss/localization.xml');
if (!$xml_localization)
{
$localizationFile = dirname(__FILE__).'/../../localization/localization.xml';
if (file_exists($localizationFile))
$xml_localization = simplexml_load_file($localizationFile);
$localization_file = dirname(__FILE__).'/../../localization/localization.xml';
if (file_exists($localization_file))
$xml_localization = simplexml_load_file($localization_file);
}
if ($xml_localization)
foreach($xml_localization->pack as $pack)
foreach ($xml_localization->pack as $pack)
$localizations_pack[(string)$pack->iso] = (string)$pack->name;
$this->tpl_option_vars['localizations_pack'] = $localizations_pack;
+220 -28
View File
@@ -89,42 +89,234 @@ class AdminPreferencesControllerCore extends AdminController
$cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
$fields = array(
'PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'maintenance_ip', 'size' => 30, 'default' => ''),
'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'),
'PS_COOKIE_CHECKIP' => array('title' => $this->l('Check IP on the cookie'), 'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0', 'visibility' => Shop::CONTEXT_ALL),
'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0', 'visibility' => Shop::CONTEXT_ALL),
'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'visibility' => Shop::CONTEXT_ALL),
'PS_COOKIE_LIFETIME_FO' => array('title' => $this->l('Lifetime of the Front Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480', 'visibility' => Shop::CONTEXT_ALL),
'PS_COOKIE_LIFETIME_BO' => array('title' => $this->l('Lifetime of the Back Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480', 'visibility' => Shop::CONTEXT_ALL),
'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'),
'PS_REGISTRATION_PROCESS_TYPE' => array('title' => $this->l('Registration process type'), 'desc' => $this->l('The "Only account creation" step register process allows the customer to register faster, and create his address later.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $registration_process_type, 'identifier' => 'value'),
'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')),
'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'),
'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'),
'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'),
'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Attachment maximum size'), 'desc' => $this->l('Set the maximum size of attachment files (in MegaBytes).').' '.$this->l('Maximum:').' '.((int)str_replace('M', '', ini_get('post_max_size')) > (int)str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '2'),
'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_CART_FOLLOWING' => array('title' => $this->l('Cart re-display at login'), 'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'),
'PRESTASTORE_LIVE' => array('title' => $this->l('Automatically check for module updates'), 'desc' => $this->l('New modules and updates are displayed on the modules page'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'visibility' => Shop::CONTEXT_ALL),
'PS_HIDE_OPTIMIZATION_TIPS' => array('title' => $this->l('Hide optimization tips'), 'desc' => $this->l('Hide optimization tips on the back office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_DISPLAY_SUPPLIERS' => array('title' => $this->l('Display suppliers and manufacturers'), 'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_SHOW_NEW_ORDERS' => array('title' => $this->l('Show notifications for new orders'), 'desc' => $this->l('This will display notifications when new orders will be made on your shop'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_SHOW_NEW_CUSTOMERS' => array('title' => $this->l('Show notifications for new customers'), 'desc' => $this->l('This will display notifications when new customers will register on your shop'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_SHOW_NEW_MESSAGES' => array('title' => $this->l('Show notifications for new messages'), 'desc' => $this->l('This will display notifications when new messages will be posted on your shop'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_SHOP_ENABLE' => array(
'title' => $this->l('Enable Shop'),
'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_MAINTENANCE_IP' => array(
'title' => $this->l('Maintenance IP'),
'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'),
'validation' => 'isGenericName',
'type' => 'maintenance_ip',
'size' => 30,
'default' => ''
),
'PS_SSL_ENABLED' => array(
'title' => $this->l('Enable SSL'),
'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'default' => '0'
),
'PS_COOKIE_CHECKIP' => array(
'title' => $this->l('Check IP on the cookie'),
'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'default' => '0',
'visibility' => Shop::CONTEXT_ALL
),
'PS_TOKEN_ENABLE' => array(
'title' => $this->l('Increase Front Office security'),
'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'default' => '0',
'visibility' => Shop::CONTEXT_ALL
),
'PS_HELPBOX' => array(
'title' => $this->l('Back Office help boxes'),
'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'visibility' => Shop::CONTEXT_ALL
),
'PS_COOKIE_LIFETIME_FO' => array(
'title' => $this->l('Lifetime of the Front Office cookie'),
'desc' => $this->l('Indicate the number of hours'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'text',
'default' => '480',
'visibility' => Shop::CONTEXT_ALL
),
'PS_COOKIE_LIFETIME_BO' => array(
'title' => $this->l('Lifetime of the Back Office cookie'),
'desc' => $this->l('Indicate the number of hours'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'text',
'default' => '480',
'visibility' => Shop::CONTEXT_ALL
),
'PS_ORDER_PROCESS_TYPE' => array(
'title' => $this->l('Order process type'),
'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'select',
'list' => $order_process_type,
'identifier' => 'value'
),
'PS_REGISTRATION_PROCESS_TYPE' => array(
'title' => $this->l('Registration process type'),
'desc' => $this->l('The "Only account creation" step register process allows the customer to register faster, and create his address later.'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'select',
'list' => $registration_process_type,
'identifier' => 'value'
),
'PS_GUEST_CHECKOUT_ENABLED' => array(
'title' => $this->l('Enable guest checkout'),
'desc' => $this->l('Your guest can make an order without registering'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_CONDITIONS' => array(
'title' => $this->l('Terms of service'),
'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'js' => array(
'on' => 'onchange="changeCMSActivationAuthorization()"',
'off' => 'onchange="changeCMSActivationAuthorization()"'
)
),
'PS_CONDITIONS_CMS_ID' => array(
'title' => $this->l('Conditions of use CMS page'),
'desc' => $this->l('Choose the Conditions of use CMS page'),
'validation' => 'isInt',
'type' => 'select',
'list' => $cms_tab,
'identifier' => 'id',
'cast' => 'intval'
),
'PS_GIFT_WRAPPING' => array(
'title' => $this->l('Offer gift-wrapping'),
'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_GIFT_WRAPPING_PRICE' => array(
'title' => $this->l('Gift-wrapping price'),
'desc' => $this->l('Set a price for gift-wrapping'),
'validation' => 'isPrice',
'cast' => 'floatval',
'type' => 'price'
),
'PS_GIFT_WRAPPING_TAX' => array(
'title' => $this->l('Gift-wrapping tax'),
'desc' => $this->l('Set a tax for gift-wrapping'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'select',
'list' => $taxes,
'identifier' => 'id'
),
'PS_ATTACHMENT_MAXIMUM_SIZE' => array(
'title' => $this->l('Attachment maximum size'),
'desc' => $this->l('Set the maximum size of attachment files (in MegaBytes).').' '.$this->l('Maximum:').' '.
((int)str_replace('M', '', ini_get('post_max_size')) > (int)str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'text',
'default' => '2'
),
'PS_RECYCLABLE_PACK' => array(
'title' => $this->l('Offer recycled packaging'),
'desc' => $this->l('Suggest recycled packaging to customer'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_CART_FOLLOWING' => array(
'title' => $this->l('Cart re-display at login'),
'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_PRICE_ROUND_MODE' => array(
'title' => $this->l('Round mode'),
'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'),
'validation' => 'isInt',
'cast' => 'intval',
'type' => 'select',
'list' => $round_mode,
'identifier' => 'value'
),
'PRESTASTORE_LIVE' => array(
'title' => $this->l('Automatically check for module updates'),
'desc' => $this->l('New modules and updates are displayed on the modules page'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'visibility' => Shop::CONTEXT_ALL
),
'PS_HIDE_OPTIMIZATION_TIPS' => array(
'title' => $this->l('Hide optimization tips'),
'desc' => $this->l('Hide optimization tips on the back office homepage'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_DISPLAY_SUPPLIERS' => array(
'title' => $this->l('Display suppliers and manufacturers'),
'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_SHOW_NEW_ORDERS' => array(
'title' => $this->l('Show notifications for new orders'),
'desc' => $this->l('This will display notifications when new orders will be made on your shop'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_SHOW_NEW_CUSTOMERS' => array(
'title' => $this->l('Show notifications for new customers'),
'desc' => $this->l('This will display notifications when new customers will register on your shop'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_SHOW_NEW_MESSAGES' => array(
'title' => $this->l('Show notifications for new messages'),
'desc' => $this->l('This will display notifications when new messages will be posted on your shop'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
)
);
if (function_exists('date_default_timezone_set'))
$fields['PS_TIMEZONE'] = array('title' => $this->l('Time Zone:'), 'validation' => 'isAnything', 'type' => 'select', 'list' => $timezones, 'identifier' => 'name', 'visibility' => Shop::CONTEXT_ALL);
$fields['PS_TIMEZONE'] = array(
'title' => $this->l('Time Zone:'),
'validation' => 'isAnything',
'type' => 'select',
'list' => $timezones,
'identifier' => 'name',
'visibility' => Shop::CONTEXT_ALL
);
// No HTTPS activation if you haven't already.
if (!Tools::usingSecureMode())
{
$fields['PS_SSL_ENABLED']['type'] = 'disabled';
$fields['PS_SSL_ENABLED']['disabled'] = '<a href="https://'.Tools::getShopDomainSsl().Tools::safeOutput($_SERVER['REQUEST_URI']).'">'.$this->l('Please click here to use HTTPS protocol before enabling SSL.').'</a>';
$fields['PS_SSL_ENABLED']['disabled'] = '<a href="https://'.Tools::getShopDomainSsl().Tools::safeOutput($_SERVER['REQUEST_URI']).'">'.
$this->l('Please click here to use HTTPS protocol before enabling SSL.').'</a>';
}
$this->options = array(
+44 -18
View File
@@ -31,32 +31,58 @@ class AdminTagsControllerCore extends AdminController
{
$this->table = 'tag';
$this->className = 'Tag';
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->bulk_actions = array(
'delete' => array('text' => $this->l('Delete selected'),
'confirm' => $this->l('Delete selected items?'))
);
$this->fieldsDisplay = array(
'id_tag' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25, 'filter_key' => 'a!id_seller_message'),
'lang' => array('title' => $this->l('Language'), 'filter_key' => 'l!name'),
'name' => array('title' => $this->l('Name'), 'width' => 200, 'filter_key' => 'a!name'),
'products' => array('title' => $this->l('Products'), 'align' => 'right', 'havingFilter' => true));
$this->_select = 'l.name as lang, COUNT(pt.id_product) as products';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'product_tag` pt ON (a.`id_tag` = pt.`id_tag`)
LEFT JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = a.`id_lang`)';
$this->_group = 'GROUP BY a.name, a.id_lang';
'id_tag' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25,
'filter_key' => 'a!id_seller_message'
),
'lang' => array(
'title' => $this->l('Language'),
'filter_key' => 'l!name'
),
'name' => array(
'title' => $this->l('Name'),
'width' => 200,
'filter_key' => 'a!name'
),
'products' => array(
'title' => $this->l('Products'),
'align' => 'right',
'havingFilter' => true
)
);
parent::__construct();
}
public function initList()
{
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->bulk_actions = array(
'delete' => array('text' => $this->l('Delete selected'),
'confirm' => $this->l('Delete selected items?'))
);
$this->_select = 'l.name as lang, COUNT(pt.id_product) as products';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'product_tag` pt
ON (a.`id_tag` = pt.`id_tag`)
LEFT JOIN `'._DB_PREFIX_.'lang` l
ON (l.`id_lang` = a.`id_lang`)';
$this->_group = 'GROUP BY a.name, a.id_lang';
return parent::initList();
}
public function postProcess()
{
if ($this->tabAccess['edit'] === '1' AND Tools::getValue('submitAdd'.$this->table))
if ($id = (int)(Tools::getValue($this->identifier)) AND $obj = new $this->className($id) AND Validate::isLoadedObject($obj))
if ($this->tabAccess['edit'] === '1' && Tools::getValue('submitAdd'.$this->table))
if ($id = (int)Tools::getValue($this->identifier) && $obj = new $this->className($id) && Validate::isLoadedObject($obj))
$obj->setProducts($_POST['products']);
return parent::postProcess();
}