diff --git a/Readme.md b/Readme.md
index b6c0945d0..791b61d1e 100755
--- a/Readme.md
+++ b/Readme.md
@@ -1,8 +1,9 @@
Readme
======
-Thelia
+Thelia
------
+[](https://travis-ci.org/thelia/thelia)
Thelia is an open source tool for creating e-business websites and managing online content. This software is published under GPL.
diff --git a/Thelia b/Thelia
index 2aaa3c3e5..a161b610f 100755
--- a/Thelia
+++ b/Thelia
@@ -7,6 +7,7 @@ require __DIR__ . '/core/bootstrap.php';
use Thelia\Core\Thelia;
use Thelia\Core\Application;
+use Thelia\Command\Output\TheliaConsoleOutput;
use Symfony\Component\Console\Input\ArgvInput;
$input = new ArgvInput();
@@ -15,4 +16,4 @@ $debug = getenv('THELIA_DEBUG') !== '0' && !$input->hasParameterOption(array('--
$thelia = new Thelia($env, $debug);
$application = new Application($thelia);
-$application->run($input);
\ No newline at end of file
+$application->run($input, new TheliaConsoleOutput());
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 31739057b..04b020c18 100755
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,7 @@
"php": ">=5.4",
"ezyang/htmlpurifier": "dev-master",
"ircmaxell/password-compat": "dev-master",
- "propel/propel": "2.0.0-alpha1",
+ "propel/propel": "dev-master",
"psr/log" : "1.0",
"symfony/class-loader": "2.2.*",
"symfony/config" : "2.2.*",
diff --git a/composer.lock b/composer.lock
index 22158aa3c..b49c21e6f 100755
--- a/composer.lock
+++ b/composer.lock
@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "449a98ad751df49842394b9e47f3f447",
+ "hash": "af923b61425810eacdb86a41df529feb",
"packages": [
{
"name": "ezyang/htmlpurifier",
@@ -11,12 +11,12 @@
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
- "reference": "v4.5.0"
+ "reference": "107b3055a10eb824701463602f77fbc8129180a2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/v4.5.0",
- "reference": "v4.5.0",
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/107b3055a10eb824701463602f77fbc8129180a2",
+ "reference": "107b3055a10eb824701463602f77fbc8129180a2",
"shasum": ""
},
"require": {
@@ -47,7 +47,7 @@
"keywords": [
"html"
],
- "time": "2013-02-18 00:04:08"
+ "time": "2013-07-17 04:56:29"
},
{
"name": "ircmaxell/password-compat",
@@ -94,12 +94,12 @@
"source": {
"type": "git",
"url": "https://github.com/kriswallsmith/assetic.git",
- "reference": "82e8fc20a3b043b378a7efbda9e3d406d420f00e"
+ "reference": "f9f754dc7524acd6daf0bf510d22c055b4967e08"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/82e8fc20a3b043b378a7efbda9e3d406d420f00e",
- "reference": "82e8fc20a3b043b378a7efbda9e3d406d420f00e",
+ "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/f9f754dc7524acd6daf0bf510d22c055b4967e08",
+ "reference": "f9f754dc7524acd6daf0bf510d22c055b4967e08",
"shasum": ""
},
"require": {
@@ -114,9 +114,9 @@
"leafo/scssphp": "*",
"leafo/scssphp-compass": "*",
"mrclay/minify": "*",
- "phpunit/phpunit": ">=3.7,<4.0",
+ "phpunit/phpunit": "~3.7",
"ptachoire/cssembed": "*",
- "twig/twig": ">=1.6,<2.0"
+ "twig/twig": "~1.6"
},
"suggest": {
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
@@ -157,7 +157,7 @@
"compression",
"minification"
],
- "time": "2013-06-13 16:47:03"
+ "time": "2013-07-11 15:56:23"
},
{
"name": "leafo/lessphp",
@@ -165,12 +165,12 @@
"source": {
"type": "git",
"url": "https://github.com/leafo/lessphp.git",
- "reference": "ff86f2941c3f3d67d56acad2f8902ca57c73b359"
+ "reference": "366fb52798d4f120503af0703da11cba4ad06f8d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/leafo/lessphp/zipball/ff86f2941c3f3d67d56acad2f8902ca57c73b359",
- "reference": "ff86f2941c3f3d67d56acad2f8902ca57c73b359",
+ "url": "https://api.github.com/repos/leafo/lessphp/zipball/366fb52798d4f120503af0703da11cba4ad06f8d",
+ "reference": "366fb52798d4f120503af0703da11cba4ad06f8d",
"shasum": ""
},
"type": "library",
@@ -198,34 +198,34 @@
],
"description": "lessphp is a compiler for LESS written in PHP.",
"homepage": "http://leafo.net/lessphp/",
- "time": "2013-05-22 17:52:29"
+ "time": "2013-07-09 16:25:09"
},
{
"name": "propel/propel",
- "version": "2.0.0-alpha1",
+ "version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/propelorm/Propel2.git",
- "reference": "2.0.0-alpha1"
+ "reference": "4cf5fca150ed93b33dc54206e3d9d943d0712621"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/propelorm/Propel2/zipball/2.0.0-alpha1",
- "reference": "2.0.0-alpha1",
+ "url": "https://api.github.com/repos/propelorm/Propel2/zipball/4cf5fca150ed93b33dc54206e3d9d943d0712621",
+ "reference": "4cf5fca150ed93b33dc54206e3d9d943d0712621",
"shasum": ""
},
"require": {
"php": ">=5.4",
- "psr/log": ">=1.0,<2.0",
- "symfony/console": ">=2.2,<3.0",
- "symfony/filesystem": ">=2.2,<3.0",
- "symfony/finder": ">=2.2,<3.0",
- "symfony/validator": ">=2.2,<3.0",
- "symfony/yaml": ">=2.2,<3.0"
+ "psr/log": "~1.0",
+ "symfony/console": "~2.2",
+ "symfony/filesystem": "~2.2",
+ "symfony/finder": "~2.2",
+ "symfony/validator": "~2.2",
+ "symfony/yaml": "~2.2"
},
"require-dev": {
- "behat/behat": ">=2.4,<3.0",
- "monolog/monolog": ">=1.3,<2.0",
+ "behat/behat": "~2.4",
+ "monolog/monolog": "~1.3",
"phpunit/phpunit": "3.7.*"
},
"suggest": {
@@ -258,7 +258,7 @@
"orm",
"persistence"
],
- "time": "2013-06-05 06:46:14"
+ "time": "2013-07-10 11:32:06"
},
{
"name": "psr/log",
@@ -487,24 +487,24 @@
},
{
"name": "symfony/class-loader",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/ClassLoader",
"source": {
"type": "git",
"url": "https://github.com/symfony/ClassLoader.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "symfony/finder": ">=2.0,<3.0"
+ "symfony/finder": "~2.0"
},
"type": "library",
"extra": {
@@ -537,17 +537,17 @@
},
{
"name": "symfony/config",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -580,21 +580,21 @@
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com",
- "time": "2013-05-10 18:08:31"
+ "time": "2013-07-10 14:03:01"
},
{
"name": "symfony/console",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -627,21 +627,21 @@
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
- "time": "2013-06-13 07:47:06"
+ "time": "2013-07-08 14:34:53"
},
{
"name": "symfony/dependency-injection",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -649,7 +649,7 @@
},
"require-dev": {
"symfony/config": ">=2.2,<2.3-dev",
- "symfony/yaml": ">=2.0,<3.0"
+ "symfony/yaml": "~2.0"
},
"suggest": {
"symfony/config": "2.2.*",
@@ -686,24 +686,24 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "symfony/dependency-injection": ">=2.0,<3.0"
+ "symfony/dependency-injection": "~2.0"
},
"suggest": {
"symfony/dependency-injection": "2.2.*",
@@ -740,17 +740,17 @@
},
{
"name": "symfony/filesystem",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -787,17 +787,17 @@
},
{
"name": "symfony/finder",
- "version": "v2.3.1",
+ "version": "v2.3.2",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
- "reference": "v2.3.1"
+ "reference": "v2.3.2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.3.1",
- "reference": "v2.3.1",
+ "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.3.2",
+ "reference": "v2.3.2",
"shasum": ""
},
"require": {
@@ -830,27 +830,27 @@
],
"description": "Symfony Finder Component",
"homepage": "http://symfony.com",
- "time": "2013-06-02 12:05:51"
+ "time": "2013-07-01 12:17:23"
},
{
"name": "symfony/form",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Form",
"source": {
"type": "git",
"url": "https://github.com/symfony/Form.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Form/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Form/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
- "symfony/event-dispatcher": ">=2.1,<3.0",
- "symfony/locale": ">=2.0,<3.0",
+ "symfony/event-dispatcher": "~2.1",
+ "symfony/locale": "~2.0",
"symfony/options-resolver": ">=2.1,<2.3-dev",
"symfony/property-access": ">=2.2,<2.3-dev"
},
@@ -889,21 +889,21 @@
],
"description": "Symfony Form Component",
"homepage": "http://symfony.com",
- "time": "2013-06-13 07:35:18"
+ "time": "2013-06-23 07:35:41"
},
{
"name": "symfony/http-foundation",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -939,37 +939,37 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "http://symfony.com",
- "time": "2013-06-13 12:48:26"
+ "time": "2013-07-15 12:12:07"
},
{
"name": "symfony/http-kernel",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
- "psr/log": ">=1.0,<2.0",
- "symfony/event-dispatcher": ">=2.1,<3.0",
+ "psr/log": "~1.0",
+ "symfony/event-dispatcher": "~2.1",
"symfony/http-foundation": ">=2.2,<2.3-dev"
},
"require-dev": {
"symfony/browser-kit": "2.2.*",
- "symfony/class-loader": ">=2.1,<3.0",
- "symfony/config": ">=2.0,<3.0",
+ "symfony/class-loader": "~2.1",
+ "symfony/config": "~2.0",
"symfony/console": "2.2.*",
- "symfony/dependency-injection": ">=2.0,<3.0",
- "symfony/finder": ">=2.0,<3.0",
- "symfony/process": ">=2.0,<3.0",
+ "symfony/dependency-injection": "~2.0",
+ "symfony/finder": "~2.0",
+ "symfony/process": "~2.0",
"symfony/routing": ">=2.2,<2.3-dev",
"symfony/stopwatch": ">=2.2,<2.3-dev"
},
@@ -1008,25 +1008,24 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "http://symfony.com",
- "time": "2013-06-19 12:09:49"
+ "time": "2013-07-15 12:28:01"
},
{
"name": "symfony/icu",
- "version": "v1.2.0",
+ "version": "v1.0.0",
"target-dir": "Symfony/Component/Icu",
"source": {
"type": "git",
"url": "https://github.com/symfony/Icu.git",
- "reference": "v1.2.0"
+ "reference": "v1.0.0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.2.0",
- "reference": "v1.2.0",
+ "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.0.0",
+ "reference": "v1.0.0",
"shasum": ""
},
"require": {
- "lib-icu": ">=4.4",
"php": ">=5.3.3",
"symfony/intl": ">=2.3,<3.0"
},
@@ -1056,26 +1055,26 @@
"icu",
"intl"
],
- "time": "2013-06-03 18:32:58"
+ "time": "2013-06-03 18:32:07"
},
{
"name": "symfony/intl",
- "version": "v2.3.1",
+ "version": "v2.3.2",
"target-dir": "Symfony/Component/Intl",
"source": {
"type": "git",
"url": "https://github.com/symfony/Intl.git",
- "reference": "v2.3.1"
+ "reference": "v2.3.2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Intl/zipball/v2.3.1",
- "reference": "v2.3.1",
+ "url": "https://api.github.com/repos/symfony/Intl/zipball/v2.3.2",
+ "reference": "v2.3.2",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
- "symfony/icu": ">=1.0-RC,<2.0"
+ "symfony/icu": "~1.0-RC"
},
"require-dev": {
"symfony/filesystem": ">=2.1"
@@ -1133,21 +1132,21 @@
"l10n",
"localization"
],
- "time": "2013-05-18 11:21:22"
+ "time": "2013-07-08 13:00:35"
},
{
"name": "symfony/locale",
- "version": "v2.3.1",
+ "version": "v2.3.2",
"target-dir": "Symfony/Component/Locale",
"source": {
"type": "git",
"url": "https://github.com/symfony/Locale.git",
- "reference": "v2.3.1"
+ "reference": "v2.3.2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Locale/zipball/v2.3.1",
- "reference": "v2.3.1",
+ "url": "https://api.github.com/repos/symfony/Locale/zipball/v2.3.2",
+ "reference": "v2.3.2",
"shasum": ""
},
"require": {
@@ -1181,21 +1180,21 @@
],
"description": "Symfony Locale Component",
"homepage": "http://symfony.com",
- "time": "2013-04-11 09:29:25"
+ "time": "2013-07-01 12:24:43"
},
{
"name": "symfony/options-resolver",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/OptionsResolver",
"source": {
"type": "git",
"url": "https://github.com/symfony/OptionsResolver.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -1237,17 +1236,17 @@
},
{
"name": "symfony/process",
- "version": "v2.3.1",
+ "version": "v2.3.2",
"target-dir": "Symfony/Component/Process",
"source": {
"type": "git",
"url": "https://github.com/symfony/Process.git",
- "reference": "v2.3.1"
+ "reference": "v2.3.2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Process/zipball/v2.3.1",
- "reference": "v2.3.1",
+ "url": "https://api.github.com/repos/symfony/Process/zipball/v2.3.2",
+ "reference": "v2.3.2",
"shasum": ""
},
"require": {
@@ -1280,21 +1279,21 @@
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com",
- "time": "2013-05-06 20:03:44"
+ "time": "2013-07-01 12:24:43"
},
{
"name": "symfony/property-access",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/PropertyAccess",
"source": {
"type": "git",
"url": "https://github.com/symfony/PropertyAccess.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -1342,27 +1341,27 @@
},
{
"name": "symfony/routing",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "doctrine/common": ">=2.2,<3.0",
- "psr/log": ">=1.0,<2.0",
+ "doctrine/common": "~2.2",
+ "psr/log": "~1.0",
"symfony/config": ">=2.2,<2.3-dev",
- "symfony/yaml": ">=2.0,<3.0"
+ "symfony/yaml": "~2.0"
},
"suggest": {
"doctrine/common": "~2.2",
@@ -1396,21 +1395,21 @@
],
"description": "Symfony Routing Component",
"homepage": "http://symfony.com",
- "time": "2013-05-10 16:49:00"
+ "time": "2013-06-23 06:56:04"
},
{
"name": "symfony/translation",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -1418,7 +1417,7 @@
},
"require-dev": {
"symfony/config": ">=2.0,<2.3-dev",
- "symfony/yaml": ">=2.2,<3.0"
+ "symfony/yaml": "~2.2"
},
"suggest": {
"symfony/config": "2.2.*",
@@ -1455,28 +1454,28 @@
},
{
"name": "symfony/validator",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Validator",
"source": {
"type": "git",
"url": "https://github.com/symfony/Validator.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Validator/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Validator/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
- "symfony/translation": ">=2.0,<3.0"
+ "symfony/translation": "~2.0"
},
"require-dev": {
"symfony/config": ">=2.2,<2.3-dev",
- "symfony/http-foundation": ">=2.1,<3.0",
- "symfony/locale": ">=2.0,<3.0",
- "symfony/yaml": ">=2.0,<3.0"
+ "symfony/http-foundation": "~2.1",
+ "symfony/locale": "~2.0",
+ "symfony/yaml": "~2.0"
},
"suggest": {
"doctrine/common": "~2.2",
@@ -1512,21 +1511,21 @@
],
"description": "Symfony Validator Component",
"homepage": "http://symfony.com",
- "time": "2013-06-02 12:05:41"
+ "time": "2013-07-02 07:41:45"
},
{
"name": "symfony/yaml",
- "version": "v2.2.3",
+ "version": "v2.2.4",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "v2.2.3"
+ "reference": "v2.2.4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.3",
- "reference": "v2.2.3",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.4",
+ "reference": "v2.2.4",
"shasum": ""
},
"require": {
@@ -1559,7 +1558,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
- "time": "2013-05-10 18:08:31"
+ "time": "2013-07-11 09:28:01"
}
],
"packages-dev": [
@@ -1569,12 +1568,12 @@
"source": {
"type": "git",
"url": "https://github.com/fzaninotto/Faker.git",
- "reference": "8b9bb44bbf864a63c2eece6744fc40240877b0c6"
+ "reference": "3613b1466d5e9518b83f87d828f93f962ff0f997"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/8b9bb44bbf864a63c2eece6744fc40240877b0c6",
- "reference": "8b9bb44bbf864a63c2eece6744fc40240877b0c6",
+ "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/3613b1466d5e9518b83f87d828f93f962ff0f997",
+ "reference": "3613b1466d5e9518b83f87d828f93f962ff0f997",
"shasum": ""
},
"require": {
@@ -1607,7 +1606,7 @@
"faker",
"fixtures"
],
- "time": "2013-07-08 09:31:33"
+ "time": "2013-07-15 16:26:12"
},
{
"name": "phpunit/php-code-coverage",
@@ -1979,7 +1978,7 @@
"stability-flags": {
"ezyang/htmlpurifier": 20,
"ircmaxell/password-compat": 20,
- "propel/propel": 15,
+ "propel/propel": 20,
"kriswallsmith/assetic": 20,
"leafo/lessphp": 20,
"ptachoire/cssembed": 20,
diff --git a/core/bootstrap.php b/core/bootstrap.php
index fd0dd80e9..8b53e72e5 100755
--- a/core/bootstrap.php
+++ b/core/bootstrap.php
@@ -11,6 +11,7 @@ define('THELIA_CONF_DIR' , THELIA_LOCAL_DIR . 'config/');
define('THELIA_MODULE_DIR' , THELIA_LOCAL_DIR . 'modules/');
define('THELIA_WEB_DIR' , THELIA_ROOT . '/web/');
define('THELIA_TEMPLATE_DIR' , THELIA_ROOT . '/templates/');
+define('DS', DIRECTORY_SEPARATOR);
$loader = require __DIR__ . "/vendor/autoload.php";
diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php
index 5d85f774f..c06ade935 100755
--- a/core/lib/Thelia/Action/Cart.php
+++ b/core/lib/Thelia/Action/Cart.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php
index 9241fd89f..4339ba4e3 100755
--- a/core/lib/Thelia/Action/Customer.php
+++ b/core/lib/Thelia/Action/Customer.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
@@ -32,23 +32,47 @@ use Thelia\Form\CustomerModification;
use Thelia\Model\Customer as CustomerModel;
use Thelia\Log\Tlog;
use Thelia\Model\CustomerQuery;
+use Thelia\Form\CustomerLogin;
+use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
+use Thelia\Core\Security\SecurityContext;
+use Thelia\Model\ConfigQuery;
+use Thelia\Tools\Redirect;
+use Symfony\Component\Validator\Exception\ValidatorException;
+use Thelia\Core\Security\Exception\AuthenticationException;
+use Thelia\Core\Template\ParserContext;
+use Thelia\Core\Security\Exception\UsernameNotFoundException;
+use Propel\Runtime\Exception\PropelException;
+
class Customer implements EventSubscriberInterface
{
+ /**
+ * @var Thelia\Core\Security\SecurityContext
+ */
+ protected $securityContext;
+
+ /**
+ * @var Thelia\Core\Template\ParserContext
+ */
+ protected $parserContext;
+
+ public function __construct(SecurityContext $securityContext, ParserContext $parserContext) {
+ $this->securityContext = $securityContext;
+ $this->parserContext = $parserContext;
+ }
public function create(ActionEvent $event)
{
-
$event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CREATECUSTOMER, $event);
$request = $event->getRequest();
- $customerForm = new CustomerCreation($request);
-
- $form = $customerForm->getForm();
+ $customerCreation = new CustomerCreation($request);
+ $form = $customerCreation->getForm();
if ($request->isMethod("post")) {
+
$form->bind($request);
if ($form->isValid()) {
@@ -68,26 +92,37 @@ class Customer implements EventSubscriberInterface
$data["country"],
$data["email"],
$data["password"],
- $request->getSession()->get("lang")
+ $request->getSession()->getLang()
);
- } catch (\PropelException $e) {
+
+ $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECUSTOMER, $event);
+
+ // Connect the newly created user,and redirect to the success URL
+ $this->processSuccessfulLogin($event, $customer, $customerCreation, true);
+
+ } catch (PropelException $e) {
Tlog::getInstance()->error(sprintf('error during creating customer on action/createCustomer with message "%s"', $e->getMessage()));
- $event->setFormError($form);
+
+ $message = "Failed to create your account, please try again.";
}
-
- //Customer is create, he is automatically connected
-
- } else {
-
- $event->setFormError($form);
+ }
+ else {
+ $message = "Missing or invalid data";
}
}
+ else {
+ $message = "Wrong form method !";
+ }
- $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECUSTOMER, $event);
+ $this->parserContext->set('customer_creation_error_message', $message);
+
+ $event->setFormError($customerCreation);
}
public function modify(ActionEvent $event)
{
+ $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECUSTOMER, $event);
+
$request = $event->getRequest();
$customerModification = new CustomerModification($request);
@@ -115,20 +150,92 @@ class Customer implements EventSubscriberInterface
$data["zipcode"],
$data["country"]
);
- } catch(\PropelException $e) {
+
+ $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECUSTOMER, $event);
+
+ // Update the logged-in user, and redirect to the success URL (exits)
+ // We don-t send the login event, as the customer si already logged.
+ $this->processSuccessfulLogin($event, $customer, $customerModification);
+ }
+ catch(PropelException $e) {
+
Tlog::getInstance()->error(sprintf('error during modifying customer on action/modifyCustomer with message "%s"', $e->getMessage()));
- $event->setFormError($form);
+
+ $message = "Failed to change your account, please try again.";
}
- } else {
- $event->setFormError($form);
+ }
+ else {
+ $message = "Missing or invalid data";
}
}
+ else {
+ $message = "Wrong form method !";
+ }
+ $this->parserContext->set('customer_change_error_message', $message);
+
+ $event->setFormError($customerModification);
}
- public function modifyPassword(ActionEvent $event)
- {
+ /**
+ * Perform user logout. The user is redirected to the provided view, if any.
+ *
+ * @param ActionEvent $event
+ */
+ public function logout(ActionEvent $event)
+ {
+ $event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGOUT, $event);
+
+ $this->getSecurityContext()->clear();
+ }
+
+ /**
+ * Perform user login. On a successful login, the user is redirected to the URL
+ * found in the success_url form parameter, or / if none was found.
+ *
+ * If login is not successfull, the same view is dispolyed again.
+ *
+ * @param ActionEvent $event
+ */
+ public function login(ActionEvent $event)
+ {
+ $request = $event->getRequest();
+
+ $form = new CustomerLogin($request);
+
+ $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $form);
+
+ try {
+ $user = $authenticator->getAuthentifiedUser();
+
+ $this->processSuccessfulLogin($event, $user, $form);
+ }
+ catch (ValidatorException $ex) {
+ $message = "Missing or invalid information. Please check your input.";
+ }
+ catch (UsernameNotFoundException $ex) {
+ $message = "This email address was not found.";
+ }
+ catch (AuthenticationException $ex) {
+ $message = "Login failed. Please check your username and password.";
+ }
+ catch (\Exception $ex) {
+ $message = sprintf("Unable to process your request. Please try again (%s in %s).", $ex->getMessage(), $ex->getFile());
+ }
+
+ // Store the form name in session (see Form Smarty plugin to find usage of this parameter)
+ $request->getSession()->setErrorFormName($form->getName());
+
+ // Put the message in the ParserContext to make it available to the template
+ $this->parserContext->set('customer_login_error_message', $message);
+
+ // A this point, the same view is displayed again.
+ }
+
+ public function changePassword(ActionEvent $event)
+ {
+ // TODO
}
/**
@@ -155,8 +262,37 @@ class Customer implements EventSubscriberInterface
{
return array(
"action.createCustomer" => array("create", 128),
- "action.modifyCustomer" => array("modify", 128)
+ "action.modifyCustomer" => array("modify", 128),
+ "action.loginCustomer" => array("login", 128),
+ "action.logoutCustomer" => array("logout", 128),
);
}
+ /**
+ * Stores the current user in the security context, and redirect to the
+ * success_url.
+ *
+ * @param CustomerModel $user the logged user
+ */
+ protected function processSuccessfulLogin(ActionEvent $event, CustomerModel $user, BaseForm $form, $sendLoginEvent = false)
+ {
+ // Success -> store user in security context
+ $this->getSecurityContext()->setUser($user);
+
+ if ($sendLoginEvent) $event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGIN, $event);
+
+ // Redirect to the success URL
+ Redirect::exec($form->getSuccessUrl());
+ }
+
+ /**
+ * Return the security context, beeing sure that we're in the CONTEXT_FRONT_OFFICE context
+ *
+ * @return SecurityContext the security context
+ */
+ protected function getSecurityContext() {
+ $this->securityContext->setContext(SecurityContext::CONTEXT_FRONT_OFFICE);
+
+ return $this->securityContext;
+ }
}
diff --git a/core/lib/Thelia/Admin/Controller/AdminController.php b/core/lib/Thelia/Admin/Controller/AdminController.php
index 1b5212cd2..57421825e 100755
--- a/core/lib/Thelia/Admin/Controller/AdminController.php
+++ b/core/lib/Thelia/Admin/Controller/AdminController.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
diff --git a/core/lib/Thelia/Admin/Controller/BaseAdminController.php b/core/lib/Thelia/Admin/Controller/BaseAdminController.php
index 7dc8f8a15..e13f10da2 100755
--- a/core/lib/Thelia/Admin/Controller/BaseAdminController.php
+++ b/core/lib/Thelia/Admin/Controller/BaseAdminController.php
@@ -27,11 +27,15 @@ use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Form\BaseForm;
-use Thelia\Model\ConfigQuery;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Thelia\Core\Security\Exception\AuthenticationTokenNotFoundException;
+use Thelia\Model\ConfigQuery;
+use Thelia\Core\Security\Exception\AuthenticationException;
+use Thelia\Core\Security\SecurityContext;
+use Thelia\Tools\URL;
+use Thelia\Tools\Redirect;
/**
*
@@ -44,14 +48,14 @@ use Thelia\Core\Security\Exception\AuthenticationTokenNotFoundException;
class BaseAdminController extends ContainerAware
{
-
const TEMPLATE_404 = "404.html";
- public function notFoundAction()
+ protected function undefinedAction()
{
return new Response($this->renderRaw(self::TEMPLATE_404), 404);
}
+
/**
* Render the givent template, and returns the result as an Http Response.
*
@@ -59,7 +63,7 @@ class BaseAdminController extends ContainerAware
* @param array $args the template arguments
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function render($templateName, $args = array())
+ protected function render($templateName, $args = array())
{
$response = new Response();
@@ -67,46 +71,79 @@ class BaseAdminController extends ContainerAware
}
/**
- * Render the givent template, and returns the result as a string.
+ * Render the given template, and returns the result as a string.
*
* @param $templateName the complete template name, with extension
* @param array $args the template arguments
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function renderRaw($templateName, $args = array())
+ protected function renderRaw($templateName, $args = array())
{
- $args = array_merge($args, array('lang' => 'fr')); // FIXME
+ $session = $this->getSession();
+
+ $args = array_merge($args, array(
+ 'locale' => $session->getLocale(),
+ 'lang' => $session->getLang()
+ ));
try {
$data = $this->getParser()->render($templateName, $args);
- }
- catch (AuthenticationTokenNotFoundException $ex) {
- // No auth token -> perform login
- return new RedirectResponse($this->generateUrl('admin/login'));
+ return $data;
}
+ catch (AuthenticationException $ex) {
- return $data;
+ // User is not authenticated, and templates requires authentication -> redirect to login page
+ // We user login_tpl as a path, not a template.
+
+ Redirect::exec(URL::absoluteUrl($ex->getLoginTemplate()));
+ }
+ }
+
+ /**
+ * Return the security context, by default in admin mode.
+ *
+ * @return Thelia\Core\Security\SecurityContext
+ */
+ protected function getSecurityContext($context = false)
+ {
+ $securityContext = $this->container->get('thelia.securityContext');
+
+ $securityContext->setContext($context === false ? SecurityContext::CONTEXT_BACK_OFFICE : $context);
+
+ return $securityContext;
}
/**
* @return \Symfony\Component\HttpFoundation\Request
*/
- public function getRequest()
+ protected function getRequest()
{
return $this->container->get('request');
}
+ /**
+ * Returns the session from the current request
+ *
+ * @return Ambigous
+ */
+ protected function getSession() {
+
+ $request = $this->getRequest();
+
+ return $request->getSession();
+ }
+
/**
*
* @return a ParserInterface instance parser, as configured.
*/
- public function getParser()
+ protected function getParser()
{
$parser = $this->container->get("thelia.parser");
- // FIXME: should be read from config
- $parser->setTemplate('admin/default');
+ // Define the template thant shoud be used
+ $parser->setTemplate(ConfigQuery::read('base_admin_template', 'admin/default'));
return $parser;
}
@@ -121,24 +158,6 @@ class BaseAdminController extends ContainerAware
return $this->getFormFactory()->createBuilder("form");
}
- /**
- * Generates a URL from the given parameters.
- *
- * @param string $route The name of the route
- * @param mixed $parameters An array of parameters
- * @param Boolean|string $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
- *
- * @return string The generated URL
- *
- * @see UrlGeneratorInterface
- */
- public function generateUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
- {
- return "thelia2/$route"; //FIXME
-
- //return $this->container->get('router')->generate($route, $parameters, $referenceType);
- }
-
/**
* Forwards the request to another controller.
*
@@ -148,24 +167,11 @@ class BaseAdminController extends ContainerAware
*
* @return Response A Response instance
*/
- public function forward($controller, array $path = array(), array $query = array())
+ protected function forward($controller, array $path = array(), array $query = array())
{
$path['_controller'] = $controller;
$subRequest = $this->container->get('request')->duplicate($query, null, $path);
return $this->container->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
}
-
- /**
- * Returns a RedirectResponse to the given URL.
- *
- * @param string $url The URL to redirect to
- * @param integer $status The status code to use for the Response
- *
- * @return RedirectResponse
- */
- public function redirect($url, $status = 302)
- {
- return new RedirectResponse($url, $status);
- }
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Admin/Controller/SessionController.php b/core/lib/Thelia/Admin/Controller/SessionController.php
index cba11a00e..115f9700c 100755
--- a/core/lib/Thelia/Admin/Controller/SessionController.php
+++ b/core/lib/Thelia/Admin/Controller/SessionController.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -25,39 +25,74 @@ namespace Thelia\Admin\Controller;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Form\AdminLogin;
+use Thelia\Core\Security\Authentication\AdminUsernamePasswordFormAuthenticator;
+use Thelia\Model\AdminLog;
+use Thelia\Core\Security\Exception\AuthenticationException;
+use Symfony\Component\Validator\Exception\ValidatorException;
+use Thelia\Tools\URL;
+use Thelia\Tools\Redirect;
class SessionController extends BaseAdminController {
- public function loginAction()
+ public function showLoginAction()
+ {
+ return $this->render("login.html");
+ }
+
+ public function checkLogoutAction()
+ {
+ $this->getSecurityContext()->clear();
+
+ // Go back to login page.
+ return Redirect::exec(URL::absoluteUrl('/admin/login')); // FIXME - should be a parameter
+ }
+
+ public function checkLoginAction()
{
- $form = $this->getLoginForm();
+ $form = new AdminLogin($this->getRequest());
- $request = $this->getRequest();
+ $request = $this->getRequest();
- if($request->isMethod("POST")) {
+ $authenticator = new AdminUsernamePasswordFormAuthenticator($request, $form);
- $form->bind($request);
+ try {
+ $user = $authenticator->getAuthentifiedUser();
- if ($form->isValid()) {
+ // Success -> store user in security context
+ $this->getSecurityContext()->setUser($user);
- $this->container->get('request')->authenticate(
- $form->get('username')->getData(),
- $form->get('password')->getData()
- );
+ // Log authentication success
+ AdminLog::append("Authentication successuful", $request, $user);
- echo "valid"; exit;
- }
- }
+ // Redirect to the success URL
+ return Redirect::exec($form->getSuccessUrl());
+ }
+ catch (ValidatorException $ex) {
- return $this->render("login.html", array(
- "form" => $form->createView()
- ));
- }
+ // Validation problem
+ $message = "Missing or invalid information. Please check your input.";
+ }
+ catch (AuthenticationException $ex) {
- protected function getLoginForm()
- {
- $adminLogin = new AdminLogin($this->getRequest());
+ // Log authentication failure
+ AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
- return $adminLogin->getForm();
+ $message = "Login failed. Please check your username and password.";
+ }
+ catch (\Exception $ex) {
+
+ // Log authentication failure
+ AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
+
+ $message = "Unable to process your request. Please try again.";
+ }
+
+ // Store the form name in session (see Form Smarty plugin to find usage of this parameter)
+ $request->getSession()->setErrorFormName($form->getName());
+
+ // Display the login form again, with an error message if required
+ return $this->render("login.html", array(
+ "message" => $message
+ ));
}
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Command/BaseModuleGenerate.php b/core/lib/Thelia/Command/BaseModuleGenerate.php
new file mode 100644
index 000000000..420563c40
--- /dev/null
+++ b/core/lib/Thelia/Command/BaseModuleGenerate.php
@@ -0,0 +1,58 @@
+. */
+/* */
+/*************************************************************************************/
+namespace Thelia\Command;
+
+use Propel\Runtime\Propel;
+use Symfony\Component\Console\Application;
+
+
+abstract class BaseModuleGenerate extends ContainerAwareCommand {
+
+ protected $module;
+ protected $moduleDirectory;
+
+ protected $reservedKeyWords = array(
+ "thelia"
+ );
+
+ protected $neededDirectories = array(
+ "Config",
+ "Model",
+ "Loop"
+ );
+
+ protected function verifyExistingModule()
+ {
+ if (file_exists($this->moduleDirectory)) {
+ throw new \RuntimeException(sprintf("%s module already exists", $this->module));
+ }
+ }
+
+ protected function formatModuleName($name)
+ {
+ if (in_array(strtolower($name), $this->reservedKeyWords)) {
+ throw new \RuntimeException(sprintf("%s module name is a reserved keyword", $name));
+ }
+ return ucfirst($name);
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Command/CacheClear.php b/core/lib/Thelia/Command/CacheClear.php
index eba228da8..485f479ce 100755
--- a/core/lib/Thelia/Command/CacheClear.php
+++ b/core/lib/Thelia/Command/CacheClear.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Command/ContainerAwareCommand.php b/core/lib/Thelia/Command/ContainerAwareCommand.php
index abd8f9960..2dc455edb 100755
--- a/core/lib/Thelia/Command/ContainerAwareCommand.php
+++ b/core/lib/Thelia/Command/ContainerAwareCommand.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php
index 9d4d4d1fd..48903c2a0 100755
--- a/core/lib/Thelia/Command/Install.php
+++ b/core/lib/Thelia/Command/Install.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
@@ -272,6 +272,10 @@ class Install extends ContainerAwareCommand
protected function tryConnection($connectionInfo, OutputInterface $output)
{
+ if (is_null($connectionInfo["dbName"])) {
+ return false;
+ }
+
$dsn = "mysql:host=%s";
try {
diff --git a/core/lib/Thelia/Command/ModuleGenerateCommand.php b/core/lib/Thelia/Command/ModuleGenerateCommand.php
new file mode 100644
index 000000000..0f456ea63
--- /dev/null
+++ b/core/lib/Thelia/Command/ModuleGenerateCommand.php
@@ -0,0 +1,104 @@
+. */
+/* */
+/*************************************************************************************/
+namespace Thelia\Command;
+
+
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Filesystem\Filesystem;
+
+class ModuleGenerateCommand extends BaseModuleGenerate {
+
+
+
+ protected function configure()
+ {
+ $this
+ ->setName("module:generate")
+ ->setDescription("generate all needed files for creating a new Module")
+ ->addArgument(
+ "name" ,
+ InputArgument::REQUIRED,
+ "name wanted for your Module"
+ )
+ ;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->module = $this->formatModuleName($input->getArgument("name"));
+ $this->moduleDirectory = THELIA_MODULE_DIR . DIRECTORY_SEPARATOR . $this->module;
+ $this->verifyExistingModule();
+
+ $this->createDirectories();
+ $this->createFiles();
+ if(method_exists($this, "renderBlock")) {
+ //impossible to change output class in CommandTester...
+ $output->renderBlock(array(
+ '',
+ sprintf("module %s create with success", $this->module),
+ "You can now configure your module and complete plugin.xml file",
+ ''
+ ), "bg=green;fg=black");
+ }
+
+ }
+
+ private function createDirectories()
+ {
+ $fs = new Filesystem();
+
+ $fs->mkdir($this->moduleDirectory);
+
+ foreach ($this->neededDirectories as $directory) {
+ $fs->mkdir($this->moduleDirectory . DIRECTORY_SEPARATOR . $directory);
+ }
+
+ }
+
+ private function createFiles()
+ {
+ $fs = new Filesystem();
+ $skeletonDir = str_replace("/", DIRECTORY_SEPARATOR, THELIA_ROOT . "/core/lib/Thelia/Command/Skeleton/Module/");
+ $fs->copy($skeletonDir . "config.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.xml");
+ $fs->copy($skeletonDir . "plugin.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "plugin.xml");
+
+ $classContent = file_get_contents($skeletonDir . "Class.php");
+
+ $classContent = str_replace("%%CLASSNAME%%", $this->module, $classContent);
+ $classContent = str_replace("%%NAMESPACE%%", $this->module, $classContent);
+
+ file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . $this->module.".php", $classContent);
+
+ $schemaContent = file_get_contents($skeletonDir . "schema.xml");
+
+ $schemaContent = str_replace("%%CONFIG_DIR%%", THELIA_CONF_DIR, $schemaContent);
+ $schemaContent = str_replace("%%NAMESPACE%%", $this->module, $schemaContent);
+
+ file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php
new file mode 100644
index 000000000..a42cb9065
--- /dev/null
+++ b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php
@@ -0,0 +1,130 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Command;
+
+
+use Propel\Generator\Command\ModelBuildCommand;
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Output\StreamOutput;
+use Symfony\Component\Filesystem\Filesystem;
+
+class ModuleGenerateModelCommand extends BaseModuleGenerate {
+
+ protected function configure()
+ {
+ $this
+ ->setName("module:generate:model")
+ ->setDescription("generate model for a specific module")
+ ->addArgument(
+ "name",
+ InputArgument::REQUIRED,
+ "module name"
+ )
+ ->addOption(
+ "generate-sql",
+ null,
+ InputOption::VALUE_NONE,
+ "with this option generate sql file at the same time"
+ )
+ ;
+
+ }
+
+ public function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->module = $this->formatModuleName($input->getArgument("name"));
+ $this->moduleDirectory = THELIA_MODULE_DIR . DS . $this->module;
+
+ $fs = new Filesystem();
+
+ if ($fs->exists($this->moduleDirectory) === false) {
+ throw new \RuntimeException(sprintf("%s module does not exists", $this->module));
+ }
+
+ if ($fs->exists($this->moduleDirectory . DS . "Config" . DS . "schema.xml") === false) {
+ throw new \RuntimeException("schema.xml not found in Config directory. Needed file for generating model");
+ }
+
+ $this->generateModel($output);
+
+ $output->renderBlock(array(
+ '',
+ 'Model generated successfuly',
+ ''
+ ), 'bg=green;fg=black');
+
+ if ($input->getOption("generate-sql")) {
+ $output->writeln(' ');
+ $this->generateSql($output);
+ }
+ }
+
+ protected function generateSql(OutputInterface $output)
+ {
+
+ $command = $this->getApplication()->find("module:generate:sql");
+
+ $command->run(
+ new ArrayInput(array(
+ "command" => $command->getName(),
+ "name" => $this->module
+ )),
+ $output
+ );
+ }
+
+ protected function generateModel(OutputInterface $output)
+ {
+ $fs = new Filesystem();
+ $moduleBuildPropel = new ModelBuildCommand();
+ $moduleBuildPropel->setApplication($this->getApplication());
+
+ $moduleBuildPropel->run(
+ new ArrayInput(array(
+ "command" => $moduleBuildPropel->getName(),
+ "--output-dir" => THELIA_MODULE_DIR,
+ "--input-dir" => $this->moduleDirectory . DS ."Config"
+ )),
+ $output
+ );
+
+ $verifyDirectories = array(
+ THELIA_MODULE_DIR . DS . "Thelia",
+ $this->moduleDirectory . DS . "Model" . DS . "Thelia"
+ );
+
+ foreach ($verifyDirectories as $directory) {
+ if ($fs->exists($directory)) {
+ $fs->remove($directory);
+ }
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php
new file mode 100644
index 000000000..95ee7a931
--- /dev/null
+++ b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php
@@ -0,0 +1,85 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Command;
+
+
+use Propel\Generator\Command\SqlBuildCommand;
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Output\StreamOutput;
+use Symfony\Component\Filesystem\Filesystem;
+
+class ModuleGenerateSqlCommand extends BaseModuleGenerate {
+
+ public function configure()
+ {
+ $this
+ ->setName("module:generate:sql")
+ ->setDescription("Generate the sql from schema.xml file")
+ ->addArgument(
+ "name",
+ InputArgument::REQUIRED,
+ "Module name"
+ )
+ ;
+ }
+
+ public function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->module = $this->formatModuleName($input->getArgument("name"));
+ $this->moduleDirectory = THELIA_MODULE_DIR . DS . $this->module;
+
+ $fs = new Filesystem();
+
+ if ($fs->exists($this->moduleDirectory) === false) {
+ throw new \RuntimeException(sprintf("%s module does not exists", $this->module));
+ }
+
+ if ($fs->exists($this->moduleDirectory . DS . "Config" . DS . "schema.xml") === false) {
+ throw new \RuntimeException("schema.xml not found in Config directory. Needed file for generating model");
+ }
+
+ $sqlBuild = new SqlBuildCommand();
+ $sqlBuild->setApplication($this->getApplication());
+
+ $sqlBuild->run(
+ new ArrayInput(array(
+ "command" => $sqlBuild->getName(),
+ "--output-dir" => $this->moduleDirectory . DS ."Config",
+ "--input-dir" => $this->moduleDirectory . DS ."Config"
+ )),
+ $output
+ );
+
+ $output->renderBlock(array(
+ '',
+ 'Sql generated successfuly',
+ 'File available in your module config directory',
+ ''
+ ), 'bg=green;fg=black');
+
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php b/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php
new file mode 100644
index 000000000..667a18087
--- /dev/null
+++ b/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php
@@ -0,0 +1,56 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Command\Output;
+
+
+use Symfony\Component\Console\Output\ConsoleOutput;
+
+class TheliaConsoleOutput extends ConsoleOutput{
+
+ public function renderBlock(array $messages, $style = "info")
+ {
+ $strlen = function ($string) {
+ if (!function_exists('mb_strlen')) {
+ return strlen($string);
+ }
+
+ if (false === $encoding = mb_detect_encoding($string)) {
+ return strlen($string);
+ }
+
+ return mb_strlen($string, $encoding);
+ };
+ $length = 0;
+ foreach ($messages as $message) {
+ $length = ($strlen($message) > $length) ? $strlen($message) : $length;
+ }
+ $ouput = array();
+ foreach ($messages as $message) {
+ $output[] = "<" . $style . ">" . " " . $message . str_repeat(' ', $length - $strlen($message)) . " " . $style . ">";
+ }
+
+ $this->writeln($output);
+ }
+
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Command/Skeleton/Module/Class.php b/core/lib/Thelia/Command/Skeleton/Module/Class.php
new file mode 100644
index 000000000..ecf67646d
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/Class.php
@@ -0,0 +1,36 @@
+. */
+/* */
+/*************************************************************************************/
+
+
+namespace %%NAMESPACE%%;
+
+use Thelia\Module\BaseModule;
+
+class %%CLASSNAME%% extends BaseModule
+{
+ /**
+ * YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
+ * Like install and destroy
+ */
+
+}
diff --git a/core/lib/Thelia/Command/Skeleton/Module/config.xml b/core/lib/Thelia/Command/Skeleton/Module/config.xml
new file mode 100644
index 000000000..2430f5027
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/config.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/smarty-sample/i18n/en.php b/core/lib/Thelia/Command/Skeleton/Module/plugin.xml
old mode 100755
new mode 100644
similarity index 100%
rename from templates/smarty-sample/i18n/en.php
rename to core/lib/Thelia/Command/Skeleton/Module/plugin.xml
diff --git a/core/lib/Thelia/Command/Skeleton/Module/schema.xml b/core/lib/Thelia/Command/Skeleton/Module/schema.xml
new file mode 100644
index 000000000..3fcba0184
--- /dev/null
+++ b/core/lib/Thelia/Command/Skeleton/Module/schema.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/core/lib/Thelia/Config/DatabaseConfiguration.php b/core/lib/Thelia/Config/DatabaseConfiguration.php
index 376c16609..16d273738 100755
--- a/core/lib/Thelia/Config/DatabaseConfiguration.php
+++ b/core/lib/Thelia/Config/DatabaseConfiguration.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Config/DefinePropel.php b/core/lib/Thelia/Config/DefinePropel.php
index 06d33ebfc..434187144 100755
--- a/core/lib/Thelia/Config/DefinePropel.php
+++ b/core/lib/Thelia/Config/DefinePropel.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml
index 2f5583e94..935faa8c3 100755
--- a/core/lib/Thelia/Config/Resources/action.xml
+++ b/core/lib/Thelia/Config/Resources/action.xml
@@ -11,13 +11,18 @@
Thelia\Core\Event\CartEvent
+
-
+
+
+
+
+
diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml
index 5a3e56c61..476035aae 100755
--- a/core/lib/Thelia/Config/Resources/config.xml
+++ b/core/lib/Thelia/Config/Resources/config.xml
@@ -12,29 +12,20 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -50,26 +41,42 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
false
%kernel.environment%
%kernel.debug%
+
@@ -85,7 +92,7 @@
-
+
%thelia.parser.loops%
@@ -103,15 +110,21 @@
+
-
+
-
+
+
+
+
+
+
diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml
index dc5e38a9b..fe5a0a283 100755
--- a/core/lib/Thelia/Config/Resources/routing/admin.xml
+++ b/core/lib/Thelia/Config/Resources/routing/admin.xml
@@ -4,14 +4,28 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
+
Thelia\Admin\Controller\AdminController::indexAction
+
+
- Thelia\Admin\Controller\SessionController::loginAction
+ Thelia\Admin\Controller\SessionController::showLoginAction
-
- Thelia\Admin\Controller\AdminController::notFoundAction
+
+
+
+ Thelia\Admin\Controller\SessionController::checkLogoutAction
+
+
+
+
+ Thelia\Admin\Controller\SessionController::checkLoginAction
+
+
+
+ Thelia\Admin\Controller\AdminController::undefinedAction
.*
\ No newline at end of file
diff --git a/core/lib/Thelia/Controller/DefaultController.php b/core/lib/Thelia/Controller/DefaultController.php
index 2c8a4ca62..646d3b27a 100755
--- a/core/lib/Thelia/Controller/DefaultController.php
+++ b/core/lib/Thelia/Controller/DefaultController.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Controller;
diff --git a/core/lib/Thelia/Core/Application.php b/core/lib/Thelia/Core/Application.php
index b6b07614c..531d8802c 100755
--- a/core/lib/Thelia/Core/Application.php
+++ b/core/lib/Thelia/Core/Application.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php
index 786093e15..9f7e9f31f 100755
--- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php
index 8de39f095..a95e7d668 100755
--- a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php
+++ b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Event/ActionEvent.php b/core/lib/Thelia/Core/Event/ActionEvent.php
index 32074c559..486b80ee8 100755
--- a/core/lib/Thelia/Core/Event/ActionEvent.php
+++ b/core/lib/Thelia/Core/Event/ActionEvent.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
@@ -25,6 +25,8 @@ namespace Thelia\Core\Event;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Request;
+use Thelia\Form\BaseForm;
+use Thelia\Core\Security\SecurityContext;
/**
*
* Class thrown on Thelia.action event
@@ -47,7 +49,7 @@ abstract class ActionEvent extends Event
*/
protected $action;
- protected $form;
+ protected $form = null;
/**
*
@@ -78,20 +80,32 @@ abstract class ActionEvent extends Event
return $this->request;
}
- public function setFormError($form)
+ /**
+ * Store a form taht contains error, to pass it to the current session.
+ *
+ * @param BaseForm $form
+ */
+ public function setFormError(BaseForm $form)
{
$this->form = $form;
$this->stopPropagation();
}
- public function getForm()
+ /**
+ * @return BaseForm the errored form, or null
+ */
+ public function getFormError()
{
return $this->form;
}
+ /**
+ * Check if theis event contains a form with errors
+ *
+ * @return boolean
+ */
public function hasFormError()
{
return $this->form !== null;
}
-
}
diff --git a/core/lib/Thelia/Core/Event/CustomRefEvent.php b/core/lib/Thelia/Core/Event/CustomRefEvent.php
index 15113c218..000f46153 100755
--- a/core/lib/Thelia/Core/Event/CustomRefEvent.php
+++ b/core/lib/Thelia/Core/Event/CustomRefEvent.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php
index aca4e106a..d570c22a1 100755
--- a/core/lib/Thelia/Core/Event/TheliaEvents.php
+++ b/core/lib/Thelia/Core/Event/TheliaEvents.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
@@ -48,9 +48,14 @@ final class TheliaEvents
*/
const INCLUSION = "thelia.include";
- const BEFORE_CREATECUSTOMER = "action.before_createcustomer";
+ const CUSTOMER_LOGOUT = "action.customer_logout";
+ const CUSTOMER_LOGIN = "action.customer_login";
- const AFTER_CREATECUSTOMER = "action.after_createcustomer";
+ const BEFORE_CREATECUSTOMER = "action.before_createcustomer";
+ const AFTER_CREATECUSTOMER = "action.after_createcustomer";
+
+ const BEFORE_CHANGECUSTOMER = "action.before_changecustomer";
+ const AFTER_CHANGECUSTOMER = "action.after_changecustomer";
const CREATECUSTOMER_CUSTOMREF = "customer.creation.customref";
}
diff --git a/core/lib/Thelia/Core/EventListener/ControllerListener.php b/core/lib/Thelia/Core/EventListener/ControllerListener.php
index 93c827c09..3ae9c77bb 100755
--- a/core/lib/Thelia/Core/EventListener/ControllerListener.php
+++ b/core/lib/Thelia/Core/EventListener/ControllerListener.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\EventListener;
@@ -29,7 +29,7 @@ use Thelia\Core\Factory\ActionEventFactory;
/**
*
- * Action are dispatch here.
+ * Action are dispatched here.
*
* A factory is used for creating appropriate action object
*
@@ -43,6 +43,7 @@ class ControllerListener implements EventSubscriberInterface
{
$dispatcher = $event->getDispatcher();
$request = $event->getRequest();
+
if (false !== $action = $request->get("action")) {
//search corresponding action
$event = new ActionEventFactory($request, $action, $event->getKernel()->getContainer()->getParameter("thelia.actionEvent"));
@@ -50,12 +51,9 @@ class ControllerListener implements EventSubscriberInterface
$dispatcher->dispatch("action.".$action, $actionEvent);
if ($actionEvent->hasFormError()) {
- $request->getSession()->set("form_error", true);
- $request->getSession()->set("form_name", $actionEvent->getForm()->createView()
- ->vars["attr"]["thelia_name"]);
+ $request->getSession()->setErrorFormName($actionEvent->getFormError()->getName());
}
}
-
}
public static function getSubscribedEvents()
diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php
index 50acd044d..2017fe6ae 100755
--- a/core/lib/Thelia/Core/EventListener/ViewListener.php
+++ b/core/lib/Thelia/Core/EventListener/ViewListener.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\EventListener;
@@ -30,6 +30,9 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserInterface;
+use Thelia\Tools\Redirect;
+use Thelia\Tools\URL;
+use Thelia\Core\Security\Exception\AuthenticationException;
/**
*
@@ -78,10 +81,15 @@ class ViewListener implements EventSubscriberInterface
} else {
$event->setResponse(new Response($content, $parser->getStatus() ?: 200));
}
- } catch (ResourceNotFoundException $e) {
+ }
+ catch (ResourceNotFoundException $e) {
$event->setResponse(new Response($e->getMessage(), 404));
}
+ catch (AuthenticationException $ex) {
+ // Redirect to the login template
+ $event->setResponse(Redirect::exec(URL::viewUrl($ex->getLoginTemplate())));
+ }
}
public function beforeKernelView(GetResponseForControllerResultEvent $event)
diff --git a/core/lib/Thelia/Core/Factory/ActionEventFactory.php b/core/lib/Thelia/Core/Factory/ActionEventFactory.php
index 7cda0a083..af41edecd 100755
--- a/core/lib/Thelia/Core/Factory/ActionEventFactory.php
+++ b/core/lib/Thelia/Core/Factory/ActionEventFactory.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php
index 4bd079685..ac684f6c6 100755
--- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php
+++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,16 +17,21 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\HttpFoundation\Session;
use Symfony\Component\HttpFoundation\Session\Session as BaseSession;
+use Thelia\Core\Security\User\UserInterface;
+use Thelia\Form\BaseForm;
+use Thelia\Model\ConfigQuery;
+use Thelia\Tools\URL;
class Session extends BaseSession {
+ // -- Language ------------------------------------------------------------
public function getLocale()
{
@@ -35,7 +40,77 @@ class Session extends BaseSession {
public function getLang()
{
- return $this->get("lang", "en");
+ return substr($this->getLocale(), 0, 2);
+ }
+
+ // -- Customer user --------------------------------------------------------
+
+ public function setCustomerUser(UserInterface $user)
+ {
+ $this->set('customer_user', $user);
+ }
+
+ public function getCustomerUser()
+ {
+ return $this->get('customer_user');
+ }
+
+ public function clearCustomerUser()
+ {
+ return $this->remove('customer_user');
+ }
+
+ // -- Admin user -----------------------------------------------------------
+
+ public function setAdminUser(UserInterface $user)
+ {
+ $this->set('admin_user', $user);
+ }
+
+ public function getAdminUser()
+ {
+ return $this->get('admin_user');
+ }
+
+ public function clearAdminUser()
+ {
+ return $this->remove('admin_user');
+ }
+
+ // -- Error form -----------------------------------------------------------
+
+ /**
+ * @param string $formName the form name
+ */
+ public function setErrorFormName($formName)
+ {
+ $this->set('error_form', $formName);
+ }
+
+ public function getErrorFormName()
+ {
+ return $this->get('error_form', null);
+ }
+
+ public function clearErrorFormName()
+ {
+ return $this->remove('error_form');
+ }
+
+ // -- Return page ----------------------------------------------------------
+
+ public function setReturnToUrl($url)
+ {
+ $this->set('return_to_url', $url);
+ }
+
+ /**
+ *
+ * @return the return-to URL, or the index page if none is defined.
+ */
+ public function getReturnToUrl()
+ {
+ return $this->get('return_to_url', URL::getIndexPage());
}
}
diff --git a/core/lib/Thelia/Core/Security/Authentication/AuthenticationProviderInterface.php b/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php
old mode 100755
new mode 100644
similarity index 71%
rename from core/lib/Thelia/Core/Security/Authentication/AuthenticationProviderInterface.php
rename to core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php
index eb60f0482..b1427f0fd
--- a/core/lib/Thelia/Core/Security/Authentication/AuthenticationProviderInterface.php
+++ b/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php
@@ -1,4 +1,5 @@
\ No newline at end of file
+ public function __construct(Request $request, AdminLogin $loginForm) {
+ parent::__construct(
+ $request,
+ $loginForm,
+ new AdminUserProvider()
+ );
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php b/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php
new file mode 100644
index 000000000..05d850bee
--- /dev/null
+++ b/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php
@@ -0,0 +1,32 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Core\Security\Authentication;
+
+interface AuthenticatorInterface {
+
+ /**
+ * Returns a UserInterface instance, authentified using the authenticator specific method
+ */
+ public function getAuthentifiedUser();
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php
new file mode 100644
index 000000000..a5b1b32e4
--- /dev/null
+++ b/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php
@@ -0,0 +1,44 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Core\Security\Authentication;
+
+use Symfony\Component\HttpFoundation\Request;
+use Thelia\Core\Security\Authentication\UsernamePasswordFormAuthenticator;
+use Thelia\Form\CustomerLogin;
+use Thelia\Core\Security\UserProvider\CustomerUserProvider;
+
+class CustomerUsernamePasswordFormAuthenticator extends UsernamePasswordFormAuthenticator {
+
+ public function __construct(Request $request, CustomerLogin $loginForm) {
+ parent::__construct(
+ $request,
+ $loginForm,
+ new CustomerUserProvider(),
+ array(
+ 'username_field_name' => 'email'
+ )
+ );
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordAuthenticator.php
deleted file mode 100755
index f6161f038..000000000
--- a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordAuthenticator.php
+++ /dev/null
@@ -1,67 +0,0 @@
-. */
-/* */
-/*************************************************************************************/
-
-namespace Thelia\Core\Security\Authentication;
-
-use Thelia\Core\Security\Authentication\AuthenticationProviderInterface;
-use Thelia\Core\Security\Encoder\PasswordEncoderInterface;
-use Thelia\Core\Security\User\UserProviderInterface;
-use Thelia\Security\Token\TokenInterface;
-use Thelia\Core\Security\Exception\IncorrectPasswordException;
-use Thelia\Core\Security\Token\UsernamePasswordToken;
-
-class UsernamePasswordAuthenticator implements AuthenticationProviderInterface {
-
- protected $userProvider;
- protected $encoder;
-
- private $token;
-
- public function __construct(UserProviderInterface $userProvider, PasswordEncoderInterface $encoder) {
- $this->userProvider = $userProvider;
- $this->encoder = $encoder;
- }
-
- public function supportsToken(TokenInterface $token) {
-
- return $token instanceof UsernamePasswordToken;
- }
-
- public function authenticate($token) {
-
- if (!$this->supports($token)) {
- return null;
- }
-
- // Retreive user
- $user = $this->userProvider->getUser($this->token->getUsername());
-
- // Check password
- $authOk = $this->encoder->isEqual($password, $user->getPassword(), $user->getAlgo(), $user->getSalt()) === true;
-
- $authenticatedToken = new UsernamePasswordToken($user, $token->getCredentials(), $authOk);
-
- return $authenticatedToken;
- }
-}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php
new file mode 100644
index 000000000..77d54d682
--- /dev/null
+++ b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php
@@ -0,0 +1,95 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Core\Security\Authentication;
+
+use Thelia\Core\Security\Authentication\AuthenticatorInterface;
+use Symfony\Component\HttpFoundation\Request;
+use Thelia\Core\Security\UserProvider\UserProviderInterface;
+use Symfony\Component\Form\Form;
+use Thelia\Core\Security\Exception\WrongPasswordException;
+use Thelia\Core\Security\Exception\UsernameNotFoundException;
+use Symfony\Component\Validator\Exception\ValidatorException;
+use Thelia\Form\BaseForm;
+
+class UsernamePasswordFormAuthenticator implements AuthenticatorInterface {
+
+ protected $request;
+ protected $loginForm;
+ protected $userProvider;
+ protected $options;
+
+ protected $baseLoginForm;
+
+ public function __construct(Request $request, BaseForm $loginForm, UserProviderInterface $userProvider, array $options = array()) {
+ $this->request = $request;
+ $this->baseLoginForm = $loginForm;
+ $this->loginForm = $this->baseLoginForm->getForm();
+ $this->userProvider = $userProvider;
+
+ $defaults = array(
+ 'required_method' => 'POST',
+ 'username_field_name' => 'username',
+ 'password_field_name' => 'password'
+ );
+
+ $this->options = array_merge($defaults, $options);
+
+ $this->loginForm->bind($this->request);
+ }
+
+ /**
+ * @return string the username value
+ */
+ public function getUsername() {
+ return $this->loginForm->get($this->options['username_field_name'])->getData();
+ }
+
+ /**
+ * @see \Thelia\Core\Security\Authentication\AuthenticatorInterface::getAuthentifiedUser()
+ */
+ public function getAuthentifiedUser() {
+
+ if ($this->request->isMethod($this->options['required_method'])) {
+
+ if (! $this->loginForm->isValid()) throw new ValidatorException("Form is not valid.");
+
+ // Retreive user
+ $username = $this->getUsername();
+ $password = $this->loginForm->get($this->options['password_field_name'])->getData();
+
+ $user = $this->userProvider->getUser($username);
+
+ if ($user === null) throw new UsernameNotFoundException(sprintf("Username '%s' was not found.", $username));
+
+ // Check user password
+ $authOk = $user->checkPassword($password) === true;
+
+ if ($authOk !== true) throw new WrongPasswordException(sprintf("Wrong password for user '%s'.", $username));
+
+ return $user;
+ }
+
+ throw new \RuntimeException("Invalid method.");
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/AuthenticationProcessor.php b/core/lib/Thelia/Core/Security/AuthenticationProcessor.php
deleted file mode 100755
index 77fd3bd77..000000000
--- a/core/lib/Thelia/Core/Security/AuthenticationProcessor.php
+++ /dev/null
@@ -1,35 +0,0 @@
-container = $container;
- }
-
- public function createToken(Request $request) {
-
- $context = $request->get('_context');
-
- try {
- $securityContext = $this->container->get("security.$context");
-
- $token = new UsernamePasswordToken(
- $request->get('_username'),
- $request->get('_password')
- );
-
- $securityContext->setToken($token);
- }
- catch (\Exception $ex) {
- // Nothing to do
- }
- }
-}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Encoder/PasswordEncoderInterface.php b/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php
old mode 100755
new mode 100644
similarity index 71%
rename from core/lib/Thelia/Core/Security/Encoder/PasswordEncoderInterface.php
rename to core/lib/Thelia/Core/Security/Exception/AuthenticationException.php
index 3353969b8..ad0e01a3b
--- a/core/lib/Thelia/Core/Security/Encoder/PasswordEncoderInterface.php
+++ b/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php
@@ -21,32 +21,28 @@
/* */
/*************************************************************************************/
-namespace Thelia\Core\Security\Encoder;
+namespace Thelia\Core\Security\Exception;
-/**
- * This interface defines a password encoder.
- *
- * @author Franck Allimant
- *
- */
-interface PasswordEncoderInterface {
+class AuthenticationException extends \Exception
+{
+ /**
+ * @var string The login template name
+ */
+ protected $loginTemplate = "login";
/**
- * Encode a string.
- *
- * @param string $password the password to encode
- * @param string $algorithm the hash() algorithm
- * @return string $salt the salt
+ * @return string the login template name
*/
- public function encode($password, $algorithm, $salt);
+ public function getLoginTemplate() {
+ return $this->loginTemplate;
+ }
/**
- * Check a string against an encoded password.
+ * Set the login template name
*
- * @param string $string the string to compare against password
- * @param string $password the encoded password
- * @param string $algorithm the hash() algorithm
- * @return string $salt the salt
+ * @param string $loginPath the login template name
*/
- public function isEqual($string, $password, $algorithm, $salt);
+ public function setLoginTemplate($loginTemplate) {
+ $this->loginTemplate = $loginTemplate;
+ }
}
diff --git a/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php b/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php
new file mode 100644
index 000000000..2168e63ca
--- /dev/null
+++ b/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php
@@ -0,0 +1,28 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Core\Security\Exception;
+
+class UsernameNotFoundException extends AuthenticationException
+{
+}
diff --git a/core/lib/Thelia/Core/Security/Exception/AuthenticationTokenNotFoundException.php b/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php
old mode 100755
new mode 100644
similarity index 96%
rename from core/lib/Thelia/Core/Security/Exception/AuthenticationTokenNotFoundException.php
rename to core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php
index 061b43257..6088f43ad
--- a/core/lib/Thelia/Core/Security/Exception/AuthenticationTokenNotFoundException.php
+++ b/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php
@@ -23,6 +23,6 @@
namespace Thelia\Core\Security\Exception;
-class AuthenticationTokenNotFoundException extends \Exception
+class WrongPasswordException extends AuthenticationException
{
}
diff --git a/core/lib/Thelia/Core/Security/Role/Role.php b/core/lib/Thelia/Core/Security/Role/Role.php
index b47e1c089..8776f9752 100755
--- a/core/lib/Thelia/Core/Security/Role/Role.php
+++ b/core/lib/Thelia/Core/Security/Role/Role.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace use Thelia\Core\Security\Role;
+namespace Thelia\Core\Security\Role;
/**
* Role is a simple implementation of a RoleInterface where the role is a
@@ -38,4 +38,8 @@ class Role implements RoleInterface
{
return $this->role;
}
+
+ public function __toString() {
+ return $this->role;
+ }
}
diff --git a/core/lib/Thelia/Core/Security/SecurityContext.php b/core/lib/Thelia/Core/Security/SecurityContext.php
index 683431518..a4409afd8 100755
--- a/core/lib/Thelia/Core/Security/SecurityContext.php
+++ b/core/lib/Thelia/Core/Security/SecurityContext.php
@@ -25,62 +25,166 @@ namespace Thelia\Core\Security;
use Thelia\Core\Security\Authentication\AuthenticationProviderInterface;
use Thelia\Core\Security\Exception\AuthenticationTokenNotFoundException;
+use Thelia\Core\Security\Token\TokenInterface;
+use Thelia\Core\Security\User\UserInterface;
+use Thelia\Core\HttpFoundation\Request;
/**
- * A simple security manager, in charge of authenticating users using various authentication systems.
+ * A simple security manager, in charge of checking user
*
* @author Franck Allimant
*/
class SecurityContext {
-/*
- protected $authProvider;
- public function __construct(AuthenticationProviderInterface $authProvider) {
- $this->authProvider = $authProvider;
- }
-*/
+ const CONTEXT_FRONT_OFFICE = 'front';
+ const CONTEXT_BACK_OFFICE = 'admin';
+
+ private $request;
+ private $context;
+
+ public function __construct(Request $request) {
+
+ $this->request = $request;
+
+ $this->context = null;
+ }
+
+ public function setContext($context) {
+ if ($context !== self::CONTEXT_FRONT_OFFICE && $context !== self::CONTEXT_BACK_OFFICE) {
+ throw new \InvalidArgumentException(sprintf("Invalid or empty context identifier '%s'", $context));
+ }
+
+ $this->context = $context;
+ }
+
+ public function getContext($exception_if_context_undefined = false) {
+ if (null === $this->context && $exception_if_context_undefined === true)
+ throw new \LogicException("No context defined. Please use setContext() first.");
+
+ return $this->context;
+ }
+
+ private function getSession() {
+ $session = $this->request->getSession();
+
+ if ($session === null)
+ throw new \LogicException("No session found.");
+
+ return $session;
+ }
+
/**
- * Checks if the current token is authenticated
+ * Gets the currently authenticated user in the current context, or null if none is defined
*
- * @throws AuthenticationCredentialsNotFoundException when the security context has no authentication token.
+ * @return UserInterface|null A UserInterface instance or null if no user is available
+ */
+ public function getUser() {
+ $context = $this->getContext(true);
+
+ if ($context === self::CONTEXT_FRONT_OFFICE)
+ $user = $this->getSession()->getCustomerUser();
+ else if ($context == self::CONTEXT_BACK_OFFICE)
+ $user = $this->getSession()->getAdminUser();
+ else
+ $user = null;
+
+ return $user;
+ }
+
+ final public function isAuthenticated()
+ {
+ if (null !== $this->getUser()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if the current user is allowed
*
* @return Boolean
- * @throws AuthenticationTokenNotFoundException if no thoken was found in context
*/
final public function isGranted($roles, $permissions)
{
- if (null === $this->token) {
- throw new AuthenticationTokenNotFoundException('The security context contains no authentication token.');
- }
+ if ($this->isAuthenticated() === true) {
- if (!$this->token->isAuthenticated()) {
- $this->token = $this->authProvider->authenticate($this->token);
- }
+ $user = $this->getUser();
- if ($this->token->isAuthenticated()) {
- // Check user roles and permissions
+ // Check if user's roles matches required roles
+ $userRoles = $user->getRoles();
+
+ $roleFound = false;
+
+ foreach($userRoles as $role) {
+ if (in_array($role, $roles)) {
+ $roleFound = true;
+
+ break;
+ }
+ }
+
+ if ($roleFound) {
+
+ if (empty($permissions)) {
+ return true;
+ }
+
+ // Get permissions from profile
+ // $userPermissions = $user->getPermissions();
+
+ echo "TODO: Finalize permissions system !";
+
+ $userPermissions = array('*'); // FIXME !
+
+ $permissionsFound = true;
+
+ // User have all permissions ?
+ if (in_array('*', $userPermissions))
+ return true;
+
+ // Check that user's permissions matches required permissions
+ foreach($permissions as $permission) {
+ if (! in_array($permission, $userPermissions)) {
+ $permissionsFound = false;
+
+ break;
+ }
+ }
+
+ return $permissionsFound;
+ }
}
return false;
}
/**
- * Gets the currently authenticated token.
+ * Sets the authenticated user.
*
- * @return TokenInterface|null A TokenInterface instance or null if no authentication information is available
+ * @param UserInterface $user A UserInterface, or null if no further user should be stored
*/
- public function getToken()
+ public function setUser(UserInterface $user)
{
- return $this->token;
+ $context = $this->getContext(true);
+
+ $user->eraseCredentials();
+
+ if ($context === self::CONTEXT_FRONT_OFFICE)
+ $this->getSession()->setCustomerUser($user);
+ else if ($context == self::CONTEXT_BACK_OFFICE)
+ $this->getSession()->setAdminUser($user);
}
/**
- * Sets the token.
- *
- * @param TokenInterface $token A TokenInterface token, or null if no further authentication information should be stored
- */
- public function setToken(TokenInterface $token = null)
- {
- $this->token = $token;
+ * Clear the user from the security context
+ */
+ public function clear() {
+ $context = $this->getContext(true);
+
+ if ($context === self::CONTEXT_FRONT_OFFICE)
+ $this->getSession()->clearCustomerUser();
+ else if ($context == self::CONTEXT_BACK_OFFICE)
+ $this->getSession()->clearAdminUser();
}
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Token/AbstractToken.php b/core/lib/Thelia/Core/Security/Token/AbstractToken.php
deleted file mode 100755
index be1f8cb8b..000000000
--- a/core/lib/Thelia/Core/Security/Token/AbstractToken.php
+++ /dev/null
@@ -1,148 +0,0 @@
-
-* @author Johannes M. Schmitt
-*/
-abstract class AbstractToken implements TokenInterface
-{
- private $user;
- private $authenticated;
-
- /**
- * Constructor.
- *
- * @param RoleInterface[] $roles An array of roles
- *
- * @throws \InvalidArgumentException
- */
- public function __construct()
- {
- $this->authenticated = false;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getUsername()
- {
- if ($this->user instanceof UserInterface) {
- return $this->user->getUsername();
- }
-
- return (string) $this->user;
- }
-
- public function getUser()
- {
- return $this->user;
- }
-
- /**
- * Sets the user in the token.
- *
- * The user can be a UserInterface instance, or an object implementing
- * a __toString method or the username as a regular string.
- *
- * @param mixed $user The user
- * @throws \InvalidArgumentException
- */
- public function setUser($user)
- {
- if (!($user instanceof UserInterface || is_string($user))) {
- throw new \InvalidArgumentException('$user must be an instanceof UserInterface, or a primitive string.');
- }
-
- if (null === $this->user) {
- $changed = false;
- } elseif ($this->user instanceof UserInterface) {
- if (!$user instanceof UserInterface) {
- $changed = true;
- } else {
- $changed = $this->hasUserChanged($user);
- }
- } elseif ($user instanceof UserInterface) {
- $changed = true;
- } else {
- $changed = (string) $this->user !== (string) $user;
- }
-
- if ($changed) {
- $this->setAuthenticated(false);
- }
-
- $this->user = $user;
- }
-
- /**
- * {@inheritdoc}
- */
- public function isAuthenticated()
- {
- return $this->authenticated;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAuthenticated($authenticated)
- {
- $this->authenticated = (Boolean) $authenticated;
- }
-
- /**
- * {@inheritdoc}
- */
- public function eraseCredentials()
- {
- if ($this->getUser() instanceof UserInterface) {
- $this->getUser()->eraseCredentials();
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function serialize()
- {
- return serialize(array($this->user, $this->authenticated));
- }
-
- /**
- * {@inheritdoc}
- */
- public function unserialize($serialized)
- {
- list($this->user, $this->authenticated) = unserialize($serialized);
- }
-
- private function hasUserChanged(UserInterface $user)
- {
- if (!($this->user instanceof UserInterface)) {
- throw new \BadMethodCallException('Method "hasUserChanged" should be called when current user class is instance of "UserInterface".');
- }
-
- if ($this->user instanceof EquatableInterface) {
- return ! (Boolean) $this->user->isEqualTo($user);
- }
-
- if ($this->user->getPassword() !== $user->getPassword()) {
- return true;
- }
-
- if ($this->user->getSalt() !== $user->getSalt()) {
- return true;
- }
-
- if ($this->user->getUsername() !== $user->getUsername()) {
- return true;
- }
-
- return false;
- }
-}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Token/TokenInterface.php b/core/lib/Thelia/Core/Security/Token/TokenInterface.php
deleted file mode 100755
index d70c8eeea..000000000
--- a/core/lib/Thelia/Core/Security/Token/TokenInterface.php
+++ /dev/null
@@ -1,81 +0,0 @@
-. */
-/* */
-/*************************************************************************************/
-
-namespace Thelia\Core\Security\Token;
-
-/**
- * TokenInterface is the interface for the user authentication information.
- *
- * Parts borrowed from Symfony Security Framework (Fabien Potencier / Johannes M. Schmitt )
- */
-
-interface TokenInterface extends \Serializable
-{
- /**
- * Returns the user credentials.
- *
- * @return mixed The user credentials
- */
- public function getCredentials();
-
- /**
- * Returns a user representation.
- *
- * @return mixed either returns an object which implements __toString(), or
- * a primitive string is returned.
- */
- public function getUser();
-
- /**
- * Sets a user instance
- *
- * @param mixed $user
- */
- public function setUser($user);
-
- /**
- * Returns the username.
- *
- * @return string
- */
- public function getUsername();
-
- /**
- * Returns whether the user is authenticated or not.
- *
- * @return Boolean true if the token has been authenticated, false otherwise
- */
- public function isAuthenticated();
-
- /**
- * Sets the authenticated flag.
- *
- * @param Boolean $isAuthenticated The authenticated flag
- */
- public function setAuthenticated($isAuthenticated);
-
- /**
- * Removes sensitive information from the token.
- */
- public function eraseCredentials();
-}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/Token/UsernamePasswordToken.php b/core/lib/Thelia/Core/Security/Token/UsernamePasswordToken.php
deleted file mode 100755
index 03f73dbdd..000000000
--- a/core/lib/Thelia/Core/Security/Token/UsernamePasswordToken.php
+++ /dev/null
@@ -1,75 +0,0 @@
-
-*/
-class UsernamePasswordToken extends AbstractToken
-{
- private $credentials;
-
- /**
- * Constructor.
- *
- * @param string $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method.
- * @param string $password The password of the user
- *
- * @throws \InvalidArgumentException
- */
- public function __construct($username, $password, array $roles = array())
- {
- $this->setUser($username);
- $this->credentials = $password;
-
- parent::setAuthenticated(count($roles) > 0);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAuthenticated($isAuthenticated)
- {
- if ($isAuthenticated) {
- throw new \LogicException('Cannot set this token to trusted after instantiation.');
- }
-
- parent::setAuthenticated(false);
- }
-
- public function getCredentials()
- {
- return $this->credentials;
- }
-
- /**
- * {@inheritdoc}
- */
- public function eraseCredentials()
- {
- parent::eraseCredentials();
-
- $this->credentials = null;
- }
-
- /**
- * {@inheritdoc}
- */
- public function serialize()
- {
- return serialize(array($this->credentials, $this->providerKey, parent::serialize()));
- }
-
- /**
- * {@inheritdoc}
- */
- public function unserialize($serialized)
- {
- list($this->credentials, $this->providerKey, $parentStr) = unserialize($serialized);
- parent::unserialize($parentStr);
- }
-}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Security/User/UserInterface.php b/core/lib/Thelia/Core/Security/User/UserInterface.php
index be158e88c..b6642ba47 100755
--- a/core/lib/Thelia/Core/Security/User/UserInterface.php
+++ b/core/lib/Thelia/Core/Security/User/UserInterface.php
@@ -21,14 +21,9 @@ interface UserInterface {
public function getPassword();
/**
- * return the salt used to calculate the user password
+ * Check a string against a the user password
*/
- public function getSalt();
-
- /**
- * return the algorithm used to calculate the user password
- */
- public function getAlgo();
+ public function checkPassword($password);
/**
* Returns the roles granted to the user.
@@ -36,7 +31,7 @@ interface UserInterface {
*
* public function getRoles()
* {
- * return array('ROLE_USER');
+ * return array('USER');
* }
*
*
diff --git a/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php
index c9ae34a96..162edf299 100755
--- a/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/AdminUserProvider.php
@@ -1,12 +1,13 @@
filterByLogin($key)
->findOne();
diff --git a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php
index 3472bc013..642056f77 100755
--- a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php
@@ -1,13 +1,13 @@
filterByEmail($key)
->findOne();
diff --git a/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php b/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php
index f2a6d139b..931fa6923 100755
--- a/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php
+++ b/core/lib/Thelia/Core/Security/UserProvider/UserProviderInterface.php
@@ -1,6 +1,6 @@
. */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php
index 4051b49a3..3fe71edfd 100755
--- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php
+++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php b/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php
index a2695ce6b..0f9972e97 100755
--- a/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php
+++ b/core/lib/Thelia/Core/Template/Element/Exception/ElementNotFoundException.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php b/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php
index 5a4983aa2..b77f76a09 100755
--- a/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php
+++ b/core/lib/Thelia/Core/Template/Element/Exception/InvalidElementException.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/Element/LoopResult.php b/core/lib/Thelia/Core/Template/Element/LoopResult.php
index f01c74210..c3a97983f 100755
--- a/core/lib/Thelia/Core/Template/Element/LoopResult.php
+++ b/core/lib/Thelia/Core/Template/Element/LoopResult.php
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/Element/LoopResultRow.php b/core/lib/Thelia/Core/Template/Element/LoopResultRow.php
index 3ac05fe5c..24fa67c7e 100755
--- a/core/lib/Thelia/Core/Template/Element/LoopResultRow.php
+++ b/core/lib/Thelia/Core/Template/Element/LoopResultRow.php
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php b/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php
index 87b41ebc5..37856c620 100755
--- a/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php
+++ b/core/lib/Thelia/Core/Template/Exception/ResourceNotFoundException.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Exception;
diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php
index 5b8b99f03..265fdbdf2 100755
--- a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php
+++ b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop\Argument;
diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php b/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php
index b4b680e08..e4fca8549 100755
--- a/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php
+++ b/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop\Argument;
diff --git a/core/lib/Thelia/Core/Template/Loop/Auth.php b/core/lib/Thelia/Core/Template/Loop/Auth.php
index d0c477ef9..5adaf8286 100755
--- a/core/lib/Thelia/Core/Template/Loop/Auth.php
+++ b/core/lib/Thelia/Core/Template/Loop/Auth.php
@@ -47,7 +47,8 @@ class Auth extends BaseLoop
{
return new ArgumentCollection(
Argument::createAnyTypeArgument('roles', null, true),
- Argument::createAnyTypeArgument('permissions')
+ Argument::createAnyTypeArgument('permissions'),
+ Argument::createAnyTypeArgument('context', 'front', false)
);
}
@@ -72,16 +73,20 @@ class Auth extends BaseLoop
*/
public function exec(&$pagination)
{
+ $context = $this->getContext();
$roles = $this->_explode($this->getRoles());
$permissions = $this->_explode($this->getPermissions());
$loopResult = new LoopResult();
try {
- $this->securityContext->isGranted($roles, $permissions == null ? array() : $permissions);
+ $this->securityContext->setContext($context);
- // Create an empty row: loop is no longer empty :)
- $loopResult->addRow(new LoopResultRow());
+ if (true === $this->securityContext->isGranted($roles, $permissions == null ? array() : $permissions)) {
+
+ // Create an empty row: loop is no longer empty :)
+ $loopResult->addRow(new LoopResultRow());
+ }
}
catch (\Exception $ex) {
// Not granted, loop is empty
diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php
index c5c64b894..db20f460e 100755
--- a/core/lib/Thelia/Core/Template/Loop/Category.php
+++ b/core/lib/Thelia/Core/Template/Loop/Category.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php
index a9f697c0a..0b3a9f3c8 100755
--- a/core/lib/Thelia/Core/Template/Loop/Product.php
+++ b/core/lib/Thelia/Core/Template/Loop/Product.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Template/ParserContext.php b/core/lib/Thelia/Core/Template/ParserContext.php
new file mode 100644
index 000000000..b1574d156
--- /dev/null
+++ b/core/lib/Thelia/Core/Template/ParserContext.php
@@ -0,0 +1,65 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Core\Template;
+
+use Thelia\Model\ConfigQuery;
+use Thelia\Core\HttpFoundation\Request;
+use Thelia\Tools\URL;
+/**
+ * The parser context is an application-wide context, which stores var-value pairs.
+ * Theses pairs are injected in the parser and becomes available to the templates.
+ *
+ * @author Franck Allimant
+ */
+class ParserContext implements \IteratorAggregate
+{
+ private $store = array();
+
+ public function __construct(Request $request) {
+
+ // Setup basic variables
+ $this
+ ->set('BASE_URL' , ConfigQuery::read('base_url', '/'))
+ ->set('INDEX_PAGE' , URL::getIndexPage())
+ ->set('RETURN_TO_URL' , URL::absoluteUrl($request->getSession()->getReturnToUrl()))
+ ;
+ }
+
+ public function set($name, $value)
+ {
+ $this->store[$name] = $value;
+
+ return $this;
+ }
+
+ public function get($name)
+ {
+ return $this->store[$name];
+ }
+
+ public function getIterator()
+ {
+ return new \ArrayIterator( $this->store );
+ }
+}
diff --git a/core/lib/Thelia/Core/Template/ParserInterface.php b/core/lib/Thelia/Core/Template/ParserInterface.php
index 08308659c..bbf926812 100755
--- a/core/lib/Thelia/Core/Template/ParserInterface.php
+++ b/core/lib/Thelia/Core/Template/ParserInterface.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php
index 10cfefec7..1f8a3cb2e 100755
--- a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php
@@ -24,6 +24,8 @@
namespace Thelia\Core\Template\Smarty\Assets;
use Thelia\Core\Template\Assets\AsseticHelper;
+use Thelia\Model\ConfigQuery;
+use Thelia\Tools\URL;
class SmartyAssetsManager
{
@@ -71,7 +73,7 @@ class SmartyAssetsManager
$url = $this->assetic_manager->asseticize(
$asset_dir.'/'.$asset_file,
$this->web_root."/".$this->path_relative_to_web_root,
- $this->path_relative_to_web_root,
+ URL::absoluteUrl($this->path_relative_to_web_root, array(), true /* path only */),
$assetType,
$filters,
$debug
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php
index 2ff6be8e3..db71484ed 100755
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php
@@ -58,7 +58,6 @@ class Form implements SmartyPluginInterface
{
protected $request;
- protected $form;
protected $formDefinition = array();
public function __construct(Request $request)
@@ -87,67 +86,74 @@ class Form implements SmartyPluginInterface
throw new \InvalidArgumentException("Missing 'name' parameter in form arguments");
}
- $instance = $this->getInstance($params['name']);
- $form = $instance->getForm();
+ $instance = $this->createInstance($params['name']);
- if (
- true === $this->request->getSession()->get("form_error", false) &&
- $this->request->getSession()->get("form_name") == $instance->getName())
- {
- $form->bind($this->request);
- $this->request->getSession()->set("form_error", false);
+ // Check if session contains our form
+ $errorForm = $this->request->getSession()->getErrorFormName();
+
+ if ($errorForm == $instance->getName()) {
+
+ // Bind form with current request to get error messages and field values.
+ $instance->getForm()->bind($this->request);
+
+ // Remove the form from the session
+ $this->request->getSession()->clearErrorFormName();
}
- $template->assign("form", $form->createView());
- } else {
+ $instance->createView();
+
+ $template->assign("form", $instance);
+ }
+ else {
return $content;
}
}
- public function formRender($params, $content, \Smarty_Internal_Template $template, &$repeat)
+ public function renderFormField($params, $content, \Smarty_Internal_Template $template, &$repeat)
{
if ($repeat) {
- $form = $params["form"];
+ $formFieldView = $this->getFormFieldView($params);
- if (! $form instanceof \Symfony\Component\Form\FormView) {
- throw new \InvalidArgumentException("form parameter in form_field block must be an instance of
- Symfony\Component\Form\FormView");
+ $template->assign("options", $formFieldView->vars);
+ $template->assign("name", $formFieldView->vars["full_name"]);
+ $template->assign("value", $formFieldView->vars["value"]);
+ $template->assign("label", $formFieldView->vars["label"]);
+
+ $errors = $formFieldView->vars["errors"];
+
+ $template->assign("error", empty($errors) ? false : true);
+
+ if (! empty($errors)) {
+ $this->assignFieldErrorVars($template, $errors);
}
-
- $template->assign("options", $form->vars);
- $template->assign("name", $form->vars["full_name"]);
- $template->assign("value", $form->vars["value"]);
- $template->assign("label", $form->vars["label"]);
- $template->assign("error", empty($form->vars["errors"]) ? false : true);
$attr = array();
- foreach ($form->vars["attr"] as $key => $value) {
+
+ foreach ($formFieldView->vars["attr"] as $key => $value) {
$attr[] = sprintf('%s="%s"', $key, $value);
}
+
$template->assign("attr", implode(" ", $attr));
- $form->setRendered();
-
- } else {
+ $formFieldView->setRendered();
+ }
+ else {
return $content;
}
}
- public function formRenderHidden($params, \Smarty_Internal_Template $template)
+ public function renderHiddenFormField($params, \Smarty_Internal_Template $template)
{
- $form = $params["form"];
-
$field = '';
- if (! $form instanceof \Symfony\Component\Form\FormView) {
- throw new \InvalidArgumentException("form parameter in form_field_hidden function must be an instance of
- Symfony\Component\Form\FormView");
- }
+ $instance = $this->getInstanceFromParams($params);
+
+ $formView = $instance->getView();
$return = "";
- foreach ($form->getIterator() as $row) {
+ foreach ($formView->getIterator() as $row) {
if ($this->isHidden($row) && $row->isRendered() === false) {
$return .= sprintf($field, $row->vars["full_name"], $row->vars["value"]);
}
@@ -156,53 +162,79 @@ class Form implements SmartyPluginInterface
return $return;
}
- protected function isHidden(FormView $formView)
- {
- return array_search("hidden", $formView->vars["block_prefixes"]);
- }
-
public function formEnctype($params, \Smarty_Internal_Template $template)
{
- $form = $params["form"];
+ $instance = $this->getInstanceFromParams($params);
- if (! $form instanceof \Symfony\Component\Form\FormView) {
- throw new \InvalidArgumentException("form parameter in form_enctype function must be an instance of
- Symfony\Component\Form\FormView");
- }
+ $formView = $instance->getForm();
- if ($form->vars["multipart"]) {
+ if ($formView->vars["multipart"]) {
return sprintf('%s="%s"',"enctype", "multipart/form-data");
}
}
public function formError($params, $content, \Smarty_Internal_Template $template, &$repeat)
{
+ $formFieldView = $this->getFormFieldView($params);
- $form = $params["form"];
- if (! $form instanceof \Symfony\Component\Form\FormView) {
- throw new \InvalidArgumentException("form parameter in form_error block must be an instance of
- Symfony\Component\Form\FormView");
- }
+ $errors = $formFieldView->vars["errors"];
- if (empty($form->vars["errors"])) {
+ if (empty($errors)) {
return "";
}
if ($repeat) {
-
- $error = $form->vars["errors"];
-
- $template->assign("message", $error[0]->getMessage());
- $template->assign("parameters", $error[0]->getMessageParameters());
- $template->assign("pluralization", $error[0]->getMessagePluralization());
-
-
- } else {
+ $this->assignFieldErrorVars($template, $errors);
+ }
+ else {
return $content;
}
}
- public function getInstance($name)
+
+ protected function assignFieldErrorVars(\Smarty_Internal_Template $template, array $errors)
+ {
+ $template->assign("message", $errors[0]->getMessage());
+ $template->assign("parameters", $errors[0]->getMessageParameters());
+ $template->assign("pluralization", $errors[0]->getMessagePluralization());
+ }
+
+ protected function isHidden(FormView $formView)
+ {
+ return array_search("hidden", $formView->vars["block_prefixes"]);
+ }
+
+ protected function getFormFieldView($params) {
+ $instance = $this->getInstanceFromParams($params);
+
+ if (! isset($params['field']))
+ throw new \InvalidArgumentException("'field' parameter is missing");
+
+ $fieldName = $params['field'];
+
+ if (empty($instance->getView()[$fieldName]))
+ throw new \InvalidArgumentException(sprintf("Field name '%s' not found in form %s", $fieldName, $instance->getName()));
+
+ return $instance->getView()[$fieldName];
+ }
+
+ protected function getInstanceFromParams($params) {
+
+ if (empty($params['form'])) {
+ throw new \InvalidArgumentException("Missing 'form' parameter in form arguments");
+ }
+
+ $instance = $params["form"];
+
+ if (! $instance instanceof \Thelia\Form\BaseForm) {
+ throw new \InvalidArgumentException(sprintf("form parameter in form_field block must be an instance of
+ \Thelia\Form\BaseForm, instance of %s found", get_class($instance)));
+ }
+
+ return $instance;
+ }
+
+ protected function createInstance($name)
{
if (!isset($this->formDefinition[$name])) {
throw new ElementNotFoundException(sprintf("%s form does not exists", $name));
@@ -210,7 +242,6 @@ class Form implements SmartyPluginInterface
$class = new \ReflectionClass($this->formDefinition[$name]);
-
return $class->newInstance(
$this->request,
"form"
@@ -224,8 +255,8 @@ class Form implements SmartyPluginInterface
{
return array(
new SmartyPluginDescriptor("block", "form", $this, "generateForm"),
- new SmartyPluginDescriptor("block", "form_field", $this, "formRender"),
- new SmartyPluginDescriptor("function", "form_field_hidden", $this, "formRenderHidden"),
+ new SmartyPluginDescriptor("block", "form_field", $this, "renderFormField"),
+ new SmartyPluginDescriptor("function", "form_hidden_fields", $this, "renderHiddenFormField"),
new SmartyPluginDescriptor("function", "form_enctype", $this, "formEnctype"),
new SmartyPluginDescriptor("block", "form_error", $this, "formError")
);
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php
index 93367f341..cd19576b1 100755
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php
@@ -27,6 +27,7 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\SmartyPluginInterface;
use Thelia\Core\Template\Smarty\Assets\SmartyAssetsManager;
use Thelia\Core\Security\SecurityContext;
+use Thelia\Core\Security\Exception\AuthenticationException;
class Security implements SmartyPluginInterface
{
@@ -39,7 +40,6 @@ class Security implements SmartyPluginInterface
private function _explode($commaSeparatedValues)
{
-
$array = explode(',', $commaSeparatedValues);
if (array_walk($array, function(&$item) {
@@ -60,10 +60,29 @@ class Security implements SmartyPluginInterface
*/
public function checkAuthFunction($params, &$smarty)
{
- $roles = $this->_explode($params['role']);
+ // Context: 'front' or 'admin'
+ $context = strtolower(trim($params['context']));
+
+ $this->securityContext->setContext($context);
+
+ $roles = $this->_explode($params['roles']);
$permissions = $this->_explode($params['permissions']);
- $this->securityContext->isGranted($roles, $permissions);
+ if (! $this->securityContext->isGranted($roles, $permissions)) {
+ $ex = new AuthenticationException(
+ sprintf("User not granted for roles '%s', permissions '%s' in context '%s'.",
+ implode(',', $roles), implode(',', $permissions), $context
+ )
+ );
+
+ if (! empty($params['login_tpl'])) {
+ $ex->setLoginTemplate($params['login_tpl']);
+ }
+
+ throw $ex;
+ }
+
+ return '';
}
/**
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php
index ec984613e..f03c34a7e 100755
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Translation.php
@@ -25,9 +25,16 @@ namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\SmartyPluginInterface;
+use Symfony\Component\Translation\TranslatorInterface;
class Translation implements SmartyPluginInterface
{
+ protected $translator;
+
+ public function __construct(TranslatorInterface $translator) {
+ $this->translator = $translator;
+ }
+
/**
* Process translate function
*
@@ -35,16 +42,9 @@ class Translation implements SmartyPluginInterface
* @param unknown $smarty
* @return string
*/
- public function theliaTranslate($params, &$smarty)
+ public function translate($params, &$smarty)
{
- if (isset($params['l'])) {
- $string = str_replace('\'', '\\\'', $params['l']);
- } else {
- $string = '';
- }
-
- // TODO
- return "$string";
+ return $this->translator->trans($params['l'], isset($params['p']) ? $params['p'] : array());
}
/**
@@ -55,7 +55,7 @@ class Translation implements SmartyPluginInterface
public function getPluginDescriptors()
{
return array(
- new SmartyPluginDescriptor('function', 'intl', $this, 'theliaTranslate'),
+ new SmartyPluginDescriptor('function', 'intl', $this, 'translate'),
);
}
}
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php
new file mode 100644
index 000000000..c2c75dffc
--- /dev/null
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php
@@ -0,0 +1,104 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Core\Template\Smarty\Plugins;
+
+use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
+use Thelia\Core\Template\Smarty\SmartyPluginInterface;
+use Thelia\Tools\URL;
+use Thelia\Core\HttpFoundation\Request;
+
+class UrlGenerator implements SmartyPluginInterface
+{
+ protected $request;
+
+ public function __construct(Request $request)
+ {
+ $this->request = $request;
+ }
+
+ /**
+ * Process url generator function
+ *
+ * @param array $params
+ * @param unknown $smarty
+ * @return string no text is returned.
+ */
+ public function generateUrlFunction($params, &$smarty)
+ {
+ // the path to process
+ $path = trim($params['path']);
+
+ return URL::absoluteUrl($path, $this->getArgsFromParam($params));
+ }
+
+ /**
+ * Process view url generator function
+ *
+ * @param array $params
+ * @param unknown $smarty
+ * @return string no text is returned.
+ */
+ public function generateViewUrlFunction($params, &$smarty)
+ {
+ // the view name (without .html)
+ $view = trim($params['view']);
+
+ // the related action (optionale)
+ $action = trim($params['action']);
+
+ $args = $this->getArgsFromParam($params);
+
+ if (! empty($action)) $args['action'] = $action;
+
+ return URL::viewUrl($view, $args);
+ }
+
+ /**
+ * Get URL parameters array from a comma separated list or arguments in the
+ * parameters.
+ *
+ * @param array $params Smarty function params
+ * @return array the parameters array (either emply, of valued)
+ */
+ private function getArgsFromParam($params) {
+
+ if (isset($params['args']))
+ return explode($params['args'], ',');
+
+ return array();
+ }
+
+ /**
+ * Define the various smarty plugins hendled by this class
+ *
+ * @return an array of smarty plugin descriptors
+ */
+ public function getPluginDescriptors()
+ {
+ return array(
+ new SmartyPluginDescriptor('function', 'url', $this, 'generateUrlFunction'),
+ new SmartyPluginDescriptor('function', 'viewurl', $this, 'generateViewUrlFunction')
+ );
+ }
+}
diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
index 8e34a89ed..a1e63dbf8 100755
--- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
+++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
@@ -7,10 +7,13 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
use \Smarty;
+use Symfony\Component\HttpFoundation\Response;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\Smarty\SmartyPluginInterface;
use Thelia\Core\Template\Exception\ResourceNotFoundException;
+use Thelia\Core\Template\ParserContext;
+use Thelia\Model\ConfigQuery;
/**
*
@@ -22,7 +25,9 @@ class SmartyParser extends Smarty implements ParserInterface
public $plugins = array();
- protected $request, $dispatcher;
+ protected $request;
+ protected $dispatcher;
+ protected $parserContext;
protected $template = "";
@@ -35,12 +40,15 @@ class SmartyParser extends Smarty implements ParserInterface
* @param string $env
* @param bool $debug
*/
- public function __construct(Request $request, EventDispatcherInterface $dispatcher, $template = false, $env = "prod", $debug = false)
+ public function __construct(
+ Request $request, EventDispatcherInterface $dispatcher, ParserContext $parserContext,
+ $template = false, $env = "prod", $debug = false)
{
parent::__construct();
$this->request = $request;
$this->dispatcher = $dispatcher;
+ $this->parserContext = $parserContext;
// Configure basic Smarty parameters
@@ -50,11 +58,11 @@ class SmartyParser extends Smarty implements ParserInterface
$cache_dir = THELIA_ROOT . 'cache/'. $env .'/smarty/cache';
if (! is_dir($cache_dir)) @mkdir($cache_dir, 0777, true);
- $this->setTemplate($template ?: 'smarty-sample'); // FIXME: put this in configuration
-
$this->setCompileDir($compile_dir);
$this->setCacheDir($cache_dir);
+ $this->setTemplate($template ?: ConfigQuery::read('active-template', 'default'));
+
$this->debugging = $debug;
// Prevent smarty ErrorException: Notice: Undefined index bla bla bla...
@@ -74,14 +82,20 @@ class SmartyParser extends Smarty implements ParserInterface
$this->status = 200;
$this->registerFilter('pre', array($this, "preThelia"));
+ $this->registerFilter('output', array($this, "removeBlankLines"));
}
public function preThelia($tpl_source, \Smarty_Internal_Template $template)
{
- $new_source = preg_replace('`{#([a-zA-Z][a-zA-Z0-9\-_]*)(.*)}`', '{\$$1$2}', $tpl_source);
- $new_source = preg_replace('`#([a-zA-Z][a-zA-Z0-9\-_]*)`', '{\$$1|dieseCanceller:\'#$1\'}', $new_source);
+ $new_source = preg_replace('`{#([a-zA-Z][a-zA-Z0-9\-_]*)(.*)}`', '{\$$1$2}', $tpl_source);
+ $new_source = preg_replace('`#([a-zA-Z][a-zA-Z0-9\-_]*)`', '{\$$1|dieseCanceller:\'#$1\'}', $new_source);
- return $new_source;
+ return $new_source;
+ }
+
+ public function removeBlankLines($tpl_source, \Smarty_Internal_Template $template)
+ {
+ return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source);
}
public function setTemplate($template_path_from_template_base)
@@ -103,8 +117,13 @@ class SmartyParser extends Smarty implements ParserInterface
* @param array $parameters an associative array of names / value pairs
* @return string the rendered template text
*/
- public function render($realTemplateName, array $parameters)
+ public function render($realTemplateName, array $parameters = array())
{
+ // Assign the parserContext variables
+ foreach($this->parserContext as $var => $value) {
+ $this->assign($var, $value);
+ }
+
$this->assign($parameters);
return $this->fetch($realTemplateName);
@@ -117,7 +136,14 @@ class SmartyParser extends Smarty implements ParserInterface
*/
public function getContent()
{
- return $this->fetch($this->getTemplateFilePath());
+ try {
+ $templateFile = $this->getTemplateFilePath();
+ }
+ catch(\RuntimeException $e) {
+ return new Response($e->getMessage(), "404");
+ }
+
+ return $this->render($templateFile);
}
/**
@@ -181,11 +207,23 @@ class SmartyParser extends Smarty implements ParserInterface
protected function getTemplateFilePath()
{
$file = $this->request->attributes->get('_view');
+ $fileName = THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/" . $file;
- $fileName = THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/" . $file . ".html";
+ $pathFileName = realpath(dirname(THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/" . $file));
+ $templateDir = realpath(THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/");
- if (file_exists($fileName)) return $fileName;
+ if (strpos($pathFileName, $templateDir) !== 0) {
+ throw new ResourceNotFoundException(sprintf("%s view does not exists", $file));
+ }
- throw new ResourceNotFoundException(sprintf("%s file not found in %s template", $file, $this->template));
+ if (!file_exists($fileName)) {
+ $fileName .= ".html";
+
+ if(!file_exists($fileName)) {
+ throw new ResourceNotFoundException(sprintf("%s file not found in %s template", $file, $this->template));
+ }
+ }
+
+ return $fileName;
}
}
diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php
index b023a4eab..526024707 100755
--- a/core/lib/Thelia/Core/Thelia.php
+++ b/core/lib/Thelia/Core/Thelia.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/TheliaContainerBuilder.php b/core/lib/Thelia/Core/TheliaContainerBuilder.php
index fb765ebb2..a97019b60 100755
--- a/core/lib/Thelia/Core/TheliaContainerBuilder.php
+++ b/core/lib/Thelia/Core/TheliaContainerBuilder.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Core/Translation/Translator.php b/core/lib/Thelia/Core/Translation/Translator.php
new file mode 100644
index 000000000..f884b0c98
--- /dev/null
+++ b/core/lib/Thelia/Core/Translation/Translator.php
@@ -0,0 +1,28 @@
+getLocale();
+ }
+
+ if (!isset($this->catalogues[$locale])) {
+ $this->loadCatalogue($locale);
+ }
+
+ if ($this->catalogues[$locale]->has((string) $id, $domain))
+ return parent::trans($id, $parameters, $domain = 'messages', $locale = null);
+ else
+ return strtr($id, $parameters);
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Exception/MemberAccessException.php b/core/lib/Thelia/Exception/MemberAccessException.php
index 9ceea565e..e1f65e590 100755
--- a/core/lib/Thelia/Exception/MemberAccessException.php
+++ b/core/lib/Thelia/Exception/MemberAccessException.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Exception;
diff --git a/core/lib/Thelia/Form/AdminLogin.php b/core/lib/Thelia/Form/AdminLogin.php
index 37efd05e7..5ed78a575 100755
--- a/core/lib/Thelia/Form/AdminLogin.php
+++ b/core/lib/Thelia/Form/AdminLogin.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -23,7 +23,6 @@
namespace Thelia\Form;
-use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Choice;
@@ -32,7 +31,7 @@ class AdminLogin extends BaseForm {
protected function buildForm()
{
- $this->form
+ $this->formBuilder
->add("username", "text", array(
"constraints" => array(
new NotBlank(),
@@ -44,12 +43,14 @@ class AdminLogin extends BaseForm {
new NotBlank()
)
))
- ->add("remember_me", "checkbox");
+ ->add("remember_me", "checkbox", array(
+ 'value' => 'yes'
+ ))
+ ;
}
public function getName()
{
- return "admin_login";
+ return "adminLogin";
}
-
}
diff --git a/core/lib/Thelia/Form/BaseForm.php b/core/lib/Thelia/Form/BaseForm.php
index b53747a5d..cebdd1f0b 100755
--- a/core/lib/Thelia/Form/BaseForm.php
+++ b/core/lib/Thelia/Form/BaseForm.php
@@ -31,14 +31,20 @@ use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider;
use Symfony\Component\Validator\Validation;
use Thelia\Model\ConfigQuery;
+use Thelia\Tools\URL;
abstract class BaseForm {
/**
* @var \Symfony\Component\Form\FormFactoryInterface
*/
+ protected $formBuilder;
+
+ /**
+ * @var \Symfony\Component\Form\Form
+ */
protected $form;
- public $name;
+ private $view = null;
public function __construct(Request $request, $type= "form", $data = array(), $options = array())
{
@@ -48,7 +54,7 @@ abstract class BaseForm {
$options["attr"]["thelia_name"] = $this->getName();
}
- $this->form = Forms::createFormFactoryBuilder()
+ $this->formBuilder = Forms::createFormFactoryBuilder()
->addExtension(new HttpFoundationExtension())
->addExtension(
new CsrfExtension(
@@ -63,9 +69,45 @@ abstract class BaseForm {
->createNamedBuilder($this->getName(), $type, $data, $options);
;
+ $this->buildForm();
+ // If not already set, define the success_url field
+ if (! $this->formBuilder->has('success_url')) {
+ $this->formBuilder->add("success_url", "text");
+ }
- $this->buildForm();
+ $this->form = $this->formBuilder->getForm();
+ }
+
+ /**
+ * Returns the absolute URL to redirect the user to if the form is successfully processed.
+ *
+ * @param string $default the default URL. If not given, the configured base URL is used.
+ *
+ * @return string an absolute URL
+ */
+ public function getSuccessUrl($default = null) {
+
+ $successUrl = $this->form->get('success_url')->getData();
+
+ if (empty($successUrl)) {
+
+ if ($default === null) $default = ConfigQuery::read('base_url', '/');
+
+ $successUrl = $default;
+ }
+
+ return URL::absoluteUrl($successUrl);
+ }
+
+ public function createView() {
+ $this->view = $this->form->createView();
+ }
+
+ public function getView() {
+ if ($this->view === null) throw new \LogicException("View was not created. Please call BaseForm::createView() first.");
+
+ return $this->view;
}
/**
@@ -73,15 +115,15 @@ abstract class BaseForm {
*/
public function getForm()
{
- return $this->form->getForm();
+ return $this->form;
}
/**
*
* in this function you add all the fields you need for your Form.
- * Form this you have to call add method on $this->form attribute :
+ * Form this you have to call add method on $this->formBuilder attribute :
*
- * $this->form->add("name", "text")
+ * $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php
index 2ba80f362..df2fb1c2c 100755
--- a/core/lib/Thelia/Form/CustomerCreation.php
+++ b/core/lib/Thelia/Form/CustomerCreation.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -33,7 +33,7 @@ class CustomerCreation extends BaseForm
protected function buildForm()
{
- $this->form
+ $this->formBuilder
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
diff --git a/core/lib/Thelia/Form/CustomerLogin.php b/core/lib/Thelia/Form/CustomerLogin.php
new file mode 100644
index 000000000..52357dbd6
--- /dev/null
+++ b/core/lib/Thelia/Form/CustomerLogin.php
@@ -0,0 +1,56 @@
+. */
+/* */
+/*************************************************************************************/
+namespace Thelia\Form;
+
+
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\Validator\Constraints\Length;
+use Symfony\Component\Validator\Constraints\NotBlank;
+use Symfony\Component\Validator\Constraints\Choice;
+use Symfony\Component\Validator\Constraints\Email;
+
+class CustomerLogin extends BaseForm {
+
+ protected function buildForm()
+ {
+ $this->formBuilder
+ ->add("email", "text", array(
+ "constraints" => array(
+ new NotBlank(),
+ new Email()
+ )
+ ))
+ ->add("password", "password", array(
+ "constraints" => array(
+ new NotBlank()
+ )
+ ))
+ ->add("remember_me", "checkbox")
+ ;
+ }
+
+ public function getName()
+ {
+ return "customer_login";
+ }
+}
diff --git a/core/lib/Thelia/Form/CustomerModification.php b/core/lib/Thelia/Form/CustomerModification.php
index cb21be2fa..c87e5fece 100755
--- a/core/lib/Thelia/Form/CustomerModification.php
+++ b/core/lib/Thelia/Form/CustomerModification.php
@@ -52,7 +52,7 @@ class CustomerModification extends BaseForm {
protected function buildForm()
{
- $this->form
+ $this->formBuilder
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
diff --git a/core/lib/Thelia/Log/AbstractTlogDestination.php b/core/lib/Thelia/Log/AbstractTlogDestination.php
index 4b859df20..5241bcdd8 100755
--- a/core/lib/Thelia/Log/AbstractTlogDestination.php
+++ b/core/lib/Thelia/Log/AbstractTlogDestination.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php
index d7fa4f5c2..2f9a0e5bc 100755
--- a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php b/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php
index d0896cd26..a510e18ef 100755
--- a/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationNull.php b/core/lib/Thelia/Log/Destination/TlogDestinationNull.php
index b5bd3dcbb..1fa8eaf3a 100755
--- a/core/lib/Thelia/Log/Destination/TlogDestinationNull.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationNull.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationText.php b/core/lib/Thelia/Log/Destination/TlogDestinationText.php
index 379794ce4..b03f03f65 100755
--- a/core/lib/Thelia/Log/Destination/TlogDestinationText.php
+++ b/core/lib/Thelia/Log/Destination/TlogDestinationText.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Log/Tlog.php b/core/lib/Thelia/Log/Tlog.php
index 76b813944..907c0d8e7 100755
--- a/core/lib/Thelia/Log/Tlog.php
+++ b/core/lib/Thelia/Log/Tlog.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Log;
diff --git a/core/lib/Thelia/Log/TlogDestinationConfig.php b/core/lib/Thelia/Log/TlogDestinationConfig.php
index b945b9dfd..1f60ba08e 100755
--- a/core/lib/Thelia/Log/TlogDestinationConfig.php
+++ b/core/lib/Thelia/Log/TlogDestinationConfig.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Model/Admin.php b/core/lib/Thelia/Model/Admin.php
index 5dd4b9ed4..34dc7fbfd 100755
--- a/core/lib/Thelia/Model/Admin.php
+++ b/core/lib/Thelia/Model/Admin.php
@@ -3,6 +3,8 @@
namespace Thelia\Model;
use Thelia\Core\Security\User\UserInterface;
+use Thelia\Core\Security\Role\Role;
+
use Thelia\Model\Base\Admin as BaseAdmin;
/**
@@ -18,9 +20,34 @@ use Thelia\Model\Base\Admin as BaseAdmin;
*/
class Admin extends BaseAdmin implements UserInterface
{
+
+ public function setPassword($password)
+ {
+ \Thelia\Log\Tlog::getInstance()->debug($password);
+
+ if ($this->isNew() && ($password === null || trim($password) == "")) {
+ throw new InvalidArgumentException("customer password is mandatory on creation");
+ }
+
+ if($password !== null && trim($password) != "") {
+ $this->setAlgo("PASSWORD_BCRYPT");
+ return parent::setPassword(password_hash($password, PASSWORD_BCRYPT));
+ }
+
+ return $this;
+ }
+
/**
* {@inheritDoc}
*/
+ public function checkPassword($password)
+ {
+ return password_verify($password, $this->password);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function getUsername() {
return $this->getLogin();
}
@@ -36,6 +63,6 @@ class Admin extends BaseAdmin implements UserInterface
* {@inheritDoc}
*/
public function getRoles() {
- return array(new Role('ROLE_ADMIN'));
+ return array(new Role('ADMIN'));
}
}
diff --git a/core/lib/Thelia/Model/AdminLog.php b/core/lib/Thelia/Model/AdminLog.php
index efa80209c..e5720fb35 100755
--- a/core/lib/Thelia/Model/AdminLog.php
+++ b/core/lib/Thelia/Model/AdminLog.php
@@ -3,7 +3,37 @@
namespace Thelia\Model;
use Thelia\Model\Base\AdminLog as BaseAdminLog;
+use Thelia\Core\HttpFoundation\Request;
+use Thelia\Log\Tlog;
+use Thelia\Model\Base\Admin as BaseAdminUser;
class AdminLog extends BaseAdminLog {
-}
+ /**
+ * A sdimple helper to insert an entry in the admin log
+ *
+ * @param unknown $actionLabel
+ * @param Request $request
+ * @param Admin $adminUser
+ */
+ public static function append($actionLabel, Request $request, BaseAdminUser $adminUser = null) {
+
+ $log = new AdminLog();
+
+ $log
+ ->setAdminLogin($adminUser !== null ? $adminUser->getLogin() : '')
+ ->setAdminFirstname($adminUser !== null ? $adminUser->getFirstname() : '')
+ ->setAdminLastname($adminUser !== null ? $adminUser->getLastname() : '')
+ ->setAction($actionLabel)
+ ->setRequest($request->__toString())
+ ;
+
+ try {
+ $log->save();
+ }
+ catch (\Exception $ex) {
+ Tlog::getInstance()->err("Failed to insert new entry in AdminLog: {ex}", array('ex' => $ex));
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Model/Base/Address.php b/core/lib/Thelia/Model/Base/Address.php
index fe734960b..e0864f269 100755
--- a/core/lib/Thelia/Model/Base/Address.php
+++ b/core/lib/Thelia/Model/Base/Address.php
@@ -142,6 +142,19 @@ abstract class Address implements ActiveRecordInterface
*/
protected $phone;
+ /**
+ * The value for the cellphone field.
+ * @var string
+ */
+ protected $cellphone;
+
+ /**
+ * The value for the is_default field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $is_default;
+
/**
* The value for the created_at field.
* @var string
@@ -172,11 +185,24 @@ abstract class Address implements ActiveRecordInterface
*/
protected $alreadyInSave = false;
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->is_default = 0;
+ }
+
/**
* Initializes internal state of Thelia\Model\Base\Address object.
+ * @see applyDefaults()
*/
public function __construct()
{
+ $this->applyDefaultValues();
}
/**
@@ -580,6 +606,28 @@ abstract class Address implements ActiveRecordInterface
return $this->phone;
}
+ /**
+ * Get the [cellphone] column value.
+ *
+ * @return string
+ */
+ public function getCellphone()
+ {
+
+ return $this->cellphone;
+ }
+
+ /**
+ * Get the [is_default] column value.
+ *
+ * @return int
+ */
+ public function getIsDefault()
+ {
+
+ return $this->is_default;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -922,6 +970,48 @@ abstract class Address implements ActiveRecordInterface
return $this;
} // setPhone()
+ /**
+ * Set the value of [cellphone] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\Address The current object (for fluent API support)
+ */
+ public function setCellphone($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->cellphone !== $v) {
+ $this->cellphone = $v;
+ $this->modifiedColumns[] = AddressTableMap::CELLPHONE;
+ }
+
+
+ return $this;
+ } // setCellphone()
+
+ /**
+ * Set the value of [is_default] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Address The current object (for fluent API support)
+ */
+ public function setIsDefault($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->is_default !== $v) {
+ $this->is_default = $v;
+ $this->modifiedColumns[] = AddressTableMap::IS_DEFAULT;
+ }
+
+
+ return $this;
+ } // setIsDefault()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -974,6 +1064,10 @@ abstract class Address implements ActiveRecordInterface
*/
public function hasOnlyDefaultValues()
{
+ if ($this->is_default !== 0) {
+ return false;
+ }
+
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -1043,13 +1137,19 @@ abstract class Address implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : AddressTableMap::translateFieldName('Phone', TableMap::TYPE_PHPNAME, $indexType)];
$this->phone = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : AddressTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : AddressTableMap::translateFieldName('Cellphone', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->cellphone = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : AddressTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->is_default = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : AddressTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : AddressTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : AddressTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -1062,7 +1162,7 @@ abstract class Address implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 16; // 16 = AddressTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 18; // 18 = AddressTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Address object", 0, $e);
@@ -1351,6 +1451,12 @@ abstract class Address implements ActiveRecordInterface
if ($this->isColumnModified(AddressTableMap::PHONE)) {
$modifiedColumns[':p' . $index++] = 'PHONE';
}
+ if ($this->isColumnModified(AddressTableMap::CELLPHONE)) {
+ $modifiedColumns[':p' . $index++] = 'CELLPHONE';
+ }
+ if ($this->isColumnModified(AddressTableMap::IS_DEFAULT)) {
+ $modifiedColumns[':p' . $index++] = 'IS_DEFAULT';
+ }
if ($this->isColumnModified(AddressTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1410,6 +1516,12 @@ abstract class Address implements ActiveRecordInterface
case 'PHONE':
$stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR);
break;
+ case 'CELLPHONE':
+ $stmt->bindValue($identifier, $this->cellphone, PDO::PARAM_STR);
+ break;
+ case 'IS_DEFAULT':
+ $stmt->bindValue($identifier, $this->is_default, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1521,9 +1633,15 @@ abstract class Address implements ActiveRecordInterface
return $this->getPhone();
break;
case 14:
- return $this->getCreatedAt();
+ return $this->getCellphone();
break;
case 15:
+ return $this->getIsDefault();
+ break;
+ case 16:
+ return $this->getCreatedAt();
+ break;
+ case 17:
return $this->getUpdatedAt();
break;
default:
@@ -1569,8 +1687,10 @@ abstract class Address implements ActiveRecordInterface
$keys[11] => $this->getCity(),
$keys[12] => $this->getCountryId(),
$keys[13] => $this->getPhone(),
- $keys[14] => $this->getCreatedAt(),
- $keys[15] => $this->getUpdatedAt(),
+ $keys[14] => $this->getCellphone(),
+ $keys[15] => $this->getIsDefault(),
+ $keys[16] => $this->getCreatedAt(),
+ $keys[17] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1662,9 +1782,15 @@ abstract class Address implements ActiveRecordInterface
$this->setPhone($value);
break;
case 14:
- $this->setCreatedAt($value);
+ $this->setCellphone($value);
break;
case 15:
+ $this->setIsDefault($value);
+ break;
+ case 16:
+ $this->setCreatedAt($value);
+ break;
+ case 17:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1705,8 +1831,10 @@ abstract class Address implements ActiveRecordInterface
if (array_key_exists($keys[11], $arr)) $this->setCity($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setCountryId($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setPhone($arr[$keys[13]]);
- if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]);
- if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]);
+ if (array_key_exists($keys[14], $arr)) $this->setCellphone($arr[$keys[14]]);
+ if (array_key_exists($keys[15], $arr)) $this->setIsDefault($arr[$keys[15]]);
+ if (array_key_exists($keys[16], $arr)) $this->setCreatedAt($arr[$keys[16]]);
+ if (array_key_exists($keys[17], $arr)) $this->setUpdatedAt($arr[$keys[17]]);
}
/**
@@ -1732,6 +1860,8 @@ abstract class Address implements ActiveRecordInterface
if ($this->isColumnModified(AddressTableMap::CITY)) $criteria->add(AddressTableMap::CITY, $this->city);
if ($this->isColumnModified(AddressTableMap::COUNTRY_ID)) $criteria->add(AddressTableMap::COUNTRY_ID, $this->country_id);
if ($this->isColumnModified(AddressTableMap::PHONE)) $criteria->add(AddressTableMap::PHONE, $this->phone);
+ if ($this->isColumnModified(AddressTableMap::CELLPHONE)) $criteria->add(AddressTableMap::CELLPHONE, $this->cellphone);
+ if ($this->isColumnModified(AddressTableMap::IS_DEFAULT)) $criteria->add(AddressTableMap::IS_DEFAULT, $this->is_default);
if ($this->isColumnModified(AddressTableMap::CREATED_AT)) $criteria->add(AddressTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(AddressTableMap::UPDATED_AT)) $criteria->add(AddressTableMap::UPDATED_AT, $this->updated_at);
@@ -1810,6 +1940,8 @@ abstract class Address implements ActiveRecordInterface
$copyObj->setCity($this->getCity());
$copyObj->setCountryId($this->getCountryId());
$copyObj->setPhone($this->getPhone());
+ $copyObj->setCellphone($this->getCellphone());
+ $copyObj->setIsDefault($this->getIsDefault());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1961,10 +2093,13 @@ abstract class Address implements ActiveRecordInterface
$this->city = null;
$this->country_id = null;
$this->phone = null;
+ $this->cellphone = null;
+ $this->is_default = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
+ $this->applyDefaultValues();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);
diff --git a/core/lib/Thelia/Model/Base/AddressQuery.php b/core/lib/Thelia/Model/Base/AddressQuery.php
index 8611f14a8..f9dc30efc 100755
--- a/core/lib/Thelia/Model/Base/AddressQuery.php
+++ b/core/lib/Thelia/Model/Base/AddressQuery.php
@@ -35,6 +35,8 @@ use Thelia\Model\Map\AddressTableMap;
* @method ChildAddressQuery orderByCity($order = Criteria::ASC) Order by the city column
* @method ChildAddressQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
* @method ChildAddressQuery orderByPhone($order = Criteria::ASC) Order by the phone column
+ * @method ChildAddressQuery orderByCellphone($order = Criteria::ASC) Order by the cellphone column
+ * @method ChildAddressQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column
* @method ChildAddressQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -52,6 +54,8 @@ use Thelia\Model\Map\AddressTableMap;
* @method ChildAddressQuery groupByCity() Group by the city column
* @method ChildAddressQuery groupByCountryId() Group by the country_id column
* @method ChildAddressQuery groupByPhone() Group by the phone column
+ * @method ChildAddressQuery groupByCellphone() Group by the cellphone column
+ * @method ChildAddressQuery groupByIsDefault() Group by the is_default column
* @method ChildAddressQuery groupByCreatedAt() Group by the created_at column
* @method ChildAddressQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -84,6 +88,8 @@ use Thelia\Model\Map\AddressTableMap;
* @method ChildAddress findOneByCity(string $city) Return the first ChildAddress filtered by the city column
* @method ChildAddress findOneByCountryId(int $country_id) Return the first ChildAddress filtered by the country_id column
* @method ChildAddress findOneByPhone(string $phone) Return the first ChildAddress filtered by the phone column
+ * @method ChildAddress findOneByCellphone(string $cellphone) Return the first ChildAddress filtered by the cellphone column
+ * @method ChildAddress findOneByIsDefault(int $is_default) Return the first ChildAddress filtered by the is_default column
* @method ChildAddress findOneByCreatedAt(string $created_at) Return the first ChildAddress filtered by the created_at column
* @method ChildAddress findOneByUpdatedAt(string $updated_at) Return the first ChildAddress filtered by the updated_at column
*
@@ -101,6 +107,8 @@ use Thelia\Model\Map\AddressTableMap;
* @method array findByCity(string $city) Return ChildAddress objects filtered by the city column
* @method array findByCountryId(int $country_id) Return ChildAddress objects filtered by the country_id column
* @method array findByPhone(string $phone) Return ChildAddress objects filtered by the phone column
+ * @method array findByCellphone(string $cellphone) Return ChildAddress objects filtered by the cellphone column
+ * @method array findByIsDefault(int $is_default) Return ChildAddress objects filtered by the is_default column
* @method array findByCreatedAt(string $created_at) Return ChildAddress objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAddress objects filtered by the updated_at column
*
@@ -191,7 +199,7 @@ abstract class AddressQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, TITLE, CUSTOMER_ID, CUSTOMER_TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0';
+ $sql = 'SELECT ID, TITLE, CUSTOMER_ID, CUSTOMER_TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -738,6 +746,76 @@ abstract class AddressQuery extends ModelCriteria
return $this->addUsingAlias(AddressTableMap::PHONE, $phone, $comparison);
}
+ /**
+ * Filter the query on the cellphone column
+ *
+ * Example usage:
+ *
+ * $query->filterByCellphone('fooValue'); // WHERE cellphone = 'fooValue'
+ * $query->filterByCellphone('%fooValue%'); // WHERE cellphone LIKE '%fooValue%'
+ *
+ *
+ * @param string $cellphone The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAddressQuery The current query, for fluid interface
+ */
+ public function filterByCellphone($cellphone = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($cellphone)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $cellphone)) {
+ $cellphone = str_replace('*', '%', $cellphone);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AddressTableMap::CELLPHONE, $cellphone, $comparison);
+ }
+
+ /**
+ * Filter the query on the is_default column
+ *
+ * Example usage:
+ *
+ * $query->filterByIsDefault(1234); // WHERE is_default = 1234
+ * $query->filterByIsDefault(array(12, 34)); // WHERE is_default IN (12, 34)
+ * $query->filterByIsDefault(array('min' => 12)); // WHERE is_default > 12
+ *
+ *
+ * @param mixed $isDefault The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildAddressQuery The current query, for fluid interface
+ */
+ public function filterByIsDefault($isDefault = null, $comparison = null)
+ {
+ if (is_array($isDefault)) {
+ $useMinMax = false;
+ if (isset($isDefault['min'])) {
+ $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($isDefault['max'])) {
+ $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/Customer.php b/core/lib/Thelia/Model/Base/Customer.php
index 6941594a0..71708ab1b 100755
--- a/core/lib/Thelia/Model/Base/Customer.php
+++ b/core/lib/Thelia/Model/Base/Customer.php
@@ -74,16 +74,10 @@ abstract class Customer implements ActiveRecordInterface
protected $ref;
/**
- * The value for the customer_title_id field.
+ * The value for the title_id field.
* @var int
*/
- protected $customer_title_id;
-
- /**
- * The value for the company field.
- * @var string
- */
- protected $company;
+ protected $title_id;
/**
* The value for the firstname field.
@@ -97,54 +91,6 @@ abstract class Customer implements ActiveRecordInterface
*/
protected $lastname;
- /**
- * The value for the address1 field.
- * @var string
- */
- protected $address1;
-
- /**
- * The value for the address2 field.
- * @var string
- */
- protected $address2;
-
- /**
- * The value for the address3 field.
- * @var string
- */
- protected $address3;
-
- /**
- * The value for the zipcode field.
- * @var string
- */
- protected $zipcode;
-
- /**
- * The value for the city field.
- * @var string
- */
- protected $city;
-
- /**
- * The value for the country_id field.
- * @var int
- */
- protected $country_id;
-
- /**
- * The value for the phone field.
- * @var string
- */
- protected $phone;
-
- /**
- * The value for the cellphone field.
- * @var string
- */
- protected $cellphone;
-
/**
* The value for the email field.
* @var string
@@ -163,12 +109,6 @@ abstract class Customer implements ActiveRecordInterface
*/
protected $algo;
- /**
- * The value for the salt field.
- * @var string
- */
- protected $salt;
-
/**
* The value for the reseller field.
* @var int
@@ -519,25 +459,14 @@ abstract class Customer implements ActiveRecordInterface
}
/**
- * Get the [customer_title_id] column value.
+ * Get the [title_id] column value.
*
* @return int
*/
- public function getCustomerTitleId()
+ public function getTitleId()
{
- return $this->customer_title_id;
- }
-
- /**
- * Get the [company] column value.
- *
- * @return string
- */
- public function getCompany()
- {
-
- return $this->company;
+ return $this->title_id;
}
/**
@@ -562,94 +491,6 @@ abstract class Customer implements ActiveRecordInterface
return $this->lastname;
}
- /**
- * Get the [address1] column value.
- *
- * @return string
- */
- public function getAddress1()
- {
-
- return $this->address1;
- }
-
- /**
- * Get the [address2] column value.
- *
- * @return string
- */
- public function getAddress2()
- {
-
- return $this->address2;
- }
-
- /**
- * Get the [address3] column value.
- *
- * @return string
- */
- public function getAddress3()
- {
-
- return $this->address3;
- }
-
- /**
- * Get the [zipcode] column value.
- *
- * @return string
- */
- public function getZipcode()
- {
-
- return $this->zipcode;
- }
-
- /**
- * Get the [city] column value.
- *
- * @return string
- */
- public function getCity()
- {
-
- return $this->city;
- }
-
- /**
- * Get the [country_id] column value.
- *
- * @return int
- */
- public function getCountryId()
- {
-
- return $this->country_id;
- }
-
- /**
- * Get the [phone] column value.
- *
- * @return string
- */
- public function getPhone()
- {
-
- return $this->phone;
- }
-
- /**
- * Get the [cellphone] column value.
- *
- * @return string
- */
- public function getCellphone()
- {
-
- return $this->cellphone;
- }
-
/**
* Get the [email] column value.
*
@@ -683,17 +524,6 @@ abstract class Customer implements ActiveRecordInterface
return $this->algo;
}
- /**
- * Get the [salt] column value.
- *
- * @return string
- */
- public function getSalt()
- {
-
- return $this->salt;
- }
-
/**
* Get the [reseller] column value.
*
@@ -821,20 +651,20 @@ abstract class Customer implements ActiveRecordInterface
} // setRef()
/**
- * Set the value of [customer_title_id] column.
+ * Set the value of [title_id] column.
*
* @param int $v new value
* @return \Thelia\Model\Customer The current object (for fluent API support)
*/
- public function setCustomerTitleId($v)
+ public function setTitleId($v)
{
if ($v !== null) {
$v = (int) $v;
}
- if ($this->customer_title_id !== $v) {
- $this->customer_title_id = $v;
- $this->modifiedColumns[] = CustomerTableMap::CUSTOMER_TITLE_ID;
+ if ($this->title_id !== $v) {
+ $this->title_id = $v;
+ $this->modifiedColumns[] = CustomerTableMap::TITLE_ID;
}
if ($this->aCustomerTitle !== null && $this->aCustomerTitle->getId() !== $v) {
@@ -843,28 +673,7 @@ abstract class Customer implements ActiveRecordInterface
return $this;
- } // setCustomerTitleId()
-
- /**
- * Set the value of [company] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setCompany($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->company !== $v) {
- $this->company = $v;
- $this->modifiedColumns[] = CustomerTableMap::COMPANY;
- }
-
-
- return $this;
- } // setCompany()
+ } // setTitleId()
/**
* Set the value of [firstname] column.
@@ -908,174 +717,6 @@ abstract class Customer implements ActiveRecordInterface
return $this;
} // setLastname()
- /**
- * Set the value of [address1] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setAddress1($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->address1 !== $v) {
- $this->address1 = $v;
- $this->modifiedColumns[] = CustomerTableMap::ADDRESS1;
- }
-
-
- return $this;
- } // setAddress1()
-
- /**
- * Set the value of [address2] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setAddress2($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->address2 !== $v) {
- $this->address2 = $v;
- $this->modifiedColumns[] = CustomerTableMap::ADDRESS2;
- }
-
-
- return $this;
- } // setAddress2()
-
- /**
- * Set the value of [address3] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setAddress3($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->address3 !== $v) {
- $this->address3 = $v;
- $this->modifiedColumns[] = CustomerTableMap::ADDRESS3;
- }
-
-
- return $this;
- } // setAddress3()
-
- /**
- * Set the value of [zipcode] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setZipcode($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->zipcode !== $v) {
- $this->zipcode = $v;
- $this->modifiedColumns[] = CustomerTableMap::ZIPCODE;
- }
-
-
- return $this;
- } // setZipcode()
-
- /**
- * Set the value of [city] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setCity($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->city !== $v) {
- $this->city = $v;
- $this->modifiedColumns[] = CustomerTableMap::CITY;
- }
-
-
- return $this;
- } // setCity()
-
- /**
- * Set the value of [country_id] column.
- *
- * @param int $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setCountryId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->country_id !== $v) {
- $this->country_id = $v;
- $this->modifiedColumns[] = CustomerTableMap::COUNTRY_ID;
- }
-
-
- return $this;
- } // setCountryId()
-
- /**
- * Set the value of [phone] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setPhone($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->phone !== $v) {
- $this->phone = $v;
- $this->modifiedColumns[] = CustomerTableMap::PHONE;
- }
-
-
- return $this;
- } // setPhone()
-
- /**
- * Set the value of [cellphone] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setCellphone($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cellphone !== $v) {
- $this->cellphone = $v;
- $this->modifiedColumns[] = CustomerTableMap::CELLPHONE;
- }
-
-
- return $this;
- } // setCellphone()
-
/**
* Set the value of [email] column.
*
@@ -1139,27 +780,6 @@ abstract class Customer implements ActiveRecordInterface
return $this;
} // setAlgo()
- /**
- * Set the value of [salt] column.
- *
- * @param string $v new value
- * @return \Thelia\Model\Customer The current object (for fluent API support)
- */
- public function setSalt($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->salt !== $v) {
- $this->salt = $v;
- $this->modifiedColumns[] = CustomerTableMap::SALT;
- }
-
-
- return $this;
- } // setSalt()
-
/**
* Set the value of [reseller] column.
*
@@ -1329,73 +949,43 @@ abstract class Customer implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CustomerTableMap::translateFieldName('Ref', TableMap::TYPE_PHPNAME, $indexType)];
$this->ref = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CustomerTableMap::translateFieldName('CustomerTitleId', TableMap::TYPE_PHPNAME, $indexType)];
- $this->customer_title_id = (null !== $col) ? (int) $col : null;
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CustomerTableMap::translateFieldName('TitleId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->title_id = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CustomerTableMap::translateFieldName('Company', TableMap::TYPE_PHPNAME, $indexType)];
- $this->company = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CustomerTableMap::translateFieldName('Firstname', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CustomerTableMap::translateFieldName('Firstname', TableMap::TYPE_PHPNAME, $indexType)];
$this->firstname = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CustomerTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CustomerTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
$this->lastname = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CustomerTableMap::translateFieldName('Address1', TableMap::TYPE_PHPNAME, $indexType)];
- $this->address1 = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CustomerTableMap::translateFieldName('Address2', TableMap::TYPE_PHPNAME, $indexType)];
- $this->address2 = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CustomerTableMap::translateFieldName('Address3', TableMap::TYPE_PHPNAME, $indexType)];
- $this->address3 = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CustomerTableMap::translateFieldName('Zipcode', TableMap::TYPE_PHPNAME, $indexType)];
- $this->zipcode = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CustomerTableMap::translateFieldName('City', TableMap::TYPE_PHPNAME, $indexType)];
- $this->city = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CustomerTableMap::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)];
- $this->country_id = (null !== $col) ? (int) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('Phone', TableMap::TYPE_PHPNAME, $indexType)];
- $this->phone = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('Cellphone', TableMap::TYPE_PHPNAME, $indexType)];
- $this->cellphone = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CustomerTableMap::translateFieldName('Email', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CustomerTableMap::translateFieldName('Email', TableMap::TYPE_PHPNAME, $indexType)];
$this->email = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CustomerTableMap::translateFieldName('Password', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CustomerTableMap::translateFieldName('Password', TableMap::TYPE_PHPNAME, $indexType)];
$this->password = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CustomerTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CustomerTableMap::translateFieldName('Algo', TableMap::TYPE_PHPNAME, $indexType)];
$this->algo = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CustomerTableMap::translateFieldName('Salt', TableMap::TYPE_PHPNAME, $indexType)];
- $this->salt = (null !== $col) ? (string) $col : null;
-
- $col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : CustomerTableMap::translateFieldName('Reseller', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CustomerTableMap::translateFieldName('Reseller', TableMap::TYPE_PHPNAME, $indexType)];
$this->reseller = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 19 + $startcol : CustomerTableMap::translateFieldName('Lang', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CustomerTableMap::translateFieldName('Lang', TableMap::TYPE_PHPNAME, $indexType)];
$this->lang = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 20 + $startcol : CustomerTableMap::translateFieldName('Sponsor', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CustomerTableMap::translateFieldName('Sponsor', TableMap::TYPE_PHPNAME, $indexType)];
$this->sponsor = (null !== $col) ? (string) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 21 + $startcol : CustomerTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CustomerTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
$this->discount = (null !== $col) ? (double) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 22 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CustomerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 23 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CustomerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -1408,7 +998,7 @@ abstract class Customer implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 24; // 24 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 14; // 14 = CustomerTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Customer object", 0, $e);
@@ -1430,7 +1020,7 @@ abstract class Customer implements ActiveRecordInterface
*/
public function ensureConsistency()
{
- if ($this->aCustomerTitle !== null && $this->customer_title_id !== $this->aCustomerTitle->getId()) {
+ if ($this->aCustomerTitle !== null && $this->title_id !== $this->aCustomerTitle->getId()) {
$this->aCustomerTitle = null;
}
} // ensureConsistency
@@ -1688,11 +1278,8 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::REF)) {
$modifiedColumns[':p' . $index++] = 'REF';
}
- if ($this->isColumnModified(CustomerTableMap::CUSTOMER_TITLE_ID)) {
- $modifiedColumns[':p' . $index++] = 'CUSTOMER_TITLE_ID';
- }
- if ($this->isColumnModified(CustomerTableMap::COMPANY)) {
- $modifiedColumns[':p' . $index++] = 'COMPANY';
+ if ($this->isColumnModified(CustomerTableMap::TITLE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'TITLE_ID';
}
if ($this->isColumnModified(CustomerTableMap::FIRSTNAME)) {
$modifiedColumns[':p' . $index++] = 'FIRSTNAME';
@@ -1700,30 +1287,6 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::LASTNAME)) {
$modifiedColumns[':p' . $index++] = 'LASTNAME';
}
- if ($this->isColumnModified(CustomerTableMap::ADDRESS1)) {
- $modifiedColumns[':p' . $index++] = 'ADDRESS1';
- }
- if ($this->isColumnModified(CustomerTableMap::ADDRESS2)) {
- $modifiedColumns[':p' . $index++] = 'ADDRESS2';
- }
- if ($this->isColumnModified(CustomerTableMap::ADDRESS3)) {
- $modifiedColumns[':p' . $index++] = 'ADDRESS3';
- }
- if ($this->isColumnModified(CustomerTableMap::ZIPCODE)) {
- $modifiedColumns[':p' . $index++] = 'ZIPCODE';
- }
- if ($this->isColumnModified(CustomerTableMap::CITY)) {
- $modifiedColumns[':p' . $index++] = 'CITY';
- }
- if ($this->isColumnModified(CustomerTableMap::COUNTRY_ID)) {
- $modifiedColumns[':p' . $index++] = 'COUNTRY_ID';
- }
- if ($this->isColumnModified(CustomerTableMap::PHONE)) {
- $modifiedColumns[':p' . $index++] = 'PHONE';
- }
- if ($this->isColumnModified(CustomerTableMap::CELLPHONE)) {
- $modifiedColumns[':p' . $index++] = 'CELLPHONE';
- }
if ($this->isColumnModified(CustomerTableMap::EMAIL)) {
$modifiedColumns[':p' . $index++] = 'EMAIL';
}
@@ -1733,9 +1296,6 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::ALGO)) {
$modifiedColumns[':p' . $index++] = 'ALGO';
}
- if ($this->isColumnModified(CustomerTableMap::SALT)) {
- $modifiedColumns[':p' . $index++] = 'SALT';
- }
if ($this->isColumnModified(CustomerTableMap::RESELLER)) {
$modifiedColumns[':p' . $index++] = 'RESELLER';
}
@@ -1771,11 +1331,8 @@ abstract class Customer implements ActiveRecordInterface
case 'REF':
$stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
break;
- case 'CUSTOMER_TITLE_ID':
- $stmt->bindValue($identifier, $this->customer_title_id, PDO::PARAM_INT);
- break;
- case 'COMPANY':
- $stmt->bindValue($identifier, $this->company, PDO::PARAM_STR);
+ case 'TITLE_ID':
+ $stmt->bindValue($identifier, $this->title_id, PDO::PARAM_INT);
break;
case 'FIRSTNAME':
$stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR);
@@ -1783,30 +1340,6 @@ abstract class Customer implements ActiveRecordInterface
case 'LASTNAME':
$stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR);
break;
- case 'ADDRESS1':
- $stmt->bindValue($identifier, $this->address1, PDO::PARAM_STR);
- break;
- case 'ADDRESS2':
- $stmt->bindValue($identifier, $this->address2, PDO::PARAM_STR);
- break;
- case 'ADDRESS3':
- $stmt->bindValue($identifier, $this->address3, PDO::PARAM_STR);
- break;
- case 'ZIPCODE':
- $stmt->bindValue($identifier, $this->zipcode, PDO::PARAM_STR);
- break;
- case 'CITY':
- $stmt->bindValue($identifier, $this->city, PDO::PARAM_STR);
- break;
- case 'COUNTRY_ID':
- $stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT);
- break;
- case 'PHONE':
- $stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR);
- break;
- case 'CELLPHONE':
- $stmt->bindValue($identifier, $this->cellphone, PDO::PARAM_STR);
- break;
case 'EMAIL':
$stmt->bindValue($identifier, $this->email, PDO::PARAM_STR);
break;
@@ -1816,9 +1349,6 @@ abstract class Customer implements ActiveRecordInterface
case 'ALGO':
$stmt->bindValue($identifier, $this->algo, PDO::PARAM_STR);
break;
- case 'SALT':
- $stmt->bindValue($identifier, $this->salt, PDO::PARAM_STR);
- break;
case 'RESELLER':
$stmt->bindValue($identifier, $this->reseller, PDO::PARAM_INT);
break;
@@ -1906,69 +1436,39 @@ abstract class Customer implements ActiveRecordInterface
return $this->getRef();
break;
case 2:
- return $this->getCustomerTitleId();
+ return $this->getTitleId();
break;
case 3:
- return $this->getCompany();
- break;
- case 4:
return $this->getFirstname();
break;
- case 5:
+ case 4:
return $this->getLastname();
break;
- case 6:
- return $this->getAddress1();
- break;
- case 7:
- return $this->getAddress2();
- break;
- case 8:
- return $this->getAddress3();
- break;
- case 9:
- return $this->getZipcode();
- break;
- case 10:
- return $this->getCity();
- break;
- case 11:
- return $this->getCountryId();
- break;
- case 12:
- return $this->getPhone();
- break;
- case 13:
- return $this->getCellphone();
- break;
- case 14:
+ case 5:
return $this->getEmail();
break;
- case 15:
+ case 6:
return $this->getPassword();
break;
- case 16:
+ case 7:
return $this->getAlgo();
break;
- case 17:
- return $this->getSalt();
- break;
- case 18:
+ case 8:
return $this->getReseller();
break;
- case 19:
+ case 9:
return $this->getLang();
break;
- case 20:
+ case 10:
return $this->getSponsor();
break;
- case 21:
+ case 11:
return $this->getDiscount();
break;
- case 22:
+ case 12:
return $this->getCreatedAt();
break;
- case 23:
+ case 13:
return $this->getUpdatedAt();
break;
default:
@@ -2002,28 +1502,18 @@ abstract class Customer implements ActiveRecordInterface
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getRef(),
- $keys[2] => $this->getCustomerTitleId(),
- $keys[3] => $this->getCompany(),
- $keys[4] => $this->getFirstname(),
- $keys[5] => $this->getLastname(),
- $keys[6] => $this->getAddress1(),
- $keys[7] => $this->getAddress2(),
- $keys[8] => $this->getAddress3(),
- $keys[9] => $this->getZipcode(),
- $keys[10] => $this->getCity(),
- $keys[11] => $this->getCountryId(),
- $keys[12] => $this->getPhone(),
- $keys[13] => $this->getCellphone(),
- $keys[14] => $this->getEmail(),
- $keys[15] => $this->getPassword(),
- $keys[16] => $this->getAlgo(),
- $keys[17] => $this->getSalt(),
- $keys[18] => $this->getReseller(),
- $keys[19] => $this->getLang(),
- $keys[20] => $this->getSponsor(),
- $keys[21] => $this->getDiscount(),
- $keys[22] => $this->getCreatedAt(),
- $keys[23] => $this->getUpdatedAt(),
+ $keys[2] => $this->getTitleId(),
+ $keys[3] => $this->getFirstname(),
+ $keys[4] => $this->getLastname(),
+ $keys[5] => $this->getEmail(),
+ $keys[6] => $this->getPassword(),
+ $keys[7] => $this->getAlgo(),
+ $keys[8] => $this->getReseller(),
+ $keys[9] => $this->getLang(),
+ $keys[10] => $this->getSponsor(),
+ $keys[11] => $this->getDiscount(),
+ $keys[12] => $this->getCreatedAt(),
+ $keys[13] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -2082,69 +1572,39 @@ abstract class Customer implements ActiveRecordInterface
$this->setRef($value);
break;
case 2:
- $this->setCustomerTitleId($value);
+ $this->setTitleId($value);
break;
case 3:
- $this->setCompany($value);
- break;
- case 4:
$this->setFirstname($value);
break;
- case 5:
+ case 4:
$this->setLastname($value);
break;
- case 6:
- $this->setAddress1($value);
- break;
- case 7:
- $this->setAddress2($value);
- break;
- case 8:
- $this->setAddress3($value);
- break;
- case 9:
- $this->setZipcode($value);
- break;
- case 10:
- $this->setCity($value);
- break;
- case 11:
- $this->setCountryId($value);
- break;
- case 12:
- $this->setPhone($value);
- break;
- case 13:
- $this->setCellphone($value);
- break;
- case 14:
+ case 5:
$this->setEmail($value);
break;
- case 15:
+ case 6:
$this->setPassword($value);
break;
- case 16:
+ case 7:
$this->setAlgo($value);
break;
- case 17:
- $this->setSalt($value);
- break;
- case 18:
+ case 8:
$this->setReseller($value);
break;
- case 19:
+ case 9:
$this->setLang($value);
break;
- case 20:
+ case 10:
$this->setSponsor($value);
break;
- case 21:
+ case 11:
$this->setDiscount($value);
break;
- case 22:
+ case 12:
$this->setCreatedAt($value);
break;
- case 23:
+ case 13:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -2173,28 +1633,18 @@ abstract class Customer implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setRef($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setCustomerTitleId($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setCompany($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setFirstname($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setLastname($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setAddress1($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setAddress2($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setAddress3($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setZipcode($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setCity($arr[$keys[10]]);
- if (array_key_exists($keys[11], $arr)) $this->setCountryId($arr[$keys[11]]);
- if (array_key_exists($keys[12], $arr)) $this->setPhone($arr[$keys[12]]);
- if (array_key_exists($keys[13], $arr)) $this->setCellphone($arr[$keys[13]]);
- if (array_key_exists($keys[14], $arr)) $this->setEmail($arr[$keys[14]]);
- if (array_key_exists($keys[15], $arr)) $this->setPassword($arr[$keys[15]]);
- if (array_key_exists($keys[16], $arr)) $this->setAlgo($arr[$keys[16]]);
- if (array_key_exists($keys[17], $arr)) $this->setSalt($arr[$keys[17]]);
- if (array_key_exists($keys[18], $arr)) $this->setReseller($arr[$keys[18]]);
- if (array_key_exists($keys[19], $arr)) $this->setLang($arr[$keys[19]]);
- if (array_key_exists($keys[20], $arr)) $this->setSponsor($arr[$keys[20]]);
- if (array_key_exists($keys[21], $arr)) $this->setDiscount($arr[$keys[21]]);
- if (array_key_exists($keys[22], $arr)) $this->setCreatedAt($arr[$keys[22]]);
- if (array_key_exists($keys[23], $arr)) $this->setUpdatedAt($arr[$keys[23]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitleId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setFirstname($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setLastname($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setEmail($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setPassword($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setAlgo($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setReseller($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setLang($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setSponsor($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDiscount($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
+ if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
}
/**
@@ -2208,22 +1658,12 @@ abstract class Customer implements ActiveRecordInterface
if ($this->isColumnModified(CustomerTableMap::ID)) $criteria->add(CustomerTableMap::ID, $this->id);
if ($this->isColumnModified(CustomerTableMap::REF)) $criteria->add(CustomerTableMap::REF, $this->ref);
- if ($this->isColumnModified(CustomerTableMap::CUSTOMER_TITLE_ID)) $criteria->add(CustomerTableMap::CUSTOMER_TITLE_ID, $this->customer_title_id);
- if ($this->isColumnModified(CustomerTableMap::COMPANY)) $criteria->add(CustomerTableMap::COMPANY, $this->company);
+ if ($this->isColumnModified(CustomerTableMap::TITLE_ID)) $criteria->add(CustomerTableMap::TITLE_ID, $this->title_id);
if ($this->isColumnModified(CustomerTableMap::FIRSTNAME)) $criteria->add(CustomerTableMap::FIRSTNAME, $this->firstname);
if ($this->isColumnModified(CustomerTableMap::LASTNAME)) $criteria->add(CustomerTableMap::LASTNAME, $this->lastname);
- if ($this->isColumnModified(CustomerTableMap::ADDRESS1)) $criteria->add(CustomerTableMap::ADDRESS1, $this->address1);
- if ($this->isColumnModified(CustomerTableMap::ADDRESS2)) $criteria->add(CustomerTableMap::ADDRESS2, $this->address2);
- if ($this->isColumnModified(CustomerTableMap::ADDRESS3)) $criteria->add(CustomerTableMap::ADDRESS3, $this->address3);
- if ($this->isColumnModified(CustomerTableMap::ZIPCODE)) $criteria->add(CustomerTableMap::ZIPCODE, $this->zipcode);
- if ($this->isColumnModified(CustomerTableMap::CITY)) $criteria->add(CustomerTableMap::CITY, $this->city);
- if ($this->isColumnModified(CustomerTableMap::COUNTRY_ID)) $criteria->add(CustomerTableMap::COUNTRY_ID, $this->country_id);
- if ($this->isColumnModified(CustomerTableMap::PHONE)) $criteria->add(CustomerTableMap::PHONE, $this->phone);
- if ($this->isColumnModified(CustomerTableMap::CELLPHONE)) $criteria->add(CustomerTableMap::CELLPHONE, $this->cellphone);
if ($this->isColumnModified(CustomerTableMap::EMAIL)) $criteria->add(CustomerTableMap::EMAIL, $this->email);
if ($this->isColumnModified(CustomerTableMap::PASSWORD)) $criteria->add(CustomerTableMap::PASSWORD, $this->password);
if ($this->isColumnModified(CustomerTableMap::ALGO)) $criteria->add(CustomerTableMap::ALGO, $this->algo);
- if ($this->isColumnModified(CustomerTableMap::SALT)) $criteria->add(CustomerTableMap::SALT, $this->salt);
if ($this->isColumnModified(CustomerTableMap::RESELLER)) $criteria->add(CustomerTableMap::RESELLER, $this->reseller);
if ($this->isColumnModified(CustomerTableMap::LANG)) $criteria->add(CustomerTableMap::LANG, $this->lang);
if ($this->isColumnModified(CustomerTableMap::SPONSOR)) $criteria->add(CustomerTableMap::SPONSOR, $this->sponsor);
@@ -2294,22 +1734,12 @@ abstract class Customer implements ActiveRecordInterface
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setRef($this->getRef());
- $copyObj->setCustomerTitleId($this->getCustomerTitleId());
- $copyObj->setCompany($this->getCompany());
+ $copyObj->setTitleId($this->getTitleId());
$copyObj->setFirstname($this->getFirstname());
$copyObj->setLastname($this->getLastname());
- $copyObj->setAddress1($this->getAddress1());
- $copyObj->setAddress2($this->getAddress2());
- $copyObj->setAddress3($this->getAddress3());
- $copyObj->setZipcode($this->getZipcode());
- $copyObj->setCity($this->getCity());
- $copyObj->setCountryId($this->getCountryId());
- $copyObj->setPhone($this->getPhone());
- $copyObj->setCellphone($this->getCellphone());
$copyObj->setEmail($this->getEmail());
$copyObj->setPassword($this->getPassword());
$copyObj->setAlgo($this->getAlgo());
- $copyObj->setSalt($this->getSalt());
$copyObj->setReseller($this->getReseller());
$copyObj->setLang($this->getLang());
$copyObj->setSponsor($this->getSponsor());
@@ -2374,9 +1804,9 @@ abstract class Customer implements ActiveRecordInterface
public function setCustomerTitle(ChildCustomerTitle $v = null)
{
if ($v === null) {
- $this->setCustomerTitleId(NULL);
+ $this->setTitleId(NULL);
} else {
- $this->setCustomerTitleId($v->getId());
+ $this->setTitleId($v->getId());
}
$this->aCustomerTitle = $v;
@@ -2401,8 +1831,8 @@ abstract class Customer implements ActiveRecordInterface
*/
public function getCustomerTitle(ConnectionInterface $con = null)
{
- if ($this->aCustomerTitle === null && ($this->customer_title_id !== null)) {
- $this->aCustomerTitle = ChildCustomerTitleQuery::create()->findPk($this->customer_title_id, $con);
+ if ($this->aCustomerTitle === null && ($this->title_id !== null)) {
+ $this->aCustomerTitle = ChildCustomerTitleQuery::create()->findPk($this->title_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
@@ -3002,22 +2432,12 @@ abstract class Customer implements ActiveRecordInterface
{
$this->id = null;
$this->ref = null;
- $this->customer_title_id = null;
- $this->company = null;
+ $this->title_id = null;
$this->firstname = null;
$this->lastname = null;
- $this->address1 = null;
- $this->address2 = null;
- $this->address3 = null;
- $this->zipcode = null;
- $this->city = null;
- $this->country_id = null;
- $this->phone = null;
- $this->cellphone = null;
$this->email = null;
$this->password = null;
$this->algo = null;
- $this->salt = null;
$this->reseller = null;
$this->lang = null;
$this->sponsor = null;
diff --git a/core/lib/Thelia/Model/Base/CustomerQuery.php b/core/lib/Thelia/Model/Base/CustomerQuery.php
index eb6371592..16fa65016 100755
--- a/core/lib/Thelia/Model/Base/CustomerQuery.php
+++ b/core/lib/Thelia/Model/Base/CustomerQuery.php
@@ -23,22 +23,12 @@ use Thelia\Model\Map\CustomerTableMap;
*
* @method ChildCustomerQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCustomerQuery orderByRef($order = Criteria::ASC) Order by the ref column
- * @method ChildCustomerQuery orderByCustomerTitleId($order = Criteria::ASC) Order by the customer_title_id column
- * @method ChildCustomerQuery orderByCompany($order = Criteria::ASC) Order by the company column
+ * @method ChildCustomerQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column
* @method ChildCustomerQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
* @method ChildCustomerQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
- * @method ChildCustomerQuery orderByAddress1($order = Criteria::ASC) Order by the address1 column
- * @method ChildCustomerQuery orderByAddress2($order = Criteria::ASC) Order by the address2 column
- * @method ChildCustomerQuery orderByAddress3($order = Criteria::ASC) Order by the address3 column
- * @method ChildCustomerQuery orderByZipcode($order = Criteria::ASC) Order by the zipcode column
- * @method ChildCustomerQuery orderByCity($order = Criteria::ASC) Order by the city column
- * @method ChildCustomerQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
- * @method ChildCustomerQuery orderByPhone($order = Criteria::ASC) Order by the phone column
- * @method ChildCustomerQuery orderByCellphone($order = Criteria::ASC) Order by the cellphone column
* @method ChildCustomerQuery orderByEmail($order = Criteria::ASC) Order by the email column
* @method ChildCustomerQuery orderByPassword($order = Criteria::ASC) Order by the password column
* @method ChildCustomerQuery orderByAlgo($order = Criteria::ASC) Order by the algo column
- * @method ChildCustomerQuery orderBySalt($order = Criteria::ASC) Order by the salt column
* @method ChildCustomerQuery orderByReseller($order = Criteria::ASC) Order by the reseller column
* @method ChildCustomerQuery orderByLang($order = Criteria::ASC) Order by the lang column
* @method ChildCustomerQuery orderBySponsor($order = Criteria::ASC) Order by the sponsor column
@@ -48,22 +38,12 @@ use Thelia\Model\Map\CustomerTableMap;
*
* @method ChildCustomerQuery groupById() Group by the id column
* @method ChildCustomerQuery groupByRef() Group by the ref column
- * @method ChildCustomerQuery groupByCustomerTitleId() Group by the customer_title_id column
- * @method ChildCustomerQuery groupByCompany() Group by the company column
+ * @method ChildCustomerQuery groupByTitleId() Group by the title_id column
* @method ChildCustomerQuery groupByFirstname() Group by the firstname column
* @method ChildCustomerQuery groupByLastname() Group by the lastname column
- * @method ChildCustomerQuery groupByAddress1() Group by the address1 column
- * @method ChildCustomerQuery groupByAddress2() Group by the address2 column
- * @method ChildCustomerQuery groupByAddress3() Group by the address3 column
- * @method ChildCustomerQuery groupByZipcode() Group by the zipcode column
- * @method ChildCustomerQuery groupByCity() Group by the city column
- * @method ChildCustomerQuery groupByCountryId() Group by the country_id column
- * @method ChildCustomerQuery groupByPhone() Group by the phone column
- * @method ChildCustomerQuery groupByCellphone() Group by the cellphone column
* @method ChildCustomerQuery groupByEmail() Group by the email column
* @method ChildCustomerQuery groupByPassword() Group by the password column
* @method ChildCustomerQuery groupByAlgo() Group by the algo column
- * @method ChildCustomerQuery groupBySalt() Group by the salt column
* @method ChildCustomerQuery groupByReseller() Group by the reseller column
* @method ChildCustomerQuery groupByLang() Group by the lang column
* @method ChildCustomerQuery groupBySponsor() Group by the sponsor column
@@ -92,22 +72,12 @@ use Thelia\Model\Map\CustomerTableMap;
*
* @method ChildCustomer findOneById(int $id) Return the first ChildCustomer filtered by the id column
* @method ChildCustomer findOneByRef(string $ref) Return the first ChildCustomer filtered by the ref column
- * @method ChildCustomer findOneByCustomerTitleId(int $customer_title_id) Return the first ChildCustomer filtered by the customer_title_id column
- * @method ChildCustomer findOneByCompany(string $company) Return the first ChildCustomer filtered by the company column
+ * @method ChildCustomer findOneByTitleId(int $title_id) Return the first ChildCustomer filtered by the title_id column
* @method ChildCustomer findOneByFirstname(string $firstname) Return the first ChildCustomer filtered by the firstname column
* @method ChildCustomer findOneByLastname(string $lastname) Return the first ChildCustomer filtered by the lastname column
- * @method ChildCustomer findOneByAddress1(string $address1) Return the first ChildCustomer filtered by the address1 column
- * @method ChildCustomer findOneByAddress2(string $address2) Return the first ChildCustomer filtered by the address2 column
- * @method ChildCustomer findOneByAddress3(string $address3) Return the first ChildCustomer filtered by the address3 column
- * @method ChildCustomer findOneByZipcode(string $zipcode) Return the first ChildCustomer filtered by the zipcode column
- * @method ChildCustomer findOneByCity(string $city) Return the first ChildCustomer filtered by the city column
- * @method ChildCustomer findOneByCountryId(int $country_id) Return the first ChildCustomer filtered by the country_id column
- * @method ChildCustomer findOneByPhone(string $phone) Return the first ChildCustomer filtered by the phone column
- * @method ChildCustomer findOneByCellphone(string $cellphone) Return the first ChildCustomer filtered by the cellphone column
* @method ChildCustomer findOneByEmail(string $email) Return the first ChildCustomer filtered by the email column
* @method ChildCustomer findOneByPassword(string $password) Return the first ChildCustomer filtered by the password column
* @method ChildCustomer findOneByAlgo(string $algo) Return the first ChildCustomer filtered by the algo column
- * @method ChildCustomer findOneBySalt(string $salt) Return the first ChildCustomer filtered by the salt column
* @method ChildCustomer findOneByReseller(int $reseller) Return the first ChildCustomer filtered by the reseller column
* @method ChildCustomer findOneByLang(string $lang) Return the first ChildCustomer filtered by the lang column
* @method ChildCustomer findOneBySponsor(string $sponsor) Return the first ChildCustomer filtered by the sponsor column
@@ -117,22 +87,12 @@ use Thelia\Model\Map\CustomerTableMap;
*
* @method array findById(int $id) Return ChildCustomer objects filtered by the id column
* @method array findByRef(string $ref) Return ChildCustomer objects filtered by the ref column
- * @method array findByCustomerTitleId(int $customer_title_id) Return ChildCustomer objects filtered by the customer_title_id column
- * @method array findByCompany(string $company) Return ChildCustomer objects filtered by the company column
+ * @method array findByTitleId(int $title_id) Return ChildCustomer objects filtered by the title_id column
* @method array findByFirstname(string $firstname) Return ChildCustomer objects filtered by the firstname column
* @method array findByLastname(string $lastname) Return ChildCustomer objects filtered by the lastname column
- * @method array findByAddress1(string $address1) Return ChildCustomer objects filtered by the address1 column
- * @method array findByAddress2(string $address2) Return ChildCustomer objects filtered by the address2 column
- * @method array findByAddress3(string $address3) Return ChildCustomer objects filtered by the address3 column
- * @method array findByZipcode(string $zipcode) Return ChildCustomer objects filtered by the zipcode column
- * @method array findByCity(string $city) Return ChildCustomer objects filtered by the city column
- * @method array findByCountryId(int $country_id) Return ChildCustomer objects filtered by the country_id column
- * @method array findByPhone(string $phone) Return ChildCustomer objects filtered by the phone column
- * @method array findByCellphone(string $cellphone) Return ChildCustomer objects filtered by the cellphone column
* @method array findByEmail(string $email) Return ChildCustomer objects filtered by the email column
* @method array findByPassword(string $password) Return ChildCustomer objects filtered by the password column
* @method array findByAlgo(string $algo) Return ChildCustomer objects filtered by the algo column
- * @method array findBySalt(string $salt) Return ChildCustomer objects filtered by the salt column
* @method array findByReseller(int $reseller) Return ChildCustomer objects filtered by the reseller column
* @method array findByLang(string $lang) Return ChildCustomer objects filtered by the lang column
* @method array findBySponsor(string $sponsor) Return ChildCustomer objects filtered by the sponsor column
@@ -227,7 +187,7 @@ abstract class CustomerQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, REF, CUSTOMER_TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, EMAIL, PASSWORD, ALGO, SALT, RESELLER, LANG, SPONSOR, DISCOUNT, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
+ $sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -387,18 +347,18 @@ abstract class CustomerQuery extends ModelCriteria
}
/**
- * Filter the query on the customer_title_id column
+ * Filter the query on the title_id column
*
* Example usage:
*
- * $query->filterByCustomerTitleId(1234); // WHERE customer_title_id = 1234
- * $query->filterByCustomerTitleId(array(12, 34)); // WHERE customer_title_id IN (12, 34)
- * $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12
+ * $query->filterByTitleId(1234); // WHERE title_id = 1234
+ * $query->filterByTitleId(array(12, 34)); // WHERE title_id IN (12, 34)
+ * $query->filterByTitleId(array('min' => 12)); // WHERE title_id > 12
*
*
* @see filterByCustomerTitle()
*
- * @param mixed $customerTitleId The value to use as filter.
+ * @param mixed $titleId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -406,16 +366,16 @@ abstract class CustomerQuery extends ModelCriteria
*
* @return ChildCustomerQuery The current query, for fluid interface
*/
- public function filterByCustomerTitleId($customerTitleId = null, $comparison = null)
+ public function filterByTitleId($titleId = null, $comparison = null)
{
- if (is_array($customerTitleId)) {
+ if (is_array($titleId)) {
$useMinMax = false;
- if (isset($customerTitleId['min'])) {
- $this->addUsingAlias(CustomerTableMap::CUSTOMER_TITLE_ID, $customerTitleId['min'], Criteria::GREATER_EQUAL);
+ if (isset($titleId['min'])) {
+ $this->addUsingAlias(CustomerTableMap::TITLE_ID, $titleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
- if (isset($customerTitleId['max'])) {
- $this->addUsingAlias(CustomerTableMap::CUSTOMER_TITLE_ID, $customerTitleId['max'], Criteria::LESS_EQUAL);
+ if (isset($titleId['max'])) {
+ $this->addUsingAlias(CustomerTableMap::TITLE_ID, $titleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
@@ -426,36 +386,7 @@ abstract class CustomerQuery extends ModelCriteria
}
}
- return $this->addUsingAlias(CustomerTableMap::CUSTOMER_TITLE_ID, $customerTitleId, $comparison);
- }
-
- /**
- * Filter the query on the company column
- *
- * Example usage:
- *
- * $query->filterByCompany('fooValue'); // WHERE company = 'fooValue'
- * $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%'
- *
- *
- * @param string $company The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByCompany($company = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($company)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $company)) {
- $company = str_replace('*', '%', $company);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::COMPANY, $company, $comparison);
+ return $this->addUsingAlias(CustomerTableMap::TITLE_ID, $titleId, $comparison);
}
/**
@@ -516,250 +447,6 @@ abstract class CustomerQuery extends ModelCriteria
return $this->addUsingAlias(CustomerTableMap::LASTNAME, $lastname, $comparison);
}
- /**
- * Filter the query on the address1 column
- *
- * Example usage:
- *
- * $query->filterByAddress1('fooValue'); // WHERE address1 = 'fooValue'
- * $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%'
- *
- *
- * @param string $address1 The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByAddress1($address1 = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($address1)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $address1)) {
- $address1 = str_replace('*', '%', $address1);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::ADDRESS1, $address1, $comparison);
- }
-
- /**
- * Filter the query on the address2 column
- *
- * Example usage:
- *
- * $query->filterByAddress2('fooValue'); // WHERE address2 = 'fooValue'
- * $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%'
- *
- *
- * @param string $address2 The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByAddress2($address2 = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($address2)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $address2)) {
- $address2 = str_replace('*', '%', $address2);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::ADDRESS2, $address2, $comparison);
- }
-
- /**
- * Filter the query on the address3 column
- *
- * Example usage:
- *
- * $query->filterByAddress3('fooValue'); // WHERE address3 = 'fooValue'
- * $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%'
- *
- *
- * @param string $address3 The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByAddress3($address3 = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($address3)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $address3)) {
- $address3 = str_replace('*', '%', $address3);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::ADDRESS3, $address3, $comparison);
- }
-
- /**
- * Filter the query on the zipcode column
- *
- * Example usage:
- *
- * $query->filterByZipcode('fooValue'); // WHERE zipcode = 'fooValue'
- * $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%'
- *
- *
- * @param string $zipcode The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByZipcode($zipcode = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($zipcode)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $zipcode)) {
- $zipcode = str_replace('*', '%', $zipcode);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::ZIPCODE, $zipcode, $comparison);
- }
-
- /**
- * Filter the query on the city column
- *
- * Example usage:
- *
- * $query->filterByCity('fooValue'); // WHERE city = 'fooValue'
- * $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
- *
- *
- * @param string $city The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByCity($city = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($city)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $city)) {
- $city = str_replace('*', '%', $city);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::CITY, $city, $comparison);
- }
-
- /**
- * Filter the query on the country_id column
- *
- * Example usage:
- *
- * $query->filterByCountryId(1234); // WHERE country_id = 1234
- * $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
- * $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
- *
- *
- * @param mixed $countryId The value to use as filter.
- * Use scalar values for equality.
- * Use array values for in_array() equivalent.
- * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByCountryId($countryId = null, $comparison = null)
- {
- if (is_array($countryId)) {
- $useMinMax = false;
- if (isset($countryId['min'])) {
- $this->addUsingAlias(CustomerTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($countryId['max'])) {
- $this->addUsingAlias(CustomerTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::COUNTRY_ID, $countryId, $comparison);
- }
-
- /**
- * Filter the query on the phone column
- *
- * Example usage:
- *
- * $query->filterByPhone('fooValue'); // WHERE phone = 'fooValue'
- * $query->filterByPhone('%fooValue%'); // WHERE phone LIKE '%fooValue%'
- *
- *
- * @param string $phone The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByPhone($phone = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($phone)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $phone)) {
- $phone = str_replace('*', '%', $phone);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::PHONE, $phone, $comparison);
- }
-
- /**
- * Filter the query on the cellphone column
- *
- * Example usage:
- *
- * $query->filterByCellphone('fooValue'); // WHERE cellphone = 'fooValue'
- * $query->filterByCellphone('%fooValue%'); // WHERE cellphone LIKE '%fooValue%'
- *
- *
- * @param string $cellphone The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterByCellphone($cellphone = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($cellphone)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $cellphone)) {
- $cellphone = str_replace('*', '%', $cellphone);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::CELLPHONE, $cellphone, $comparison);
- }
-
/**
* Filter the query on the email column
*
@@ -847,35 +534,6 @@ abstract class CustomerQuery extends ModelCriteria
return $this->addUsingAlias(CustomerTableMap::ALGO, $algo, $comparison);
}
- /**
- * Filter the query on the salt column
- *
- * Example usage:
- *
- * $query->filterBySalt('fooValue'); // WHERE salt = 'fooValue'
- * $query->filterBySalt('%fooValue%'); // WHERE salt LIKE '%fooValue%'
- *
- *
- * @param string $salt The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildCustomerQuery The current query, for fluid interface
- */
- public function filterBySalt($salt = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($salt)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $salt)) {
- $salt = str_replace('*', '%', $salt);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(CustomerTableMap::SALT, $salt, $comparison);
- }
-
/**
* Filter the query on the reseller column
*
@@ -1114,14 +772,14 @@ abstract class CustomerQuery extends ModelCriteria
{
if ($customerTitle instanceof \Thelia\Model\CustomerTitle) {
return $this
- ->addUsingAlias(CustomerTableMap::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison);
+ ->addUsingAlias(CustomerTableMap::TITLE_ID, $customerTitle->getId(), $comparison);
} elseif ($customerTitle instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
- ->addUsingAlias(CustomerTableMap::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ ->addUsingAlias(CustomerTableMap::TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCustomerTitle() only accepts arguments of type \Thelia\Model\CustomerTitle or Collection');
}
diff --git a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php
index 940db1425..42ba4bd98 100755
--- a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php
+++ b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php
@@ -450,7 +450,7 @@ abstract class CustomerTitleQuery extends ModelCriteria
{
if ($customer instanceof \Thelia\Model\Customer) {
return $this
- ->addUsingAlias(CustomerTitleTableMap::ID, $customer->getCustomerTitleId(), $comparison);
+ ->addUsingAlias(CustomerTitleTableMap::ID, $customer->getTitleId(), $comparison);
} elseif ($customer instanceof ObjectCollection) {
return $this
->useCustomerQuery()
diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php
index 13024996b..4d9a78ea0 100755
--- a/core/lib/Thelia/Model/Customer.php
+++ b/core/lib/Thelia/Model/Customer.php
@@ -2,6 +2,7 @@
namespace Thelia\Model;
+use Symfony\Component\Config\Definition\Exception\Exception;
use Thelia\Model\Base\Customer as BaseCustomer;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
@@ -12,6 +13,9 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\User\UserInterface;
use Propel\Runtime\Connection\ConnectionInterface;
+use Propel\Runtime\Propel;
+use Thelia\Model\Map\CustomerTableMap;
+use Thelia\Core\Security\Role\Role;
/**
* Skeleton subclass for representing a row from the 'customer' table.
@@ -52,16 +56,9 @@ class Customer extends BaseCustomer implements UserInterface
public function createOrUpdate($titleId, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $countryId, $email, $plainPassword = null, $lang = null, $reseller = 0, $sponsor = null, $discount = 0)
{
$this
- ->setCustomerTitleId($titleId)
+ ->setTitleId($titleId)
->setFirstname($firstname)
->setLastname($lastname)
- ->setAddress1($address1)
- ->setAddress2($address2)
- ->setAddress3($address3)
- ->setPhone($phone)
- ->setCellphone($cellphone)
- ->setZipcode($zipcode)
- ->setCountryId($countryId)
->setEmail($email)
->setPassword($plainPassword)
->setReseller($reseller)
@@ -73,8 +70,36 @@ class Customer extends BaseCustomer implements UserInterface
$this->setLang($lang);
}
- $this->save();
+ $con = Propel::getWriteConnection(CustomerTableMap::DATABASE_NAME);
+ $con->beginTransaction();
+ try {
+ $this->save($con);
+
+ $address = new Address();
+
+ $address
+ ->setCustomerTitleId($titleId)
+ ->setFirstname($firstname)
+ ->setLastname($lastname)
+ ->setAddress1($address1)
+ ->setAddress2($address2)
+ ->setAddress3($address3)
+ ->setPhone($phone)
+ ->setCellphone($cellphone)
+ ->setZipcode($zipcode)
+ ->setCountryId($countryId)
+ ->setIsDefault(1)
+ ->setCustomer($this)
+ ->save($con);
+
+ $con->commit();
+
+
+ } catch(Exception $e) {
+ $con->rollback();
+ throw $e;
+ }
}
public function preInsert(ConnectionInterface $con = null)
@@ -91,7 +116,7 @@ class Customer extends BaseCustomer implements UserInterface
protected function generateRef()
{
- return date("YmdHI");
+ return date("YmdHisu");
}
public function setPassword($password)
@@ -113,12 +138,19 @@ class Customer extends BaseCustomer implements UserInterface
$this->dispatcher = $dispatcher;
}
+ /**
+ * {@inheritDoc}
+ */
+ public function getUsername() {
+ return $this->getEmail();
+ }
+
/**
* {@inheritDoc}
*/
-
- public function getUsername() {
- return $this->getEmail();
+ public function checkPassword($password)
+ {
+ return password_verify($password, $this->password);
}
/**
@@ -132,6 +164,6 @@ class Customer extends BaseCustomer implements UserInterface
* {@inheritDoc}
*/
public function getRoles() {
- return array(new Role('ROLE_CUSTOMER'));
+ return array(new Role('CUSTOMER'));
}
}
diff --git a/core/lib/Thelia/Model/Map/AddressTableMap.php b/core/lib/Thelia/Model/Map/AddressTableMap.php
index 8a6126964..a67d383fb 100755
--- a/core/lib/Thelia/Model/Map/AddressTableMap.php
+++ b/core/lib/Thelia/Model/Map/AddressTableMap.php
@@ -57,7 +57,7 @@ class AddressTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 16;
+ const NUM_COLUMNS = 18;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class AddressTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 16;
+ const NUM_HYDRATE_COLUMNS = 18;
/**
* the column name for the ID field
@@ -139,6 +139,16 @@ class AddressTableMap extends TableMap
*/
const PHONE = 'address.PHONE';
+ /**
+ * the column name for the CELLPHONE field
+ */
+ const CELLPHONE = 'address.CELLPHONE';
+
+ /**
+ * the column name for the IS_DEFAULT field
+ */
+ const IS_DEFAULT = 'address.IS_DEFAULT';
+
/**
* the column name for the CREATED_AT field
*/
@@ -161,12 +171,12 @@ class AddressTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::TITLE, AddressTableMap::CUSTOMER_ID, AddressTableMap::CUSTOMER_TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ self::TYPE_PHPNAME => array('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::TITLE, AddressTableMap::CUSTOMER_ID, AddressTableMap::CUSTOMER_TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -176,12 +186,12 @@ class AddressTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'createdAt' => 14, 'updatedAt' => 15, ),
- self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::TITLE => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::CUSTOMER_TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CREATED_AT => 14, AddressTableMap::UPDATED_AT => 15, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'created_at' => 14, 'updated_at' => 15, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
+ self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::TITLE => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::CUSTOMER_TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -214,6 +224,8 @@ class AddressTableMap extends TableMap
$this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null);
$this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', true, null, null);
$this->addColumn('PHONE', 'Phone', 'VARCHAR', false, 20, null);
+ $this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null);
+ $this->addColumn('IS_DEFAULT', 'IsDefault', 'TINYINT', false, null, 0);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -392,6 +404,8 @@ class AddressTableMap extends TableMap
$criteria->addSelectColumn(AddressTableMap::CITY);
$criteria->addSelectColumn(AddressTableMap::COUNTRY_ID);
$criteria->addSelectColumn(AddressTableMap::PHONE);
+ $criteria->addSelectColumn(AddressTableMap::CELLPHONE);
+ $criteria->addSelectColumn(AddressTableMap::IS_DEFAULT);
$criteria->addSelectColumn(AddressTableMap::CREATED_AT);
$criteria->addSelectColumn(AddressTableMap::UPDATED_AT);
} else {
@@ -409,6 +423,8 @@ class AddressTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CITY');
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
$criteria->addSelectColumn($alias . '.PHONE');
+ $criteria->addSelectColumn($alias . '.CELLPHONE');
+ $criteria->addSelectColumn($alias . '.IS_DEFAULT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php b/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php
index 14fc79eeb..02a20540e 100755
--- a/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php
@@ -151,7 +151,7 @@ class AttributeAvI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_av', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/AttributeAvTableMap.php b/core/lib/Thelia/Model/Map/AttributeAvTableMap.php
index 138f0fa9c..0c5c2e1c9 100755
--- a/core/lib/Thelia/Model/Map/AttributeAvTableMap.php
+++ b/core/lib/Thelia/Model/Map/AttributeAvTableMap.php
@@ -106,7 +106,7 @@ class AttributeAvTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php b/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php
index b60cae5b8..8471d3e26 100755
--- a/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php
@@ -151,7 +151,7 @@ class AttributeI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/AttributeTableMap.php b/core/lib/Thelia/Model/Map/AttributeTableMap.php
index dca811cbc..773e13cab 100755
--- a/core/lib/Thelia/Model/Map/AttributeTableMap.php
+++ b/core/lib/Thelia/Model/Map/AttributeTableMap.php
@@ -101,7 +101,7 @@ class AttributeTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php b/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php
index 1611b2ebf..8c52aa7b2 100755
--- a/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php
@@ -151,7 +151,7 @@ class CategoryI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'category', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/CategoryTableMap.php b/core/lib/Thelia/Model/Map/CategoryTableMap.php
index 83010e4fa..a301a5efe 100755
--- a/core/lib/Thelia/Model/Map/CategoryTableMap.php
+++ b/core/lib/Thelia/Model/Map/CategoryTableMap.php
@@ -131,7 +131,7 @@ class CategoryTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php b/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php
index a83f87b76..b953b0ac9 100755
--- a/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php
@@ -151,7 +151,7 @@ class ConfigI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'config', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/ConfigTableMap.php b/core/lib/Thelia/Model/Map/ConfigTableMap.php
index 8bd68a964..ebd5d6edf 100755
--- a/core/lib/Thelia/Model/Map/ConfigTableMap.php
+++ b/core/lib/Thelia/Model/Map/ConfigTableMap.php
@@ -116,7 +116,7 @@ class ConfigTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/ContentI18nTableMap.php b/core/lib/Thelia/Model/Map/ContentI18nTableMap.php
index ee9122a6c..f718623b0 100755
--- a/core/lib/Thelia/Model/Map/ContentI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/ContentI18nTableMap.php
@@ -151,7 +151,7 @@ class ContentI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/ContentTableMap.php b/core/lib/Thelia/Model/Map/ContentTableMap.php
index 60b04ae36..b794c7244 100755
--- a/core/lib/Thelia/Model/Map/ContentTableMap.php
+++ b/core/lib/Thelia/Model/Map/ContentTableMap.php
@@ -121,7 +121,7 @@ class ContentTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/CountryI18nTableMap.php b/core/lib/Thelia/Model/Map/CountryI18nTableMap.php
index cc60b09d2..272231464 100755
--- a/core/lib/Thelia/Model/Map/CountryI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/CountryI18nTableMap.php
@@ -151,7 +151,7 @@ class CountryI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'country', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/CountryTableMap.php b/core/lib/Thelia/Model/Map/CountryTableMap.php
index c4b96c8bd..3060da70f 100755
--- a/core/lib/Thelia/Model/Map/CountryTableMap.php
+++ b/core/lib/Thelia/Model/Map/CountryTableMap.php
@@ -116,7 +116,7 @@ class CountryTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/CustomerTableMap.php b/core/lib/Thelia/Model/Map/CustomerTableMap.php
index 030d233d9..fbd2a9b98 100755
--- a/core/lib/Thelia/Model/Map/CustomerTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTableMap.php
@@ -57,7 +57,7 @@ class CustomerTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 24;
+ const NUM_COLUMNS = 14;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CustomerTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 24;
+ const NUM_HYDRATE_COLUMNS = 14;
/**
* the column name for the ID field
@@ -80,14 +80,9 @@ class CustomerTableMap extends TableMap
const REF = 'customer.REF';
/**
- * the column name for the CUSTOMER_TITLE_ID field
+ * the column name for the TITLE_ID field
*/
- const CUSTOMER_TITLE_ID = 'customer.CUSTOMER_TITLE_ID';
-
- /**
- * the column name for the COMPANY field
- */
- const COMPANY = 'customer.COMPANY';
+ const TITLE_ID = 'customer.TITLE_ID';
/**
* the column name for the FIRSTNAME field
@@ -99,46 +94,6 @@ class CustomerTableMap extends TableMap
*/
const LASTNAME = 'customer.LASTNAME';
- /**
- * the column name for the ADDRESS1 field
- */
- const ADDRESS1 = 'customer.ADDRESS1';
-
- /**
- * the column name for the ADDRESS2 field
- */
- const ADDRESS2 = 'customer.ADDRESS2';
-
- /**
- * the column name for the ADDRESS3 field
- */
- const ADDRESS3 = 'customer.ADDRESS3';
-
- /**
- * the column name for the ZIPCODE field
- */
- const ZIPCODE = 'customer.ZIPCODE';
-
- /**
- * the column name for the CITY field
- */
- const CITY = 'customer.CITY';
-
- /**
- * the column name for the COUNTRY_ID field
- */
- const COUNTRY_ID = 'customer.COUNTRY_ID';
-
- /**
- * the column name for the PHONE field
- */
- const PHONE = 'customer.PHONE';
-
- /**
- * the column name for the CELLPHONE field
- */
- const CELLPHONE = 'customer.CELLPHONE';
-
/**
* the column name for the EMAIL field
*/
@@ -154,11 +109,6 @@ class CustomerTableMap extends TableMap
*/
const ALGO = 'customer.ALGO';
- /**
- * the column name for the SALT field
- */
- const SALT = 'customer.SALT';
-
/**
* the column name for the RESELLER field
*/
@@ -201,12 +151,12 @@ class CustomerTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Ref', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'Email', 'Password', 'Algo', 'Salt', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'email', 'password', 'algo', 'salt', 'reseller', 'lang', 'sponsor', 'discount', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::CUSTOMER_TITLE_ID, CustomerTableMap::COMPANY, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::ADDRESS1, CustomerTableMap::ADDRESS2, CustomerTableMap::ADDRESS3, CustomerTableMap::ZIPCODE, CustomerTableMap::CITY, CustomerTableMap::COUNTRY_ID, CustomerTableMap::PHONE, CustomerTableMap::CELLPHONE, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::SALT, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'REF', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'EMAIL', 'PASSWORD', 'ALGO', 'SALT', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'ref', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'email', 'password', 'algo', 'salt', 'reseller', 'lang', 'sponsor', 'discount', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, )
+ self::TYPE_PHPNAME => array('Id', 'Ref', 'TitleId', 'Firstname', 'Lastname', 'Email', 'Password', 'Algo', 'Reseller', 'Lang', 'Sponsor', 'Discount', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'titleId', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(CustomerTableMap::ID, CustomerTableMap::REF, CustomerTableMap::TITLE_ID, CustomerTableMap::FIRSTNAME, CustomerTableMap::LASTNAME, CustomerTableMap::EMAIL, CustomerTableMap::PASSWORD, CustomerTableMap::ALGO, CustomerTableMap::RESELLER, CustomerTableMap::LANG, CustomerTableMap::SPONSOR, CustomerTableMap::DISCOUNT, CustomerTableMap::CREATED_AT, CustomerTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'REF', 'TITLE_ID', 'FIRSTNAME', 'LASTNAME', 'EMAIL', 'PASSWORD', 'ALGO', 'RESELLER', 'LANG', 'SPONSOR', 'DISCOUNT', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'ref', 'title_id', 'firstname', 'lastname', 'email', 'password', 'algo', 'reseller', 'lang', 'sponsor', 'discount', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
@@ -216,12 +166,12 @@ class CustomerTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'CustomerTitleId' => 2, 'Company' => 3, 'Firstname' => 4, 'Lastname' => 5, 'Address1' => 6, 'Address2' => 7, 'Address3' => 8, 'Zipcode' => 9, 'City' => 10, 'CountryId' => 11, 'Phone' => 12, 'Cellphone' => 13, 'Email' => 14, 'Password' => 15, 'Algo' => 16, 'Salt' => 17, 'Reseller' => 18, 'Lang' => 19, 'Sponsor' => 20, 'Discount' => 21, 'CreatedAt' => 22, 'UpdatedAt' => 23, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'customerTitleId' => 2, 'company' => 3, 'firstname' => 4, 'lastname' => 5, 'address1' => 6, 'address2' => 7, 'address3' => 8, 'zipcode' => 9, 'city' => 10, 'countryId' => 11, 'phone' => 12, 'cellphone' => 13, 'email' => 14, 'password' => 15, 'algo' => 16, 'salt' => 17, 'reseller' => 18, 'lang' => 19, 'sponsor' => 20, 'discount' => 21, 'createdAt' => 22, 'updatedAt' => 23, ),
- self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::CUSTOMER_TITLE_ID => 2, CustomerTableMap::COMPANY => 3, CustomerTableMap::FIRSTNAME => 4, CustomerTableMap::LASTNAME => 5, CustomerTableMap::ADDRESS1 => 6, CustomerTableMap::ADDRESS2 => 7, CustomerTableMap::ADDRESS3 => 8, CustomerTableMap::ZIPCODE => 9, CustomerTableMap::CITY => 10, CustomerTableMap::COUNTRY_ID => 11, CustomerTableMap::PHONE => 12, CustomerTableMap::CELLPHONE => 13, CustomerTableMap::EMAIL => 14, CustomerTableMap::PASSWORD => 15, CustomerTableMap::ALGO => 16, CustomerTableMap::SALT => 17, CustomerTableMap::RESELLER => 18, CustomerTableMap::LANG => 19, CustomerTableMap::SPONSOR => 20, CustomerTableMap::DISCOUNT => 21, CustomerTableMap::CREATED_AT => 22, CustomerTableMap::UPDATED_AT => 23, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'CUSTOMER_TITLE_ID' => 2, 'COMPANY' => 3, 'FIRSTNAME' => 4, 'LASTNAME' => 5, 'ADDRESS1' => 6, 'ADDRESS2' => 7, 'ADDRESS3' => 8, 'ZIPCODE' => 9, 'CITY' => 10, 'COUNTRY_ID' => 11, 'PHONE' => 12, 'CELLPHONE' => 13, 'EMAIL' => 14, 'PASSWORD' => 15, 'ALGO' => 16, 'SALT' => 17, 'RESELLER' => 18, 'LANG' => 19, 'SPONSOR' => 20, 'DISCOUNT' => 21, 'CREATED_AT' => 22, 'UPDATED_AT' => 23, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'customer_title_id' => 2, 'company' => 3, 'firstname' => 4, 'lastname' => 5, 'address1' => 6, 'address2' => 7, 'address3' => 8, 'zipcode' => 9, 'city' => 10, 'country_id' => 11, 'phone' => 12, 'cellphone' => 13, 'email' => 14, 'password' => 15, 'algo' => 16, 'salt' => 17, 'reseller' => 18, 'lang' => 19, 'sponsor' => 20, 'discount' => 21, 'created_at' => 22, 'updated_at' => 23, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'TitleId' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Email' => 5, 'Password' => 6, 'Algo' => 7, 'Reseller' => 8, 'Lang' => 9, 'Sponsor' => 10, 'Discount' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'titleId' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'createdAt' => 12, 'updatedAt' => 13, ),
+ self::TYPE_COLNAME => array(CustomerTableMap::ID => 0, CustomerTableMap::REF => 1, CustomerTableMap::TITLE_ID => 2, CustomerTableMap::FIRSTNAME => 3, CustomerTableMap::LASTNAME => 4, CustomerTableMap::EMAIL => 5, CustomerTableMap::PASSWORD => 6, CustomerTableMap::ALGO => 7, CustomerTableMap::RESELLER => 8, CustomerTableMap::LANG => 9, CustomerTableMap::SPONSOR => 10, CustomerTableMap::DISCOUNT => 11, CustomerTableMap::CREATED_AT => 12, CustomerTableMap::UPDATED_AT => 13, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'TITLE_ID' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'EMAIL' => 5, 'PASSWORD' => 6, 'ALGO' => 7, 'RESELLER' => 8, 'LANG' => 9, 'SPONSOR' => 10, 'DISCOUNT' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'title_id' => 2, 'firstname' => 3, 'lastname' => 4, 'email' => 5, 'password' => 6, 'algo' => 7, 'reseller' => 8, 'lang' => 9, 'sponsor' => 10, 'discount' => 11, 'created_at' => 12, 'updated_at' => 13, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
@@ -242,22 +192,12 @@ class CustomerTableMap extends TableMap
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 50, null);
- $this->addForeignKey('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', 'customer_title', 'ID', false, null, null);
- $this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
+ $this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', false, null, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
- $this->addColumn('ADDRESS1', 'Address1', 'VARCHAR', true, 255, null);
- $this->addColumn('ADDRESS2', 'Address2', 'VARCHAR', false, 255, null);
- $this->addColumn('ADDRESS3', 'Address3', 'VARCHAR', false, 255, null);
- $this->addColumn('ZIPCODE', 'Zipcode', 'VARCHAR', false, 10, null);
- $this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null);
- $this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', true, null, null);
- $this->addColumn('PHONE', 'Phone', 'VARCHAR', false, 20, null);
- $this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null);
$this->addColumn('EMAIL', 'Email', 'VARCHAR', false, 50, null);
$this->addColumn('PASSWORD', 'Password', 'VARCHAR', false, 255, null);
$this->addColumn('ALGO', 'Algo', 'VARCHAR', false, 128, null);
- $this->addColumn('SALT', 'Salt', 'VARCHAR', false, 128, null);
$this->addColumn('RESELLER', 'Reseller', 'TINYINT', false, null, null);
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
$this->addColumn('SPONSOR', 'Sponsor', 'VARCHAR', false, 50, null);
@@ -271,7 +211,7 @@ class CustomerTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('customer_title_id' => 'id', ), 'SET NULL', 'RESTRICT');
+ $this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Addresses');
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Orders');
} // buildRelations()
@@ -439,22 +379,12 @@ class CustomerTableMap extends TableMap
if (null === $alias) {
$criteria->addSelectColumn(CustomerTableMap::ID);
$criteria->addSelectColumn(CustomerTableMap::REF);
- $criteria->addSelectColumn(CustomerTableMap::CUSTOMER_TITLE_ID);
- $criteria->addSelectColumn(CustomerTableMap::COMPANY);
+ $criteria->addSelectColumn(CustomerTableMap::TITLE_ID);
$criteria->addSelectColumn(CustomerTableMap::FIRSTNAME);
$criteria->addSelectColumn(CustomerTableMap::LASTNAME);
- $criteria->addSelectColumn(CustomerTableMap::ADDRESS1);
- $criteria->addSelectColumn(CustomerTableMap::ADDRESS2);
- $criteria->addSelectColumn(CustomerTableMap::ADDRESS3);
- $criteria->addSelectColumn(CustomerTableMap::ZIPCODE);
- $criteria->addSelectColumn(CustomerTableMap::CITY);
- $criteria->addSelectColumn(CustomerTableMap::COUNTRY_ID);
- $criteria->addSelectColumn(CustomerTableMap::PHONE);
- $criteria->addSelectColumn(CustomerTableMap::CELLPHONE);
$criteria->addSelectColumn(CustomerTableMap::EMAIL);
$criteria->addSelectColumn(CustomerTableMap::PASSWORD);
$criteria->addSelectColumn(CustomerTableMap::ALGO);
- $criteria->addSelectColumn(CustomerTableMap::SALT);
$criteria->addSelectColumn(CustomerTableMap::RESELLER);
$criteria->addSelectColumn(CustomerTableMap::LANG);
$criteria->addSelectColumn(CustomerTableMap::SPONSOR);
@@ -464,22 +394,12 @@ class CustomerTableMap extends TableMap
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.REF');
- $criteria->addSelectColumn($alias . '.CUSTOMER_TITLE_ID');
- $criteria->addSelectColumn($alias . '.COMPANY');
+ $criteria->addSelectColumn($alias . '.TITLE_ID');
$criteria->addSelectColumn($alias . '.FIRSTNAME');
$criteria->addSelectColumn($alias . '.LASTNAME');
- $criteria->addSelectColumn($alias . '.ADDRESS1');
- $criteria->addSelectColumn($alias . '.ADDRESS2');
- $criteria->addSelectColumn($alias . '.ADDRESS3');
- $criteria->addSelectColumn($alias . '.ZIPCODE');
- $criteria->addSelectColumn($alias . '.CITY');
- $criteria->addSelectColumn($alias . '.COUNTRY_ID');
- $criteria->addSelectColumn($alias . '.PHONE');
- $criteria->addSelectColumn($alias . '.CELLPHONE');
$criteria->addSelectColumn($alias . '.EMAIL');
$criteria->addSelectColumn($alias . '.PASSWORD');
$criteria->addSelectColumn($alias . '.ALGO');
- $criteria->addSelectColumn($alias . '.SALT');
$criteria->addSelectColumn($alias . '.RESELLER');
$criteria->addSelectColumn($alias . '.LANG');
$criteria->addSelectColumn($alias . '.SPONSOR');
diff --git a/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php b/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php
index d403756fa..5344099c5 100755
--- a/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php
@@ -141,7 +141,7 @@ class CustomerTitleI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'customer_title', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('SHORT', 'Short', 'VARCHAR', false, 10, null);
$this->addColumn('LONG', 'Long', 'VARCHAR', false, 45, null);
} // initialize()
diff --git a/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php b/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php
index a392ee4dd..44b16fafd 100755
--- a/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php
@@ -106,7 +106,7 @@ class CustomerTitleTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
@@ -166,7 +166,7 @@ class CustomerTitleTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'SET NULL', 'RESTRICT', 'Customers');
+ $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::ONE_TO_MANY, array('id' => 'title_id', ), 'RESTRICT', 'RESTRICT', 'Customers');
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
$this->addRelation('CustomerTitleI18n', '\\Thelia\\Model\\CustomerTitleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CustomerTitleI18ns');
} // buildRelations()
@@ -191,7 +191,6 @@ class CustomerTitleTableMap extends TableMap
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CustomerTableMap::clearInstancePool();
CustomerTitleI18nTableMap::clearInstancePool();
}
diff --git a/core/lib/Thelia/Model/Map/DocumentI18nTableMap.php b/core/lib/Thelia/Model/Map/DocumentI18nTableMap.php
index d0356e8c6..70314ea02 100755
--- a/core/lib/Thelia/Model/Map/DocumentI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/DocumentI18nTableMap.php
@@ -151,7 +151,7 @@ class DocumentI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'document', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/DocumentTableMap.php b/core/lib/Thelia/Model/Map/DocumentTableMap.php
index 50bb37b95..d53263a06 100755
--- a/core/lib/Thelia/Model/Map/DocumentTableMap.php
+++ b/core/lib/Thelia/Model/Map/DocumentTableMap.php
@@ -126,7 +126,7 @@ class DocumentTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php b/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php
index b3114e7ba..ba592b4b0 100755
--- a/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php
@@ -151,7 +151,7 @@ class FeatureAvI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_av', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/FeatureAvTableMap.php b/core/lib/Thelia/Model/Map/FeatureAvTableMap.php
index f447f8dc5..972a25744 100755
--- a/core/lib/Thelia/Model/Map/FeatureAvTableMap.php
+++ b/core/lib/Thelia/Model/Map/FeatureAvTableMap.php
@@ -101,7 +101,7 @@ class FeatureAvTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php b/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php
index af0dfc263..dba05fb67 100755
--- a/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php
@@ -151,7 +151,7 @@ class FeatureI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/FeatureTableMap.php b/core/lib/Thelia/Model/Map/FeatureTableMap.php
index 8d851559e..b1f309603 100755
--- a/core/lib/Thelia/Model/Map/FeatureTableMap.php
+++ b/core/lib/Thelia/Model/Map/FeatureTableMap.php
@@ -106,7 +106,7 @@ class FeatureTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/FolderI18nTableMap.php b/core/lib/Thelia/Model/Map/FolderI18nTableMap.php
index fc85b17ec..d10344811 100755
--- a/core/lib/Thelia/Model/Map/FolderI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/FolderI18nTableMap.php
@@ -151,7 +151,7 @@ class FolderI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/FolderTableMap.php b/core/lib/Thelia/Model/Map/FolderTableMap.php
index 794e3691c..c26e23dc8 100755
--- a/core/lib/Thelia/Model/Map/FolderTableMap.php
+++ b/core/lib/Thelia/Model/Map/FolderTableMap.php
@@ -131,7 +131,7 @@ class FolderTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/GroupI18nTableMap.php b/core/lib/Thelia/Model/Map/GroupI18nTableMap.php
index 585127821..57788593a 100755
--- a/core/lib/Thelia/Model/Map/GroupI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/GroupI18nTableMap.php
@@ -151,7 +151,7 @@ class GroupI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/GroupTableMap.php b/core/lib/Thelia/Model/Map/GroupTableMap.php
index a8c830005..881a2fa84 100755
--- a/core/lib/Thelia/Model/Map/GroupTableMap.php
+++ b/core/lib/Thelia/Model/Map/GroupTableMap.php
@@ -101,7 +101,7 @@ class GroupTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/ImageI18nTableMap.php b/core/lib/Thelia/Model/Map/ImageI18nTableMap.php
index 4f3b197a6..a78e7667c 100755
--- a/core/lib/Thelia/Model/Map/ImageI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/ImageI18nTableMap.php
@@ -151,7 +151,7 @@ class ImageI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'image', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/ImageTableMap.php b/core/lib/Thelia/Model/Map/ImageTableMap.php
index 0f8d82b20..c49f24527 100755
--- a/core/lib/Thelia/Model/Map/ImageTableMap.php
+++ b/core/lib/Thelia/Model/Map/ImageTableMap.php
@@ -126,7 +126,7 @@ class ImageTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/MessageI18nTableMap.php b/core/lib/Thelia/Model/Map/MessageI18nTableMap.php
index f084515c0..bb9bfdd2e 100755
--- a/core/lib/Thelia/Model/Map/MessageI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/MessageI18nTableMap.php
@@ -146,7 +146,7 @@ class MessageI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'LONGVARCHAR', false, null, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('DESCRIPTION_HTML', 'DescriptionHtml', 'CLOB', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/MessageTableMap.php b/core/lib/Thelia/Model/Map/MessageTableMap.php
index de2a205f9..392dac824 100755
--- a/core/lib/Thelia/Model/Map/MessageTableMap.php
+++ b/core/lib/Thelia/Model/Map/MessageTableMap.php
@@ -126,7 +126,7 @@ class MessageTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php b/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php
index 67b7a34ef..a8e680f1c 100755
--- a/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php
@@ -151,7 +151,7 @@ class ModuleI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'module', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/ModuleTableMap.php b/core/lib/Thelia/Model/Map/ModuleTableMap.php
index 5370c1da1..cccaa890a 100755
--- a/core/lib/Thelia/Model/Map/ModuleTableMap.php
+++ b/core/lib/Thelia/Model/Map/ModuleTableMap.php
@@ -116,7 +116,7 @@ class ModuleTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php b/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php
index 5d78c474c..1b2052c2e 100755
--- a/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php
@@ -151,7 +151,7 @@ class OrderStatusI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_status', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/OrderStatusTableMap.php b/core/lib/Thelia/Model/Map/OrderStatusTableMap.php
index eecfe5a03..18406d9aa 100755
--- a/core/lib/Thelia/Model/Map/OrderStatusTableMap.php
+++ b/core/lib/Thelia/Model/Map/OrderStatusTableMap.php
@@ -101,7 +101,7 @@ class OrderStatusTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/ProductI18nTableMap.php b/core/lib/Thelia/Model/Map/ProductI18nTableMap.php
index 8da33f15d..79a01514a 100755
--- a/core/lib/Thelia/Model/Map/ProductI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductI18nTableMap.php
@@ -151,7 +151,7 @@ class ProductI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php
index b009a97af..40200ce10 100755
--- a/core/lib/Thelia/Model/Map/ProductTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductTableMap.php
@@ -166,7 +166,7 @@ class ProductTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php b/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php
index 8a8ce501a..ec22e2fd3 100755
--- a/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php
@@ -151,7 +151,7 @@ class ResourceI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'resource', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
diff --git a/core/lib/Thelia/Model/Map/ResourceTableMap.php b/core/lib/Thelia/Model/Map/ResourceTableMap.php
index e56960892..8d7708ddd 100755
--- a/core/lib/Thelia/Model/Map/ResourceTableMap.php
+++ b/core/lib/Thelia/Model/Map/ResourceTableMap.php
@@ -101,7 +101,7 @@ class ResourceTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/TaxI18nTableMap.php b/core/lib/Thelia/Model/Map/TaxI18nTableMap.php
index 2c4c92f4f..a06230c37 100755
--- a/core/lib/Thelia/Model/Map/TaxI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/TaxI18nTableMap.php
@@ -141,7 +141,7 @@ class TaxI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
} // initialize()
diff --git a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php
index 689f30728..1f0ed1e96 100755
--- a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php
+++ b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php
@@ -131,7 +131,7 @@ class TaxRuleI18nTableMap extends TableMap
$this->setUseIdGenerator(false);
// columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null);
- $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
} // initialize()
/**
diff --git a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php
index 9b862de99..cc5f628b9 100755
--- a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php
+++ b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php
@@ -111,7 +111,7 @@ class TaxRuleTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Model/Map/TaxTableMap.php b/core/lib/Thelia/Model/Map/TaxTableMap.php
index b941e7b52..6d43f20e9 100755
--- a/core/lib/Thelia/Model/Map/TaxTableMap.php
+++ b/core/lib/Thelia/Model/Map/TaxTableMap.php
@@ -101,7 +101,7 @@ class TaxTableMap extends TableMap
*
* @var string
*/
- const DEFAULT_LOCALE = 'en_EN';
+ const DEFAULT_LOCALE = 'en_US';
/**
* holds an array of fieldnames
diff --git a/core/lib/Thelia/Core/Security/Encoder/PasswordHashEncoder.php b/core/lib/Thelia/Module/BaseModule.php
old mode 100755
new mode 100644
similarity index 66%
rename from core/lib/Thelia/Core/Security/Encoder/PasswordHashEncoder.php
rename to core/lib/Thelia/Module/BaseModule.php
index 7a66812f5..14777d331
--- a/core/lib/Thelia/Core/Security/Encoder/PasswordHashEncoder.php
+++ b/core/lib/Thelia/Module/BaseModule.php
@@ -1,4 +1,5 @@
- */
+abstract class BaseModule
+{
-class PasswordHashEncoder implements PasswordEncoderInterface {
+ public function __construct()
+ {
- /**
- * {@inheritdoc}
- */
- public function encode($password, $algorithm, $salt)
- {
- if (!in_array($algorithm, hash_algos(), true)) {
- throw new \LogicException(sprintf('The algorithm "%s" is not supported.', $algorithm));
- }
+ }
- // Salt the string
- $salted = $password.$salt;
+ protected function activate()
+ {
- // Create the hash
- $digest = hash($algorithm, $salted, true);
+ }
- // "stretch" hash
- for ($i = 1; $i < 5000; $i++) {
- $digest = hash($algorithm, $digest.$salted, true);
- }
+ abstract public function install();
+ abstract public function destroy();
- return base64_encode($digest);
- }
-
- /**
- * {@inheritdoc}
- */
- public function isEqual($string, $password, $algorithm, $salt)
- {
- $encoded = $this->encode($password, $algorithm, $salt);
-
- return $encoded == $string;
- }
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php b/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php
index b0ce6b841..6042a7cad 100755
--- a/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php
+++ b/core/lib/Thelia/Routing/Matcher/DefaultMatcher.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Routing\Matcher;
diff --git a/core/lib/Thelia/Routing/NullUrlGenerator.php b/core/lib/Thelia/Routing/NullUrlGenerator.php
index 0206a7f2e..f43f4ee5a 100755
--- a/core/lib/Thelia/Routing/NullUrlGenerator.php
+++ b/core/lib/Thelia/Routing/NullUrlGenerator.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Routing/TheliaMatcherCollection.php b/core/lib/Thelia/Routing/TheliaMatcherCollection.php
index bf1c8e2f2..b6769c148 100755
--- a/core/lib/Thelia/Routing/TheliaMatcherCollection.php
+++ b/core/lib/Thelia/Routing/TheliaMatcherCollection.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Routing;
diff --git a/core/lib/Thelia/Tests/Command/BaseCommandTest.php b/core/lib/Thelia/Tests/Command/BaseCommandTest.php
new file mode 100644
index 000000000..ca9d0a632
--- /dev/null
+++ b/core/lib/Thelia/Tests/Command/BaseCommandTest.php
@@ -0,0 +1,20 @@
+getMock("Symfony\Component\HttpKernel\KernelInterface");
+
+ return $kernel;
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Tests/Command/CacheClearTest.php b/core/lib/Thelia/Tests/Command/CacheClearTest.php
index 019414b02..f29d600ed 100755
--- a/core/lib/Thelia/Tests/Command/CacheClearTest.php
+++ b/core/lib/Thelia/Tests/Command/CacheClearTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Tests\Command;
diff --git a/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php
new file mode 100644
index 000000000..dcbc98fff
--- /dev/null
+++ b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php
@@ -0,0 +1,108 @@
+. */
+/* */
+/*************************************************************************************/
+namespace Thelia\Tests\Command;
+
+
+use Symfony\Component\Console\Tester\CommandTester;
+use Symfony\Component\Filesystem\Filesystem;
+use Thelia\Core\Application;
+use Thelia\Command\ModuleGenerateCommand;
+
+class ModuleGenerateCommandTest extends BaseCommandTest {
+
+ protected $command;
+ protected $commandTester;
+
+ public static function clearTest()
+ {
+ $fs = new Filesystem();
+
+ if ($fs->exists(THELIA_MODULE_DIR . "Test")) {
+ $fs->remove(THELIA_MODULE_DIR . "Test");
+ }
+ }
+
+ public static function setUpBeforeClass()
+ {
+ self::clearTest();
+ }
+
+ public static function tearDownAfterClass()
+ {
+ self::clearTest();
+ }
+
+ public function setUp()
+ {
+ $application = new Application($this->getKernel());
+
+ $moduleGenerator = new ModuleGenerateCommand();
+
+ $application->add($moduleGenerator);
+
+ $this->command = $application->find("module:generate");
+ $this->commandTester = new CommandTester($this->command);
+
+ }
+
+ public function testGenerateModule()
+ {
+ $tester = $this->commandTester;
+
+ $tester->execute(array(
+ "command" => $this->command->getName(),
+ "name" => "test"
+ ));
+
+ $fs = new Filesystem();
+
+ $this->assertTrue($fs->exists(THELIA_MODULE_DIR . "Test"));
+ }
+
+ /**
+ * @depends testGenerateModule
+ * @expectedException \RuntimeException
+ */
+ public function testGenerateDuplicateModule()
+ {
+ $tester = $this->commandTester;
+
+ $tester->execute(array(
+ "command" => $this->command->getName(),
+ "name" => "test"
+ ));
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ */
+ public function testGenerateWithReservedKeyWord()
+ {
+ $tester = $this->commandTester;
+
+ $tester->execute(array(
+ "command" => $this->command->getName(),
+ "name" => "thelia"
+ ));
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
index 84bc6c1a7..27255c089 100755
--- a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
+++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Core/Security/Encoder/PasswordHashEncoderTest.php b/core/lib/Thelia/Tests/Core/Security/Encoder/PasswordHashEncoderTest.php
deleted file mode 100755
index 7590b3788..000000000
--- a/core/lib/Thelia/Tests/Core/Security/Encoder/PasswordHashEncoderTest.php
+++ /dev/null
@@ -1,75 +0,0 @@
-encode('password', 'sha512', 'a simple salt');
-
- // echo "PASS=\{$pass\}";
-
- $this->assertEquals("L3f/gGy4nBVhi8WSsC1a7E9JM8U+rtk6ZT+NiqX8M1UDJv6mahQEZ1z2cN/y9pixH+hgWbkBitONMiXWscomoQ==", $pass, "Expected password not found.");
- }
-
- public function testIsEqual()
- {
- $encoder = new PasswordHashEncoder();
-
- $exp = "L3f/gGy4nBVhi8WSsC1a7E9JM8U+rtk6ZT+NiqX8M1UDJv6mahQEZ1z2cN/y9pixH+hgWbkBitONMiXWscomoQ==";
-
- $this->assertTrue($encoder->isEqual($exp, 'password', 'sha512', 'a simple salt'));
- }
-
- public function testWrongPass()
- {
- $encoder = new PasswordHashEncoder();
-
- $exp = "L3f/gGy4nBVhi8WSsC1a7E9JM8U+rtk6ZT+NiqX8M1UDJv6mahQEZ1z2cN/y9pixH+hgWbkBitONMiXWscomoQ==";
-
- $this->assertFalse($encoder->isEqual($exp, 'grongron', 'sha512', 'a simple salt'));
- }
-
- public function testWrongSalt()
- {
- $encoder = new PasswordHashEncoder();
-
- $exp = "L3f/gGy4nBVhi8WSsC1a7E9JM8U+rtk6ZT+NiqX8M1UDJv6mahQEZ1z2cN/y9pixH+hgWbkBitONMiXWscomoQ==";
-
- $this->assertFalse($encoder->isEqual($exp, 'password', 'sha512', 'another salt'));
- }
-
- public function testWrongAlgo()
- {
- $encoder = new PasswordHashEncoder();
-
- $exp = "L3f/gGy4nBVhi8WSsC1a7E9JM8U+rtk6ZT+NiqX8M1UDJv6mahQEZ1z2cN/y9pixH+hgWbkBitONMiXWscomoQ==";
-
- $this->assertFalse($encoder->isEqual($exp, 'password', 'md5', 'another salt'));
- }
-
- /**
- * @expectedException LogicException
- */
- public function testUnsupportedAlgo()
- {
- $encoder = new PasswordHashEncoder();
-
- $exp = "L3f/gGy4nBVhi8WSsC1a7E9JM8U+rtk6ZT+NiqX8M1UDJv6mahQEZ1z2cN/y9pixH+hgWbkBitONMiXWscomoQ==";
-
- $encoder->isEqual($exp, 'password', 'sbonk', 'another salt');
- }
-
- /**
- * @expectedException LogicException
- */
- public function testEncodeWrongAlgorithm()
- {
- $encoder = new PasswordHashEncoder();
-
- $encoder->encode('password', 'pouët', 'a simple salt');
- }
-}
\ No newline at end of file
diff --git a/core/lib/Thelia/Tests/Core/Security/Encoder/PasswordPhpCompatEncoderTest.php b/core/lib/Thelia/Tests/Core/Security/Encoder/PasswordPhpCompatEncoderTest.php
deleted file mode 100755
index 988be2360..000000000
--- a/core/lib/Thelia/Tests/Core/Security/Encoder/PasswordPhpCompatEncoderTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-encoder = new PasswordPhpCompatEncoder();
- }
-
- public function testEncode()
- {
- $hash = $this->encoder->encode("foo", PASSWORD_BCRYPT);
-
- $this->assertEquals($hash, crypt("foo", $hash));
- }
-
-}
\ No newline at end of file
diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php
index 21d1f132b..e8dc69d99 100755
--- a/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php
+++ b/core/lib/Thelia/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Log/TlogTest.php b/core/lib/Thelia/Tests/Log/TlogTest.php
index bde1cdb39..f94b759be 100755
--- a/core/lib/Thelia/Tests/Log/TlogTest.php
+++ b/core/lib/Thelia/Tests/Log/TlogTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
@@ -29,8 +29,7 @@ class TlogTest extends \PHPUnit_Framework_TestCase
{
protected static $logger;
- //protected $regex = "/(\\d)(:)(\\s+)(%s)(\\s+)(\\[.*?\\])(\\s+)(\\{.*?\\})(\\s+)(\\d{4})(-)(\\d{2})(-)(\\d{2})(\\s+)(\\d{2})(:)(\\d{2})(:)(\\d{2})(:)(\\s+)(%s)([\n])/is";
- protected $regex = "/[0-9]+:[\s](%s)+[\s]\[[a-zA-Z\.]+:[a-zA-Z]+\(\)\][\s]\{[0-9]+\}[\s][0-9]{4}-[0-9]{2}-[0-9]{2}[\s][0-9]{2}:[0-9]{2}:[0-9]{2}:[\s](%s).*$/is";
+ protected $regex = "/[0-9]+:[\s](%s)+[\s]\[[a-zA-Z\.]+:[a-zA-Z]+\(\)\][\s]\{[0-9]+\}[\s][0-9]{4}-[0-9]{2}-[0-9]{2}[\s][0-9]{1,2}:[0-9]{2}:[0-9]{2}:[\s](%s).*$/is";
public static function setUpBeforeClass()
{
diff --git a/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php b/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php
index 2a8ba5fa0..2a4409860 100755
--- a/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/AlphaNumStringListTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php b/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php
index 46526715b..ae07cce6b 100755
--- a/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/AlphaNumStringTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/AnyTypeTest.php b/core/lib/Thelia/Tests/Type/AnyTypeTest.php
index 8e959d154..e4750000e 100755
--- a/core/lib/Thelia/Tests/Type/AnyTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/AnyTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/BooleanTypeTest.php b/core/lib/Thelia/Tests/Type/BooleanTypeTest.php
index 26a85b31b..a4842a39f 100755
--- a/core/lib/Thelia/Tests/Type/BooleanTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/BooleanTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/EnumListTypeTest.php b/core/lib/Thelia/Tests/Type/EnumListTypeTest.php
index a992fb0bd..a225464c1 100755
--- a/core/lib/Thelia/Tests/Type/EnumListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/EnumListTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/EnumTypeTest.php b/core/lib/Thelia/Tests/Type/EnumTypeTest.php
index 5ed4637e9..10660ee38 100755
--- a/core/lib/Thelia/Tests/Type/EnumTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/EnumTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/FloatTypeTest.php b/core/lib/Thelia/Tests/Type/FloatTypeTest.php
index 82bf9bfe2..600c696f8 100755
--- a/core/lib/Thelia/Tests/Type/FloatTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/FloatTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/IntListTypeTest.php b/core/lib/Thelia/Tests/Type/IntListTypeTest.php
index 80ffa3e2e..a10d124e4 100755
--- a/core/lib/Thelia/Tests/Type/IntListTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/IntListTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/IntTypeTest.php b/core/lib/Thelia/Tests/Type/IntTypeTest.php
index 2f9ce8a40..7d39093dc 100755
--- a/core/lib/Thelia/Tests/Type/IntTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/IntTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/JsonTypeTest.php b/core/lib/Thelia/Tests/Type/JsonTypeTest.php
index 79b2c59b8..1f4b0162b 100755
--- a/core/lib/Thelia/Tests/Type/JsonTypeTest.php
+++ b/core/lib/Thelia/Tests/Type/JsonTypeTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tests/Type/TypeCollectionTest.php b/core/lib/Thelia/Tests/Type/TypeCollectionTest.php
index 5cef59215..0aaec01df 100755
--- a/core/lib/Thelia/Tests/Type/TypeCollectionTest.php
+++ b/core/lib/Thelia/Tests/Type/TypeCollectionTest.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
diff --git a/core/lib/Thelia/Tools/DIGenerator.php b/core/lib/Thelia/Tools/DIGenerator.php
index a17586a55..f18338d5b 100755
--- a/core/lib/Thelia/Tools/DIGenerator.php
+++ b/core/lib/Thelia/Tools/DIGenerator.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Tools;
diff --git a/core/lib/Thelia/Tools/Redirect.php b/core/lib/Thelia/Tools/Redirect.php
index b4c89fcce..92ae28fa9 100755
--- a/core/lib/Thelia/Tools/Redirect.php
+++ b/core/lib/Thelia/Tools/Redirect.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,28 +17,26 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Tools;
-use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\RedirectResponse;
class Redirect
{
-
+
public static function unauthorize($url)
{
self::exec($url, 401);
}
-
+
public static function exec($url, $status = 302)
{
- $response = new Response('', $status, array(
- "location" => $url
- ));
-
+ $response = new RedirectResponse($url, $status);
+
$response->send();
exit;
}
diff --git a/core/lib/Thelia/Core/Security/Encoder/PasswordPhpCompatEncoder.php b/core/lib/Thelia/Tools/URL.php
old mode 100755
new mode 100644
similarity index 51%
rename from core/lib/Thelia/Core/Security/Encoder/PasswordPhpCompatEncoder.php
rename to core/lib/Thelia/Tools/URL.php
index 32b1c7fd0..4f8480eab
--- a/core/lib/Thelia/Core/Security/Encoder/PasswordPhpCompatEncoder.php
+++ b/core/lib/Thelia/Tools/URL.php
@@ -20,39 +20,65 @@
/* along with this program. If not, see . */
/* */
/*************************************************************************************/
-namespace Thelia\Core\Security\Encoder;
-/**
- *
- * use password api include in php 5.5 and available throw the password_compat library.
- *
- * Class PasswordPhpCompatEncoder
- * @package Thelia\Core\Security\Encoder
- */
-class PasswordPhpCompatEncoder implements PasswordEncoderInterface {
+namespace Thelia\Tools;
- /**
- * Encode a string.
+use Thelia\Model\ConfigQuery;
+
+class URL
+{
+ public static function getIndexPage() {
+ return ConfigQuery::read('base_url', '/') . "index_dev.php"; // FIXME !
+ }
+
+ /**
+ * Returns the Absolute URL for a given path relative to web root. By default,
+ * the index.php (or index_dev.php) script name is added to the URL, use
+ * $path_only = true to get a path without the index script.
*
- * @param string $password the password to encode
- * @param string $algorithm the hash() algorithm
- * @return string $salt the salt, the salt is not used here.
+ * @param string $path the relative path
+ * @param array $parameters An array of parameters
+ * @param boolean $path_only if true, getIndexPage() will not be added
+ *
+ * @return string The generated URL
*/
- public function encode($password, $algorithm, $salt = null)
+ public static function absoluteUrl($path, array $parameters = array(), $path_only = false)
{
- return password_hash($password, $algorithm);
+ // Already absolute ?
+ if (substr($path, 0, 4) != 'http') {
+
+ $root = $path_only ? ConfigQuery::read('base_url', '/') : self::getIndexPage();
+
+ $base = $root . $path;
+ }
+ else
+ $base = $path;
+
+ $queryString = '';
+
+ foreach($parameters as $name => $value) {
+ $queryString = sprintf("%s=%s&", urlencode($name), urlencode($value));
+ }
+
+ $sepChar = strstr($base, '?') === false ? '?' : '&';
+
+ if ('' !== $queryString = rtrim($queryString, "&")) $queryString = $sepChar . $queryString;
+
+ return $base . $queryString;
}
- /**
- * Check a string against an encoded password.
+ /**
+ * Returns the Absolute URL to a view
*
- * @param string $string the string to compare against password
- * @param string $password the encoded password
- * @param string $algorithm the hash() algorithm, not used here
- * @return string $salt the salt, not used here
+ * @param string $viewName the view name (e.g. login for login.html)
+ * @param mixed $parameters An array of parameters
+ *
+ * @return string The generated URL
*/
- public function isEqual($string, $password, $algorithm = null, $salt = null)
- {
- return password_verify($string, $password);
- }
-}
\ No newline at end of file
+ public static function viewUrl($viewName, array $parameters = array()) {
+
+ $path = sprintf("%s?view=%s", self::getIndexPage(), $viewName);
+
+ return self::absoluteUrl($path, $parameters);
+ }
+}
diff --git a/core/lib/Thelia/Type/AlphaNumStringListType.php b/core/lib/Thelia/Type/AlphaNumStringListType.php
index 41af21e07..4f24eb274 100755
--- a/core/lib/Thelia/Type/AlphaNumStringListType.php
+++ b/core/lib/Thelia/Type/AlphaNumStringListType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/AlphaNumStringType.php b/core/lib/Thelia/Type/AlphaNumStringType.php
index 963237cb0..726e6eb67 100755
--- a/core/lib/Thelia/Type/AlphaNumStringType.php
+++ b/core/lib/Thelia/Type/AlphaNumStringType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/AnyType.php b/core/lib/Thelia/Type/AnyType.php
index ca0a14616..5cdbb1272 100755
--- a/core/lib/Thelia/Type/AnyType.php
+++ b/core/lib/Thelia/Type/AnyType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/BooleanType.php b/core/lib/Thelia/Type/BooleanType.php
index f6f292330..69cba66ac 100755
--- a/core/lib/Thelia/Type/BooleanType.php
+++ b/core/lib/Thelia/Type/BooleanType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/EnumListType.php b/core/lib/Thelia/Type/EnumListType.php
index c80501737..b1fc5eb79 100755
--- a/core/lib/Thelia/Type/EnumListType.php
+++ b/core/lib/Thelia/Type/EnumListType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/EnumType.php b/core/lib/Thelia/Type/EnumType.php
index 0221f8b8e..416f9714a 100755
--- a/core/lib/Thelia/Type/EnumType.php
+++ b/core/lib/Thelia/Type/EnumType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/FloatType.php b/core/lib/Thelia/Type/FloatType.php
index 3c10df86c..f82f34b58 100755
--- a/core/lib/Thelia/Type/FloatType.php
+++ b/core/lib/Thelia/Type/FloatType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/IntListType.php b/core/lib/Thelia/Type/IntListType.php
index cd4eadf22..d07e5e18f 100755
--- a/core/lib/Thelia/Type/IntListType.php
+++ b/core/lib/Thelia/Type/IntListType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/IntType.php b/core/lib/Thelia/Type/IntType.php
index c2d6dcfa8..8e2ec4fd8 100755
--- a/core/lib/Thelia/Type/IntType.php
+++ b/core/lib/Thelia/Type/IntType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/JsonType.php b/core/lib/Thelia/Type/JsonType.php
index 39ee57d53..5a195b291 100755
--- a/core/lib/Thelia/Type/JsonType.php
+++ b/core/lib/Thelia/Type/JsonType.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/TypeCollection.php b/core/lib/Thelia/Type/TypeCollection.php
index c2170bfb6..2adf84ddc 100755
--- a/core/lib/Thelia/Type/TypeCollection.php
+++ b/core/lib/Thelia/Type/TypeCollection.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/core/lib/Thelia/Type/TypeInterface.php b/core/lib/Thelia/Type/TypeInterface.php
index b2ba11a4b..b293b1783 100755
--- a/core/lib/Thelia/Type/TypeInterface.php
+++ b/core/lib/Thelia/Type/TypeInterface.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Type;
diff --git a/install/INSTALL-TODO.txt b/install/INSTALL-TODO.txt
new file mode 100644
index 000000000..772946a7c
--- /dev/null
+++ b/install/INSTALL-TODO.txt
@@ -0,0 +1,10 @@
+A faire dans la procédure d'install
+-----------------------------------
+
+Variables Config à initialiser:
+
+- base_url : url de base de la boutique avec / final (ex. http://www.boutique.com/, ou http://www.boutique.com/path/to/thelia2/ )
+- base_admin_template : chemin du template admin relatif au repertoire template (ex. admin/default)
+- default_locale : la locale par défaut (ex. en_US), à utiliser pour les fichiers de traduction
+- asset_dir_from_web_root : le chemin relatif à /web du repertoires des assets (ex. assets)
+- active_template: chemin du template front relatif au repertoire template (ex. default)
diff --git a/install/thelia.sql b/install/thelia.sql
index 94d933587..36b041e11 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -453,22 +453,11 @@ CREATE TABLE `customer`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`ref` VARCHAR(50) NOT NULL,
- `customer_title_id` INTEGER,
- `company` VARCHAR(255),
`firstname` VARCHAR(255) NOT NULL,
`lastname` VARCHAR(255) NOT NULL,
- `address1` VARCHAR(255) NOT NULL,
- `address2` VARCHAR(255) COMMENT ' ',
- `address3` VARCHAR(255),
- `zipcode` VARCHAR(10),
- `city` VARCHAR(255) NOT NULL,
- `country_id` INTEGER NOT NULL,
- `phone` VARCHAR(20),
- `cellphone` VARCHAR(20),
`email` VARCHAR(50),
`password` VARCHAR(255),
`algo` VARCHAR(128),
- `salt` VARCHAR(128),
`reseller` TINYINT,
`lang` VARCHAR(10),
`sponsor` VARCHAR(50),
@@ -476,13 +465,7 @@ CREATE TABLE `customer`
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
- UNIQUE INDEX `ref_UNIQUE` (`ref`),
- INDEX `idx_customer_customer_title_id` (`customer_title_id`),
- CONSTRAINT `fk_customer_customer_title_id`
- FOREIGN KEY (`customer_title_id`)
- REFERENCES `customer_title` (`id`)
- ON UPDATE RESTRICT
- ON DELETE SET NULL
+ UNIQUE INDEX `ref_UNIQUE` (`ref`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -507,6 +490,8 @@ CREATE TABLE `address`
`city` VARCHAR(255) NOT NULL,
`country_id` INTEGER NOT NULL,
`phone` VARCHAR(20),
+ `cellphone` VARCHAR(20),
+ `is_default` TINYINT DEFAULT 0,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
@@ -1040,11 +1025,11 @@ DROP TABLE IF EXISTS `admin_group`;
CREATE TABLE `admin_group`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
- `group_id` INTEGER,
- `admin_id` INTEGER,
+ `group_id` INTEGER NOT NULL,
+ `admin_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
- PRIMARY KEY (`id`),
+ PRIMARY KEY (`id`,`group_id`,`admin_id`),
INDEX `idx_admin_group_group_id` (`group_id`),
INDEX `idx_admin_group_admin_id` (`admin_id`),
CONSTRAINT `fk_admin_group_group_id`
@@ -1074,8 +1059,8 @@ CREATE TABLE `group_resource`
`write` TINYINT DEFAULT 0,
`created_at` DATETIME,
`updated_at` DATETIME,
- PRIMARY KEY (`id`),
- INDEX `id_idx` (`group_id`),
+ PRIMARY KEY (`id`,`group_id`,`resource_id`),
+ INDEX `id_group_resource_group_id` (`group_id`),
INDEX `idx_group_resource_resource_id` (`resource_id`),
CONSTRAINT `fk_group_resource_group_id`
FOREIGN KEY (`group_id`)
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 8b97f4e8c..db538dacf 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -1,942 +1,931 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/admin/default/assets/css/admin.less b/templates/admin/default/assets/css/admin.less
index fb3b8f8b7..c19e623f6 100755
--- a/templates/admin/default/assets/css/admin.less
+++ b/templates/admin/default/assets/css/admin.less
@@ -235,4 +235,162 @@ hr {
border: 1px solid #e5e5e5;
.border-radius;
.box-shadow;
+}
+
+// -- Allow inline forms validation states ------------------------------------
+
+.form-inline .warning .control-label,
+.form-inline .warning .help-block,
+.form-inline .warning .help-inline {
+ color: #c09853;
+}
+
+.form-inline .warning .checkbox,
+.form-inline .warning .radio,
+.form-inline .warning input,
+.form-inline .warning select,
+.form-inline .warning textarea {
+ color: #c09853;
+}
+
+.form-inline .warning input,
+.form-inline .warning select,
+.form-inline .warning textarea {
+ border-color: #c09853;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+}
+
+.form-inline .warning input:focus,
+.form-inline .warning select:focus,
+.form-inline .warning textarea:focus {
+ border-color: #a47e3c;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
+}
+
+.form-inline .warning .input-prepend .add-on,
+.form-inline .warning .input-append .add-on {
+ color: #c09853;
+ background-color: #fcf8e3;
+ border-color: #c09853;
+}
+
+.form-inline .error .control-label,
+.form-inline .error .help-block,
+.form-inline .error .help-inline {
+ color: #b94a48;
+}
+
+.form-inline .error .checkbox,
+.form-inline .error .radio,
+.form-inline .error input,
+.form-inline .error select,
+.form-inline .error textarea {
+ color: #b94a48;
+}
+
+.form-inline .error input,
+.form-inline .error select,
+.form-inline .error textarea {
+ border-color: #b94a48;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+}
+
+.form-inline .error input:focus,
+.form-inline .error select:focus,
+.form-inline .error textarea:focus {
+ border-color: #953b39;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
+}
+
+.form-inline .error .input-prepend .add-on,
+.form-inline .error .input-append .add-on {
+ color: #b94a48;
+ background-color: #f2dede;
+ border-color: #b94a48;
+}
+
+.form-inline .success .control-label,
+.form-inline .success .help-block,
+.form-inline .success .help-inline {
+ color: #468847;
+}
+
+.form-inline .success .checkbox,
+.form-inline .success .radio,
+.form-inline .success input,
+.form-inline .success select,
+.form-inline .success textarea {
+ color: #468847;
+}
+
+.form-inline .success input,
+.form-inline .success select,
+.form-inline .success textarea {
+ border-color: #468847;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+}
+
+.form-inline .success input:focus,
+.form-inline .success select:focus,
+.form-inline .success textarea:focus {
+ border-color: #356635;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
+}
+
+.form-inline .success .input-prepend .add-on,
+.form-inline .success .input-append .add-on {
+ color: #468847;
+ background-color: #dff0d8;
+ border-color: #468847;
+}
+
+.form-inline .info .control-label,
+.form-inline .info .help-block,
+.form-inline .info .help-inline {
+ color: #3a87ad;
+}
+
+.form-inline .info .checkbox,
+.form-inline .info .radio,
+.form-inline .info input,
+.form-inline .info select,
+.form-inline .info textarea {
+ color: #3a87ad;
+}
+
+.form-inline .info input,
+.form-inline .info select,
+.form-inline .info textarea {
+ border-color: #3a87ad;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+}
+
+.form-inline .info input:focus,
+.form-inline .info select:focus,
+.form-inline .info textarea:focus {
+ border-color: #2d6987;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3;
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3;
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3;
+}
+
+.form-inline .info .input-prepend .add-on,
+.form-inline .info .input-append .add-on {
+ color: #3a87ad;
+ background-color: #d9edf7;
+ border-color: #3a87ad;
}
\ No newline at end of file
diff --git a/templates/admin/default/home.html b/templates/admin/default/home.html
index 01e667a28..1f1e7b4e5 100755
--- a/templates/admin/default/home.html
+++ b/templates/admin/default/home.html
@@ -1,4 +1,4 @@
-{check_auth roles="ADMIN"}
+{check_auth context="admin" roles="ADMIN" login_tpl="/admin/login"}
{$page_title={intl l='Home'}}
{include file='includes/header.inc.html'}
diff --git a/templates/admin/default/includes/footer.inc.html b/templates/admin/default/includes/footer.inc.html
index 5fd1a6b8f..aca554da2 100755
--- a/templates/admin/default/includes/footer.inc.html
+++ b/templates/admin/default/includes/footer.inc.html
@@ -1,7 +1,7 @@