//// Merge -> revision 8290

This commit is contained in:
tDidierjean
2011-09-01 09:53:43 +00:00
parent b973c3ef12
commit a7ad178f28
50 changed files with 431 additions and 256 deletions
+12 -8
View File
@@ -25,8 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once("../classes/Validate.php");
class LanguageManager
{
private $url_xml;
@@ -72,8 +70,12 @@ class LanguageManager
return $this->lang;
}
/** get the http_accept_language isocode (if exists),
* and use it to find the corresponding prestashop id_lang
* otherwise, return 0.
* @return int id_lang to use
*/
private function getIdByHAL(){
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$FirstHAL = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
@@ -86,14 +88,16 @@ class LanguageManager
}
else
return 0;
}
/** set lang property with param $_GET['language'] if present,
* or by $_SERVER['HTTP_ACCEPT_LANGUAGE'] otherwise
*/
private function setLanguage()
{
if( isset($_GET['language']) AND Validate::isInt($_GET['language']))
$id_lang = (int)($_GET['language']);
if (!isset($id_lang))
if ( !empty($_GET['language']))
$id_lang = (int)($_GET['language'])>0 ? $_GET['language'] : 0;
if (empty($id_lang))
$id_lang = ($this->getIdByHAL());
$this->lang = $this->xml_file->lang[(int)($id_lang)];
}
@@ -102,4 +106,4 @@ class LanguageManager
{
return ($this->lang == NULL) ? false : dirname(__FILE__).$this->lang['trad_file'];
}
}
}
+13 -15
View File
@@ -40,28 +40,26 @@ class ToolsInstall
{
// Don't include theses files if classes are already defined
if (!class_exists('Validate', false))
include_once(INSTALL_PATH.'/../classes/Validate.php');
require_once(INSTALL_PATH.'/../classes/Validate.php');
if (!class_exists('Db', false))
include_once(INSTALL_PATH.'/../classes/Db.php');
require_once(INSTALL_PATH.'/../classes/Db.php');
if (!class_exists('MySQL', false))
include_once(INSTALL_PATH.'/../classes/MySQL.php');
require_once(INSTALL_PATH.'/../classes/MySQL.php');
if($posted)
{
// Check POST data...
$data_check = array(
!isset($_GET['server']) OR empty($_GET['server']),
!Validate::isMailName($_GET['server']),
!isset($_GET['type']) OR empty($_GET['type']),
!Validate::isMailName($_GET['type']),
!isset($_GET['name']) OR empty($_GET['name']),
!Validate::isMailName($_GET['name']),
!isset($_GET['login']) OR empty($_GET['login']),
!Validate::isMailName($_GET['login']),
!isset($_GET['password'])
!isset($_GET['server']) OR empty($_GET['server']) OR !Validate::isUrl($_GET['server']),
!isset($_GET['engine']) OR empty($_GET['engine']) OR !Validate::isMySQLEngine($_GET['engine']),
!isset($_GET['name']) OR empty($_GET['name']) OR !Validate::isUnixName($_GET['name']),
!isset($_GET['login']) OR empty($_GET['login']) OR !Validate::isUnixName($_GET['login']),
!isset($_GET['password']),
!isset($_GET['tablePrefix']) OR !Validate::isTablePrefix($_GET['tablePrefix']),
);
foreach ($data_check AS $data)
if ($data)
return 8;
@@ -100,9 +98,9 @@ class ToolsInstall
public static function sendMail($smtpChecked, $smtpServer, $content, $subject, $type, $to, $from, $smtpLogin, $smtpPassword, $smtpPort = 25, $smtpEncryption)
{
include(INSTALL_PATH.'/../tools/swift/Swift.php');
include(INSTALL_PATH.'/../tools/swift/Swift/Connection/SMTP.php');
include(INSTALL_PATH.'/../tools/swift/Swift/Connection/NativeMail.php');
require_once(INSTALL_PATH.'/../tools/swift/Swift.php');
require_once(INSTALL_PATH.'/../tools/swift/Swift/Connection/SMTP.php');
require_once(INSTALL_PATH.'/../tools/swift/Swift/Connection/NativeMail.php');
$swift = NULL;
$result = NULL;
+2 -2
View File
@@ -367,12 +367,12 @@ function verifyDbAccess ()
url: "model.php",
data:
"method=checkDB"
+"&type=MySQL"
+"&server="+ $("#dbServer").val()
+"&login="+ $("#dbLogin").val()
+"&password="+encodeURIComponent($("#dbPassword").val())
+"&engine="+$("#dbEngine option:selected").val()
+"&name="+ $("#dbName").val(),
+ "&name=" + $("#dbName").val()
+ "&tablePrefix=" + $("#db_prefix").val(),
success: function(ret)
{
ret = ret.getElementsByTagName('action')[0];
+7 -7
View File
@@ -54,9 +54,9 @@ if (version_compare(phpversion(), '5.0.0', '<'))
die;
}
require(dirname(__FILE__).'/../config/autoload.php');
include_once(INSTALL_PATH.'/classes/ToolsInstall.php');
include_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
require_once(dirname(__FILE__).'/../config/autoload.php');
require_once(INSTALL_PATH.'/classes/ToolsInstall.php');
require_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
/* Prevent from bad URI parsing when using index.php */
$requestUri = str_replace('index.php', '', $_SERVER['REQUEST_URI']);
@@ -71,7 +71,7 @@ $tooOld = true;
$installOfOldVersion = false;
if (file_exists(INSTALL_PATH.'/../config/settings.inc.php'))
{
include(INSTALL_PATH.'/../config/settings.inc.php');
require_once(INSTALL_PATH.'/../config/settings.inc.php');
$oldversion =_PS_VERSION_;
// fix : complete version number if there is not all 4 numbers
@@ -92,7 +92,7 @@ if (file_exists(INSTALL_PATH.'/../config/settings.inc.php'))
$installOfOldVersion = (version_compare($oldversion, INSTALL_VERSION) == 1);
}
include(INSTALL_PATH.'/classes/LanguagesManager.php');
require_once(INSTALL_PATH.'/classes/LanguagesManager.php');
$lm = new LanguageManager(dirname(__FILE__).'/langs/list.xml');
$_LANG = array();
$_LIST_WORDS = array();
@@ -101,7 +101,7 @@ function lang($txt) {
return (isset($_LANG[$txt]) ? $_LANG[$txt] : $txt);
}
if ($lm->getIncludeTradFilename())
include_once($lm->getIncludeTradFilename());
require_once($lm->getIncludeTradFilename());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@@ -173,7 +173,7 @@ if ($lm->getIncludeTradFilename())
txtError[5] = "<?php echo lang('Can\'t create settings file, if /config/settings.inc.php exists, please give the public write permissions to this file, else please create a file named settings.inc.php in config directory.'); ?>";
txtError[6] = "<?php echo lang('Can\'t write settings file, please create a file named settings.inc.php in config directory.'); ?>";
txtError[7] = "<?php echo lang('Impossible to upload the file!'); ?>";
txtError[8] = "<?php echo lang('Data integrity is not valided. Hack attempt?'); ?>";
txtError[8] = "<?php echo lang('Your database connection settings are not valid. Please check your server, name, login and prefix.'); ?>";
txtError[9] = "<?php echo lang('Impossible to read the content of a MySQL content file.'); ?>";
txtError[10] = "<?php echo lang('Impossible the access the a MySQL content file.'); ?>";
txtError[11] = "<?php echo lang('Error while inserting data in the database:'); ?>";
+1
View File
@@ -283,3 +283,4 @@ $_LANG['In this aim, use our'] = 'Verwenden Sie dazu unseren';
$_LANG['Additional Benefits'] = 'Exklusiv Angebot';
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Exklusiv Angebot für die Verkäufer PrestaShop';
$_LANG['PHP magic quotes option is off (recommended)'] = 'Die PHP-Option "magic quotes" ist deaktiviert (empfohlen)';
$_LANG['Other activity...'] = 'Andere activiteit...';
+1
View File
@@ -283,3 +283,4 @@ $_LANG['In this aim, use our'] = 'En este objetivo, utilice nuestro';
$_LANG['Additional Benefits'] = 'Otros beneficios';
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Ofertas exclusivas dedicadas a los comerciantes PrestaShop';
$_LANG['PHP magic quotes option is off (recommended)'] = 'La opción PHP "magic quotes" está desactivada (aconsejable)';
$_LANG['Other activity...'] = 'Otra actividad...';
+2 -1
View File
@@ -22,7 +22,7 @@ $_LANG['Configure your database by filling out the following fields:'] = 'Config
$_LANG['Congratulation, your online shop is now ready!'] = 'Félicitations, votre boutique est installée !';
$_LANG['Contact us!'] = 'Contactez-nous !';
$_LANG['Create new files and folders allowed'] = 'Création de nouveaux dossiers et fichiers autorisée';
$_LANG['Data integrity is not valided. Hack attempt?'] = 'L\'intégrité des données n\'est pas validée.';
$_LANG['Your database connection settings are not valid. Please check your server, name, login and prefix.'] = 'Vos informations de connexion à la base de données ne sont pas valides. Veuillez vérifier le serveur, nom, login et préfixe que vous avez indiqué.';
$_LANG['Database Server is available but database is not found'] = 'Le serveur de bases de données est disponible mais la base de données n\'a pas été trouvée';
$_LANG['Database Server is not found. Please verify the login, password and server fields.'] = 'Le serveur de bases de données n\'a pas été trouvé, merci de vérifier vos identifiants ou le nom du serveur.';
$_LANG['Database configuration'] = 'Configuration de la base de données';
@@ -289,3 +289,4 @@ $_LANG['Additional Benefits'] = 'Avantages exclusifs PrestaShop';
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Offres réservées aux marchands PrestaShop';
$_LANG['PHP magic quotes option is off (recommended)'] = 'L\'option PHP "magic quotes" est désactivée (recommandé)';
$_LANG['Dom extension loaded'] = 'L\'extension Dom est activée';
$_LANG['Other activity...'] = 'Autre activité..';
+1
View File
@@ -270,3 +270,4 @@ $_LANG['In this aim, use our'] = 'A questo scopo, utilizzare il nostro';
$_LANG['Additional Benefits'] = 'Ulteriori vantaggi';
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Offerte esclusivo dedicato ai venditori PrestaShop';
$_LANG['PHP magic quotes option is off (recommended)'] = 'Opzione magic quotes PHP è disattivata (consigliato)';
$_LANG['Other activity...'] = 'Altre attività ...';
+9 -8
View File
@@ -54,6 +54,7 @@ if ( substr($memory_limit,-1) != 'G'
){
@ini_set('memory_limit','128M');
}
require_once(dirname(__FILE__).'/../config/autoload.php');
/* Redefine REQUEST_URI if empty (on some webservers...) */
if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '')
@@ -64,7 +65,7 @@ $_SERVER['REQUEST_URI'] = str_replace('//', '/', $_SERVER['REQUEST_URI']);
define('INSTALL_VERSION', '1.5.0.1');
define('PS_INSTALLATION_IN_PROGRESS', true);
include_once(INSTALL_PATH.'/classes/ToolsInstall.php');
require_once(INSTALL_PATH.'/classes/ToolsInstall.php');
define('SETTINGS_FILE', INSTALL_PATH.'/../config/settings.inc.php');
define('DEFINES_FILE', INSTALL_PATH.'/../config/defines.inc.php');
define('INSTALLER__PS_BASE_URI', substr($_SERVER['REQUEST_URI'], 0, -1 * (strlen($_SERVER['REQUEST_URI']) - strrpos($_SERVER['REQUEST_URI'], '/')) - strlen(substr(dirname($_SERVER['REQUEST_URI']), strrpos(dirname($_SERVER['REQUEST_URI']), '/')+1))));
@@ -85,31 +86,31 @@ if (isset($_GET['method']))
switch ($_GET['method'])
{
case 'checkConfig' :
include_once('xml/checkConfig.php');
require_once('xml/checkConfig.php');
break;
case 'checkDB' :
include_once('xml/checkDB.php');
require_once('xml/checkDB.php');
break;
case 'createDB' :
include_once('xml/createDB.php');
require_once('xml/createDB.php');
break;
case 'checkMail' :
include_once('xml/checkMail.php');
require_once('xml/checkMail.php');
break;
case 'checkShopInfos' :
include_once('xml/checkShopInfos.php');
require_once('xml/checkShopInfos.php');
break;
case 'doUpgrade' :
include_once('xml/doUpgrade.php');
require_once('xml/doUpgrade.php');
break;
case 'getVersionFromDb' :
include_once('xml/getVersionFromDb.php');
require_once('xml/getVersionFromDb.php');
break;
}
}
+14 -2
View File
@@ -25,10 +25,22 @@
* International Registered Trademark & Property of PrestaShop SA
*/
/** remove the uncompatible module gridextjs (1.4.0.8 upgrade)
*/
function gridextjs_deprecated()
{
if (file_exists(dirname(__FILE__).'/../../modules/gridextjs'))
return rename(dirname(__FILE__).'/../../modules/gridextjs', dirname(__FILE__).'/../../modules/gridextjs.deprecated');
// if exists, use _PS_MODULE_DIR_ or _PS_ROOT_DIR_
// instead of guessing the modules dir
if (defined('_PS_MODULE_DIR_'))
$gridextjs_path = _PS_MODULE_DIR_ . 'gridextjs';
else
if (defined('_PS_ROOT_DIR_'))
$gridextjs_path = _PS_ROOT_DIR_ . '/modules/gridextjs';
else
$gridextjs_path = dirname(__FILE__).'/../../modules/gridextjs';
if (file_exists($gridextjs_path))
return rename($gridextjs_path, str_replace('gridextjs', 'gridextjs.deprecated', $gridextjs_path));
return true;
}
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
include('../classes/Tools.php');
require_once('../classes/Tools.php');
if (!isset($_GET['language']))
$_GET['language'] = 0;
function getPreinstallXmlLang($object, $field)
+1 -1
View File
@@ -1509,7 +1509,7 @@ CREATE TABLE `PREFIX_tax_lang` (
UNIQUE KEY `tax_lang_index` (`id_tax`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE PREFIX_timezone (
CREATE TABLE `PREFIX_timezone` (
id_timezone int(10) unsigned NOT NULL auto_increment,
name VARCHAR(32) NOT NULL,
PRIMARY KEY timezone_index(`id_timezone`)
+1 -1
View File
@@ -152,7 +152,7 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
(80, 'PS_ORDER_PROCESS_TYPE', 0, NOW(), NOW()),
(81, 'PS_SPECIFIC_PRICE_PRIORITIES', 'id_shop;id_currency;id_country;id_group', NOW(), NOW()),
(82, 'PS_TAX_DISPLAY', 0, NOW(), NOW()),
(83, 'PS_SMARTY_FORCE_COMPILE', 1, NOW(), NOW()),
(83, 'PS_SMARTY_FORCE_COMPILE', 0, NOW(), NOW()),
(84, 'PS_DISTANCE_UNIT', 'km', NOW(), NOW()),
(85, 'PS_STORES_DISPLAY_CMS', 1, NOW(), NOW()),
(86, 'PS_STORES_DISPLAY_FOOTER', 1, NOW(), NOW()),
+3 -1
View File
@@ -15,4 +15,6 @@ AND `id_lang` = (
ALTER TABLE `PREFIX_discount` ADD `include_tax` TINYINT(1) NOT NULL DEFAULT '0';
UPDATE `PREFIX_order_detail`set `product_price` = `product_price` /( 1-(`group_reduction`/100));
UPDATE `PREFIX_order_detail` SET `product_price` = `product_price` /( 1-(`group_reduction`/100));
DELETE FROM `PREFIX_configuration` WHERE name IN ('PS_LAYERED_BITLY_USERNAME', 'PS_LAYERED_BITLY_API_KEY', 'PS_LAYERED_SHARE') LIMIT 3;
+5 -5
View File
@@ -30,11 +30,11 @@ if (function_exists('date_default_timezone_set'))
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
include(INSTALL_PATH.'/classes/AddConfToFile.php');
include(INSTALL_PATH.'/../classes/Validate.php');
include(INSTALL_PATH.'/../classes/Db.php');
include(INSTALL_PATH.'/../classes/Tools.php');
include_once(INSTALL_PATH.'/../config/settings.inc.php');
require_once(INSTALL_PATH.'/classes/AddConfToFile.php');
require_once(INSTALL_PATH.'/../classes/Validate.php');
require_once(INSTALL_PATH.'/../classes/Db.php');
require_once(INSTALL_PATH.'/../classes/Tools.php');
require_once(INSTALL_PATH.'/../config/settings.inc.php');
Context::getContext()->shop = Shop::initialize();
define('_THEME_NAME_', Context::getContext()->shop->getTheme());
+10 -17
View File
@@ -36,29 +36,22 @@ if (file_exists(SETTINGS_FILE))
if (!unlink(SETTINGS_FILE))
die('<action result="fail" error="17" />'."\n");
include(INSTALL_PATH.'/classes/AddConfToFile.php');
include(INSTALL_PATH.'/../classes/Validate.php');
include(INSTALL_PATH.'/../classes/Db.php');
include(INSTALL_PATH.'/../classes/Tools.php');
require_once(INSTALL_PATH.'/classes/AddConfToFile.php');
require_once(INSTALL_PATH.'/../classes/Validate.php');
require_once(INSTALL_PATH.'/../classes/Db.php');
require_once(INSTALL_PATH.'/../classes/Tools.php');
global $logger;
//check db access
include_once(INSTALL_PATH.'/classes/ToolsInstall.php');
$resultDB = ToolsInstall::checkDB($_GET['server'], $_GET['login'], $_GET['password'], $_GET['name'], true, $_GET['engine']);
$resultDB = ToolsInstall::checkDB($_GET['server'], $_GET['login'], $_GET['password'], $_GET['name'], true);
if ($resultDB !== true){
$logger->logError('Invalid database configuration');
die("<action result='fail' error='".$resultDB."'/>\n");
}
// Check POST data...
$data_check = array(
!isset($_GET['mode']) OR ( $_GET['mode'] != "full" AND $_GET['mode'] != "lite"),
!isset($_GET['tablePrefix']) OR !Validate::isMailName($_GET['tablePrefix']) OR !preg_match('/^[a-z0-9_]*$/i', $_GET['tablePrefix'])
);
foreach ($data_check AS $data)
if ($data)
if (!isset($_GET['mode']) OR ($_GET['mode'] != "full" AND $_GET['mode'] != "lite"))
die('<action result="fail" error="8"/>'."\n");
// Writing data in settings file
@@ -67,12 +60,12 @@ $_PS_DIRECTORY_ = trim(str_replace(' ', '%20', INSTALLER__PS_BASE_URI), '/');
$_PS_DIRECTORY_ = ($_PS_DIRECTORY_) ? '/'.$_PS_DIRECTORY_.'/' : '/';
$datas = array(
array('_DB_SERVER_', trim($_GET['server'])),
array('_DB_TYPE_', trim($_GET['type'])),
array('_DB_TYPE_', 'MySQL'),
array('_DB_NAME_', trim($_GET['name'])),
array('_DB_USER_', trim($_GET['login'])),
array('_DB_PASSWD_', trim($_GET['password'])),
array('_DB_PREFIX_', trim($_GET['tablePrefix'])),
array('_MYSQL_ENGINE_', $_GET['engine']),
array('_MYSQL_ENGINE_', trim($_GET['engine'])),
array('_PS_CACHING_SYSTEM_', 'MCached'),
array('_PS_CACHE_ENABLED_', '0'),
array('_MEDIA_SERVER_1_', ''),
@@ -103,8 +96,8 @@ foreach (array(INSTALL_PATH.'/../tools/smarty/cache/', INSTALL_PATH.'/../tools/s
if ($confFile->error != false)
die('<action result="fail" error="'.$confFile->error.'" />'."\n");
//load new settings
include(SETTINGS_FILE);
//load new settings, and fatal error if you can't
require_once(SETTINGS_FILE);
//-----------
//import SQL data
+1 -1
View File
@@ -241,7 +241,7 @@ if (empty($neededUpgradeFiles))
//refresh conf file
include(INSTALL_PATH.'/classes/AddConfToFile.php');
require_once(INSTALL_PATH.'/classes/AddConfToFile.php');
$oldLevel = error_reporting(E_ALL);
$mysqlEngine = (defined('_MYSQL_ENGINE_') ? _MYSQL_ENGINE_ : 'MyISAM');
$datas = array(
+3 -3
View File
@@ -26,9 +26,9 @@
*/
require_once(SETTINGS_FILE);
include_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
require_once(INSTALL_PATH.'/classes/GetVersionFromDb.php');
include(INSTALL_PATH.'/classes/LanguagesManager.php');
require_once(INSTALL_PATH.'/classes/LanguagesManager.php');
$lm = new LanguageManager(INSTALL_PATH.'/langs/list.xml');
$_LANG = array();
$_LIST_WORDS = array();
@@ -82,4 +82,4 @@ if ($psVersionDb && in_array($psVersionDb, $versions))
else
{
die('<action result="ko" lang="' . htmlspecialchars(sprintf(lang('Warning, we detected that the version specified in your config/settings.inc.php does not match your SQL database structure.<br />File config/settings.inc.php indicates: %1$s<br />Our automatic detection tool has detected a version between %2$s and %3$s<br /><br />You should edit your config/settings.inc.php file to replace %1$s by your real shop version.<br />Failure to fix this issue before upgrading may result in severe complications.<br />Do not forget to relaunch the installer after this modification by pressing F5 on your web browser.'), '<span class="versionInfo">' . _PS_VERSION_ . '</span>', '<span class="versionInfo">' . $versions[count($versions) - 1] . '</span>', '<span class="versionInfo">' . $versions[0] . '</span>')) . '" />');
}
}