From f99bb7cffa3f1e8a8a71ed60558887a18ed47e7e Mon Sep 17 00:00:00 2001 From: rMalie Date: Wed, 28 Dec 2011 10:49:34 +0000 Subject: [PATCH] // Fix pub@prestashop.com default account password --- classes/Customer.php | 2 +- classes/Tools.php | 2 +- install-new/classes/xmlLoader.php | 20 +++++++++++--------- install-new/fixtures/apple/install.php | 6 ++++++ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/classes/Customer.php b/classes/Customer.php index 68670a138..70957b9c6 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -269,7 +269,7 @@ class CustomerCore extends ObjectModel WHERE `active` = 1 AND `email` = \''.pSQL($email).'\' '.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER).' - '.(isset($passwd) ? 'AND `passwd` = \''.md5(_COOKIE_KEY_.$passwd).'\'' : '').' + '.(isset($passwd) ? 'AND `passwd` = \''.Tools::encrypt($passwd).'\'' : '').' AND `deleted` = 0 AND `is_guest` = 0'; $result = Db::getInstance()->getRow($sql); diff --git a/classes/Tools.php b/classes/Tools.php index 9dd87dfa1..c5e72ea81 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -879,7 +879,7 @@ class ToolsCore */ public static function encrypt($passwd) { - return md5(pSQL(_COOKIE_KEY_.$passwd)); + return md5(_COOKIE_KEY_.$passwd); } /** diff --git a/install-new/classes/xmlLoader.php b/install-new/classes/xmlLoader.php index 10f8ec0f6..bc11a9827 100644 --- a/install-new/classes/xmlLoader.php +++ b/install-new/classes/xmlLoader.php @@ -285,7 +285,15 @@ class InstallXmlLoader } $data = $this->rewriteRelationedData($entity, $data); - $this->createEntity($entity, $identifier, (string)$xml->fields['class'], $data, $data_lang); + if (method_exists($this, 'createEntity'.Tools::toCamelCase($entity))) + { + // Create entity with custom method in current class + $method = 'createEntity'.Tools::toCamelCase($entity); + $this->$method($identifier, $data, $data_lang); + } + else + $this->createEntity($entity, $identifier, (string)$xml->fields['class'], $data, $data_lang); + if ($xml->fields['image']) { if (method_exists($this, 'copyImages'.Tools::toCamelCase($entity))) @@ -406,13 +414,7 @@ class InstallXmlLoader public function createEntity($entity, $identifier, $classname, array $data, array $data_lang = array()) { $xml = $this->loadEntity($entity); - if (method_exists($this, 'createEntity'.Tools::toCamelCase($entity))) - { - // Create entity with custom method in current class - $method = 'createEntity'.Tools::toCamelCase($entity); - $entity_id = $this->$method($identifier, $data, $data_lang); - } - else if ($classname) + if ($classname) { // Create entity with ObjectModel class $object = new $classname(); @@ -501,7 +503,7 @@ class InstallXmlLoader } } - return $entity_id; + $this->storeId($entity, $identifier, $entity_id); } public function generatePrimary($entity, $primary) diff --git a/install-new/fixtures/apple/install.php b/install-new/fixtures/apple/install.php index aaa4362cd..ba5825dba 100644 --- a/install-new/fixtures/apple/install.php +++ b/install-new/fixtures/apple/install.php @@ -33,5 +33,11 @@ */ class InstallFixturesApple extends InstallXmlLoader { + public function createEntityCustomer($identifier, array $data, array $data_lang) + { + if ($identifier == 'John') + $data['passwd'] = Tools::encrypt('123456789'); + return $this->createEntity('customer', $identifier, 'Customer', $data, $data_lang); + } }