diff --git a/composer.json b/composer.json index cbc35dfd5..c96442d51 100644 --- a/composer.json +++ b/composer.json @@ -8,11 +8,18 @@ "setasign/fpdi": "^1.6", "cybermonde/odtphp": "^1.7", "fabpot/goutte": "^3.2", - "monolog/monolog": "^1.22" + "monolog/monolog": "^1.22", + "scores/library": "dev-master" }, "require-dev": { "ccampbell/chromephp": "^4.1" }, + "repositories": [ + { + "type": "git", + "url": "git@gitlab.factory.insight.doubletrade.com:scores/library.git" + } + ], "include-path": ["library/"], "autoload": { "classmap": [ @@ -21,7 +28,7 @@ "library/GenCourrier/", "library/Giant/", "library/Infogreffe/", - "library/Scores/", + "library/Scores/", "library/WorldCheck/" ] }, diff --git a/composer.lock b/composer.lock index 8b18c2865..1b42f1402 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "6c57b3ee229a68f4d482e680536a8f55", + "content-hash": "56cf98787986107c5603de8032378c7b", "packages": [ { "name": "cybermonde/odtphp", @@ -41,6 +41,475 @@ ], "time": "2015-06-02T07:28:25+00:00" }, + { + "name": "doctrine/annotations", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2015-08-31T12:32:49+00:00" + }, + { + "name": "doctrine/cache", + "version": "v1.6.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2016-10-29T11:16:17+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2015-04-14T22:21:58+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.6.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/7bce00698899aa2c06fe7365c76e4d78ddb15fa3", + "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.5|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2016-11-30T16:50:46+00:00" + }, + { + "name": "doctrine/dbal", + "version": "v2.5.12", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "7b9e911f9d8b30d43b96853dab26898c710d8f44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/7b9e911f9d8b30d43b96853dab26898c710d8f44", + "reference": "7b9e911f9d8b30d43b96853dab26898c710d8f44", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.8-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*||^3.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2017-02-08T12:53:47+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2015-11-06T14:35:42+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, { "name": "fabpot/goutte", "version": "v3.2.1", @@ -92,21 +561,21 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.2.2", + "version": "6.2.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", "shasum": "" }, "require": { "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", + "guzzlehttp/psr7": "^1.4", "php": ">=5.5" }, "require-dev": { @@ -150,7 +619,7 @@ "rest", "web service" ], - "time": "2016-10-08T15:01:37+00:00" + "time": "2017-02-28T22:50:30+00:00" }, { "name": "guzzlehttp/promises", @@ -205,16 +674,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.3.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", "shasum": "" }, "require": { @@ -250,29 +719,36 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" } ], - "description": "PSR-7 message implementation", + "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ "http", "message", + "request", + "response", "stream", - "uri" + "uri", + "url" ], - "time": "2016-06-24T23:00:38+00:00" + "time": "2017-03-20T17:10:46+00:00" }, { "name": "monolog/monolog", - "version": "1.22.0", + "version": "1.22.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "bad29cb8d18ab0315e6c477751418a82c850d558" + "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558", - "reference": "bad29cb8d18ab0315e6c477751418a82c850d558", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0", + "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0", "shasum": "" }, "require": { @@ -337,7 +813,7 @@ "logging", "psr-3" ], - "time": "2016-11-26T00:15:39+00:00" + "time": "2017-03-13T07:08:03+00:00" }, { "name": "phpoffice/phpexcel", @@ -493,6 +969,41 @@ ], "time": "2016-10-10T12:19:37+00:00" }, + { + "name": "scores/library", + "version": "dev-master", + "source": { + "type": "git", + "url": "git@gitlab.factory.insight.doubletrade.com:scores/library.git", + "reference": "0b5d5b46854f79fba7b27301aa7b9d8977e3a750" + }, + "require": { + "doctrine/dbal": "^2.5", + "monolog/monolog": "^1.22", + "zendframework/zendframework1": "^1.12" + }, + "require-dev": { + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/Metier/", + "src/Scores/" + ] + }, + "include-path": [ + "src/" + ], + "authors": [ + { + "name": "Scores et Decisions", + "email": "supportdev@scores-decisions.com" + } + ], + "description": "library", + "time": "2017-03-31 13:12:30" + }, { "name": "setasign/fpdi", "version": "1.6.1", @@ -597,16 +1108,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.2.2", + "version": "v3.2.6", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "548f8230bad9f77463b20b15993a008f03e96db5" + "reference": "2fe0caa60c1a1dfeefd0425741182687a9b382b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/548f8230bad9f77463b20b15993a008f03e96db5", - "reference": "548f8230bad9f77463b20b15993a008f03e96db5", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/2fe0caa60c1a1dfeefd0425741182687a9b382b8", + "reference": "2fe0caa60c1a1dfeefd0425741182687a9b382b8", "shasum": "" }, "require": { @@ -650,20 +1161,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:32:22+00:00" + "time": "2017-02-21T09:12:04+00:00" }, { "name": "symfony/css-selector", - "version": "v3.2.2", + "version": "v3.2.6", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa" + "reference": "a48f13dc83c168f1253a5d2a5a4fb46c36244c4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/f0e628f04fc055c934b3211cfabdb1c59eefbfaa", - "reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/a48f13dc83c168f1253a5d2a5a4fb46c36244c4c", + "reference": "a48f13dc83c168f1253a5d2a5a4fb46c36244c4c", "shasum": "" }, "require": { @@ -703,20 +1214,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:32:22+00:00" + "time": "2017-02-21T09:12:04+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.2.2", + "version": "v3.2.6", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024" + "reference": "403944e294cf4ceb3b8447f54cbad88ea7b99cee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/27d9790840a4efd3b7bb8f5f4f9efc27b36b7024", - "reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/403944e294cf4ceb3b8447f54cbad88ea7b99cee", + "reference": "403944e294cf4ceb3b8447f54cbad88ea7b99cee", "shasum": "" }, "require": { @@ -759,7 +1270,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:32:22+00:00" + "time": "2017-02-21T09:12:04+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -978,7 +1489,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "scores/library": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], diff --git a/library/Scores/Auth/Adapter/Db.php b/library/Scores/Auth/Adapter/Db.php deleted file mode 100644 index 8772f87a9..000000000 --- a/library/Scores/Auth/Adapter/Db.php +++ /dev/null @@ -1,102 +0,0 @@ -_username = $username; - $this->_password = $password; - $this->_hash = md5($username.'|'.$password); - $this->checkWs = $checkWs; - } - - /** - * Limit access to only client IDs - * @param array $id - */ - public function limitClient($id = null) - { - if (is_array($id) && count($id)>0) { - $this->clients = $id; - } - } - - /** - * Override the timeout - * @param integer $seconds - */ - public function setTimeout($seconds = null) - { - if ($seconds===null) - return; - - $this->_timeout = $seconds; - } - - /** - * (non-PHPdoc) - * @see Zend_Auth_Adapter_Interface::authenticate() - */ - public function authenticate() - { - $userM = new Application_Model_Sdv1Utilisateurs(); - - $sql = $userM->select() - ->setIntegrityCheck(false) - ->from(array('u'=>'sdv1.utilisateurs'), array('u.idClient', 'u.id', 'u.login', 'u.password')) - ->join(array('c'=>'sdv1.clients'), 'u.idClient = c.id', array('c.timeout')) - ->where('u.login=?', $this->_username) - ->where('u.actif=?', 1) - ->where('u.deleted=?', 0) - ->where('c.actif=?','Oui'); - - if ( count($this->clients) > 0 ) { - $sql->where('u.idClient IN('.join(',',$this->clients).')'); - } - - if ($this->checkWs) { - $sql->where('u.accesWS=?',1); - } - - $result = $userM->fetchRow($sql); - - $identity = new stdClass(); - $identity->username = $this->_username; - $identity->hash = $this->_hash; - - if ( null === $result ) { - return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $identity); - } else { - if ( $this->_password == $result->password - || $this->_password == md5($result->login.'|'.$result->password) ) { - - $identity->id = $result->id; - $identity->idClient = $result->idClient; - $timeout = (!empty($result->timeout)) ? $result->timeout : $this->_timeout; - $identity->timeout = $timeout; - $identity->time = time() + $timeout; - return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity); - - } else { - return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity); - } - } - } -} \ No newline at end of file diff --git a/library/Scores/Auth/Adapter/Ws.php b/library/Scores/Auth/Adapter/Ws.php deleted file mode 100644 index 20c70384e..000000000 --- a/library/Scores/Auth/Adapter/Ws.php +++ /dev/null @@ -1,246 +0,0 @@ -_username = $username; - $this->_password = $password; - - if ($mode == 'hach') { - $this->_checkHach = true; - } - - if ($mode == 'iponly'){ - $ip = $_SERVER['REMOTE_ADDR']; - if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) { - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; - } - $this->_password = 'iponly:'.$ip; - $this->_checkIp = true; - } - - if (Zend_Registry::isRegistered('logger')) { - $this->logger = Zend_Registry::get('logger'); - } - } - - /** - * (non-PHPdoc) - * @see Zend_Auth_Adapter_Interface::authenticate() - */ - public function authenticate() - { - $ip = $_SERVER['REMOTE_ADDR']; - if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && in_array($ip, $this->listProxyIp)) { - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; - } - - $ws = new Scores_Ws_Client('gestion', '0.3'); - $ws->setHttpLogin($this->_username); - $ws->setHttpPassword($this->_password); - $adressIp = $_SERVER['REMOTE_ADDR']; - $parameters = new stdClass(); - $parameters->login = $this->_username; - $parameters->ipUtilisateur = $ip; - $parameters->from = 'auth'; - $InfosLogin = $ws->getInfosLogin($parameters); - - $this->logger->info(__CLASS__ . ' : '.__METHOD__); - $this->logger->info(print_r($InfosLogin,1)); - - $identity = new stdClass(); - - // --- Erreur technique - if ($InfosLogin === false) { - return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible")); - } - // --- Renvoi - elseif (is_string($InfosLogin) || $InfosLogin->error->errnum != 0) { - $message = $InfosLogin; - return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message)); - } - // --- Assignation identity - elseif ($InfosLogin->result->login == $this->_username) { - if ($this->_checkIp || $this->_checkHach) { - $identity->password = $this->_password; - } else { - $identity->password = md5($InfosLogin->result->login.'|'.$this->_password); - } - $identity->username = $InfosLogin->result->login; - $identity->email = $InfosLogin->result->email; - $identity->profil = $InfosLogin->result->profil; - $identity->pref = $InfosLogin->result->pref; - $identity->droits = $InfosLogin->result->droits; - $identity->droitsClients = $InfosLogin->result->droitsClients; - $identity->nom = $InfosLogin->result->nom; - $identity->prenom = $InfosLogin->result->prenom; - $identity->tel = $InfosLogin->result->tel; - $identity->fax = $InfosLogin->result->fax; - $identity->mobile = $InfosLogin->result->mobile; - $identity->id = $InfosLogin->result->id; - $identity->idClient = $InfosLogin->result->idClient; - $identity->reference = $InfosLogin->result->reference; - $identity->nbReponses = $InfosLogin->result->nbReponses; - $identity->typeScore = $InfosLogin->result->typeScore; - $identity->dateValidation = $InfosLogin->result->dateValidation; - $identity->nombreConnexions = $InfosLogin->result->nombreConnexions; - $identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion; - $identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte; - $identity->dateFinCompte = $InfosLogin->result->dateFinCompte; - $identity->acceptationCGU = $InfosLogin->result->acceptationCGU; - $identity->ip = $ip; - $identity->version = $InfosLogin->result->version; - $identity->modeEdition = false; - - $timeout = (!empty($InfosLogin->result->timeout)) ? - $InfosLogin->result->timeout : $this->_timeout; - $identity->timeout = $timeout; - $identity->time = time() + $timeout; - $lang = in_array($InfosLogin->result->lang, array('fr','en')) ? - $InfosLogin->result->lang : 'fr'; - $identity->lang = $lang; - $identity->langtmp = $lang; - - // --- Adresse Ip interdites - $ipInterdites = - '81.252.88.0-81.252.88.7' // CTE D AGGLOMERATION DE SOPHIA - . ';' . '195.200.187.163' // PacWan - . ';' . '213.11.81.41' // Verizon France SAS - . ';' . '83.206.171.252' // FR-BASE-D-INFORMATIONS-LEGALES-BI - . ';' . '81.255.32.139' - . ';' . '212.155.191.1*' // Satair A/S - . ';' . '217.70.1*.17' // OJSC "Sibirtelecom" - . ';' . '212.37.196.156' // GENERALE-MULTIMEDIA-SUD - . ';' . '80.245.60.121' // Planete Marseille - Mailclub - . ';' . '213.246.57.101' // IKOULA - . ';' . '193.104.158.0-193.104.158.255' // Altares.fr - . ';' . '195.6.3.0-195.6.3.255' // ORT - . ';' . '217.144.112.0-217.144.116.63' // Coface - ; - if ( $this->checkPlagesIp($ipInterdites, $adressIp) ) { - return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity); - } - - // --- OK connecté - $this->_username = $identity->username; - $this->_password = $identity->password; - return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity); - } - // --- Fallback - else { - return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity, array("Identification impossible")); - } - } - - /** - * Controle si une adresse IP est dans une liste des IP communiquées sous la forme - * 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10 - * @param string $strPlageIP - * La plage d'adresses IP - * @param string $adresseIP - * L'adresse IP à tester - * @return boolean - */ - protected function checkPlagesIp($strPlageIP, $adresseIP) - { - $connected = false; - $tabIpAllowed = explode(';', trim($strPlageIP)); - if (count($tabIpAllowed)==1 && $tabIpAllowed[0]=='') $tabIpAllowed = array(); - - foreach ($tabIpAllowed as $ip) { - $tabPlages = explode('-', $ip); - // C'est une plage d'adresse '-' - if (isset($tabPlages[1])) - $connected = $this->in_plage($tabPlages[0],$tabPlages[1],$adresseIP); - else { - // C'est une adresse avec ou sans masque '*' - if (preg_match('/^'.str_replace('*','.*',str_replace('.','\.',$ip)).'$/', $adresseIP) ) - $connected=true; - } - if ($connected) break; - } - if (count($tabIpAllowed)==0) return false; - elseif (!$connected) { - return false; - } - return true; - } - - /** - * Enter description here ... - * @param unknown_type $plage_1 - * @param unknown_type $plage_2 - * @param unknown_type $ip - * @return boolean - */ - protected function in_plage($plage_1,$plage_2,$ip) - { - $ip2 = $this->getIpNumber($ip); - if ($ip2>=$this->getIpNumber($plage_1) && $ip2<=$this->getIpNumber($plage_2)) - return true; - else - return false; - } - - /** - * Converti une IP en nombre - * @param string $ip Adresse IP - * @return integer - */ - protected function getIpNumber($ip) - { - $tab=explode('.', $ip); - return (($tab[0]*256*256*256) + ($tab[1]*256*256) + ($tab[2]*256) + ($tab[3])); - } - -} \ No newline at end of file diff --git a/library/Scores/Locale/String.php b/library/Scores/Locale/String.php deleted file mode 100644 index 6a9b815ba..000000000 --- a/library/Scores/Locale/String.php +++ /dev/null @@ -1,87 +0,0 @@ - smtp, sendmail, file - * Si method = smtp - * (host => IP, dns) - * - * Activer l'authentification - * (auth => login, plain, ....) - * (username => ) - * (password => ) - */ - public function __construct( $config = null ) - { - if ($config === null) { - $c = Zend_Registry::get('config'); - $this->config = $c->profil->mail; - } else { - $this->config = $config; - } - - $this->_charset = 'ISO-8859-15'; - - // --- Configuration du transport SMTP - if ( $this->config->method == 'smtp' ) { - - $config = array(); - - if ( isset($this->config->auth) ) { - $config['auth'] = $this->config->auth; - if ( isset($this->config->username) ) { - $config['username'] = $this->config->username; - } - if ( isset($this->config->password) ) { - $config['password'] = $this->config->password; - } - } - - if ( isset($this->config->port) ) { - $config['port'] = $this->config->port; - } - - $tr = new Zend_Mail_Transport_Smtp($this->config->host, $config); - } - - // --- Configuration transport Sendmail - if ( $this->config->method == 'sendmail' ) { - $tr = new Zend_Mail_Transport_Sendmail(); - } - - // --- Configuration transport File - if ( $this->config->method == 'file' ) { - $tr = new Zend_Mail_Transport_File(array('callback' => array($this, 'recipientFilename'))); - } - - $this->transport = $tr; - } - - /** - * Champ From en fonction de la clé de configuration - * @param string $configKey - */ - public function setFromKey($configKey) - { - $email = $this->config->email->$configKey; - $this->setFrom($email, ucfirst($configKey)); - } - - /** - * Champ To en fonction de la clé de configuration - * @param string $configKey - */ - public function addToKey($configKey) - { - $email = $this->config->email->$configKey; - $this->addTo($email, ucfirst($configKey)); - } - - /** - * Définit le sujet de l'email - * @param string $texte - */ - public function setSubjectC($texte = '') - { - $this->setSubject($this->txtConvert($texte)); - } - - /** - * Définit le corps de l'email au format texte - * @param string $texte - */ - public function setBodyTextC($texte = '') - { - $this->setBodyText($this->txtConvert($texte)); - } - - /** - * Définit le corps de l'email au format html - * @param string $html - */ - public function setBodyHtmlC($html = '') - { - $this->setBodyHtml($this->txtConvert($html)); - } - - /** - * Envoi de l'emai - */ - public function execute() - { - return $this->send($this->transport); - } - - //We suppose that character encoding of strings is UTF-8 on PHP script. - protected function txtConvert($string) - { - return mb_convert_encoding($string, 'ISO-8859-15', 'UTF-8'); - } - - protected function recipientFilename($transport) - { - return $transport->recipients . '_' . mt_rand() . '.tmp'; - } -} \ No newline at end of file diff --git a/library/Scores/Wkhtml/Pdf.php b/library/Scores/Wkhtml/Pdf.php deleted file mode 100644 index 8ea4ca2f0..000000000 --- a/library/Scores/Wkhtml/Pdf.php +++ /dev/null @@ -1,54 +0,0 @@ -wkhtml = $c->profil->wkhtmltopdf->path; - } - - /** - * Défini les options supplémentaires à l'execution de wkhtmltopdf - * -n, --disable-javascript Do not allow webpages to run javascript. - * --disable-internal-links Do no make local links - * --disable-external-links Do no make links to remote web pages - * --user-style-sheet Specify a user style sheet, to load with every page. - * --print-media-type Use print media-type instead of screen. - * --header-left|right - * @param string $name - * @param string $value - */ - public function setOptions($name, $value = '') - { - $this->options[$name] = $value; - } - - /** - * Imprime un fichier HTML en PDF avec l'utilitaire wkhtmltopdf - * @param string $fileIn - * @param string $fileOut - * @return string Nom du fichier - */ - public function exec($fileIn, $fileOut = '') - { - if (empty($fileOut)) {$fileOut = str_replace('.html', '.pdf', $fileIn); } - if(file_exists($fileOut)){ unlink($fileOut); } - - $options = '--print-media-type'; - $options.= ' --disable-internal-links'; - if ( count($this->options) ) - { - foreach ( $this->options as $name => $value ) - { - $options.= ' --'.$name; - if ($value!= '') $options.= ' "'.$value.'"'; - } - } - - $cmd = $this->wkhtml.' '.$options.' "'.$fileIn.'" "'.$fileOut.'"'; - exec( $cmd ); - return $fileOut; - } -} \ No newline at end of file