//// Merge -> revision 8290

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8295 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-09-01 09:53:43 +00:00
parent d27c0b3b7d
commit c2258ae8e9
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;