Compare commits
No commits in common. "master" and "2.5" have entirely different histories.
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +0,0 @@
|
||||
/.settings/
|
||||
/.buildpath
|
||||
/.project
|
||||
/vendor/
|
||||
/composer-develop.lock
|
22
README.md
22
README.md
@ -1,22 +0,0 @@
|
||||
# WebService
|
||||
## Installation du projet
|
||||
|
||||
1. Création de la configuration du VHOST apache
|
||||
2. Référencer le domaine virtuel dans le fichier host de la machine
|
||||
* ex : 192.168.33.10 webservice.sd.dev
|
||||
3. Executer composer install pour charger les librairies externes dans vendor
|
||||
4. Configurer l'application (application.ini)
|
||||
* exemple fourni - `docs/config` ou projet `ansible`
|
||||
|
||||
Voir le fichier `docs/README` pour plus d'éléments
|
||||
|
||||
|
||||
## Mode développement pour les librairies externes
|
||||
|
||||
Utiliser la branche `develop` de `scores/library`
|
||||
|
||||
`$ COMPOSER=composer-develop.json composer install`
|
||||
|
||||
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
<?php
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Processor\IntrospectionProcessor;
|
||||
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
protected function _initConfig()
|
||||
@ -10,209 +6,150 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
$config = new Zend_Config($this->getOptions());
|
||||
Zend_Registry::set('config', $config);
|
||||
|
||||
define('MYSQL_HOST', $config->profil->db->metier->params->host);
|
||||
define('MYSQL_USER', $config->profil->db->metier->params->username);
|
||||
define('MYSQL_PASS', $config->profil->db->metier->params->password);
|
||||
define('LOG_PATH', $config->profil->path->shared.'/log');
|
||||
|
||||
// Entreprise
|
||||
define('SPHINX_ENT_HOST', $config->profil->sphinx->ent->host);
|
||||
define('SPHINX_ENT_PORT', intval($config->profil->sphinx->ent->port));
|
||||
define('SPHINX_ENT_VERSION', $config->profil->sphinx->ent->version);
|
||||
|
||||
// Dirigeants
|
||||
define('SPHINX_DIR_HOST', $config->profil->sphinx->dir->host);
|
||||
define('SPHINX_DIR_PORT', intval($config->profil->sphinx->dir->port));
|
||||
define('SPHINX_DIR_VERSION', $config->profil->sphinx->dir->version);
|
||||
|
||||
// Historique
|
||||
define('SPHINX_HISTO_HOST', $config->profil->sphinx->histo->host);
|
||||
define('SPHINX_HISTO_PORT', intval($config->profil->sphinx->histo->port));
|
||||
define('SPHINX_HISTO_VERSION', $config->profil->sphinx->histo->version);
|
||||
|
||||
// Actionnaire
|
||||
define('SPHINX_ACT_HOST', $config->profil->sphinx->act->host);
|
||||
define('SPHINX_ACT_PORT', intval($config->profil->sphinx->act->port));
|
||||
define('SPHINX_ACT_VERSION', $config->profil->sphinx->act->version);
|
||||
|
||||
//Old
|
||||
define('SPHINX_HOST', $config->profil->sphinx->ent->host);
|
||||
define('SPHINX_PORT', intval($config->profil->sphinx->ent->port));
|
||||
//Load old config
|
||||
require_once 'WsScore/Configure.php';
|
||||
$oldconfig = new Configure();
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
//Initialisation global des paramètres de vue
|
||||
protected function _initViewSettings()
|
||||
{
|
||||
$this->bootstrap('view');
|
||||
protected function _initViewSettings()
|
||||
{
|
||||
$this->bootstrap('view');
|
||||
|
||||
$view = $this->getResource('view');
|
||||
$view->setEncoding('UTF-8');
|
||||
$view->doctype('HTML5');
|
||||
$view = $this->getResource('view');
|
||||
$view->setEncoding('UTF-8');
|
||||
$view->doctype('HTML5');
|
||||
|
||||
$view->headMeta()
|
||||
->appendName('viewport', 'width=device-width, initial-scale=1.0')
|
||||
->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
|
||||
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
|
||||
$view->headMeta()
|
||||
->appendName('viewport', 'width=device-width, initial-scale=1.0')
|
||||
->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
|
||||
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
|
||||
->appendHttpEquiv('Content-Language', 'fr-FR');
|
||||
|
||||
//Favicon - Touch icon for iOS 2.0+ and Android 2.1+
|
||||
$view->headLink()->headLink(array(
|
||||
'rel' => 'apple-touch-icon-precomposed',
|
||||
'href' => '/favicon-152.png'
|
||||
));
|
||||
//Favicon - targeted to any additional png size
|
||||
$view->headLink()->headLink(array(
|
||||
'rel' => 'icon',
|
||||
'type' => 'image/png',
|
||||
'href' => '/favicon-32.png'
|
||||
));
|
||||
$view->headLink()->headLink(array(
|
||||
'rel' => 'shortcut icon',
|
||||
'type' => 'image/x-icon',
|
||||
'href' => '/favicon.ico')
|
||||
);
|
||||
$view->headLink()
|
||||
->appendStylesheet('/libs/bootstrap-v3.0.3/css/bootstrap.min.css', 'all')
|
||||
->appendStylesheet('/themes/default/css/docs.css', 'all')
|
||||
->appendStylesheet('/themes/default/css/main.css', 'all');
|
||||
|
||||
$view->headLink()
|
||||
->appendStylesheet('/assets/libs/bootstrap-3.3.7/css/bootstrap.min.css', 'all')
|
||||
->appendStylesheet('/assets/themes/default/css/docs.css', 'all')
|
||||
->appendStylesheet('/assets/themes/default/css/main.css', 'all');
|
||||
$view->headScript()
|
||||
->appendFile('/libs/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/libs/jquery-1.11.0.min.js', 'text/javascript')
|
||||
->appendFile('/libs/bootstrap-v3.0.3/js/bootstrap.min.js', 'text/javascript');
|
||||
|
||||
$view->headScript()
|
||||
->appendFile('/assets/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/assets/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
|
||||
->appendFile('/assets/libs/jquery-1.12.4.min.js', 'text/javascript')
|
||||
->appendFile('/assets/libs/bootstrap-3.3.7/js/bootstrap.min.js', 'text/javascript');
|
||||
$view->headTitle()->setSeparator(' - ');
|
||||
$view->headTitle('Web Service API - Scores & Decisions');
|
||||
}
|
||||
|
||||
$view->headTitle()->setSeparator(' - ');
|
||||
$view->headTitle('Web Service API - Scores & Decisions');
|
||||
}
|
||||
//Initialisation global des paramètres de log
|
||||
protected function _initLogging()
|
||||
{
|
||||
/*$c = Zend_Registry::get('config');
|
||||
$WsLogger = new Zend_Log();
|
||||
$WsFileWriter = new Zend_Log_Writer_Stream($c->profil->path->log.'/wsentreprise.log');
|
||||
$WsFileWriter->addFilter(Zend_Log::INFO);
|
||||
$WsLogger->addWriter($WsFileWriter);
|
||||
Zend_Registry::set('WsLogger', $WsLogger);*/
|
||||
}
|
||||
|
||||
protected function _initRouter()
|
||||
{
|
||||
$this->bootstrap('frontController');
|
||||
$front = $this->getResource('frontController');
|
||||
$router = $front->getRouter();
|
||||
protected function _initRouter()
|
||||
{
|
||||
$this->bootstrap('frontController');
|
||||
$front = $this->getResource('frontController');
|
||||
$router = $front->getRouter();
|
||||
|
||||
// Lire les services disponibles et créer les routes
|
||||
$services = require_once APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach ($services as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$route = new Zend_Controller_Router_Route($section.'/:version', array(
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => $section,
|
||||
'version' => '',
|
||||
));
|
||||
$router->addRoute($section, $route);
|
||||
}
|
||||
}
|
||||
//Lire les services disponibles et créer les routes
|
||||
$services = require_once APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach( $services as $section => $params )
|
||||
{
|
||||
if ($params['actif']) {
|
||||
$route = new Zend_Controller_Router_Route($section.'/:version', array(
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => $section,
|
||||
'version' => '',
|
||||
));
|
||||
$router->addRoute($section, $route);
|
||||
|
||||
// Route pour WS Clients
|
||||
$route = new Zend_Controller_Router_Route('clients/:client/:version', array(
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => 'clients',
|
||||
'client' => '',
|
||||
'version' => ''
|
||||
));
|
||||
$router->addRoute('client', $route);
|
||||
$route = new Zend_Controller_Router_Route('jsonrpc/'.$section.'/:version', array(
|
||||
'controller' => 'jsonrpc',
|
||||
'action' => 'index',
|
||||
'service' => $section,
|
||||
'version' => '',
|
||||
));
|
||||
$router->addRoute('jsonrpc-'.$section, $route);
|
||||
}
|
||||
}
|
||||
|
||||
$fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array(
|
||||
'controller' => 'fichier',
|
||||
'fichier' => '',
|
||||
));
|
||||
$router->addRoute('fichier', $fichierRoute);
|
||||
return $router;
|
||||
}
|
||||
//Route pour WS Clients
|
||||
$route = new Zend_Controller_Router_Route('clients/:client/:version', array(
|
||||
'controller' => 'service',
|
||||
'action' => 'index',
|
||||
'service' => 'clients',
|
||||
'client' => '',
|
||||
'version' => ''
|
||||
));
|
||||
$router->addRoute('client', $route);
|
||||
|
||||
protected function _initDb()
|
||||
{
|
||||
$c = new Zend_Config($this->getOptions());
|
||||
try {
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
} catch (Exception $e) {
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
echo '<pre>';
|
||||
print_r($e);
|
||||
echo '</pre>';
|
||||
} else {
|
||||
echo "Le service rencontre actuellement un problème technique.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
$fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array(
|
||||
'controller' => 'fichier',
|
||||
'fichier' => '',
|
||||
));
|
||||
$router->addRoute('fichier', $fichierRoute);
|
||||
return $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default adapter to use with all model
|
||||
*/
|
||||
Zend_Db_Table::setDefaultAdapter($db);
|
||||
}
|
||||
protected function _initDb()
|
||||
{
|
||||
$c = Zend_Registry::get('config');
|
||||
try {
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
} catch ( Exception $e ) {
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
echo '<pre>'; print_r($e); echo '</pre>';
|
||||
} else {
|
||||
echo "Le service rencontre actuellement un problème technique.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function _initDoctrine()
|
||||
{
|
||||
$c = new Zend_Config($this->getOptions());
|
||||
/**
|
||||
* Set the default adapter to use with all model
|
||||
*/
|
||||
Zend_Db_Table::setDefaultAdapter($db);
|
||||
}
|
||||
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
protected function _initWsDebug()
|
||||
{
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
$autoloader->registerNamespace('WsDebug');
|
||||
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
$logger = new Scores_Logger_Sql();
|
||||
$config->setSQLLogger($logger);
|
||||
}
|
||||
$options = array(
|
||||
'plugins' => array(
|
||||
'Exception',
|
||||
),
|
||||
);
|
||||
|
||||
$connectionParams = array(
|
||||
'dbname' => $c->profil->db->metier->params->dbname,
|
||||
'user' => $c->profil->db->metier->params->username,
|
||||
'password' => $c->profil->db->metier->params->password,
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'charset' => 'utf8',
|
||||
'driver' => 'pdo_mysql',
|
||||
);
|
||||
$debug = new WsDebug_Controller_Plugin_Debug($options);
|
||||
|
||||
try {
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
echo '<pre>';
|
||||
print_r($e);
|
||||
echo '</pre>';
|
||||
} else {
|
||||
echo "Le service rencontre actuellement un problème technique.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
$this->bootstrap('frontController');
|
||||
$frontController = $this->getResource('frontController');
|
||||
$frontController->registerPlugin($debug);
|
||||
}
|
||||
|
||||
Zend_Registry::set('doctrine', $conn);
|
||||
}
|
||||
|
||||
protected function _initCache()
|
||||
{
|
||||
if (APPLICATION_ENV!='development') {
|
||||
//MetadataCache pour la base de données
|
||||
$frontendOptions = array(
|
||||
'lifetime' => 14400,
|
||||
'automatic_serialization' => true
|
||||
);
|
||||
$backendOptions = array();
|
||||
$cache = Zend_Cache::factory('Core', 'Apc', $frontendOptions, $backendOptions);
|
||||
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
}
|
||||
}
|
||||
|
||||
protected function _initLogger()
|
||||
{
|
||||
$config = new Zend_Config($this->getOptions());
|
||||
$logFile = $config->profil->path->shared.'/log/application.log';
|
||||
|
||||
$log = new Logger('APP');
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
$level = Logger::DEBUG;
|
||||
} else {
|
||||
$level = Logger::NOTICE;
|
||||
}
|
||||
$log->pushHandler(new StreamHandler($logFile, $level));
|
||||
$log->pushProcessor(new IntrospectionProcessor());
|
||||
|
||||
Zend_Registry::set('logger', $log);
|
||||
}
|
||||
}
|
||||
protected function _initCache()
|
||||
{
|
||||
if ( APPLICATION_ENV!='development' ) {
|
||||
//MetadataCache pour la base de données
|
||||
$frontendOptions = array(
|
||||
'lifetime' => 14400,
|
||||
'automatic_serialization' => true
|
||||
);
|
||||
$backendOptions = array();
|
||||
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
|
||||
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
}
|
||||
}
|
||||
}
|
2
application/autoload_classmap.php
Normal file
2
application/autoload_classmap.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
return array();
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
Zend_Registry::set('config', $c);
|
||||
|
||||
// Database - Zend Style
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
// Database - Doctrine Style
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
$connectionParams = array(
|
||||
'dbname' => $c->profil->db->metier->params->dbname,
|
||||
'user' => $c->profil->db->metier->params->username,
|
||||
'password' => $c->profil->db->metier->params->password,
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'charset' => 'utf8',
|
||||
'driver' => 'pdo_mysql',
|
||||
);
|
||||
|
||||
try {
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
||||
Zend_Registry::set('doctrine', $conn);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
echo "Connection Database impossible.\n";
|
||||
exit;
|
||||
}
|
1
application/configs/.gitignore
vendored
1
application/configs/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/application.ini
|
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
return array(
|
||||
array(
|
||||
'label'=> "Accueil",
|
||||
'controller' => 'index',
|
||||
'action' => 'index',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "Documentation",
|
||||
'controller' => 'documentation',
|
||||
'action' => 'index',
|
||||
'pages' => array(
|
||||
array(
|
||||
'label'=> "Information générale",
|
||||
'controller' => 'documentation',
|
||||
'action' => 'index',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'uri' => '#',
|
||||
),
|
||||
array(
|
||||
'label'=> "Liste des services",
|
||||
'controller' => 'documentation',
|
||||
'action' => 'services',
|
||||
'pages' => array(),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label'=> "Démonstration",
|
||||
'controller' => 'demo',
|
||||
'action' => 'index',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "Contact",
|
||||
'controller' => 'index',
|
||||
'action' => 'contact',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "Paramètres",
|
||||
'controller' => 'user',
|
||||
'action' => 'params',
|
||||
'pages' => array(),
|
||||
),
|
||||
array(
|
||||
'label'=> "A propos",
|
||||
'controller' => 'index',
|
||||
'action' => 'about',
|
||||
'pages' => array(),
|
||||
),
|
||||
);
|
@ -1,107 +1,109 @@
|
||||
<?php
|
||||
class DemoController extends Zend_Controller_Action
|
||||
{
|
||||
protected $_username;
|
||||
protected $_hash;
|
||||
protected $_username;
|
||||
protected $_hash;
|
||||
|
||||
protected $methods = array(
|
||||
'getIdentite' => array(
|
||||
'ws' => 'entreprise/v0.8?wsdl',
|
||||
'form' => 'getIdentite',
|
||||
),
|
||||
);
|
||||
protected $methods = array(
|
||||
'getIdentite' => array(
|
||||
'ws' => 'entreprise/v0.7?wsdl',
|
||||
'form' => 'getIdentite',
|
||||
),
|
||||
);
|
||||
|
||||
public function init()
|
||||
public function init()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$this->_username = $auth->getIdentity()->username;
|
||||
$this->_hash = $auth->getIdentity()->hash;
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$this->_username = $auth->getIdentity()->username;
|
||||
$this->_hash = $auth->getIdentity()->hash;
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
//Liste
|
||||
//Liste
|
||||
|
||||
|
||||
$tabMethods = array();
|
||||
foreach ($this->methods as $method => $element) {
|
||||
$url = $this->view->url(array(
|
||||
'controller' => 'demo',
|
||||
'action' => 'method',
|
||||
'name' => $method,
|
||||
));
|
||||
$tabMethods[] = array(
|
||||
'nom' => $method,
|
||||
'url' => $url,
|
||||
);
|
||||
}
|
||||
foreach($this->methods as $method => $element){
|
||||
$url = $this->view->url(array(
|
||||
'controller' => 'demo',
|
||||
'action' => 'method',
|
||||
'name' => $method,
|
||||
));
|
||||
$tabMethods[] = array(
|
||||
'nom' => $method,
|
||||
'url' => $url,
|
||||
);
|
||||
}
|
||||
|
||||
$this->view->assign('methods', $tabMethods);
|
||||
$this->view->assign('methods', $tabMethods);
|
||||
}
|
||||
|
||||
public function methodAction()
|
||||
{
|
||||
$method = $this->_getParam('name', '');
|
||||
$this->view->assign('method', $method);
|
||||
//Affichage du formulaire
|
||||
if (array_key_exists($method, $this->methods)) {
|
||||
$class = 'Scores_Ws_Form_'.ucfirst($method);
|
||||
if (class_exists($class)) {
|
||||
$form = new $class;
|
||||
$form->addElement('hidden', 'method', array(
|
||||
'value' => $method,
|
||||
));
|
||||
if ($this->_request->isPost()) {
|
||||
$formData = $this->_request->getPost();
|
||||
$form->populate($formData);
|
||||
}
|
||||
$this->view->assign('form', $form);
|
||||
} else {
|
||||
$this->view->assign('message', "Impossible d'afficher le formulaire !");
|
||||
}
|
||||
}
|
||||
}
|
||||
public function methodAction()
|
||||
{
|
||||
$method = $this->_getParam('name','');
|
||||
$this->view->assign('method', $method);
|
||||
//Affichage du formulaire
|
||||
if (array_key_exists($method, $this->methods)){
|
||||
$class = 'Scores_Ws_Form_'.ucfirst($method);
|
||||
if (class_exists($class)){
|
||||
$form = new $class;
|
||||
$form->addElement('hidden', 'method', array(
|
||||
'value' => $method,
|
||||
));
|
||||
if ($this->_request->isPost()) {
|
||||
$formData = $this->_request->getPost();
|
||||
$form->populate($formData);
|
||||
}
|
||||
$this->view->assign('form', $form);
|
||||
} else {
|
||||
$this->view->assign('message',"Impossible d'afficher le formulaire !");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function requeteAction()
|
||||
{
|
||||
public function requeteAction()
|
||||
{
|
||||
if ($this->_request->isPost()) {
|
||||
$formData = $this->_request->getPost();
|
||||
$method = $formData['method'];
|
||||
$class = 'Scores_Ws_Form_'.ucfirst($method);
|
||||
if (class_exists($class)) {
|
||||
$form = new $class;
|
||||
if ($form->isValid($formData)) {
|
||||
$method = $formData['method'];
|
||||
$siret = $formData['siret'];
|
||||
$accesWs = $this->methods[$method]['ws'];
|
||||
$hostName = $this->getRequest()->getHttpHost();
|
||||
$options = array(
|
||||
'login' => $this->_username,
|
||||
'password' => $this->_hash,
|
||||
'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS
|
||||
);
|
||||
$client = new Zend_Soap_Client('http://'.$hostName.'/'.$accesWs, $options);
|
||||
$params = new StdClass();
|
||||
$params->siret = $siret;
|
||||
try {
|
||||
$reponse = $client->getIdentite($params);
|
||||
} catch (Zend_Soap_Client_Exception $e) {
|
||||
$reponse = $e->getMessage();
|
||||
}
|
||||
$soap = array(
|
||||
'requete' => $params,
|
||||
'reponse' => $reponse,
|
||||
);
|
||||
$this->view->assign('soap', $soap);
|
||||
$xml = array(
|
||||
'requete' => $client->getLastRequest(),
|
||||
'reponse' => $client->getLastResponse()
|
||||
);
|
||||
$this->view->assign('xml', $xml);
|
||||
} else {
|
||||
$this->_forward('method', 'demo', null, array('name'=> 'getIdentite'));
|
||||
}
|
||||
}
|
||||
$method = $formData['method'];
|
||||
$class = 'Scores_Ws_Form_'.ucfirst($method);
|
||||
if (class_exists($class)) {
|
||||
$form = new $class;
|
||||
if ($form->isValid($formData)) {
|
||||
$method = $formData['method'];
|
||||
$siret = $formData['siret'];
|
||||
$accesWs = $this->methods[$method]['ws'];
|
||||
$hostName = $this->getRequest()->getHttpHost();
|
||||
$options = array(
|
||||
'login' => $this->_username,
|
||||
'password' => $this->_hash,
|
||||
'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS
|
||||
);
|
||||
$client = new Zend_Soap_Client('http://'.$hostName.'/'.$accesWs, $options);
|
||||
$params = new StdClass();
|
||||
$params->siret = $siret;
|
||||
try {
|
||||
$reponse = $client->getIdentite($params);
|
||||
} catch (Zend_Soap_Client_Exception $e) {
|
||||
$reponse = $e->getMessage();
|
||||
}
|
||||
$soap = array(
|
||||
'requete' => $params,
|
||||
'reponse' => $reponse,
|
||||
);
|
||||
$this->view->assign('soap',$soap);
|
||||
$xml = array(
|
||||
'requete' => $client->getLastRequest(),
|
||||
'reponse' => $client->getLastResponse()
|
||||
);
|
||||
$this->view->assign('xml',$xml);
|
||||
} else {
|
||||
$this->_forward('method', 'demo', null, array('name'=> 'getIdentite'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,188 +2,188 @@
|
||||
class DocumentationController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
/**
|
||||
/**
|
||||
* Affichage de la documentation des webservices
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
//Do nothing
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des services
|
||||
*/
|
||||
public function servicesAction()
|
||||
{
|
||||
}
|
||||
public function servicesAction()
|
||||
{
|
||||
|
||||
/**
|
||||
* Liste des version par service
|
||||
*/
|
||||
public function servicevAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$name = $request->getParam('name');
|
||||
}
|
||||
|
||||
$this->view->key = $name;
|
||||
}
|
||||
/**
|
||||
* Liste des version par service
|
||||
*/
|
||||
public function servicevAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$name = $request->getParam('name');
|
||||
|
||||
public function serviceAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type', 'sd');
|
||||
$ws = strtolower($request->getParam('name', 'entreprise'));
|
||||
$this->view->key = $name;
|
||||
}
|
||||
|
||||
$myService = $this->view->WsServices[$ws];
|
||||
public function serviceAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type', 'sd');
|
||||
$ws = strtolower($request->getParam('name','entreprise'));
|
||||
|
||||
// Gestion des versions
|
||||
$serviceVersions = array();
|
||||
$configServiceVersions = $myService['versions'];
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', $defautVersion);
|
||||
// Gestion des versions
|
||||
$serviceVersions = array();
|
||||
$configServiceVersions = $this->view->WsServices[$ws]['versions'];
|
||||
foreach( $configServiceVersions as $section => $params ){
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', $defautVersion);
|
||||
|
||||
$this->view->assign('serviceName', $myService['name']);
|
||||
$this->view->assign('serviceVersion', $version);
|
||||
$this->view->assign('serviceName', $this->view->WsServices[$ws]['name']);
|
||||
$this->view->assign('serviceVersion', $version);
|
||||
|
||||
$isDeprecated = false;
|
||||
if ($myService['versions'][$version]['defaut'] == '') {
|
||||
$isDeprecated = true;
|
||||
}
|
||||
$this->view->assign('isDeprecated', $isDeprecated);
|
||||
if ( $type == 'client') {
|
||||
$client = $ws;
|
||||
$ws = 'entreprise';
|
||||
}
|
||||
|
||||
if ($type == 'client') {
|
||||
$client = $ws;
|
||||
$ws = 'entreprise';
|
||||
}
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
if ( $type == 'client') {
|
||||
$pathClassService = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/';
|
||||
} else {
|
||||
$pathClassService = 'WsScore/'.ucfirst($ws).'/v'.$version.'/';
|
||||
}
|
||||
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
if ($type == 'client') {
|
||||
$pathClassService = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/';
|
||||
} else {
|
||||
$pathClassService = 'WsScore/'.ucfirst($ws).'/v'.$version.'/';
|
||||
}
|
||||
//Génération du tableau de mapping
|
||||
$classmap = include $pathClassService.'Config.php';
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$classmap = include $pathClassService.'Config.php';
|
||||
//Définir l'url d'accès au WSDL
|
||||
$wsdl_url = $this->view->baseUrl();
|
||||
if ( $type == 'client') {
|
||||
$wsdl_url.= '/clients/'.$client.'/v'.$version;
|
||||
} else {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version;
|
||||
}
|
||||
if (APPLICATION_ENV == 'production'){
|
||||
$wsdl_url.= '?wsdl';
|
||||
} else {
|
||||
$wsdl_url.= '?wsdl-auto';
|
||||
}
|
||||
|
||||
//Définir l'url d'accès au WSDL
|
||||
$wsdl_url = $this->view->baseUrl();
|
||||
if ($type == 'client') {
|
||||
$wsdl_url.= '/clients/'.$client.'/v'.$version;
|
||||
} else {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version;
|
||||
}
|
||||
if (APPLICATION_ENV == 'production') {
|
||||
$wsdl_url.= '?wsdl';
|
||||
} else {
|
||||
$wsdl_url.= '?wsdl-auto';
|
||||
}
|
||||
// Affichage de la documentation
|
||||
$doc = new Scores_Ws_Doc(ucfirst($ws), $classmap, $pathClassService);
|
||||
$tabServiceMethods = $doc->getServiceMethods();
|
||||
// Tri des méthodes par ordre alphabétique
|
||||
$tabServiceMethodsK = array();
|
||||
foreach($tabServiceMethods as $method) {
|
||||
$tabServiceMethodsK[$method['name']] = $method;
|
||||
}
|
||||
ksort($tabServiceMethodsK);
|
||||
$tabServiceTypes = $doc->getServiceTypes();
|
||||
|
||||
// Affichage de la documentation
|
||||
$doc = new Scores_Ws_Doc(ucfirst($ws), $classmap, $pathClassService);
|
||||
$tabServiceMethods = $doc->getServiceMethods();
|
||||
// Tri des méthodes par ordre alphabétique
|
||||
$tabServiceMethodsK = array();
|
||||
foreach ($tabServiceMethods as $method) {
|
||||
$tabServiceMethodsK[$method['name']] = $method;
|
||||
}
|
||||
ksort($tabServiceMethodsK);
|
||||
$tabServiceTypes = $doc->getServiceTypes();
|
||||
|
||||
$this->view->assign('wsdl', $wsdl_url);
|
||||
$this->view->assign('serviceMethods', $tabServiceMethodsK);
|
||||
$this->view->assign('serviceTypes', $tabServiceTypes);
|
||||
}
|
||||
$this->view->assign('wsdl', $wsdl_url);
|
||||
$this->view->assign('serviceMethods', $tabServiceMethodsK);
|
||||
$this->view->assign('serviceTypes', $tabServiceTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les exemples de code disponible pour chaque méthode
|
||||
*/
|
||||
public function exemplesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$ws = strtolower($request->getParam('ws', 'Entreprise'));
|
||||
$auth = Zend_Auth::getInstance();
|
||||
public function exemplesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$ws = strtolower($request->getParam('ws','Entreprise'));
|
||||
$auth = Zend_Auth::getInstance();
|
||||
|
||||
//Si client possède un webservice particulier alors on redirige vers la doc clients
|
||||
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ($clients as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$wsClients[$params['idClient']] = $section;
|
||||
}
|
||||
}
|
||||
//Si client possède un webservice particulier alors on redirige vers la doc clients
|
||||
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach( $clients as $section => $params ){
|
||||
if ($params['actif']) {
|
||||
$wsClients[$params['idClient']] = $section;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists($auth->getIdentity()->idClient, $wsClients)) {
|
||||
$this->_forward('clients', 'documentation', null, array(
|
||||
'nom' => $wsClients[$auth->getIdentity()->idClient]
|
||||
));
|
||||
} else {
|
||||
if (array_key_exists($auth->getIdentity()->idClient, $wsClients)){
|
||||
|
||||
// Liste des webservices
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach ($services as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
$this->_forward('clients', 'documentation', null, array(
|
||||
'nom' => $wsClients[$auth->getIdentity()->idClient]
|
||||
));
|
||||
|
||||
// On vérifie que l'utilisateur peut accèder à la documentation
|
||||
$username = $auth->getIdentity()->username;
|
||||
$idClient = $auth->getIdentity()->idClient;
|
||||
if (array_key_exists($ws, $wsServices)) {
|
||||
if (isset($wsServices['idClient']) && $idClient!=$wsServices['idClient']) {
|
||||
$this->renderScript('documentation/nodoc.phtml');
|
||||
exit;
|
||||
}
|
||||
if (isset($wsServices['user']) && !in_array($username, $wsServices['user'])) {
|
||||
$this->renderScript('documentation/nodoc.phtml');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Gestion des versions
|
||||
$serviceVersions = array();
|
||||
$configServiceVersions = $wsServices[$ws]['versions'];
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', $defautVersion);
|
||||
// Liste des webservices
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach( $services as $section => $params )
|
||||
{
|
||||
if ($params['actif']) {
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
$pathClassService = 'WsScore/'.ucfirst($ws).'/v'.$version.'/';
|
||||
// On vérifie que l'utilisateur peut accèder à la documentation
|
||||
$username = $auth->getIdentity()->username;
|
||||
$idClient = $auth->getIdentity()->idClient;
|
||||
if ( array_key_exists($ws, $wsServices) )
|
||||
{
|
||||
if ( isset($wsServices['idClient']) && $idClient!=$wsServices['idClient'] )
|
||||
{
|
||||
$this->renderScript('documentation/nodoc.phtml');
|
||||
exit;
|
||||
}
|
||||
if ( isset($wsServices['user']) && !in_array($username, $wsServices['user']) )
|
||||
{
|
||||
$this->renderScript('documentation/nodoc.phtml');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$classmap = include $pathClassService.'Config.php';
|
||||
// Gestion des versions
|
||||
$serviceVersions = array();
|
||||
$configServiceVersions = $wsServices[$ws]['versions'];
|
||||
foreach( $configServiceVersions as $section => $params ){
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', $defautVersion);
|
||||
|
||||
//Définir l'url d'accès au WSDL
|
||||
$wsdl_url = $this->view->baseUrl();
|
||||
if (APPLICATION_ENV == 'production') {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version.'?wsdl';
|
||||
} else {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version.'?wsdl-auto';
|
||||
}
|
||||
// Affichage de la documentation
|
||||
$doc = new Scores_Ws_Doc(ucfirst($ws), $classmap, $pathClassService);
|
||||
$tabServiceMethods = $doc->getServiceMethods();
|
||||
// Tri des méthodes par ordre alphabétique
|
||||
$tabServiceMethodsK = array();
|
||||
foreach ($tabServiceMethods as $method) {
|
||||
$tabServiceMethodsK[$method['name']] = $method;
|
||||
}
|
||||
ksort($tabServiceMethodsK);
|
||||
$tabServiceTypes = $doc->getServiceTypes();
|
||||
$this->view->assign('wsdl', $wsdl_url);
|
||||
$this->view->assign('serviceMethods', $tabServiceMethodsK);
|
||||
$this->view->assign('serviceTypes', $tabServiceTypes);
|
||||
}
|
||||
}
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
$pathClassService = 'WsScore/'.ucfirst($ws).'/v'.$version.'/';
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$classmap = include $pathClassService.'Config.php';
|
||||
|
||||
//Définir l'url d'accès au WSDL
|
||||
$wsdl_url = $this->view->baseUrl();
|
||||
if (APPLICATION_ENV == 'production'){
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version.'?wsdl';
|
||||
} else {
|
||||
$wsdl_url.= '/'.$ws.'/v'.$version.'?wsdl-auto';
|
||||
}
|
||||
// Affichage de la documentation
|
||||
$doc = new Scores_Ws_Doc(ucfirst($ws), $classmap, $pathClassService);
|
||||
$tabServiceMethods = $doc->getServiceMethods();
|
||||
// Tri des méthodes par ordre alphabétique
|
||||
$tabServiceMethodsK = array();
|
||||
foreach($tabServiceMethods as $method) {
|
||||
$tabServiceMethodsK[$method['name']] = $method;
|
||||
}
|
||||
ksort($tabServiceMethodsK);
|
||||
$tabServiceTypes = $doc->getServiceTypes();
|
||||
$this->view->assign('wsdl', $wsdl_url);
|
||||
$this->view->assign('serviceMethods', $tabServiceMethodsK);
|
||||
$this->view->assign('serviceTypes', $tabServiceTypes);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Affichage exemple de code avec coloration syntaxique
|
||||
@ -192,23 +192,24 @@ class DocumentationController extends Zend_Controller_Action
|
||||
*/
|
||||
public function codeAction()
|
||||
{
|
||||
$langage = strtolower($this->_getParam('langage', ''));
|
||||
$element = $this->_getParam('element', '');
|
||||
$langage = strtolower($this->_getParam('langage',''));
|
||||
$element = $this->_getParam('element','');
|
||||
|
||||
$fichier = APPLICATION_PATH . '/../public/assets/code/' . $element . '-' . $langage . '.txt';
|
||||
if (file_exists($fichier)) {
|
||||
$sourceCode = file_get_contents($fichier);
|
||||
$fichier = APPLICATION_PATH . '/../public/assets/code/' . $element . '-' . $langage . '.txt';
|
||||
if (file_exists($fichier)){
|
||||
$sourceCode = file_get_contents($fichier);
|
||||
|
||||
$geshi = new GeSHi($sourceCode, $langage);
|
||||
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
||||
$sourceHighlight = $geshi->parse_code();
|
||||
require_once 'Vendors/geshi/geshi.php';
|
||||
$geshi = new GeSHi($sourceCode, $langage);
|
||||
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
||||
$sourceHighlight = $geshi->parse_code();
|
||||
|
||||
$this->view->assign('langage', strtoupper($langage));
|
||||
$this->view->assign('code', $sourceHighlight);
|
||||
} else {
|
||||
$this->view->assign('langage',
|
||||
'Element non traités, Vous pouvez aussi nous fournir des exemples.');
|
||||
}
|
||||
$this->view->assign('langage', strtoupper($langage));
|
||||
$this->view->assign('code', $sourceHighlight);
|
||||
} else {
|
||||
$this->view->assign('langage',
|
||||
'Element non traités, Vous pouvez aussi nous fournir des exemples.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,8 +217,10 @@ class DocumentationController extends Zend_Controller_Action
|
||||
*/
|
||||
public function erreurAction()
|
||||
{
|
||||
$ws = new Scores_Ws_Server();
|
||||
$erreurs = $ws->listError;
|
||||
$this->view->assign('erreurs', $erreurs);
|
||||
require_once 'WsScore/WsScore.php';
|
||||
$ws = new WsScore();
|
||||
$erreurs = $ws->listError;
|
||||
$this->view->assign('erreurs', $erreurs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
class ErrorController extends Zend_Controller_Action
|
||||
{
|
||||
public function errorAction()
|
||||
public function errorAction()
|
||||
{
|
||||
$errors = $this->_getParam('error_handler');
|
||||
|
||||
@ -44,3 +44,4 @@ class ErrorController extends Zend_Controller_Action
|
||||
return $log;
|
||||
}
|
||||
}
|
||||
|
||||
|
20
application/controllers/ExportController.php
Normal file
20
application/controllers/ExportController.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
class ExportController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
echo "Export";
|
||||
}
|
||||
|
||||
protected function checkFile($path)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,261 +1,159 @@
|
||||
<?php
|
||||
class FichierController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
protected $conn;
|
||||
public function init()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
}
|
||||
public function bodaccAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ( $auth->hasIdentity() ) {
|
||||
|
||||
public function bodaccAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$directory = $c->profil->path->shared.'/datafile/bodacc/histo';
|
||||
$directory = '/mnt/bodacc';
|
||||
|
||||
$q = $this->getRequest()->getParam('q');
|
||||
$filename = base64_decode($q);
|
||||
$q = $this->getRequest()->getParam('q');
|
||||
$file = base64_decode($q);
|
||||
|
||||
$file = $directory.'/'.$filename;
|
||||
$output_file = $directory.'/'.$file;
|
||||
|
||||
if (file_exists($file) && filesize($file) > 0) {
|
||||
if (file_exists($output_file) && filesize($output_file)>0) {
|
||||
$content_type = 'application/pdf';
|
||||
header('Content-type: '.$content_type.'');
|
||||
header('Content-Length: '.filesize($output_file));
|
||||
header('Content-MD5: '.base64_encode(md5_file($output_file)));
|
||||
header('Content-Disposition: inline; filename="'.basename($output_file).'"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression','0');
|
||||
echo file_get_contents($output_file);
|
||||
|
||||
//Log de la requete
|
||||
$data = array(
|
||||
'login' => $auth->getIdentity()->username,
|
||||
'idClient' => $auth->getIdentity()->idClient,
|
||||
'page' => 'histobodacc',
|
||||
'siren' => '',
|
||||
'nic' => '',
|
||||
'params' => $file,
|
||||
'test' => 0,
|
||||
'raisonSociale' => '',
|
||||
'cp' => '',
|
||||
'ville' => '',
|
||||
'ipClient' => $_SERVER['REMOTE_ADDR'],
|
||||
);
|
||||
$this->conn->insert('sdv1.logs', $data);
|
||||
//Log de la requete
|
||||
$tabInsert = array(
|
||||
'login' => $auth->getIdentity()->username,
|
||||
'idClient' => $auth->getIdentity()->idClient,
|
||||
'page' => 'histobodacc',
|
||||
'siren' => '',
|
||||
'nic' => '',
|
||||
'params' => $file,
|
||||
'test' => 0,
|
||||
'raisonSociale' => '',
|
||||
'cp' => '',
|
||||
'ville' => '',
|
||||
'ipClient' => $_SERVER['REMOTE_ADDR'],
|
||||
);
|
||||
require_once 'framework/common/mysql.php';
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->insert('logs', array_merge($tabInsert,$tabRdvInsee), false, true);
|
||||
|
||||
$content_type = 'application/pdf';
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo "Erreur lors de l'affichage du fichier.";
|
||||
}
|
||||
} else {
|
||||
echo "Authentification échoué.";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "Erreur lors de l'affichage du fichier.";
|
||||
}
|
||||
} else {
|
||||
echo "Authentification échoué.";
|
||||
}
|
||||
}
|
||||
|
||||
public function logsAction()
|
||||
{
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/'.$filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
public function logsAction()
|
||||
{
|
||||
$file = $this->getRequest()->getParam('fichier');
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = APPLICATION_PATH . '/../data/files/';
|
||||
//Envoi du fichier sur la sortie standard
|
||||
if ( file_exists($path.$file) ) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($path.$file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="' . basename($path.$file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo file_get_contents($path.$file);
|
||||
}
|
||||
}
|
||||
|
||||
public function csvAction()
|
||||
{
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/'. $filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
public function csvAction()
|
||||
{
|
||||
$file = $this->getRequest()->getParam('fichier');
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = APPLICATION_PATH . '/../data/files/';
|
||||
//Envoi du fichier sur la sortie standard
|
||||
if ( file_exists($path.$file) ) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($path.$file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="' . basename($path.$file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo file_get_contents($path.$file);
|
||||
}
|
||||
}
|
||||
|
||||
public function kbisAction()
|
||||
{
|
||||
$content_type = 'application/pdf';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = realpath($c->profil->path->shared).'/datafile/kbis/'.$filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
public function kbisAction()
|
||||
{
|
||||
$file = $this->getRequest()->getParam('fichier');
|
||||
$content_type = 'application/pdf';
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = realpath($c->profil->path->secure).'/kbis/';
|
||||
//Envoi du fichier sur la sortie standard
|
||||
if ( file_exists($path.$file) ) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($path.$file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="' . basename($path.$file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo file_get_contents($path.$file);
|
||||
}
|
||||
}
|
||||
|
||||
public function associationsAction()
|
||||
{
|
||||
$content_type = 'application/pdf';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/' . $filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
public function associationsAction()
|
||||
{
|
||||
$file = $this->getRequest()->getParam('fichier');
|
||||
$content_type = 'application/pdf';
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = APPLICATION_PATH . '/../data/files/associations/';
|
||||
//Envoi du fichier sur la sortie standard
|
||||
if ( file_exists($path.$file) ) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($path.$file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="' . basename($path.$file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo file_get_contents($path.$file);
|
||||
}
|
||||
}
|
||||
|
||||
public function greffesAction()
|
||||
{
|
||||
$content_type = 'application/pdf';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/' .$filename;
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
public function greffesAction()
|
||||
{
|
||||
$file = $this->getRequest()->getParam('fichier');
|
||||
$content_type = 'application/pdf';
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = APPLICATION_PATH . '/../data/files/greffes/';
|
||||
//Envoi du fichier sur la sortie standard
|
||||
if ( file_exists($path.$file) ) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($path.$file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="' . basename($path.$file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo file_get_contents($path.$file);
|
||||
}
|
||||
}
|
||||
|
||||
public function crmAction()
|
||||
{
|
||||
$content_type = 'application/x-bzip';
|
||||
$filename = $this->getRequest()->getParam('fichier');
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->shared . '/files/' .$filename;
|
||||
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
if (file_exists($file)) {
|
||||
$modules = array(); //apache_get_modules();
|
||||
if (in_array('mod_xsendfile', $modules)) {
|
||||
header('X-Sendfile: ' . $file);
|
||||
header('Content-Type: ' . $content_type);
|
||||
header('Content-Disposition: inline; filename="' . $content_type . '"');
|
||||
exit;
|
||||
} else {
|
||||
ini_set('zlib.output_compression', '0');
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-Type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($file)));
|
||||
header('Content-Disposition: inline; filename="' . basename($file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
78
application/controllers/ImportController.php
Normal file
78
application/controllers/ImportController.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
class ImportController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function fileformAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$this->view->inlineScript()->appendFile('/scripts/jquery.form.js');
|
||||
$this->view->inlineScript()->appendFile('/scripts/jqueryprogressbar.js');
|
||||
|
||||
$this->view->assign('filesize', ini_get('upload_max_filesize'));
|
||||
|
||||
$request = $this->getRequest();
|
||||
$idClient = $request->getParam('idClient', null);
|
||||
$login = $request->getParam('login', null);
|
||||
|
||||
$this->view->assign('idClient', $idClient);
|
||||
$this->view->assign('login', $login);
|
||||
}
|
||||
|
||||
public function fileuploadAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$idClient = $request->getParam('idClient');
|
||||
$login = $request->getParam('login');
|
||||
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
||||
$path = realpath($config->data).'/validation';
|
||||
if(!file_exists($path)) mkdir($path);
|
||||
|
||||
if ( isset($_FILES) && count($_FILES)==1 ){
|
||||
$n = $_FILES['fichier']['name'];
|
||||
$s = $_FILES['fichier']['size'];
|
||||
$tmp_name = $_FILES['fichier']['tmp_name'];
|
||||
|
||||
$extValide = array('csv');
|
||||
$extension = strrchr($n,'.');
|
||||
$extension = substr($extension,1);
|
||||
//Vérifier l'extension du fichier
|
||||
if(!in_array($extension, $extValide)){
|
||||
echo "Extension de fichier incorrect !";
|
||||
} elseif (move_uploaded_file($tmp_name, $path.'/'.$idClient.'-'.$name.'.'.$extension)){
|
||||
echo "Fichier envoyé, <a href=\"".
|
||||
$this->view->url(array(
|
||||
'controller' => 'import',
|
||||
'action' => 'checkfile',
|
||||
'file' => $idClient.'-'.$name.'.'.$extension,
|
||||
))."\">Vérifier le format</a>";
|
||||
} else {
|
||||
echo "Erreur : ".$_FILES['fichier']['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Etat de progression de l'upload du fichier
|
||||
*/
|
||||
public function fileprogressAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key', '');
|
||||
if (!empty($key)) {
|
||||
//$rep sera égal à false si la clef n'existe pas dans le cache apc
|
||||
$rep = apc_fetch('upload_'.$key);
|
||||
echo json_encode($rep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -3,13 +3,12 @@ class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function contactAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function aboutAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,106 +1,108 @@
|
||||
<?php
|
||||
class JsonrpcController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
//Nom du service
|
||||
$serviceName = strtolower($request->getParam('service', 'Entreprise'));
|
||||
|
||||
//Service spécifique client
|
||||
if ($serviceName == 'clients') {
|
||||
$client = $request->getParam('client', '');
|
||||
//Liste des clients
|
||||
$clients = array();
|
||||
$listeClients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ($listeClients as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$clients[] = $section;
|
||||
}
|
||||
}
|
||||
if (!in_array($client, $clients)) {
|
||||
echo 'Service clients introuvable !';
|
||||
exit;
|
||||
}
|
||||
$configServiceVersions = $clients[$client]['versions'];
|
||||
} else {
|
||||
//Service versions
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
$configServiceVersions = $services[$serviceName]['versions'];
|
||||
}
|
||||
|
||||
//Liste des versions
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', 'v'.$defautVersion);
|
||||
$version = substr($version, 1);
|
||||
|
||||
// Version inexistante
|
||||
if (!array_key_exists($version, $serviceVersions)) {
|
||||
echo "Version inexistante.";
|
||||
exit;
|
||||
}
|
||||
// Version désactivé
|
||||
if (!$serviceVersions[$version]['actif']) {
|
||||
echo "Version désactivée.";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
if ($serviceName == 'clients') {
|
||||
$pathServiceClassIni = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/Entreprise.ini';
|
||||
$pathServiceClassPhp = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/Entreprise.php';
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl-auto';
|
||||
//On redéfini le nom du service
|
||||
$serviceName = 'Entreprise';
|
||||
$fichierWsdl = ucfirst($client).'-'.$serviceName.'-'.$version.'.wsdl';
|
||||
} else {
|
||||
$pathServiceClassIni = 'WsScore/'.ucfirst($serviceName).'/v'.$version.'/'.ucfirst($serviceName).'.ini';
|
||||
$pathServiceClassPhp = 'WsScore/'.ucfirst($serviceName).'/v'.$version.'/'.ucfirst($serviceName).'.php';
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl-auto';
|
||||
$fichierWsdl = ucfirst($serviceName).'-'.$version.'.wsdl';
|
||||
}
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$wsConfig = new Zend_Config_Ini($pathServiceClassIni);
|
||||
foreach ($wsConfig->Type->toArray() as $Type) {
|
||||
$classmap[$Type] = $Type;
|
||||
}
|
||||
|
||||
//Inclusion des classes de données
|
||||
require_once $pathServiceClassPhp;
|
||||
|
||||
// Instance du server
|
||||
$server = new Zend_Json_Server();
|
||||
// Define class name
|
||||
$server->setClass(ucfirst($serviceName));
|
||||
|
||||
// Gestion du SMD
|
||||
if ($this->getRequest()->isGet()) {
|
||||
// Indiquer URL endpoint
|
||||
//$this->getHelper('url')->url(array('controller'=>'', 'action'=>'' ));
|
||||
$server->setTarget('/jsonrpc/'.$serviceName.'/'.$version.'/')
|
||||
->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2);
|
||||
// Grab the SMD
|
||||
$smd = $server->getServiceMap();
|
||||
|
||||
//Return the SMD to the client
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: application/json');
|
||||
}
|
||||
echo $smd;
|
||||
return;
|
||||
} else {
|
||||
$server->setAutoEmitResponse(true);
|
||||
$server->handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
$request = $this->getRequest();
|
||||
|
||||
//Nom du service
|
||||
$serviceName = strtolower($request->getParam('service', 'Entreprise'));
|
||||
|
||||
//Service spécifique client
|
||||
if ($serviceName == 'clients') {
|
||||
$client = $request->getParam('client', '');
|
||||
//Liste des clients
|
||||
$clients = array();
|
||||
$listeClients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ( $listeClients as $section => $params ) {
|
||||
if ($params['actif']){
|
||||
$clients[] = $section;
|
||||
}
|
||||
}
|
||||
if (!in_array($client, $clients)){
|
||||
echo 'Service clients introuvable !';
|
||||
exit;
|
||||
}
|
||||
$configServiceVersions = $clients[$client]['versions'];
|
||||
}
|
||||
else
|
||||
{
|
||||
//Service versions
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
$configServiceVersions = $services[$serviceName]['versions'];
|
||||
}
|
||||
|
||||
//Liste des versions
|
||||
foreach( $configServiceVersions as $section => $params ) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', 'v'.$defautVersion);
|
||||
$version = substr($version, 1);
|
||||
|
||||
// Version inexistante
|
||||
if ( !array_key_exists($version, $serviceVersions) ) {
|
||||
echo "Version inexistante.";
|
||||
exit;
|
||||
}
|
||||
// Version désactivé
|
||||
if ( !$serviceVersions[$version]['actif'] ) {
|
||||
echo "Version désactivée.";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
if ($serviceName == 'clients') {
|
||||
$pathServiceClassIni = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/Entreprise.ini';
|
||||
$pathServiceClassPhp = 'WsScore/Clients/'.ucfirst($client).'/v'.$version.'/Entreprise.php';
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl-auto';
|
||||
//On redéfini le nom du service
|
||||
$serviceName = 'Entreprise';
|
||||
$fichierWsdl = ucfirst($client).'-'.$serviceName.'-'.$version.'.wsdl';
|
||||
} else {
|
||||
$pathServiceClassIni = 'WsScore/'.ucfirst($serviceName).'/v'.$version.'/'.ucfirst($serviceName).'.ini';
|
||||
$pathServiceClassPhp = 'WsScore/'.ucfirst($serviceName).'/v'.$version.'/'.ucfirst($serviceName).'.php';
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl-auto';
|
||||
$fichierWsdl = ucfirst($serviceName).'-'.$version.'.wsdl';
|
||||
}
|
||||
|
||||
//Génération du tableau de mapping
|
||||
$wsConfig = new Zend_Config_Ini($pathServiceClassIni);
|
||||
foreach($wsConfig->Type->toArray() as $Type){
|
||||
$classmap[$Type] = $Type;
|
||||
}
|
||||
|
||||
//Inclusion des classes de données
|
||||
require_once $pathServiceClassPhp;
|
||||
|
||||
// Instance du server
|
||||
$server = new Zend_Json_Server();
|
||||
// Define class name
|
||||
$server->setClass(ucfirst($serviceName));
|
||||
|
||||
// Gestion du SMD
|
||||
if($this->getRequest()->isGet()){
|
||||
// Indiquer URL endpoint
|
||||
//$this->getHelper('url')->url(array('controller'=>'', 'action'=>'' ));
|
||||
$server->setTarget('/jsonrpc/'.$serviceName.'/'.$version.'/')
|
||||
->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2);
|
||||
// Grab the SMD
|
||||
$smd = $server->getServiceMap();
|
||||
|
||||
//Return the SMD to the client
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: application/json');
|
||||
}
|
||||
echo $smd;
|
||||
return;
|
||||
} else {
|
||||
$server->setAutoEmitResponse(true);
|
||||
$server->handle();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,128 +1,119 @@
|
||||
<?php
|
||||
use League\Csv\Writer;
|
||||
|
||||
class RefController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
//Ne fait rien...
|
||||
}
|
||||
public function indexAction ()
|
||||
{
|
||||
//Ne fait rien...
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne accès au fichier
|
||||
*/
|
||||
public function fichierAction()
|
||||
{
|
||||
//Lecture du nom du fichier
|
||||
$fichier = $this->_getParam('q', '');
|
||||
$fichier = $fichier . '.csv';
|
||||
if (!empty($fichier) && file_exists('fichiers/'.$fichier)) {
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
/**
|
||||
* Donne accès au fichier
|
||||
*/
|
||||
public function fichierAction ()
|
||||
{
|
||||
//Lecture du nom du fichier
|
||||
$fichier = $this->_getParam('q','');
|
||||
$fichier = $fichier . '.csv';
|
||||
if (!empty($fichier) && file_exists('fichiers/'.$fichier))
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
list($nomFichier, $extFichier) = explode('.', $fichier);
|
||||
//Distribution du fichier sur la sortie standard
|
||||
switch ($extFichier) {
|
||||
case 'png': $content_type = 'image/png'; break;
|
||||
case 'gif': $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg': $content_type = 'image/jpeg'; break;
|
||||
case 'pdf': $content_type = 'application/pdf'; break;
|
||||
case 'csv': $content_type = 'application/csv-tab-delimited-table'; break;
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Type', $content_type);
|
||||
$contentDisposition = 'attachment';
|
||||
switch ($contentDisposition) {
|
||||
case 'inline':
|
||||
$this->getResponse()->setHeader('Content-Disposition', 'inline');
|
||||
break;
|
||||
case 'attachment':
|
||||
$this->getResponse()->setHeader('Content-Disposition', "attachment; filename=\"$fichier\"");
|
||||
break;
|
||||
}
|
||||
list($nomFichier, $extFichier) = explode('.',$fichier);
|
||||
//Distribution du fichier sur la sortie standard
|
||||
switch ($extFichier) {
|
||||
case 'png' : $content_type = 'image/png'; break;
|
||||
case 'gif' : $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg' : $content_type = 'image/jpeg'; break;
|
||||
case 'pdf' : $content_type = 'application/pdf'; break;
|
||||
case 'csv' : $content_type = 'application/csv-tab-delimited-table'; break;
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Type', $content_type);
|
||||
$contentDisposition = 'attachment';
|
||||
switch ($contentDisposition) {
|
||||
case 'inline':
|
||||
$this->getResponse()->setHeader('Content-Disposition', 'inline');
|
||||
break;
|
||||
case 'attachment':
|
||||
$this->getResponse()->setHeader('Content-Disposition', "attachment; filename=\"$fichier\"");
|
||||
break;
|
||||
}
|
||||
|
||||
$data = file_get_contents('assets/fichiers/'.$fichier);
|
||||
$data = file_get_contents('assets/fichiers/'.$fichier);
|
||||
|
||||
$this->getResponse()->setHeader('Content-Length', strlen($data))
|
||||
->setHeader('Cache-Control', 'private, max-age=0, must-revalidate')
|
||||
->setHeader('Pragma', 'public')
|
||||
->setBody($data);
|
||||
} else {
|
||||
$this->view->assign('message', 'Fichier introuvable !');
|
||||
}
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Length', strlen($data))
|
||||
->setHeader('Cache-Control', 'private, max-age=0, must-revalidate')
|
||||
->setHeader('Pragma', 'public')
|
||||
->setBody($data);
|
||||
} else {
|
||||
$this->view->assign('message', 'Fichier introuvable !');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne accès aux données contenues dans une table de base de données
|
||||
*/
|
||||
public function tableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$requetesql = $request->getParam('q', '');
|
||||
$fichierCsv = $requetesql.'.csv';
|
||||
$fichierSql = $requetesql.'.sql';
|
||||
/**
|
||||
* Donne accès aux données contenues dans une table de base de données
|
||||
*/
|
||||
public function tableAction ()
|
||||
{
|
||||
$requetesql = $this->_getParam('q','');
|
||||
$fichierCsv = $requetesql.'.csv';
|
||||
$fichierSql = $requetesql.'.sql';
|
||||
|
||||
//Emplacement des fichiers générés - lien symbolique en PRODUCTION
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = $c->profil->path->shared . '/files/fichiers/';
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path);
|
||||
}
|
||||
if (!empty($requetesql)) {
|
||||
if (!file_exists($path . $fichierCsv)) {
|
||||
if (file_exists('assets/sql/'.$fichierSql)) {
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection $conn
|
||||
*/
|
||||
$conn = Zend_Registry::get('doctrine');
|
||||
$sql = file_get_contents('assets/sql/'.$fichierSql);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->setFetchMode(\PDO::FETCH_ASSOC);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$csv = Writer::createFromPath($path . $fichierCsv.'.tmp', 'w');
|
||||
$csv->setNewline("\r\n");
|
||||
$headers = array_keys($stmt->fetch());
|
||||
$csv->insertOne($headers);
|
||||
$csv->insertAll($stmt);
|
||||
}
|
||||
rename($path . $fichierCsv.'.tmp', $path . $fichierCsv);
|
||||
}
|
||||
}
|
||||
//Emplacement des fichiers générés - lien symbolique en PRODUCTION
|
||||
$path = DOC_WEB_LOCAL . 'fichiers/';
|
||||
if (!is_dir($path)) { mkdir($path); }
|
||||
if (!empty($requetesql))
|
||||
{
|
||||
if (!file_exists($path . $fichierCsv))
|
||||
{
|
||||
if (file_exists('assets/sql/'.$fichierSql))
|
||||
{
|
||||
//Connexion mysql
|
||||
$sql = file_get_contents('assets/sql/'.$fichierSql);
|
||||
require_once 'framework/common/mysql.php';
|
||||
$db = new WDB();
|
||||
$db->exportCSV($sql, $path . $fichierCsv, ',', "\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($path . $fichierCsv)) {
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
//Distribution du fichier sur la sortie standard
|
||||
list($nomFichier, $extFichier) = explode('.', $fichierCsv);
|
||||
switch ($extFichier) {
|
||||
case 'png': $content_type = 'image/png'; break;
|
||||
case 'gif': $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg': $content_type = 'image/jpeg'; break;
|
||||
case 'pdf': $content_type = 'application/pdf'; break;
|
||||
case 'csv': $content_type = 'application/csv-tab-delimited-table'; break;
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Type', $content_type);
|
||||
$contentDisposition = 'attachment';
|
||||
switch ($contentDisposition) {
|
||||
case 'inline':
|
||||
$this->getResponse()->setHeader('Content-Disposition', 'inline');
|
||||
break;
|
||||
case 'attachment':
|
||||
$this->getResponse()->setHeader('Content-Disposition', "attachment; filename=\"$fichierCsv\"");
|
||||
break;
|
||||
}
|
||||
if (file_exists($path . $fichierCsv))
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
//Distribution du fichier sur la sortie standard
|
||||
list($nomFichier, $extFichier) = explode('.',$fichierCsv);
|
||||
switch ($extFichier)
|
||||
{
|
||||
case 'png' : $content_type = 'image/png'; break;
|
||||
case 'gif' : $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg' : $content_type = 'image/jpeg'; break;
|
||||
case 'pdf' : $content_type = 'application/pdf'; break;
|
||||
case 'csv' : $content_type = 'application/csv-tab-delimited-table'; break;
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Type', $content_type);
|
||||
$contentDisposition = 'attachment';
|
||||
switch ($contentDisposition)
|
||||
{
|
||||
case 'inline':
|
||||
$this->getResponse()->setHeader('Content-Disposition', 'inline');
|
||||
break;
|
||||
case 'attachment':
|
||||
$this->getResponse()->setHeader('Content-Disposition', "attachment; filename=\"$fichierCsv\"");
|
||||
break;
|
||||
}
|
||||
|
||||
$data = file_get_contents($path . $fichierCsv);
|
||||
$data = file_get_contents($path . $fichierCsv);
|
||||
|
||||
$this->getResponse()->setHeader('Content-Length', strlen($data))
|
||||
->setHeader('Cache-Control', 'private, max-age=0, must-revalidate')
|
||||
->setHeader('Pragma', 'public')
|
||||
->setBody($data);
|
||||
}
|
||||
} else {
|
||||
$this->view->assign('message', 'Paramètres incorrects !');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->getResponse()->setHeader('Content-Length', strlen($data))
|
||||
->setHeader('Cache-Control', 'private, max-age=0, must-revalidate')
|
||||
->setHeader('Pragma', 'public')
|
||||
->setBody($data);
|
||||
}
|
||||
} else {
|
||||
$this->view->assign('message', 'Paramètres incorrects !');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -7,196 +7,172 @@ class ServiceController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Be sure we don't make any render
|
||||
*/
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$request = $this->getRequest();
|
||||
|
||||
// --- Get the service name, make sure the string is in lower case
|
||||
$serviceName = strtolower($request->getParam('service', 'Entreprise'));
|
||||
//Get the service name, make sure the string is in lower case
|
||||
$serviceName = strtolower($request->getParam('service', 'Entreprise'));
|
||||
|
||||
// --- ClassName and Directory with first letter capitalized
|
||||
$serviceClassName = ucfirst($serviceName);
|
||||
//ClassName and Directory with first letter capitalized
|
||||
$serviceClassName = ucfirst($serviceName);
|
||||
|
||||
// --- Customize service for customers
|
||||
if ('clients' == $serviceName) {
|
||||
$client = strtolower($request->getParam('client', ''));
|
||||
$clientClassName = ucfirst($client);
|
||||
// --- Get list of customers
|
||||
$clients = array();
|
||||
$listeClients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ($listeClients as $section => $params) {
|
||||
if ($params['actif']) {
|
||||
$clients[$section] = $params;
|
||||
}
|
||||
}
|
||||
if (!array_key_exists($client, $clients)) {
|
||||
echo 'Service clients introuvable !';
|
||||
exit;
|
||||
}
|
||||
$configServiceVersions = $clients[$client]['versions'];
|
||||
}
|
||||
// --- Service versions
|
||||
else {
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
$configServiceVersions = $services[$serviceName]['versions'];
|
||||
}
|
||||
//Customize service for customers
|
||||
if ('clients' == $serviceName ) {
|
||||
$client = strtolower($request->getParam('client', ''));
|
||||
$clientClassName = ucfirst($client);
|
||||
//Get list of customers
|
||||
$clients = array();
|
||||
$listeClients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach ( $listeClients as $section => $params ){
|
||||
if ($params['actif']) {
|
||||
$clients[$section] = $params;
|
||||
}
|
||||
}
|
||||
if (!array_key_exists($client, $clients)){
|
||||
echo 'Service clients introuvable !';
|
||||
exit;
|
||||
}
|
||||
$configServiceVersions = $clients[$client]['versions'];
|
||||
}
|
||||
else
|
||||
{
|
||||
//Service versions
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
$configServiceVersions = $services[$serviceName]['versions'];
|
||||
}
|
||||
|
||||
// --- Check versions
|
||||
foreach ($configServiceVersions as $section => $params) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', 'v'.$defautVersion);
|
||||
$version = substr($version, 1);
|
||||
// Check versions
|
||||
foreach( $configServiceVersions as $section => $params ) {
|
||||
$serviceVersions[$section] = $params;
|
||||
if ($params['defaut']) {
|
||||
$defautVersion = $section;
|
||||
}
|
||||
}
|
||||
$version = $request->getParam('version', 'v'.$defautVersion);
|
||||
$version = substr($version, 1);
|
||||
|
||||
// --- Version inexistante
|
||||
if (!array_key_exists($version, $serviceVersions)) {
|
||||
echo "Version inexistante.";
|
||||
exit;
|
||||
}
|
||||
// --- Version désactivé
|
||||
if (!$serviceVersions[$version]['actif']) {
|
||||
echo "Version désactivée.";
|
||||
exit;
|
||||
}
|
||||
// Version inexistante
|
||||
if ( !array_key_exists($version, $serviceVersions) ) {
|
||||
echo "Version inexistante.";
|
||||
exit;
|
||||
}
|
||||
// Version désactivé
|
||||
if ( !$serviceVersions[$version]['actif'] ) {
|
||||
echo "Version désactivée.";
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- Charger les classes et les types pour le service suivant la version
|
||||
if ('clients' == $serviceName) {
|
||||
$pathServiceClassIni = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Config.php';
|
||||
$pathServiceClassPhp = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Service.php';
|
||||
// --- Gestion du mode de génération du wsdl
|
||||
if (APPLICATION_ENV == 'development'
|
||||
|| array_key_exists('mode', $serviceVersions[$version])
|
||||
&& $serviceVersions[$version]['mode']=='auto') {
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl-auto';
|
||||
} else {
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl';
|
||||
}
|
||||
$pathServiceUri = 'clients/'.$client.'/v'.$version;
|
||||
// --- On redéfini le nom du service
|
||||
$serviceClassName = 'Entreprise';
|
||||
$fichierWsdl = $clientClassName.'-'.$serviceClassName.'-'.$version.'.wsdl';
|
||||
} else {
|
||||
$pathServiceClassIni = 'WsScore/'.$serviceClassName.'/v'.$version.'/Config.php';
|
||||
$pathServiceClassPhp = 'WsScore/'.$serviceClassName.'/v'.$version.'/Service.php';
|
||||
// --- Gestion du mode de génération du wsdl
|
||||
if (APPLICATION_ENV == 'development'
|
||||
|| array_key_exists('mode', $serviceVersions[$version])
|
||||
&& $serviceVersions[$version]['mode']=='auto') {
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl-auto';
|
||||
} else {
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl';
|
||||
}
|
||||
$pathServiceUri = $serviceName.'/v'.$version;
|
||||
$fichierWsdl = $serviceClassName.'-'.$version.'.wsdl';
|
||||
}
|
||||
// Charger les classes et les types pour le service suivant la version
|
||||
if ('clients' == $serviceName) {
|
||||
|
||||
// --- Get map of WSDL type to PHP Classes
|
||||
$classmap = include $pathServiceClassIni;
|
||||
$pathServiceClassIni = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Config.php';
|
||||
$pathServiceClassPhp = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Entreprise.php';
|
||||
//Gestion du mode de génération du wsdl
|
||||
if ( APPLICATION_ENV == 'development'
|
||||
|| array_key_exists('mode', $serviceVersions[$version])
|
||||
&& $serviceVersions[$version]['mode']=='auto') {
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl-auto';
|
||||
} else {
|
||||
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl';
|
||||
}
|
||||
//On redéfini le nom du service
|
||||
$serviceClassName = 'Entreprise';
|
||||
$fichierWsdl = $clientClassName.'-'.$serviceClassName.'-'.$version.'.wsdl';
|
||||
|
||||
// --- Inclusion des classes de données
|
||||
require_once $pathServiceClassPhp;
|
||||
} else {
|
||||
|
||||
// --- Get hostname - add compatibility with Reverse Proxy
|
||||
$hostName = $request->getHttpHost();
|
||||
$hostScheme = $request->getScheme();
|
||||
$http = new Zend_Controller_Request_Http();
|
||||
$proxyScheme = $http->getHeader('X-Forwarded-Proto');
|
||||
if ($proxyScheme == 'https') {
|
||||
$hostScheme = 'https';
|
||||
}
|
||||
$fichierWsdl = $hostName . '-' . $hostScheme . '-' . $fichierWsdl;
|
||||
$c = Zend_registry::get('config');
|
||||
$wsdlPath = $c->profil->path->shared . '/wsdl';
|
||||
$pathServiceClassIni = 'WsScore/'.$serviceClassName.'/v'.$version.'/Config.php';
|
||||
$pathServiceClassPhp = 'WsScore/'.$serviceClassName.'/v'.$version.'/'.$serviceClassName.'.php';
|
||||
//Gestion du mode de génération du wsdl
|
||||
if ( APPLICATION_ENV == 'development'
|
||||
|| array_key_exists('mode', $serviceVersions[$version])
|
||||
&& $serviceVersions[$version]['mode']=='auto') {
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl-auto';
|
||||
} else {
|
||||
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl';
|
||||
}
|
||||
$fichierWsdl = $serviceClassName.'-'.$version.'.wsdl';
|
||||
|
||||
// --- Fourniture du wsdl
|
||||
if (isset($_GET['wsdl']) && file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/xml');
|
||||
}
|
||||
readfile($wsdlPath . '/' . $fichierWsdl);
|
||||
} elseif (isset($_GET['wsdl']) && !file_exists($wsdlPath . '/' . $fichierWsdl)
|
||||
|| isset($_GET['wsdl-generate'])
|
||||
|| isset($_GET['wsdl-auto'])) {
|
||||
// --- Définition du webservice
|
||||
$wsdl = new Zend_Soap_AutoDiscover();
|
||||
$wsdl->setComplexTypeStrategy('Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence');
|
||||
$wsdl->setOperationBodyStyle(array('use' => 'literal'));
|
||||
$wsdl->setBindingStyle(array('style' => 'document'));
|
||||
$wsdl->setClass($serviceClassName);
|
||||
}
|
||||
|
||||
if ($hostScheme == 'https') {
|
||||
$wsdl->setUri($hostScheme.'://'.$hostName.'/'.$pathServiceUri);
|
||||
}
|
||||
//Get map of WSDL type to PHP Classes
|
||||
$classmap = include $pathServiceClassIni;
|
||||
|
||||
// --- Enregistrement du WSDL dans un fichier
|
||||
if (isset($_GET['wsdl-generate'])) {
|
||||
if (file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
unlink($wsdlPath . '/' . $fichierWsdl);
|
||||
}
|
||||
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);
|
||||
echo "Le fichier $fichierWsdl a été généré";
|
||||
// --- Génération/Fourniture du wsdl
|
||||
} elseif (isset($_GET['wsdl']) && !file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/xml');
|
||||
}
|
||||
readfile($wsdlPath . '/' . $fichierWsdl);
|
||||
}
|
||||
// --- Envoi sur la sortie standard le wsdl sans enregistrement dans un fichier
|
||||
elseif (isset($_GET['wsdl-auto'])) {
|
||||
$wsdl->handle();
|
||||
}
|
||||
}
|
||||
// --- Fourniture du service
|
||||
else {
|
||||
// --- Traitement
|
||||
if (in_array(APPLICATION_ENV, array('production', 'staging'))
|
||||
&& file_exists($wsdlPath . '/' . $fichierWsdl)) {
|
||||
$server = new Zend_Soap_Server($wsdlPath . '/' . $fichierWsdl);
|
||||
} else {
|
||||
$server = new Zend_Soap_Server($hostScheme.'://'.$hostName.'/'.$pathServiceUrl);
|
||||
}
|
||||
//Inclusion des classes de données
|
||||
require_once $pathServiceClassPhp;
|
||||
|
||||
// --- Sonde paramètres server
|
||||
$debug = false;
|
||||
$debugUser = '';
|
||||
if ($debug && $_SERVER['PHP_AUTH_USER'] == $debugUser) {
|
||||
file_put_contents(APPLICATION_PATH . '/../debugserver.log',
|
||||
"FichierWSDL : ".$fichierWsdl."\n".
|
||||
"Hostname : ".$hostName."\n"
|
||||
);
|
||||
}
|
||||
// Fourniture du wsdl
|
||||
if ( isset($_GET['wsdl']) && file_exists($fichierWsdl) ) {
|
||||
|
||||
// --- Options et traitement de la requete
|
||||
$server->setSoapFeatures(SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
$server->setClassmap($classmap);
|
||||
$server->setEncoding('UTF-8');
|
||||
$server->registerFaultException(array('Scores_Ws_Exception'));
|
||||
$server->setWsiCompliant(true);
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/xml');
|
||||
}
|
||||
echo file_get_contents($fichierWsdl);
|
||||
|
||||
// --- Création du service
|
||||
$server->setObject(new $serviceClassName());
|
||||
$server->handle();
|
||||
} elseif ( isset($_GET['wsdl']) && !file_exists($fichierWsdl)
|
||||
|| isset($_GET['wsdl-generate'])
|
||||
|| isset($_GET['wsdl-auto']) ) {
|
||||
|
||||
// --- Pour débuggage ultime
|
||||
$debug = false;
|
||||
$debugUser = '';
|
||||
if ($debug && $_SERVER['PHP_AUTH_USER'] == $debugUser) {
|
||||
file_put_contents(APPLICATION_PATH . '/../debugcall.log',
|
||||
"FichierWSDL : ".$fichierWsdl."\n"."Hostname : ".$hostName."\n");
|
||||
$request = $server->getLastRequest();
|
||||
file_put_contents(APPLICATION_PATH . '/../debugcall.log', $request . "\n", FILE_APPEND);
|
||||
$response = $server->getLastResponse();
|
||||
file_put_contents(APPLICATION_PATH . '/../debugcall.log', $response. "\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
// Définition du webservice
|
||||
$wsdl = new Zend_Soap_AutoDiscover();
|
||||
$wsdl->setComplexTypeStrategy('Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence');
|
||||
$wsdl->setOperationBodyStyle( array('use' => 'literal') );
|
||||
$wsdl->setBindingStyle( array('style' => 'document') );
|
||||
$wsdl->setClass($serviceClassName);
|
||||
|
||||
// Enregistrement du WSDL dans un fichier
|
||||
if ( isset($_GET['wsdl-generate']) ) {
|
||||
if (file_exists($fichierWsdl)) {
|
||||
unlink($fichierWsdl);
|
||||
}
|
||||
$wsdl->dump($fichierWsdl);
|
||||
echo "Le fichier $fichierWsdl a été généré";
|
||||
|
||||
//Génération/Fourniture du wsdl
|
||||
} elseif (isset($_GET['wsdl']) && !file_exists($fichierWsdl)) {
|
||||
$wsdl->dump($fichierWsdl);
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/xml');
|
||||
}
|
||||
echo file_get_contents($fichierWsdl);
|
||||
|
||||
// Envoi sur la sortie standard le wsdl sans enregistrement dans un fichier
|
||||
} elseif ( isset($_GET['wsdl-auto']) ){
|
||||
$wsdl->handle();
|
||||
}
|
||||
|
||||
// Fourniture du service
|
||||
} else {
|
||||
|
||||
// Traitement
|
||||
if (APPLICATION_ENV == 'production' && file_exists($fichierWsdl)) {
|
||||
$server = new Zend_Soap_Server($fichierWsdl);
|
||||
} else {
|
||||
$hostName = $this->getRequest()->getHttpHost();
|
||||
$server = new Zend_Soap_Server('http://'.$hostName.'/'.$pathServiceUrl);
|
||||
}
|
||||
|
||||
$server->setSoapFeatures(SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
$server->setClassmap($classmap);
|
||||
$server->setEncoding('UTF-8');
|
||||
$server->registerFaultException(array('WsScores_Exception'));
|
||||
$server->setWsiCompliant(true);
|
||||
$server->setObject(new $serviceClassName());
|
||||
$server->handle();
|
||||
|
||||
//Pour débuggage ultime
|
||||
$debug = false;
|
||||
if ($debug){
|
||||
$request = $server->getLastRequest();
|
||||
file_put_contents(APPLICATION_PATH . '/../request.log', $request);
|
||||
$response = $server->getLastResponse();
|
||||
file_put_contents(APPLICATION_PATH . '/../response.log', $response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,133 +1,73 @@
|
||||
<?php
|
||||
class UserController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
class UserController extends Zend_Controller_Action {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$activeNav = $this->view->navigation();
|
||||
$activeNav->removePages();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function loginAction()
|
||||
{
|
||||
}
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
public function loginAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->view->headLink()
|
||||
->appendStylesheet('/themes/default/css/signin.css', 'all');
|
||||
|
||||
$this->view->headLink()->appendStylesheet('/assets/themes/default/css/signin.css', 'all');
|
||||
$this->view->headTitle()->append('Connexion');
|
||||
$form = new Application_Form_Login();
|
||||
$this->view->form = $form;
|
||||
$request = $this->getRequest();
|
||||
if ($request->isPost()) {
|
||||
$formData = $request->getPost();
|
||||
if ($form->isValid($formData)) {
|
||||
$login = $form->getValue('login');
|
||||
$pass = $form->getValue('pass');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$authAdapter = new Scores_Auth_Adapter_Db($login, $pass, true);
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if (!$result->isValid()){
|
||||
$this->view->message = '';
|
||||
foreach ($result->getMessages() as $message) {
|
||||
$this->view->message.= $message."<br/>";
|
||||
}
|
||||
} else {
|
||||
$timeout = $auth->getIdentity()->timeout;
|
||||
|
||||
$this->view->headTitle()->append('Connexion');
|
||||
$form = new Application_Form_Login();
|
||||
$this->view->form = $form;
|
||||
$request = $this->getRequest();
|
||||
if ($request->isPost()) {
|
||||
$formData = $request->getPost();
|
||||
if ($form->isValid($formData)) {
|
||||
$login = $form->getValue('login');
|
||||
$pass = $form->getValue('pass');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$authAdapter = new Scores_Auth_Adapter_Db($login, $pass, true);
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if ($result->isValid()) {
|
||||
$timeout = $auth->getIdentity()->timeout;
|
||||
//Ecrit un cookie persistant valide pendant le temps definit
|
||||
Zend_Session::rememberMe($timeout);
|
||||
|
||||
//Ecrit un cookie persistant valide pendant le temps definit
|
||||
Zend_Session::rememberMe($timeout);
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
|
||||
$sessionNamespace->setExpirationSeconds($timeout);
|
||||
$auth->setStorage($storage);
|
||||
$url = '';
|
||||
if (Zend_Session::namespaceIsset('login')){
|
||||
$session = new Zend_Session_Namespace('login');
|
||||
if (isset($session->url)) {
|
||||
$url = $session->url;
|
||||
}
|
||||
}
|
||||
if (!empty($url)){
|
||||
$this->_redirect($url);
|
||||
}
|
||||
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
|
||||
$sessionNamespace->setExpirationSeconds($timeout);
|
||||
$auth->setStorage($storage);
|
||||
$this->_redirect('/');
|
||||
}
|
||||
|
||||
$this->redirect('/');
|
||||
} else {
|
||||
$this->view->message = '';
|
||||
foreach ($result->getMessages() as $message) {
|
||||
$this->view->message.= $message."<br/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function logoutAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
$this->_helper->layout()->disableLayout();
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
}
|
||||
|
||||
public function paramsAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
$login = $identity->username;
|
||||
$pass = $identity->hash;
|
||||
|
||||
$this->view->login = $login;
|
||||
$this->view->authorizationHeader = base64_encode($login.':'.$pass);
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection $conn
|
||||
*/
|
||||
$conn = Zend_Registry::get('doctrine');
|
||||
$userSql = "SELECT * FROM sdv1.utilisateurs WHERE id=:id";
|
||||
$stmt = $conn->prepare($userSql);
|
||||
$stmt->bindValue('id', $identity->id);
|
||||
$stmt->execute();
|
||||
$user = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
$this->view->IdFullName = $user->civilite . ' ' . $user->nom . ' ' . $user->prenom;
|
||||
$this->view->IdEmail = $user->email;
|
||||
|
||||
//Liste des droits
|
||||
$listdroit = explode(' ', $user->droits);
|
||||
|
||||
//Association méthodes - droits
|
||||
$assoc = array(
|
||||
'getAnnoncesAsso' => array('ANNONCES'),
|
||||
'getAnnoncesBalo' => array('ANNONCES'),
|
||||
'getAnnoncesBoamp' => array('ANNONCES'),
|
||||
'getAnnoncesLegales' => array('ANNONCES'),
|
||||
'getAnnoncesNum' => array('ANNONCES'),
|
||||
'getAvisRncs' => array('AVISRNCS'),
|
||||
'getBanques' => array('BANQUES'),
|
||||
'getBilan' => array('LIASSE'),
|
||||
'getDirigeants' => array('DIRIGEANTS'),
|
||||
'getIdentite' => array('IDENTITE'),
|
||||
'getIdentiteProcol' => array('IDPROCOL'),
|
||||
'getIndiScore' => array('INDISCORE1', 'INDISCORE2', 'INDISCORE3'),
|
||||
'getInfosBourse' => array('BOURSE'),
|
||||
'getInfosReg' => array('INFOSREG'),
|
||||
'getLiasseInfos' => array(),
|
||||
'getLienRef' => array('LIENS'),
|
||||
'getLiens' => array('LIENS'),
|
||||
'getLiensById' => array('LIENS'),
|
||||
'getListeBilans' => array('LIASSE'),
|
||||
'getListeCompetences' => array('COMPETENCES'),
|
||||
'getListeEtablissements' => array('ETABLISSEMENTS'),
|
||||
'getListeEvenements' => array('EVENINSEE'),
|
||||
'getRapport' => array('INDISCORE3'),
|
||||
'getRatios' => array('RATIOS'),
|
||||
'getSubventionDetail' => array(''),
|
||||
'getSubventionList' => array(''),
|
||||
'getTVA' => array(''),
|
||||
'getValo' => array('VALORISATION'),
|
||||
'isSirenExistant' => array(''),
|
||||
'searchAutreId' => array('SEARCHENT'),
|
||||
'searchDir' => array('SEARCHDIR'),
|
||||
'searchEntreprise' => array('SEARCHENT'),
|
||||
'searchNomAdr' => array('SEARCHENT'),
|
||||
'searchRefClient' => array(),
|
||||
'searchSiren' => array('SEARCHENT'),
|
||||
'searchTelFax' => array('SEARCHENT'),
|
||||
);
|
||||
|
||||
$display = array();
|
||||
foreach ($listdroit as $droit) {
|
||||
foreach ($assoc as $l => $d) {
|
||||
if (in_array(strtoupper($droit), $d)) {
|
||||
$display[] = array(
|
||||
'label' => $l,
|
||||
'droit' => $droit,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->display = $display;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,4 +3,5 @@ class Application_Model_JoScoresSurveillance extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'scores_surveillance';
|
||||
protected $_schema = 'jo';
|
||||
protected $_primary = 'siren';
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocComplement extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function docComplement($method)
|
||||
{
|
||||
}
|
||||
}
|
||||
public function docComplement($method)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocDescription extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function docDescription($method)
|
||||
{
|
||||
return $method['desc'];
|
||||
}
|
||||
}
|
||||
public function docDescription($method)
|
||||
{
|
||||
return $method['desc'];
|
||||
}
|
||||
}
|
@ -1,31 +1,31 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocExemple extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function docExemple($method)
|
||||
{
|
||||
$exemple = '';
|
||||
$langages = array(
|
||||
'php' => 'PHP',
|
||||
'java' => 'Java',
|
||||
'perl' => 'Perl',
|
||||
'python' => 'Python',
|
||||
'csharp' => 'C#'
|
||||
);
|
||||
public function docExemple($method)
|
||||
{
|
||||
$exemple = '';
|
||||
$langages = array(
|
||||
'php' => 'PHP',
|
||||
'java' => 'Java',
|
||||
'perl' => 'Perl',
|
||||
'python' => 'Python',
|
||||
'csharp' => 'C#'
|
||||
);
|
||||
|
||||
foreach ($langages as $langage => $lib) {
|
||||
$fichier = 'assets/code/'.$method.'-'.$langage.'.txt';
|
||||
if (file_exists($fichier)) {
|
||||
$url = $this->view->url(
|
||||
array(
|
||||
'controller' => 'documentation',
|
||||
'action' => 'code',
|
||||
'langage' => $langage,
|
||||
'element' => $method,
|
||||
), null, true);
|
||||
$exemple.= '<a href="'.$url.'">' . $lib . '</a>';
|
||||
$exemple.= ' ';
|
||||
}
|
||||
}
|
||||
return $exemple;
|
||||
}
|
||||
}
|
||||
foreach ($langages as $langage => $lib){
|
||||
$fichier = 'assets/code/'.$method.'-'.$langage.'.txt';
|
||||
if (file_exists($fichier)){
|
||||
$url = $this->view->url(
|
||||
array(
|
||||
'controller' => 'documentation',
|
||||
'action' => 'code',
|
||||
'langage' => $langage,
|
||||
'element' => $method,
|
||||
), null, true);
|
||||
$exemple.= '<a href="'.$url.'">' . $lib . '</a>';
|
||||
$exemple.= ' ';
|
||||
}
|
||||
}
|
||||
return $exemple;
|
||||
}
|
||||
}
|
@ -1,59 +1,61 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocMethod extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
|
||||
public function docMethod($method)
|
||||
{
|
||||
$output = '';
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
|
||||
$returnType = $method['return'];
|
||||
$methodName = $method['name'];
|
||||
public function docMethod($method)
|
||||
{
|
||||
$output = '';
|
||||
|
||||
$cptParameters = 0;
|
||||
$parameters = '';
|
||||
foreach ($method['params'] as $param) {
|
||||
if (isset($param['optional'])) {
|
||||
$parameters.= '[';
|
||||
}
|
||||
$parameters.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$parameters.= ' ';
|
||||
$parameters.= '<b>' . $param['name'] . '</b>';
|
||||
$returnType = $method['return'];
|
||||
$methodName = $method['name'];
|
||||
|
||||
if (isset($param['optional'])) {
|
||||
if (isset($param['defaultValue'])) {
|
||||
$parameters.= ' = ';
|
||||
if (is_bool($param['defaultValue'])) {
|
||||
$parameters.= ($param['defaultValue'] === false) ? 'false' : 'true' ;
|
||||
} elseif (is_string($param['defaultValue']) && $param['defaultValue']=='') {
|
||||
$parameters.= "''";
|
||||
} else {
|
||||
$parameters.= $param['defaultValue'];
|
||||
}
|
||||
}
|
||||
$parameters.= ']';
|
||||
}
|
||||
$cptParameters++;
|
||||
if ($cptParameters < count($method['params'])) {
|
||||
$parameters.= ', ';
|
||||
}
|
||||
}
|
||||
$output = '<i>' . $this->transcodeType($returnType) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>' . $methodName . '</b>' . ' <b>(</b> ' . $parameters . ' <b>)</b>';
|
||||
return $output;
|
||||
}
|
||||
$cptParameters = 0;
|
||||
$parameters = '';
|
||||
foreach ($method['params'] as $param) {
|
||||
if (isset($param['optional'])) {
|
||||
$parameters.= '[';
|
||||
}
|
||||
$parameters.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$parameters.= ' ';
|
||||
$parameters.= '<b>' . $param['name'] . '</b>';
|
||||
|
||||
if (isset($param['optional'])) {
|
||||
if (isset($param['defaultValue'])) {
|
||||
$parameters.= ' = ';
|
||||
if (is_bool($param['defaultValue'])){
|
||||
$parameters.= ($param['defaultValue'] === false) ? 'false' : 'true' ;
|
||||
} elseif (is_string($param['defaultValue']) && $param['defaultValue']==''){
|
||||
$parameters.= "''";
|
||||
} else {
|
||||
$parameters.= $param['defaultValue'];
|
||||
}
|
||||
}
|
||||
$parameters.= ']';
|
||||
}
|
||||
$cptParameters++;
|
||||
if ($cptParameters < count($method['params'])){
|
||||
$parameters.= ', ';
|
||||
}
|
||||
}
|
||||
$output = '<i>' . $this->transcodeType($returnType) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>' . $methodName . '</b>' . ' <b>(</b> ' . $parameters . ' <b>)</b>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if(array_key_exists($type, $this->_transcodeType)){
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if (array_key_exists($type, $this->_transcodeType)) {
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,80 +1,81 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocParameter extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $serviceTypes;
|
||||
protected $serviceTypes;
|
||||
|
||||
protected $types = array(
|
||||
'string', 'str',
|
||||
'boolean', 'bool',
|
||||
'int', 'integer', 'long',
|
||||
'float', 'double',
|
||||
'array', 'object', 'mixed'
|
||||
);
|
||||
protected $types = array(
|
||||
'string', 'str',
|
||||
'boolean', 'bool',
|
||||
'int', 'integer', 'long',
|
||||
'float', 'double',
|
||||
'array', 'object', 'mixed'
|
||||
);
|
||||
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
|
||||
public function docParameter($params, $serviceTypes)
|
||||
{
|
||||
$this->serviceTypes = $serviceTypes;
|
||||
$output = '';
|
||||
if (count($params)>0) {
|
||||
$output.= '<ul>';
|
||||
foreach ($params as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
public function docParameter($params, $serviceTypes)
|
||||
{
|
||||
$this->serviceTypes = $serviceTypes;
|
||||
$output = '';
|
||||
if (count($params)>0) {
|
||||
$output.= '<ul>';
|
||||
foreach ($params as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function parseType($type)
|
||||
{
|
||||
$output = '';
|
||||
$type = str_replace('[]', '', $type);
|
||||
if (array_key_exists($type, $this->serviceTypes)) {
|
||||
$types = $this->serviceTypes[$type];
|
||||
$output.= '<ul>';
|
||||
foreach ($types as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
} elseif (in_array($type, $this->types)) {
|
||||
$output.= '';
|
||||
} elseif ($type == 'void') {
|
||||
$output.= 'Void';
|
||||
} else {
|
||||
$output.= ' => <b>Type '.$type.' inconnu</b>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
private function parseType($type)
|
||||
{
|
||||
$output = '';
|
||||
$type = str_replace('[]', '', $type);
|
||||
if (array_key_exists($type, $this->serviceTypes)) {
|
||||
$types = $this->serviceTypes[$type];
|
||||
$output.= '<ul>';
|
||||
foreach ($types as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
} elseif (in_array($type, $this->types)) {
|
||||
$output.= '';
|
||||
} elseif ($type == 'void'){
|
||||
$output.= 'Void';
|
||||
} else {
|
||||
$output.= ' => <b>Type '.$type.' inconnu</b>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function formatParam($param)
|
||||
{
|
||||
$output = '';
|
||||
$output.= '<li>';
|
||||
$output.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>' . $param['name'] . '</b>';
|
||||
if (isset($param['description']) && !empty($param['description'])) {
|
||||
$output.= ' - '.$param['description'];
|
||||
}
|
||||
if (!in_array($param['type'], $this->types)) {
|
||||
$output.= $this->parseType($param['type']);
|
||||
}
|
||||
$output.= '</li>';
|
||||
return $output;
|
||||
}
|
||||
private function formatParam($param)
|
||||
{
|
||||
$output = '';
|
||||
$output.= '<li>';
|
||||
$output.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>' . $param['name'] . '</b>';
|
||||
if (isset($param['description']) && !empty($param['description'])) {
|
||||
$output.= ' - '.$param['description'];
|
||||
}
|
||||
if (!in_array($param['type'], $this->types)) {
|
||||
$output.= $this->parseType($param['type']);
|
||||
}
|
||||
$output.= '</li>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if (array_key_exists($type, $this->_transcodeType)) {
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if(array_key_exists($type, $this->_transcodeType)){
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,73 +1,74 @@
|
||||
<?php
|
||||
class Zend_View_Helper_DocReturn extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $serviceTypes;
|
||||
protected $serviceTypes;
|
||||
|
||||
protected $types = array(
|
||||
'string', 'str',
|
||||
'boolean', 'bool',
|
||||
'integer', 'int', 'long',
|
||||
'float', 'double',
|
||||
'array', 'object', 'mixed'
|
||||
);
|
||||
protected $types = array(
|
||||
'string', 'str',
|
||||
'boolean', 'bool',
|
||||
'integer', 'int', 'long',
|
||||
'float', 'double',
|
||||
'array', 'object', 'mixed'
|
||||
);
|
||||
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
protected $_transcodeType = array(
|
||||
'str' => 'string',
|
||||
'bool' => 'boolean',
|
||||
'integer' => 'int',
|
||||
);
|
||||
|
||||
public function docReturn($type, $serviceTypes)
|
||||
{
|
||||
$this->serviceTypes = $serviceTypes;
|
||||
return $this->parseType($type);
|
||||
}
|
||||
public function docReturn($type, $serviceTypes)
|
||||
{
|
||||
$this->serviceTypes = $serviceTypes;
|
||||
return $this->parseType($type);
|
||||
}
|
||||
|
||||
private function parseType($type)
|
||||
{
|
||||
$output = '';
|
||||
$type = str_replace('[]', '', $type);
|
||||
if (array_key_exists($type, $this->serviceTypes)) {
|
||||
$types = $this->serviceTypes[$type];
|
||||
$output.= '<ul>';
|
||||
foreach ($types as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
} elseif (in_array($type, $this->types)) {
|
||||
$output.= '<i>' . $type . '</i> ';
|
||||
} elseif ($type == 'void') {
|
||||
$output.= 'Void';
|
||||
} else {
|
||||
$output.= ' => <b>Type '.$type.' inconnu</b>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
private function parseType($type)
|
||||
{
|
||||
$output = '';
|
||||
$type = str_replace('[]', '', $type);
|
||||
if (array_key_exists($type, $this->serviceTypes)) {
|
||||
$types = $this->serviceTypes[$type];
|
||||
$output.= '<ul>';
|
||||
foreach ($types as $param) {
|
||||
$output.= $this->formatParam($param);
|
||||
}
|
||||
$output.= '</ul>';
|
||||
} elseif (in_array($type, $this->types)) {
|
||||
$output.= '<i>' . $type . '</i> ';
|
||||
} elseif ($type == 'void'){
|
||||
$output.= 'Void';
|
||||
} else {
|
||||
$output.= ' => <b>Type '.$type.' inconnu</b>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function formatParam($param)
|
||||
{
|
||||
$output = '';
|
||||
$output.= '<li>';
|
||||
$output.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>'. $param['name'] . '</b>';
|
||||
if (isset($param['description']) && !empty($param['description'])) {
|
||||
$output.= ' - '.$param['description'];
|
||||
}
|
||||
$type = str_replace('[]', '', $param['type']);
|
||||
if (!in_array($type, $this->types)) {
|
||||
$output.= $this->parseType($param['type']);
|
||||
}
|
||||
$output.= '</li>';
|
||||
return $output;
|
||||
}
|
||||
private function formatParam($param)
|
||||
{
|
||||
$output = '';
|
||||
$output.= '<li>';
|
||||
$output.= '<i>' . $this->transcodeType($param['type']) . '</i>';
|
||||
$output.= ' ';
|
||||
$output.= '<b>'. $param['name'] . '</b>';
|
||||
if (isset($param['description']) && !empty($param['description'])) {
|
||||
$output.= ' - '.$param['description'];
|
||||
}
|
||||
$type = str_replace('[]', '', $param['type']);
|
||||
if (!in_array($type, $this->types)) {
|
||||
$output.= $this->parseType($param['type']);
|
||||
}
|
||||
$output.= '</li>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if(array_key_exists($type, $this->_transcodeType)){
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
private function transcodeType($type)
|
||||
{
|
||||
if (array_key_exists($type, $this->_transcodeType)) {
|
||||
return $this->_transcodeType[$type];
|
||||
} else {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,16 @@
|
||||
|
||||
class Zend_View_Helper_ProfileLink extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function profileLink()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
public function profileLink()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$username = $auth->getIdentity()->username;
|
||||
$logoutUrl = $this->view->url(array(
|
||||
'controller' => 'user',
|
||||
'action' => 'logout'
|
||||
'controller' => 'user',
|
||||
'action' => 'logout'
|
||||
), null, true);
|
||||
return '<a href="'.$logoutUrl.'" title="Se déconnecter" class="navbar-link">Déconnexion : ' . $username . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
<h1>Démonstration - Liste des méthodes</h1>
|
||||
|
||||
<p class="bg-info">Uniquement disponible à titre d'information. Se référer à la documentation pour réaliser des tests.</p>
|
||||
|
||||
<ul>
|
||||
<?php foreach($this->methods as $method){ ?>
|
||||
<?php
|
||||
foreach($this->methods as $method){
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo $method['url'];?>">
|
||||
<?php echo $method['nom'];?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
@ -1,13 +1,5 @@
|
||||
<div class="page-header"><h1>Service <?=$this->serviceName?> v<?=$this->serviceVersion?></h1></div>
|
||||
|
||||
<?php if ( $this->isDeprecated === true) {?>
|
||||
<p class="bg-danger">Cette version est déprécié. Elle est désactivé.</p>
|
||||
<?php }?>
|
||||
|
||||
<?php if ( $this->Info ) {?>
|
||||
<p class="bg-info"><?=$this->Info?></p>
|
||||
<?php }?>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">WSDL</h3>
|
||||
@ -18,6 +10,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Liste des opérations</h3>
|
||||
@ -25,26 +18,23 @@
|
||||
<div class="panel-body">
|
||||
<ol>
|
||||
<?php foreach ($this->serviceMethods as $method) {?>
|
||||
<li>
|
||||
<b><?php echo $method['name'];?></b>
|
||||
<a href="#<?php echo $method['name'];?>"><i>Détail</i></a>
|
||||
</li>
|
||||
<?php }?>
|
||||
<li>
|
||||
<b><?php echo $method['name'];?></b>
|
||||
<a href="#<?php echo $method['name'];?>"><i>Détail</i></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-header">
|
||||
<h2>Détails</h2>
|
||||
</div>
|
||||
|
||||
<?php foreach ($this->serviceMethods as $method) {?>
|
||||
<div class="panel panel-default" id="<?=$method['name']?>">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><h4><?=$method['name']?></h4></h3>
|
||||
<h3 class="panel-title">Détails</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<ul class="list-group">
|
||||
<?php foreach ($this->serviceMethods as $method) {?>
|
||||
<li class="list-group-item">
|
||||
<a id="<?=$method['name']?>"></a><h4><?=$method['name']?></h4>
|
||||
|
||||
<h5>Description</h5>
|
||||
<div class="bs-callout bs-callout-php">
|
||||
@ -60,19 +50,14 @@
|
||||
|
||||
<h5>Retour</h5>
|
||||
<div class="bs-callout bs-callout-php">
|
||||
<?php if ($method['returnDesc'] != '') {?><?=$method['returnDesc']?><br/><br/><?php }?>
|
||||
<?=$this->docReturn($method['return'], $this->serviceTypes);?>
|
||||
</div>
|
||||
|
||||
<?php $exemple = $this->docExemple($method['name'])?>
|
||||
<?php if ( !empty($exemple) ) {?>
|
||||
<h5>Exemple</h5>
|
||||
<div class="bs-callout bs-callout-php">
|
||||
<?=$exemple?>
|
||||
<?=$this->docExemple($method['name'])?>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
@ -27,21 +27,13 @@
|
||||
'type'=>$params['type'],
|
||||
'version'=>$version),null,true)?>">
|
||||
Version <?=$version?></a>
|
||||
|
||||
<div class="pull-right">
|
||||
<?php if ( $versionElement['defaut'] === true ) { ?>
|
||||
<span class="label label-success">Actuel</span>
|
||||
<span style="float:right;" class="label label-success">Défaut</span>
|
||||
<?php } elseif ( $versionElement['defaut'] === false ) {?>
|
||||
<span class="label label-danger">Déprécié</span>
|
||||
<span style="float:right;" class="label label-danger">Déprécié</span>
|
||||
<?php } elseif ( $versionElement['defaut'] == 'beta') {?>
|
||||
<span class="label label-warning">Beta</span>
|
||||
<span style="float:right;" class="label label-warning">Beta</span>
|
||||
<?php }?>
|
||||
<?php if ( $versionElement['actif'] === true ) { ?>
|
||||
<span class="label label-info">Actif</span>
|
||||
<?php } else {?>
|
||||
<span class="label label-info">Inactif</span>
|
||||
<?php }?>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
@ -1,18 +1,28 @@
|
||||
<h1>An error occurred</h1>
|
||||
<h2><?php echo $this->message ?></h2>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Zend Framework Default Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>An error occurred</h1>
|
||||
<h2><?php echo $this->message ?></h2>
|
||||
|
||||
<?php if (isset($this->exception)): ?>
|
||||
<?php if (isset($this->exception)): ?>
|
||||
|
||||
<h3>Exception information:</h3>
|
||||
<p>
|
||||
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
|
||||
</p>
|
||||
<h3>Exception information:</h3>
|
||||
<p>
|
||||
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
|
||||
</p>
|
||||
|
||||
<h3>Stack trace:</h3>
|
||||
<pre><?php echo $this->exception->getTraceAsString() ?>
|
||||
</pre>
|
||||
<h3>Stack trace:</h3>
|
||||
<pre><?php echo $this->exception->getTraceAsString() ?>
|
||||
</pre>
|
||||
|
||||
<h3>Request Parameters:</h3>
|
||||
<pre><?php echo var_export($this->request->getParams(), true) ?>
|
||||
</pre>
|
||||
<?php endif ?>
|
||||
<h3>Request Parameters:</h3>
|
||||
<pre><?php echo var_export($this->request->getParams(), true) ?>
|
||||
</pre>
|
||||
<?php endif ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,3 +1,3 @@
|
||||
<div class="container">
|
||||
<p class="text-muted credit"> © <?=date('Y')?> <a href="http://www.scores-decisions.com">Scores & Décisions SAS</a>.</p>
|
||||
<p class="text-muted credit"> © <?=date('Y')?> <a href="http://www.scores-decisions.com">Scores & Décisions</a>.</p>
|
||||
</div>
|
@ -11,26 +11,23 @@
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<?php foreach ($this->navigation()->getContainer() as $page) {?>
|
||||
<?php if ( $page->hasPages() ) {?>
|
||||
<li class="dropdown<?php if ( $page->isActive(true) ) { echo ' active'; } ?>">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?=$page->label?> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="<?=$page->getHref()?>">Accueil</a></li>
|
||||
<li class="divider"></li>
|
||||
<?php foreach ( $page->getPages() as $child ) {?>
|
||||
<?php if ( $child->getHref() == '#') {?>
|
||||
<li class="divider"></li>
|
||||
<?php } else {?>
|
||||
<li<?php if ( $child->isActive(true) ) { echo ' class="active"'; } ?>><a href="<?=$child->getHref()?>"><?=$child->label?></a></li>
|
||||
<?php }?>
|
||||
<li class="active"><a href="<?=$this->url(array('controller'=>'index', 'action'=>'index'),null,true)?>">Accueil</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="<?=$this->url(array('controller'=>'documentation','action'=>'index'),null,true)?>">Information générale</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="<?=$this->url(array('controller'=>'documentation','action'=>'services'),null,true)?>">Liste des services</a></li>
|
||||
<li class="divider"></li>
|
||||
<?php if ( count($this->WsServices)>0 ) {?>
|
||||
<?php foreach ( $this->WsServices as $service => $params) {?>
|
||||
<li><a href="<?=$this->url(array('controller'=>'documentation','action'=>'service','name'=>$service,'type'=>$params['type']),null,true)?>"><?=$params['name']?></a></li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php } else {?>
|
||||
<li<?php if ( $page->isActive(true) ) { echo ' class="active"'; } ?>><a href="<?=$page->getHref()?>"><?=$page->label?></a></li>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="<?=$this->url(array('controller'=>'demo', 'action'=>'index'), null, true)?>">Démonstration</a></li>
|
||||
<li><a href="<?=$this->url(array('controller'=>'index', 'action'=>'contact'), null, true)?>">Contact</a></li>
|
||||
</ul>
|
||||
<p class="navbar-text pull-right"><?=$this->profileLink()?></p>
|
||||
</div><!--/.nav-collapse -->
|
||||
|
@ -1,6 +0,0 @@
|
||||
<div class="page-header"><h1>Contact</h1></div>
|
||||
<p class="lead"></p>
|
||||
<p>Pour toutes questions concernant les paramètres techniques ou une explication des données, vous pouvez contactez
|
||||
votre commercial ou le service support (<a href="mailto:support@scores-decisions.com">support@scores-decisions.com</a>).</p>
|
||||
|
||||
<p>Merci de rappeler pour référence le login utilisé pour l'accès au WebService.</p>
|
@ -14,7 +14,6 @@
|
||||
|
||||
<form class="form-signin" method="<?=$this->form->getMethod()?>" action="<?=$this->form->getAction()?>">
|
||||
<h2 class="form-signin-heading">Web Service API</h2>
|
||||
<div style="text-align:center;"><p class="text-danger"><span><?=$this->message?></span></p></div>
|
||||
<input name="login" value="<?=$this->form->getValue('login')?>" type="text" class="form-control" placeholder="Identifiant" autofocus>
|
||||
<input name="pass" value="<?=$this->form->getValue('pass')?>" type="password" class="form-control" placeholder="Mot de passe">
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Connexion</button>
|
||||
|
@ -1,36 +0,0 @@
|
||||
<div class="page-header"><h1>Identifiant</h1></div>
|
||||
|
||||
<h2>Identité</h2>
|
||||
<address>
|
||||
<p>Login : <?=$this->login?></p>
|
||||
<strong><?=$this->IdFullName?></strong><br>
|
||||
<a href="mailto:#"><?=$this->IdEmail?></a>
|
||||
</address>
|
||||
|
||||
<h2>Authorization Header</h2>
|
||||
<div class="bs-callout bs-callout-warning">
|
||||
Authorization: Basic <?=$this->authorizationHeader;?>
|
||||
</div>
|
||||
<div>
|
||||
Base64("<?=$this->login?>:*****") = "<?=$this->authorizationHeader;?>"
|
||||
</div>
|
||||
|
||||
<div class="page-header"><h1>Paramètres</h1></div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Méthode</th>
|
||||
<th>Droit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ( count($this->display)>0 ) {?>
|
||||
<?php foreach ( $this->display as $d ) {?>
|
||||
<tr>
|
||||
<td><?=$d['label']?></td>
|
||||
<td><?=$d['droit']?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Aide.",
|
||||
'path=s' => "{Service Name}/{version}",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "\nType Service\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$wsPath = APPLICATION_PATH . '/../library/WsScore/';
|
||||
|
||||
require_once $wsPath . $opts->path . '/Types.php';
|
||||
$detect = new Zend_Reflection_File($wsPath . $opts->path . '/Types.php');
|
||||
$result = $detect->getClasses();
|
||||
|
||||
$outPath = dirname($wsPath . $opts->path . '/Types.php');
|
||||
$outFile = $outPath . '/Config.php';
|
||||
|
||||
if (count($result) > 0) {
|
||||
file_put_contents($outFile, "<?php\n");
|
||||
file_put_contents($outFile, "return array(\n", FILE_APPEND);
|
||||
foreach ($result as $c) {
|
||||
file_put_contents($outFile, "\t'". $c->name . "' => '" . $c->name ."',\n", FILE_APPEND);
|
||||
}
|
||||
file_put_contents($outFile, ");\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
161
bin/classmap_generator.php
Normal file
161
bin/classmap_generator.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Loader
|
||||
* @subpackage Exception
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generate class maps for use with autoloading.
|
||||
*
|
||||
* Usage:
|
||||
* --help|-h Get usage message
|
||||
* --library|-l [ <string> ] Library to parse; if none provided, assumes
|
||||
* current directory
|
||||
* --output|-o [ <string> ] Where to write autoload file; if not provided,
|
||||
* assumes "autoload_classmap.php" in library directory
|
||||
* --overwrite|-w Whether or not to overwrite existing autoload
|
||||
* file
|
||||
*/
|
||||
|
||||
$libPath = dirname(__FILE__) . '/../library';
|
||||
if (!is_dir($libPath)) {
|
||||
// Try to load StandardAutoloader from include_path
|
||||
if (false === include('Zend/Loader/StandardAutoloader.php')) {
|
||||
echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL;
|
||||
exit(2);
|
||||
}
|
||||
} else {
|
||||
// Try to load StandardAutoloader from library
|
||||
if (false === include(dirname(__FILE__) . '/../library/Zend/Loader/StandardAutoloader.php')) {
|
||||
echo "Unable to locate autoloader via library; aborting" . PHP_EOL;
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
realpath($libPath),
|
||||
get_include_path(),
|
||||
)));
|
||||
|
||||
// Setup autoloading
|
||||
$loader = new Zend_Loader_StandardAutoloader();
|
||||
$loader->setFallbackAutoloader(true);
|
||||
$loader->register();
|
||||
|
||||
$rules = array(
|
||||
'help|h' => 'Get usage message',
|
||||
'library|l-s' => 'Library to parse; if none provided, assumes current directory',
|
||||
'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory',
|
||||
'overwrite|w' => 'Whether or not to overwrite existing autoload file',
|
||||
);
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt($rules);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if ($opts->getOption('h')) {
|
||||
echo $opts->getUsageMessage();
|
||||
exit();
|
||||
}
|
||||
|
||||
$path = $libPath;
|
||||
if (array_key_exists('PWD', $_SERVER)) {
|
||||
$path = $_SERVER['PWD'];
|
||||
}
|
||||
if (isset($opts->l)) {
|
||||
$path = $opts->l;
|
||||
if (!is_dir($path)) {
|
||||
echo "Invalid library directory provided" . PHP_EOL . PHP_EOL;
|
||||
echo $opts->getUsageMessage();
|
||||
exit(2);
|
||||
}
|
||||
$path = realpath($path);
|
||||
}
|
||||
|
||||
$usingStdout = false;
|
||||
$output = $path . DIRECTORY_SEPARATOR . 'autoload_classmap.php';
|
||||
if (isset($opts->o)) {
|
||||
$output = $opts->o;
|
||||
if ('-' == $output) {
|
||||
$output = STDOUT;
|
||||
$usingStdout = true;
|
||||
} elseif (!is_writeable(dirname($output))) {
|
||||
echo "Cannot write to '$output'; aborting." . PHP_EOL
|
||||
. PHP_EOL
|
||||
. $opts->getUsageMessage();
|
||||
exit(2);
|
||||
} elseif (file_exists($output)) {
|
||||
if (!$opts->getOption('w')) {
|
||||
echo "Autoload file already exists at '$output'," . PHP_EOL
|
||||
. "but 'overwrite' flag was not specified; aborting." . PHP_EOL
|
||||
. PHP_EOL
|
||||
. $opts->getUsageMessage();
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$strip = $path;
|
||||
|
||||
if (!$usingStdout) {
|
||||
echo "Creating class file map for library in '$path'..." . PHP_EOL;
|
||||
}
|
||||
|
||||
// Get the ClassFileLocator, and pass it the library path
|
||||
$l = new Zend_File_ClassFileLocator($path);
|
||||
|
||||
// Iterate over each element in the path, and create a map of
|
||||
// classname => filename, where the filename is relative to the library path
|
||||
$map = new stdClass;
|
||||
$strip .= DIRECTORY_SEPARATOR;
|
||||
function createMap(Iterator $i, $map, $strip) {
|
||||
$file = $i->current();
|
||||
$namespace = empty($file->namespace) ? '' : $file->namespace . '\\';
|
||||
$filename = str_replace($strip, '', $file->getRealpath());
|
||||
|
||||
// Windows portability
|
||||
$filename = str_replace(array('/', '\\'), "' . DIRECTORY_SEPARATOR . '", $filename);
|
||||
|
||||
$map->{$namespace . $file->classname} = $filename;
|
||||
|
||||
return true;
|
||||
}
|
||||
iterator_apply($l, 'createMap', array($l, $map, $strip));
|
||||
|
||||
// Create a file with the class/file map.
|
||||
// Stupid syntax highlighters make separating < from PHP declaration necessary
|
||||
$dirStore = 'dirname_' . uniqid();
|
||||
$content = '<' . "?php\n"
|
||||
. '$' . $dirStore . " = dirname(__FILE__);\n"
|
||||
. 'return ' . var_export((array) $map, true) . ';';
|
||||
|
||||
// Prefix with dirname(__FILE__); modify the generated content
|
||||
$content = preg_replace('#(=> )#', '$1$' . $dirStore . ' . DIRECTORY_SEPARATOR . ', $content);
|
||||
$content = str_replace("\\'", "'", $content);
|
||||
|
||||
// Write the contents to disk
|
||||
file_put_contents($output, $content);
|
||||
|
||||
if (!$usingStdout) {
|
||||
echo "Wrote classmap file to '" . realpath($output) . "'" . PHP_EOL;
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
$typesFichier = array('csv', 'fichiers', 'clients', 'kbis');
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => 'Displays usage information.',
|
||||
'all' => 'Execute toutes les actions (cron).',
|
||||
'type=w' => 'Supprime uniquement les fichiers indiqués.',
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo $opts->getUsageMessage();
|
||||
?>
|
||||
|
||||
Types de fichier disponibles : <?php echo join(', ', $typesFichier)?>
|
||||
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($opts->all || $opts->type)
|
||||
{
|
||||
foreach ($typesFichier as $dir)
|
||||
{
|
||||
if ($opts->all || $opts->type==$dir ){
|
||||
removeFileInDir(LOG_PATH.'/'.$dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeFileInDir($dir)
|
||||
{
|
||||
if (is_dir($dir)) {
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
unlink($dir . $file);
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
443
bin/greffe.php
443
bin/greffe.php
@ -1,443 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Affiche l'aide.",
|
||||
'list' => "Liste les actes en attente disponible sur le FTP et affiche les informations",
|
||||
'get-s' => "Recupère seulement les actes du FTP (un seul document si la référence est spécifier G<NNN> )",
|
||||
'send-s' => "Récupère les actes et envoi un mail à chaque client (un seul acte si la référence est spécifier G<NNN>)",
|
||||
'type-s' => "Type de document : bilan, acte",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Vérifie les actes numérisés reçus en provenance des Greffes.";
|
||||
echo "\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$testMail = false;
|
||||
|
||||
$test = false;
|
||||
if (isset($opts->list)){
|
||||
$test = true;
|
||||
}
|
||||
|
||||
$types = array('bi', 'ac');
|
||||
|
||||
// Configuration FTP
|
||||
define ('ACTES_IGNUM_FTP_URL', 'ftp.scores-decisions.com');
|
||||
define ('ACTES_IGNUM_FTP_USER', 'mpc2500');
|
||||
define ('ACTES_IGNUM_FTP_PASS', 'passmpc78');
|
||||
|
||||
$pathIn = $c->profil->path->shared.'/files';
|
||||
|
||||
$report_email = $c->profil->mail->email->support;
|
||||
$report_subject = 'Traitement des actes '.date('Y-m-d H:i:s');
|
||||
$report_txt = '';
|
||||
|
||||
function sendMail($commande, $type){
|
||||
$subject = "Actes ou Statuts disponible pour ".$commande->raisonSociale.' ('.$commande->siren.')';
|
||||
$message = "Bonjour,\n\n";
|
||||
$message.= "Le document commandé pour ".$commande->raisonSociale." (siren ".$commande->siren.") est disponible en téléchargement sur le site de Scores & Décisions.\r\n\r\n";
|
||||
if ($commande->refClient!='') {
|
||||
$message = "Votre référence : ".$commande->refClient."\r\n\r\n";
|
||||
}
|
||||
switch ( $type ) {
|
||||
case 'BI':
|
||||
$dateBilan = substr($commande->bilanCloture,8,2).'/'.substr($commande->bilanCloture,5,2).'/'.substr($commande->bilanCloture,0,4);
|
||||
$message.= "Bilan cloturé le ".$dateBilan;
|
||||
break;
|
||||
case 'AC':
|
||||
$dateActe = substr($commande->acteDate,8,2).'/'.substr($commande->acteDate,5,2).'/'.substr($commande->acteDate,0,4);
|
||||
$dateDepot = substr($commande->depotDate,8,2).'/'.substr($commande->depotDate,5,2).'/'.substr($commande->depotDate,0,4);
|
||||
$message.= "Acte n°".$commande->acteNum." du ".$dateActe." (Dépot n°".$commande->depotNum." du ".$dateDepot.") ";
|
||||
break;
|
||||
}
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "Consulter la fiche identité http://extranet.scores-decisions.com/identite/fiche/siret/".$commande->siren.", puis rubrique \"Pieces Officielles\"\n";
|
||||
|
||||
$message.= "ou directement depuis la page suivante http://extranet.scores-decisions.com/pieces";
|
||||
switch ( $type ) {
|
||||
case 'BI':
|
||||
$message.= "/bilans/siret/".$commande->siren;
|
||||
break;
|
||||
case 'AC':
|
||||
$message.= "/actes/siret/".$commande->siren;
|
||||
break;
|
||||
}
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "Bien cordialement, \n";
|
||||
$message.= "Le service support.\n";
|
||||
$message.= "\n";
|
||||
|
||||
$message.= "--";
|
||||
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "SCORES & DECISIONS";
|
||||
$message.= "\n";
|
||||
$message.= "Service support";
|
||||
$message.= "\n";
|
||||
$message.= "1, rue de Clairefontaine - 78120 RAMBOUILLET";
|
||||
$message.= "\n";
|
||||
$message.= "tél : 0 811 261 216";
|
||||
$message.= "\n";
|
||||
$message.= "fax : 33 (0)1 75 43 85 74";
|
||||
$message.= "\n";
|
||||
$message.= "support@scores-decisions.com";
|
||||
$message.= "\n";
|
||||
$message.= "http://www.scores-decisions.com/";
|
||||
$message.= "\n";
|
||||
$message.= "Scores & Décisions est l'acteur nouvelle génération de l'information et de l'évaluation des entreprises";
|
||||
|
||||
$message.= "\n\n";
|
||||
|
||||
$message.= "Pensez à l'environnement avant d'imprimer ce message !";
|
||||
$message.= "\n";
|
||||
$message.= "Save paper - think before you print";
|
||||
$message.= "\n";
|
||||
|
||||
$headers = 'From: support@scores-decisions.com' . "\r\n" .
|
||||
'Reply-To: support@scores-decisions.com';
|
||||
|
||||
if ( mail(strtolower($commande->email), $subject, utf8_decode($message), $headers) ){
|
||||
echo date ('Y/m/d - H:i:s').' - Un email a été envoyé à '.$commande->email." pour la commande ".$commande->id.".\n";
|
||||
return true;
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s').' - ERREUR : Impossible d\'envoyer l\'email à '.$commande->email." pour la commande ".$commande->id.".\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des commandes non traités depuis la base de données
|
||||
*/
|
||||
$tabCommandes = array();
|
||||
if (in_array('ac', $types)) {
|
||||
$sql = "SELECT * FROM sdv1.greffe_commandes_ac WHERE mode=:mode AND dateCommande!=:commande AND dateEnvoi=:envoi";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('mode', 'C');
|
||||
$stmt->bindValue('commande', '0000-00-00 00:00:00');
|
||||
$stmt->bindValue('envoi', '0000-00-00 00:00:00');
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabCommandes['G-AC-'.$row->id] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (in_array('bi', $types)) {
|
||||
$sql = "SELECT * FROM sdv1.greffe_commandes_bi WHERE mode=:mode AND dateCommande!=:commande AND dateEnvoi=:envoi";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('mode', 'C');
|
||||
$stmt->bindValue('commande', '0000-00-00 00:00:00');
|
||||
$stmt->bindValue('envoi', '0000-00-00 00:00:00');
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabCommandes['G-BI-'.$row->id] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
$nbCommandes = count($tabCommandes);
|
||||
echo date('Y/m/d - H:i:s') ." - Il y a $nbCommandes commandes en attente de réception courrier ou numérisation !\n";
|
||||
|
||||
/**
|
||||
* Connexion au site FTP pour la récupération de la liste des fichiers au format pdf
|
||||
*/
|
||||
$conn_id = ftp_connect(ACTES_IGNUM_FTP_URL);
|
||||
if (!$conn_id) {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de se connecter au serveur FTP (".ACTES_IGNUM_FTP_URL.") !\n";
|
||||
exit;
|
||||
}
|
||||
$login_result = ftp_login($conn_id, ACTES_IGNUM_FTP_USER, ACTES_IGNUM_FTP_PASS);
|
||||
if (!$login_result) {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de s'authentifier sur le serveur FTP (".ACTES_IGNUM_FTP_URL.")!\n";
|
||||
exit;
|
||||
}
|
||||
ftp_pasv($conn_id, true);
|
||||
$contents = ftp_nlist($conn_id, "*.pdf");
|
||||
if ($contents === false) {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de se connecter au serveur FTP (".ACTES_IGNUM_FTP_URL.") !\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste de tout les fichiers disponible dans le repertoire
|
||||
* et associe une clé pour faciliter le tri
|
||||
*/
|
||||
$tabFichiersFtp = array();
|
||||
foreach ($contents as $filename){
|
||||
$indice = 0;
|
||||
$f = strtolower($filename);
|
||||
if (preg_match('/g-(ac|bi)-[0-9]+\.pdf/', $f)
|
||||
|| preg_match('/g-(ac|bi)-[0-9]+-[0-9]{1,2}\.pdf/', $f)) {
|
||||
$part = substr(str_replace('.pdf', '', $f), 5);
|
||||
$p = strpos($part, '-');
|
||||
if ( $p === false ) {
|
||||
$ref = substr($f, 0, 5) . $part;
|
||||
$indice = 0;
|
||||
} else {
|
||||
$ref = substr($f, 0, 5) . substr($part, 0, $p);
|
||||
$indice = substr($part, $p+1);
|
||||
}
|
||||
$tabFichiersFtp[strtoupper($ref).'-'.$indice] = $filename;
|
||||
}
|
||||
// Fichiers en anomalies
|
||||
else {
|
||||
if ($test) {
|
||||
echo "Erreur : Anomalie fichier numérisé $filename\n";
|
||||
} else {
|
||||
$subject = "Erreur : Anomalie fichier numérisé";
|
||||
$message = "Le fichier $filename a été trouvé et ne correspond pas au format attendu";
|
||||
$headers = 'From: supportdev@scores-decisions.com' . "\r\n" .
|
||||
'Reply-To: supportdev@scores-decisions.com';
|
||||
mail('supportdev@scores-decisions.com', $subject, $message, $headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tri des fichiers par ordre décroissant
|
||||
* Les noms des fichiers sont incrémenté par 1
|
||||
*/
|
||||
krsort($tabFichiersFtp);
|
||||
|
||||
/**
|
||||
* Dans le cas ou il y a eu une erreur de scan, la production passe a nouveau le
|
||||
* document dans le scanner et le fichier est envoyé sur le ftp
|
||||
* Le document est nommé G[ref],G[ref]-1,G[ref]-2,.....pdf.
|
||||
* On garde donc le dernier document scanné.
|
||||
*/
|
||||
$lastRef = '';
|
||||
$tabFichiersTemp = array();
|
||||
foreach($tabFichiersFtp as $k => $val) {
|
||||
$part = substr($k, 5);
|
||||
$p = strpos($part, '-');
|
||||
if ($p === false) {
|
||||
$ref = substr($k, 0, 5) . $part;
|
||||
} else {
|
||||
$ref = substr($k, 0, 5) . substr($part, 0, $p);
|
||||
}
|
||||
|
||||
if( $lastRef != $ref ) {
|
||||
$tabFichiersTemp[$ref] = $val;
|
||||
}
|
||||
$lastRef = $ref;
|
||||
|
||||
}
|
||||
$tabFichiers = $tabFichiersTemp;
|
||||
unset($tabFichiersTemp);
|
||||
|
||||
/**
|
||||
* Pour chaque commande, test de la présence d'un fichier associé
|
||||
* Si le fichier correspond téléchargement du fichier
|
||||
*/
|
||||
foreach ($tabCommandes as $ref => $commande) {
|
||||
foreach ($tabFichiers as $refAssocie => $fichier) {
|
||||
|
||||
if ($ref == $refAssocie) {
|
||||
echo date ('Y/m/d - H:i:s')." - Traitement de la commande $ref\n";
|
||||
if ($test) {
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier $fichier \n";
|
||||
} else {
|
||||
// Récupération du fichier depuis le FTP (s'il n'existe pas déjà)
|
||||
if (!file_exists($pathIn.'/'.$fichier)) {
|
||||
if (ftp_get($conn_id, $pathIn.'/'.$fichier, $fichier, FTP_BINARY, 0)) {
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier $fichier téléchargé depuis le serveur FTP.\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." - ERREUR : Impossible de télécharger le fichier $fichier !\n";
|
||||
}
|
||||
}
|
||||
|
||||
switch (substr($ref,2,2)) {
|
||||
case 'BI':
|
||||
$infogreffe = new Metier_Infogreffe_DocBI();
|
||||
$infogreffe->setSiren($commande->siren);
|
||||
//Format date cloture
|
||||
$dateCloture = substr($commande->bilanCloture,0,4) . '-' .
|
||||
substr($commande->bilanCloture,5,2) . '-' .
|
||||
substr($commande->bilanCloture,8,2);
|
||||
$path = $infogreffe->getFilePath($commande->bilanType, $dateCloture);
|
||||
$nomCible = $infogreffe->getFileName($commande->bilanType, $dateCloture);
|
||||
$fileOut = $c->profil->infogreffe->storage->path.'/'.$path.'/'.$nomCible;
|
||||
|
||||
$isFileOnStorage = false;
|
||||
if (file_exists($fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déjà présent en ".$fileOut.".\n";
|
||||
} else {
|
||||
if (copy($pathIn.'/'.$fichier, $fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déplacé en ".$fileOut.".\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Impossible de déplacer ".$pathIn.'/'.$fichier." en ".$fileOut." !\n";
|
||||
}
|
||||
}
|
||||
|
||||
// --- Lecture présence référence bilan
|
||||
if ($commande->bilanType=='sociaux') {
|
||||
$sql = "SELECT * FROM jo.greffes_bilans WHERE siren=:siren AND date_cloture=:cloture AND type_comptes='' OR type_comptes='sociaux'";
|
||||
} else {
|
||||
$sql = "SELECT * FROM jo.greffes_bilans WHERE siren=:siren AND date_cloture=:cloture AND type_comptes='consolides'";
|
||||
}
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $commande->siren);
|
||||
$stmt->bindValue('cloture', $dateCloture);
|
||||
$stmt->execute();
|
||||
$item = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
// --- Enregistrement
|
||||
if ($isFileOnStorage && $item->pdfDate == '0000-00-00') {
|
||||
$infos = $infogreffe->pdfInfos($fileOut);
|
||||
if (false !== $infos) {
|
||||
$data = array(
|
||||
'pdfLink' => $nomCible,
|
||||
'pdfSize' => $infos['size'],
|
||||
'pdfPage' => $infos['pages'],
|
||||
'pdfVer' => $infos['version'],
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$conn->update('jo.greffes_bilans', $data, array('id' => $item->id));
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'AC':
|
||||
$sql = "SELECT id, siren, numRC, LPAD(numGreffe,4,0) AS numGreffe, pdfLink,
|
||||
pdfSize, pdfPage, pdfDate, num_depot, date_depot, date_acte,
|
||||
LPAD(num_acte,2,0) AS num_acte, type_acte, type_acte_libelle,
|
||||
nbpages_acte, decision_nature, decision_libelle FROM jo.greffes_actes
|
||||
WHERE siren=:siren AND num_depot=:depot AND num_acte=:acte AND type_acte=:type";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $commande->siren);
|
||||
$stmt->bindValue('depot', $commande->depotNum);
|
||||
$stmt->bindValue('acte', $commande->acteNum);
|
||||
$stmt->bindValue('type', $commande->acteType);
|
||||
$stmt->execute();
|
||||
$item = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
$infogreffe = new Metier_Infogreffe_DocAC();
|
||||
$infogreffe->setSiren($commande->siren);
|
||||
$date = $commande->acteDate;
|
||||
if ($date == '0000-00-00') {
|
||||
$date = $commande->depotDate;
|
||||
}
|
||||
|
||||
$path = $infogreffe->getFilePath($date);
|
||||
//(Numéro du Greffe)-(dossier_millesime)-(dossier_statut)-(dossier_chrono)-(num_depot)
|
||||
$options = $item->numGreffe . '-' . substr($item->numRC,0,2) . '-' . substr($item->numRC,2,1) . '-' . substr($item->numRC,3) . '-' . $item->num_depot;
|
||||
$nomCible = $infogreffe->getFileName($date, $commande->acteNum, $commande->acteType, $options);
|
||||
|
||||
$fileOut = $c->profil->infogreffe->storage->path.'/'.$path.'/'.$nomCible;
|
||||
|
||||
$isFileOnStorage = false;
|
||||
|
||||
if (file_exists($fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déjà présent en ".$fileOut.".\n";
|
||||
} else {
|
||||
if (copy($pathIn.'/'.$fichier, $fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".$pathIn.'/'.$fichier." déplacé en ".$fileOut.".\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Impossible de déplacer ".$pathIn.'/'.$fichier." en ".$fileOut." !\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($isFileOnStorage && $item->pdfDate == '0000-00-00') {
|
||||
$infos = $infogreffe->pdfInfos($fileOut);
|
||||
if ( false !== $infos ) {
|
||||
$data = array(
|
||||
'pdfLink' => $nomCible,
|
||||
'pdfSize' => $infos['size'],
|
||||
'pdfPage' => $infos['pages'],
|
||||
'pdfVer' => $infos['version'],
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$conn->update('jo.greffes_actes', $data, array('id' => $item->id));
|
||||
echo " = enregistrement.\n";
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Envoi du mail et Mise à jour de la commande
|
||||
if (file_exists($fileOut)) {
|
||||
if ( $testMail ) {
|
||||
echo "Envoi fichier $nomCible ($ref) à ".$commande->email;
|
||||
} else {
|
||||
$report_txt.= "$ref intégré à l'extranet";
|
||||
$isMailSent = false;
|
||||
if (trim($commande->email)!=''){
|
||||
$isMailSent = sendMail($commande, substr($ref,2,2));
|
||||
} else {
|
||||
$isMailSent = true;
|
||||
}
|
||||
if ( $isMailSent ) {
|
||||
$data = array( 'dateEnvoi' => date('YmdHis'));
|
||||
switch ( substr($ref,2,2) ) {
|
||||
case 'BI':
|
||||
$conn->update('sdv1.greffe_commandes_bi', $data, array('id' => $commande->id));
|
||||
break;
|
||||
case 'AC':
|
||||
$conn->update('sdv1.greffe_commandes_ac', $data, array('id' => $commande->id));
|
||||
break;
|
||||
}
|
||||
echo date ('Y/m/d - H:i:s')." - Commande $ref mise à jour\n";
|
||||
$report_txt.= ' - Email envoyé à '.$commande->email;
|
||||
} else {
|
||||
$report_txt.= ' - Email non envoyé !';
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Email non envoyé et commande $ref non mise à jour\n";
|
||||
}
|
||||
$report_txt.= "\n";
|
||||
}
|
||||
} // Fin envoi mail
|
||||
}
|
||||
} // Fin condition ref
|
||||
}
|
||||
}
|
||||
ftp_close($conn_id);
|
||||
|
||||
if (empty($report_txt)) {
|
||||
$report_txt = "Aucun envoi.";
|
||||
}
|
||||
|
||||
//Envoi du mail de rapport
|
||||
if (!$test && !$testMail){
|
||||
$headers = 'From: supportdev@scores-decisions.com';
|
||||
if (mail($report_email, $report_subject, utf8_decode($report_txt))){
|
||||
echo date ('Y/m/d - H:i:s')." - Rapport envoyé.\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." - Erreur lors de l'envoir du rapport !\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
378
bin/kbis2.php
378
bin/kbis2.php
@ -1,378 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
/**
|
||||
* User-Agent
|
||||
* IE 11.0 : Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Affiche l'aide.",
|
||||
'siren=s' => "Commander un kbis",
|
||||
'commandes' => "Liste les commandes passees (Reference), si reference alors recupere le kbis",
|
||||
'visu=s' => "Telechargement du kbis avec une reference (--commandes obligatoire)",
|
||||
'debug' => "Mode debug",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if ($optionsNb == 0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Telecharge le kbis chez infogreffe.";
|
||||
echo "\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset($opts->debug) ) {
|
||||
define('DEBUG', true);
|
||||
} else {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
338 437 189
|
||||
552 144 503
|
||||
|
||||
https://www.infogreffe.fr/societes/
|
||||
|
||||
Se connecter
|
||||
Form
|
||||
Var client : 0041
|
||||
Var utilisateur : 2559
|
||||
Var password : 69873
|
||||
|
||||
|
||||
1 - GET https://www.infogreffe.fr/societes/
|
||||
|
||||
2 - POST https://www.infogreffe.fr/sso/identity/authenticate
|
||||
password 69873
|
||||
uri realm=abonnes
|
||||
username 00412559
|
||||
token.id=AQIC5wM2LY4Sfcy_Nc7YNNc2BtJVjZr-CrTMfnMxDw1iSvw.*AAJTSQACMDIAAlMxAAIwNA..*
|
||||
|
||||
3 - GET https://www.infogreffe.fr/societes/
|
||||
|
||||
|
||||
|
||||
4 - GET https://www.infogreffe.fr/services/entreprise/rest/recherche/parPhrase?nbIdRetournes=100&surveillanceVisible=true&miseAuPanierVisible=true&typeProduitMisEnAvant=EXTRAIT&phrase=338437189
|
||||
miseAuPanierVisible true
|
||||
nbIdRetournes 100
|
||||
phrase 338437189
|
||||
surveillanceVisible true
|
||||
typeProduitMisEnAvant EXTRAIT
|
||||
|
||||
{"critereRecherchePrincipal":"338437189","critereRecherche":null,"entrepRechInfosComplementaires":null
|
||||
,"entrepRCSStoreResponse":{"success":true,"identifier":"id","label":"deno","loadedAttr":"numeroDossier"
|
||||
,"idRecherche":"ENTREP_RCS_ACTIF","nbTotalResultats":1,"items":[{"id":8143039,"numeroDossier":"130586B20094"
|
||||
,"etablissementChrono":"0000","libelleEntreprise":{"denomination":"PROVENCE PLOMBERIE","denominationEirl"
|
||||
:null,"enseigne":"PROVENCE PLOMBERIE","nomCommercial":null,"sigle":null},"siren":338437189,"nic":"00016"
|
||||
,"adresse":{"lignes":["QUARTIER LA MARIANNE "],"codePostal":"13560","bureauDistributeur":"SÉNAS"},"codePaysRegistreEtranger"
|
||||
:null,"greffe":{"numero":"1305","nom":"TARASCON","codeGroupement":"05","codeEDI":"G1305","nomGreffeMin"
|
||||
:null},"typeEtab":"SIE","produitAuPanier":"AJOUTABLE","typeInscription":1,"sourceDonnees":"GTC","radie"
|
||||
:false,"dateRadiation":null,"nbEtablissements":1,"activite":{"codeNAF":"4322A","libelleNAF":"Travaux
|
||||
d'installation d'eau et de gaz en tous locaux"},"etatSurveillance":"SURVEILLABLE"}],"typeProduitMisEnAvant"
|
||||
:"EXTRAIT","critereRecherchePrincipal":null,"entrepRechInfosComplementaires":null},"entrepMultiStoreResponse"
|
||||
:{"success":true,"identifier":"id","label":"deno","loadedAttr":"numeroDossier","idRecherche":null,"nbTotalResultats"
|
||||
:0,"items":null,"typeProduitMisEnAvant":"EXTRAIT","critereRecherchePrincipal":null,"entrepRechInfosComplementaires"
|
||||
:null},"entrepRadieeStoreResponse":null,"entrepHorsRCSStoreResponse":{"success":true,"identifier":"id"
|
||||
,"label":"deno","loadedAttr":"numeroDossier","idRecherche":"ENTREP_HORS_RCS_ACTIFS","nbTotalResultats"
|
||||
:0,"items":[],"typeProduitMisEnAvant":"EXTRAIT","critereRecherchePrincipal":null,"entrepRechInfosComplementaires"
|
||||
:null},"reprStoreResponse":{"success":true,"identifier":"id","label":"deno","loadedAttr":"numeroDossier"
|
||||
,"idRecherche":"REPRESENTANT","nbTotalResultats":0,"items":[],"typeProduitMisEnAvant":"EXTRAIT","critereRecherchePrincipal"
|
||||
:"338437189","critereRecherche":null,"entrepRechInfosComplementaires":null},"typeProduitMisEnAvant":"EXTRAIT"
|
||||
}
|
||||
|
||||
5 - GET https://www.infogreffe.fr/societes/entreprise-societe/338437189-provence-plomberie-130586B200940000.html?typeProduitOnglet=EXTRAIT&afficherretour=false
|
||||
afficherretour false
|
||||
typeProduitOnglet EXTRAIT
|
||||
|
||||
<title>PROVENCE PLOMBERIE à SÉNAS (338437189) - Infogreffe</title>
|
||||
|
||||
5 - GET https://www.infogreffe.fr/services/produits/rest/catalogue/dossier/130586B20094/0000
|
||||
|
||||
{"ordrePresentationParProduit":{"BILAN_SAISI":6,"EXTRAIT":1,"ETAT_ENDETEMENT":2,"DOSSIER_COMPLET":9,"HISTO_MODIFS_RCS"
|
||||
:7,"CERTIF_PROC_COLLECTIVE":8,"ACTE":5},"cataloguePrix":{"ETAT_ENDETEMENT":{"typeProduit":"ETAT_ENDETEMENT"
|
||||
,"prixBaseTTC":46.8,"prixFraisEnvoiPostalTTC":1.42,"prixFraisEnvoiElectroniqueTTC":2.34,"prixBaseTTCParTypeInscription"
|
||||
:3.12,"prixFraisEnvoiPostalTTCParTypeInscription":0.89},"BILAN_SAISI":{"typeProduit":"BILAN_SAISI","prixBaseTTC"
|
||||
:3.6,"prixFraisEnvoiPostalTTC":0.0,"prixFraisEnvoiElectroniqueTTC":2.34},"STATUT_A_JOUR":{"typeProduit"
|
||||
:"STATUT_A_JOUR","prixBaseTTC":9.36,"prixFraisEnvoiPostalTTC":2.15,"prixFraisEnvoiElectroniqueTTC":2
|
||||
.34},"HISTO_MODIFS_RCS":{"typeProduit":"HISTO_MODIFS_RCS","prixBaseTTC":7.8,"prixFraisEnvoiPostalTTC"
|
||||
:0.0,"prixFraisEnvoiElectroniqueTTC":2.34},"BILAN_COMPLET":{"typeProduit":"BILAN_COMPLET","prixBaseTTC"
|
||||
:9.36,"prixFraisEnvoiPostalTTC":2.15,"prixFraisEnvoiElectroniqueTTC":2.34},"EXTRAIT":{"typeProduit":"EXTRAIT"
|
||||
,"prixBaseTTC":3.12,"prixFraisEnvoiPostalTTC":0.89,"prixFraisEnvoiElectroniqueTTC":0.78},"DOSSIER_COMPLET"
|
||||
:{"typeProduit":"DOSSIER_COMPLET","prixBaseTTC":70.19999999999999,"prixFraisEnvoiPostalTTC":7.499999999999999
|
||||
,"prixFraisEnvoiElectroniqueTTC":2.34},"ACTE":{"typeProduit":"ACTE","prixBaseTTC":9.36,"prixFraisEnvoiPostalTTC"
|
||||
:2.15,"prixFraisEnvoiElectroniqueTTC":2.34},"CERTIF_PROC_COLLECTIVE":{"typeProduit":"CERTIF_PROC_COLLECTIVE"
|
||||
,"prixBaseTTC":1.56,"prixFraisEnvoiPostalTTC":0.89,"prixFraisEnvoiElectroniqueTTC":2.34}},"produits"
|
||||
:[{"modesDeDiffusionDispos":["V","C","M","T"],"produit":{"typeProduit":"EXTRAIT","modifiable":true,"identifiant"
|
||||
:{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"kbisPeriodique"
|
||||
:true},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C"],"produit":{"typeProduit":"ETAT_ENDETEMENT"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094"},"categoriesInscription":[{"code":"C1","libelle":"Catégorie 1","typesInscription":[{"code":"PRIV_SECU"
|
||||
,"libelle":"Privilège de la sécurité sociale et des régimes complémentaires"},{"code":"PRIV_TRESOR","libelle"
|
||||
:"Privilège du Trésor Public"},{"code":"PROTET","libelle":"Protêts"},{"code":"PRIV_ANAEM","libelle":"Agence
|
||||
Nationale de l'Accueil des Etrangers et des Migrations"}]},{"code":"C2","libelle":"Catégorie 2","typesInscription"
|
||||
:[{"code":"NAN_FOND_COMM","libelle":"Nantissements du fonds de commerce"},{"code":"PRIV_VENDEUR","libelle"
|
||||
:"Privilèges du vendeur de fonds de commerce et d'action résolutoire"},{"code":"NAN_OUTIL","libelle"
|
||||
:"Nantissements de l'outillage, matériel et équipement"},{"code":"DECL_CREANCES","libelle":"Déclaration
|
||||
de créance"}]},{"code":"C3","libelle":"Catégorie 3","typesInscription":[{"code":"OP_CREDIT_BAIL","libelle"
|
||||
:"Opérations de crédit-bail en matière mobilière"},{"code":"PUB_CONTRAT_LOC","libelle":"Publicité de
|
||||
contrats de location"},{"code":"PUB_RESEV_PROPR","libelle":"Publicité de clauses de réserve de propri
|
||||
été"}]},{"code":"C4","libelle":"Catégorie 4","typesInscription":[{"code":"GAGE_STOCKS","libelle":"Gage
|
||||
des stocks"},{"code":"WARRANTS_CAT","libelle":"Warrants"}]},{"code":"C5","libelle":"Catégorie 5","typesInscription"
|
||||
:[{"code":"PRETS_DELAIS","libelle":"Prêts et délais"},{"code":"BIENS_INALIENABLES","libelle":"Biens inali
|
||||
énables"}]}]},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"STATUT_A_JOUR"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","depotActeNumero":4,"acteChrono":2},"dateActe":1418770800000,"typeActe":{"code":"STAJh","libelle"
|
||||
:"Statuts mis à jour"},"nbPages":16,"decisions":[],"depot":{"numeroDepot":"4","numeroDepotManu":3459
|
||||
,"dateDepot":1419980400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["C"],"produit":{"typeProduit"
|
||||
:"ACTE","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut"
|
||||
:"B","dossierChrono":"20094","depotActeNumero":1,"acteChrono":1},"dateActe":652485600000,"typeActe":
|
||||
{"code":"ORDPREh","libelle":"Ordonnance du président"},"nbPages":0,"decisions":[{"natureDecision":{"code"
|
||||
:"AGPRh","libelle":"Prorogation du délai de réunion de l'A.G. chargée d'approuver les comptes"},"libelle"
|
||||
:null}],"depot":{"numeroDepot":"1","numeroDepotManu":16,"dateDepot":655686000000}},"miseAuPanier":null
|
||||
},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"ACTE","modifiable":true,"identifiant"
|
||||
:{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","depotActeNumero"
|
||||
:2,"acteChrono":1},"dateActe":807832800000,"typeActe":{"code":"PVAh","libelle":"Procès-verbal d'assembl
|
||||
ée"},"nbPages":19,"decisions":[],"depot":{"numeroDepot":"2","numeroDepotManu":814,"dateDepot":812156400000
|
||||
}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"ACTE","modifiable"
|
||||
:true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","depotActeNumero":2,"acteChrono":2},"dateActe":807832800000,"typeActe":{"code":"STAJh","libelle"
|
||||
:"Statuts mis à jour"},"nbPages":19,"decisions":[],"depot":{"numeroDepot":"2","numeroDepotManu":814,"dateDepot"
|
||||
:812156400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit"
|
||||
:"ACTE","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut"
|
||||
:"B","dossierChrono":"20094","depotActeNumero":2,"acteChrono":3},"dateActe":807832800000,"typeActe":
|
||||
{"code":"DIVERSh","libelle":"Divers"},"nbPages":19,"decisions":[{"natureDecision":{"code":"ZDIVh","libelle"
|
||||
:"Divers"},"libelle":"EXTENSION OBJET SOCIAL & ACTIVITE"}],"depot":{"numeroDepot":"2","numeroDepotManu"
|
||||
:814,"dateDepot":812156400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit"
|
||||
:{"typeProduit":"ACTE","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut"
|
||||
:"B","dossierChrono":"20094","depotActeNumero":3,"acteChrono":1},"dateActe":1216072800000,"typeActe"
|
||||
:{"code":"PVAh","libelle":"Procès-verbal d'assemblée"},"nbPages":4,"decisions":[{"natureDecision":{"code"
|
||||
:"ZDIVh","libelle":"Divers"},"libelle":"MODIFICATION DE L'AFFECTATION DU RESULTAT - EXERCICE CLOS LE
|
||||
31.12.2007"}],"depot":{"numeroDepot":"3","numeroDepotManu":1373,"dateDepot":1219960800000}},"miseAuPanier"
|
||||
:null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"ACTE","modifiable":true,"identifiant"
|
||||
:{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","depotActeNumero"
|
||||
:4,"acteChrono":1},"dateActe":1418770800000,"typeActe":{"code":"PVAGEXh","libelle":"Procès-verbal d'assembl
|
||||
ée générale extraordinaire"},"nbPages":3,"decisions":[{"natureDecision":{"code":"EXCLOTh","libelle":"Changement
|
||||
relatif à la date de clôture de l'exercice social"},"libelle":null}],"depot":{"numeroDepot":"4","numeroDepotManu"
|
||||
:3459,"dateDepot":1419980400000}},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","M","T"],"produit"
|
||||
:{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime"
|
||||
:"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2013,"bilanNumero":1427},"type":"BS"
|
||||
,"sousCode":"SP","dateClotureExercice":1388444400000,"denominationEIRL":null,"disponibleXbrl":false}
|
||||
,"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2013,"bilanNumero":1427},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1388444400000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2012,"bilanNumero"
|
||||
:2537},"type":"BS","sousCode":"SP","dateClotureExercice":1356908400000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2012,"bilanNumero":2537},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1356908400000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2011,"bilanNumero"
|
||||
:1672},"type":"BS","sousCode":"SP","dateClotureExercice":1325286000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2011,"bilanNumero":1672},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1325286000000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2010,"bilanNumero"
|
||||
:2196},"type":"BS","sousCode":"SP","dateClotureExercice":1293750000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2010,"bilanNumero":2196},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1293750000000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2009,"bilanNumero"
|
||||
:969},"type":"BS","sousCode":"SP","dateClotureExercice":1262214000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2009,"bilanNumero":969},"type":"BS","sousCode":"BL","dateClotureExercice":1262214000000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2008,"bilanNumero"
|
||||
:1427},"type":"BS","sousCode":"SP","dateClotureExercice":1230678000000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2008,"bilanNumero":1427},"type":"BS","sousCode":"BL","dateClotureExercice"
|
||||
:1230678000000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2007,"bilanNumero"
|
||||
:902},"type":"BS","sousCode":"SP","dateClotureExercice":1199055600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2007,"bilanNumero":902},"type":"BS","sousCode":"BL","dateClotureExercice":1199055600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2006,"bilanNumero"
|
||||
:891},"type":"BS","sousCode":"SP","dateClotureExercice":1167519600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2006,"bilanNumero":891},"type":"BS","sousCode":"BL","dateClotureExercice":1167519600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2005,"bilanNumero"
|
||||
:769},"type":"BS","sousCode":"SP","dateClotureExercice":1135983600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","C","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2005,"bilanNumero":769},"type":"BS","sousCode":"BL","dateClotureExercice":1135983600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2004,"bilanNumero"
|
||||
:704},"type":"BS","sousCode":"SP","dateClotureExercice":1104447600000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2004,"bilanNumero":704},"type":"BS","sousCode":"BL","dateClotureExercice":1104447600000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2003,"bilanNumero"
|
||||
:850},"type":"BS","sousCode":"SP","dateClotureExercice":1072825200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2003,"bilanNumero":850},"type":"BS","sousCode":"BL","dateClotureExercice":1072825200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2002,"bilanNumero"
|
||||
:959},"type":"BS","sousCode":"SP","dateClotureExercice":1041289200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2002,"bilanNumero":959},"type":"BS","sousCode":"BL","dateClotureExercice":1041289200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2001,"bilanNumero"
|
||||
:561},"type":"BS","sousCode":"SP","dateClotureExercice":1009753200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2001,"bilanNumero":561},"type":"BS","sousCode":"BL","dateClotureExercice":1009753200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"M","T"],"produit":{"typeProduit":"BILAN_SAISI","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":2000,"bilanNumero"
|
||||
:644},"type":"BS","sousCode":"SP","dateClotureExercice":978217200000,"denominationEIRL":null,"disponibleXbrl"
|
||||
:false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET"
|
||||
,"modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094","bilanMillesime":2000,"bilanNumero":644},"type":"BS","sousCode":"BL","dateClotureExercice":978217200000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"T"],"produit":{"typeProduit":"BILAN_COMPLET","modifiable":true,"identifiant":{"codeGreffe":"1305","dossierMillesime"
|
||||
:"86","dossierStatut":"B","dossierChrono":"20094","bilanMillesime":1999,"bilanNumero":986},"type":"BS"
|
||||
,"sousCode":"BL","dateClotureExercice":946594800000,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier"
|
||||
:null},{"modesDeDiffusionDispos":["V","T"],"produit":{"typeProduit":"BILAN_COMPLET","modifiable":true
|
||||
,"identifiant":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"
|
||||
,"bilanMillesime":1998,"bilanNumero":614},"type":"BS","sousCode":"BL","dateClotureExercice":915058800000
|
||||
,"denominationEIRL":null,"disponibleXbrl":false},"miseAuPanier":null},{"modesDeDiffusionDispos":["V"
|
||||
,"T"],"produit":{"typeProduit":"HISTO_MODIFS_RCS","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"}},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","C"],"produit":{"typeProduit":"CERTIF_PROC_COLLECTIVE","modifiable":true,"identifiant":{"codeGreffe"
|
||||
:"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"}},"miseAuPanier":null},{"modesDeDiffusionDispos"
|
||||
:["V","C"],"produit":{"typeProduit":"DOSSIER_COMPLET","modifiable":true,"identifiant":{"codeGreffe":"1305"
|
||||
,"dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"detailProduits":[{"typeProduit"
|
||||
:"EXTRAIT","modesDeDiffusionDispos":["V","C","M","T"]},{"typeProduit":"ETAT_ENDETEMENT","modesDeDiffusionDispos"
|
||||
:["V","C"]},{"typeProduit":"BILAN_COMPLET","modesDeDiffusionDispos":["V","C","T"],"dateClotureExercice"
|
||||
:1388444400000},{"typeProduit":"STATUT_A_JOUR","modesDeDiffusionDispos":["V","C","T"]},{"typeProduit"
|
||||
:"CERTIF_PROC_COLLECTIVE","modesDeDiffusionDispos":["V","C"]}]},"miseAuPanier":null}]}
|
||||
|
||||
ordrePresentationParProduit.EXTRAIT = 1 (+ cataloguePrix)
|
||||
|
||||
|
||||
6 - POST AJAX https://www.infogreffe.fr/services/produits/rest/panier/extrait
|
||||
idDossier 130586B20094
|
||||
modesDeDiffusion V
|
||||
modesDeDiffusion T
|
||||
nbExemplaires 0
|
||||
|
||||
{"nbDocuments":1,"nbDocumentsParTypeProduit":1,"total":3.9,"totalReduit":3.9,"hasCourrier":false,"cartoucheTotal"
|
||||
:3.9,"cartoucheReduitTotal":3.9,"produitTotal":3.9,"produitReduitTotal":3.9}
|
||||
|
||||
7 - https://www.infogreffe.fr/services/produits/rest/panier
|
||||
|
||||
{"panier":{"panierCartouches":[{"prixCartouche":{"totalTtc":3.9},"identite":{"dossier":{"idDossier":
|
||||
{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"nomGreffeImmat"
|
||||
:"TARASCON","siren":338437189,"denomination":"PROVENCE PLOMBERIE","etatposeSurveillance":null},"debiteur"
|
||||
:null,"listeEntreprises":null,"affaire":null,"nomGreffeImmat":"TARASCON"},"ordrePresentationParProduit"
|
||||
:{"EXTRAIT":1},"produits":[{"produit":{"typeProduit":"EXTRAIT","modifiable":true,"identifiant":{"codeGreffe"
|
||||
:"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono":"20094"},"kbisPeriodique":true},"miseAuPanier"
|
||||
:{"prixProduit":{"totalTtc":3.9},"modesDeDiffusionSelectionnes":["V","T"],"nbExemplaires":null,"envoiPeriodique"
|
||||
:{"periodicite":0,"duree":0},"modifiable":true},"libelleProduit":"Extrait RCS (K bis)"}],"prixTotalActes"
|
||||
:0.0,"prixTotalDap":0.0}],"prixTotal":{"totalTtc":3.9},"hasCourrier":false}}
|
||||
|
||||
8 - https://www.infogreffe.fr/services/produits/rest/panier/resume
|
||||
|
||||
{"nbDocuments":1,"nbDocumentsParTypeProduit":0,"total":3.9,"totalReduit":3.9,"hasCourrier":false}
|
||||
|
||||
9 - GET https://www.infogreffe.fr/services/achatclient/rest/achat/createCmdAbonne
|
||||
|
||||
{"numCommande":"173829445","modeDiffusionCourrier":false}
|
||||
|
||||
10 - GET https://www.infogreffe.fr/services/commandeclient/rest/client/recapCommande?numeroCommande=173829445
|
||||
numeroCommande 173829445
|
||||
|
||||
{"commande":{"idCommande":"173829445","date":1433493693000,"totalTTC":3.9,"totalTVA":0.65,"totalHT":null
|
||||
,"refCommande":"YGWJN","moyenPaiement":"COMPTE_ABONNE","numeroCartePrepayee":null,"cartouches":[{"intitule"
|
||||
:{"dossier":{"idDossier":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094"},"nomGreffeImmat":"TARASCON","siren":338437189,"denomination":"PROVENCE PLOMBERIE","etatposeSurveillance"
|
||||
:"SURVEILLABLE"},"debiteur":null,"listeEntreprises":null,"affaire":null,"nomGreffeImmat":"TARASCON"}
|
||||
,"produitsEntreprise":[{"ligneCommande":1,"document":"EXCP","produitTTC":3.9000000000000004,"produitHT"
|
||||
:0.0,"fraisDePortHT":0.0,"documentsProduit":[{"modeDiffusion":"V","nbExemplaires":1,"urlTelechargement"
|
||||
:null,"codeSuiviLivraison":null},{"modeDiffusion":"T","nbExemplaires":1,"urlTelechargement":null,"codeSuiviLivraison"
|
||||
:null}],"inDossierComplet":null,"envoiPeriodique":{"periodicite":0,"duree":0},"refEnvoiPeriodique":null
|
||||
}]}],"refCommandeClient":null,"refEnvoiPeriodique":null,"denominationSociete":null,"nomClient":"SCORES
|
||||
ET DECISIONS SAS","abNume":"0041","abAbonne":"2559","email":"CONTACT@SCORES-DECISIONS.COM","solde":null
|
||||
,"nbDocuments":null,"fraisDePortHT":0.0}}
|
||||
|
||||
11 - GET https://www.infogreffe.fr/services/commandeclient/rest/client/recapCommande?numeroCommande=173829445
|
||||
numeroCommande 173829445
|
||||
|
||||
{"commande":{"idCommande":"173829445","date":1433493693000,"totalTTC":3.9,"totalTVA":0.65,"totalHT":null
|
||||
,"refCommande":"YGWJN","moyenPaiement":"COMPTE_ABONNE","numeroCartePrepayee":null,"cartouches":[{"intitule"
|
||||
:{"dossier":{"idDossier":{"codeGreffe":"1305","dossierMillesime":"86","dossierStatut":"B","dossierChrono"
|
||||
:"20094"},"nomGreffeImmat":"TARASCON","siren":338437189,"denomination":"PROVENCE PLOMBERIE","etatposeSurveillance"
|
||||
:"SURVEILLABLE"},"debiteur":null,"listeEntreprises":null,"affaire":null,"nomGreffeImmat":"TARASCON"}
|
||||
,"produitsEntreprise":[{"ligneCommande":1,"document":"EXCP","produitTTC":3.9000000000000004,"produitHT"
|
||||
:0.0,"fraisDePortHT":0.0,"documentsProduit":[{"modeDiffusion":"V","nbExemplaires":1,"urlTelechargement"
|
||||
:null,"codeSuiviLivraison":null},{"modeDiffusion":"T","nbExemplaires":1,"urlTelechargement":null,"codeSuiviLivraison"
|
||||
:null}],"inDossierComplet":null,"envoiPeriodique":{"periodicite":0,"duree":0},"refEnvoiPeriodique":null
|
||||
}]}],"refCommandeClient":null,"refEnvoiPeriodique":null,"denominationSociete":null,"nomClient":"SCORES
|
||||
ET DECISIONS SAS","abNume":"0041","abAbonne":"2559","email":"CONTACT@SCORES-DECISIONS.COM","solde":null
|
||||
,"nbDocuments":null,"fraisDePortHT":0.0}}
|
||||
|
||||
12 - GET https://www.infogreffe.fr/societes/panier/confirmation?numCommande=173829445&typeClient=AB&etapeCoord=false
|
||||
etapeCoord false
|
||||
numCommande 173829445
|
||||
typeClient AB
|
||||
=> HTML
|
||||
Téléchargement du KBIS
|
||||
|
||||
<tbody class="commandeDocs">
|
||||
<a href="javascript:void(0);" class="voirRouge" style="color: red;">Télécharger</a>
|
||||
|
||||
https://www.infogreffe.fr/services/commandeclient/rest/client/visupdf?numeroCommande=173829445&ligneCommande=1&visualisation=undefined
|
||||
|
||||
|
||||
|
||||
13 - GET https://www.infogreffe.fr/services/commandeclient/rest/client/recapCommande?numeroCommande=173829445
|
||||
=> Voir 10
|
||||
|
||||
14 -
|
||||
|
||||
|
||||
*/
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../application/bin.bootstrap.php';
|
||||
|
||||
// --- Options
|
||||
$displayUsage = false;
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Displays usage information.",
|
||||
'sqlfile=s' => "",
|
||||
'csvfile=s' => "",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Aide / Options
|
||||
if (count($opts->getOptions())==0 || isset($opts->help)) {
|
||||
$displayUsage = true;
|
||||
}
|
||||
|
||||
// --- Usage
|
||||
if ($displayUsage) {
|
||||
echo "Génération d'un fichier CSV à partir d'un fichier SQL.\n";
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
use League\Csv\Writer;
|
||||
|
||||
$sql = file_get_contents($opts->sqlfile);
|
||||
|
||||
//we fetch the info from a DB using a PDO object
|
||||
$stmt = $conn->executeQuery($sql);
|
||||
|
||||
if ($stmt->rowCount() == 0) {
|
||||
file_put_contents($opts->csvfile, "");
|
||||
}
|
||||
else {
|
||||
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
// Create the CSV
|
||||
$csv = Writer::createFromPath($opts->csvfile.'.tmp', 'w');
|
||||
$csv->setNewline("\r\n");
|
||||
$csv->setOutputBOM(Writer::BOM_UTF8);
|
||||
|
||||
// Insert the CSV header
|
||||
$csv->insertOne(array_keys($rows[0]));
|
||||
|
||||
// Insert all data
|
||||
$csv->insertAll($rows);
|
||||
|
||||
// Set the real name of file
|
||||
rename($opts->csvfile.'.tmp', $opts->csvfile);
|
||||
}
|
44
bin/zf.bat
Normal file
44
bin/zf.bat
Normal file
@ -0,0 +1,44 @@
|
||||
@ECHO off
|
||||
REM Zend Framework
|
||||
REM
|
||||
REM LICENSE
|
||||
REM
|
||||
REM This source file is subject to the new BSD license that is bundled
|
||||
REM with this package in the file LICENSE.txt.
|
||||
REM It is also available through the world-wide-web at this URL:
|
||||
REM http://framework.zend.com/license/new-bsd
|
||||
REM If you did not receive a copy of the license and are unable to
|
||||
REM obtain it through the world-wide-web, please send an email
|
||||
REM to license@zend.com so we can send you a copy immediately.
|
||||
REM
|
||||
REM Zend
|
||||
REM Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
REM http://framework.zend.com/license/new-bsd New BSD License
|
||||
|
||||
|
||||
REM Test to see if this was installed via pear
|
||||
SET ZTMPZTMPZTMPZ=@ph
|
||||
SET TMPZTMPZTMP=%ZTMPZTMPZTMPZ%p_bin@
|
||||
REM below @php_bin@
|
||||
FOR %%x IN ("@php_bin@") DO (if %%x=="%TMPZTMPZTMP%" GOTO :NON_PEAR_INSTALLED)
|
||||
|
||||
GOTO PEAR_INSTALLED
|
||||
|
||||
:NON_PEAR_INSTALLED
|
||||
REM Assume php.exe is executable, and that zf.php will reside in the
|
||||
REM same file as this one
|
||||
SET PHP_BIN=php.exe
|
||||
SET PHP_DIR=%~dp0
|
||||
GOTO RUN
|
||||
|
||||
:PEAR_INSTALLED
|
||||
REM Assume this was installed via PEAR and use replacements php_bin & php_dir
|
||||
SET PHP_BIN=@php_bin@
|
||||
SET PHP_DIR=@php_dir@
|
||||
GOTO RUN
|
||||
|
||||
:RUN
|
||||
SET ZF_SCRIPT=%PHP_DIR%\zf.php
|
||||
"%PHP_BIN%" -d safe_mode=Off -f "%ZF_SCRIPT%" -- %*
|
||||
|
||||
|
624
bin/zf.php
Normal file
624
bin/zf.php
Normal file
@ -0,0 +1,624 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Tool
|
||||
* @subpackage Framework
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* ZF
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Tool
|
||||
* @subpackage Framework
|
||||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class ZF
|
||||
{
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_clientLoaded = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_mode = 'runTool';
|
||||
|
||||
/**
|
||||
* @var array of messages
|
||||
*/
|
||||
protected $_messages = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_homeDirectory = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_storageDirectory = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_configFile = null;
|
||||
|
||||
/**
|
||||
* main()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function main()
|
||||
{
|
||||
$zf = new self();
|
||||
$zf->bootstrap();
|
||||
$zf->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* bootstrap()
|
||||
*
|
||||
* @return ZF
|
||||
*/
|
||||
public function bootstrap()
|
||||
{
|
||||
// detect settings
|
||||
$this->_mode = $this->_detectMode();
|
||||
$this->_homeDirectory = $this->_detectHomeDirectory();
|
||||
$this->_storageDirectory = $this->_detectStorageDirectory();
|
||||
$this->_configFile = $this->_detectConfigFile();
|
||||
|
||||
// setup
|
||||
$this->_setupPHPRuntime();
|
||||
$this->_setupToolRuntime();
|
||||
}
|
||||
|
||||
/**
|
||||
* run()
|
||||
*
|
||||
* @return ZF
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
switch ($this->_mode) {
|
||||
case 'runError':
|
||||
$this->_runError();
|
||||
$this->_runInfo();
|
||||
break;
|
||||
case 'runSetup':
|
||||
if ($this->_runSetup() === false) {
|
||||
$this->_runInfo();
|
||||
}
|
||||
break;
|
||||
case 'runInfo':
|
||||
$this->_runInfo();
|
||||
break;
|
||||
case 'runTool':
|
||||
default:
|
||||
$this->_runTool();
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* _detectMode()
|
||||
*
|
||||
* @return ZF
|
||||
*/
|
||||
protected function _detectMode()
|
||||
{
|
||||
$arguments = $_SERVER['argv'];
|
||||
|
||||
$mode = 'runTool';
|
||||
|
||||
if (!isset($arguments[0])) {
|
||||
return $mode;
|
||||
}
|
||||
|
||||
if ($arguments[0] == $_SERVER['PHP_SELF']) {
|
||||
$this->_executable = array_shift($arguments);
|
||||
}
|
||||
|
||||
if (!isset($arguments[0])) {
|
||||
return $mode;
|
||||
}
|
||||
|
||||
if ($arguments[0] == '--setup') {
|
||||
$mode = 'runSetup';
|
||||
} elseif ($arguments[0] == '--info') {
|
||||
$mode = 'runInfo';
|
||||
}
|
||||
|
||||
return $mode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _detectHomeDirectory() - detect the home directory in a variety of different places
|
||||
*
|
||||
* @param bool $mustExist Should the returned value already exist in the file system
|
||||
* @param bool $returnMessages Should it log messages for output later
|
||||
* @return string
|
||||
*/
|
||||
protected function _detectHomeDirectory($mustExist = true, $returnMessages = true)
|
||||
{
|
||||
$homeDirectory = null;
|
||||
|
||||
$homeDirectory = getenv('ZF_HOME'); // check env var ZF_HOME
|
||||
if ($homeDirectory) {
|
||||
$this->_logMessage('Home directory found in environment variable ZF_HOME with value ' . $homeDirectory, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
|
||||
return $homeDirectory;
|
||||
} else {
|
||||
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
$homeDirectory = getenv('HOME'); // HOME environment variable
|
||||
|
||||
if ($homeDirectory) {
|
||||
$this->_logMessage('Home directory found in environment variable HOME with value ' . $homeDirectory, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
|
||||
return $homeDirectory;
|
||||
} else {
|
||||
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$homeDirectory = getenv('HOMEPATH');
|
||||
|
||||
if ($homeDirectory) {
|
||||
$this->_logMessage('Home directory found in environment variable HOMEPATH with value ' . $homeDirectory, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
|
||||
return $homeDirectory;
|
||||
} else {
|
||||
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
$homeDirectory = getenv('USERPROFILE');
|
||||
|
||||
if ($homeDirectory) {
|
||||
$this->_logMessage('Home directory found in environment variable USERPROFILE with value ' . $homeDirectory, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($homeDirectory))) {
|
||||
return $homeDirectory;
|
||||
} else {
|
||||
$this->_logMessage('Home directory does not exist at ' . $homeDirectory, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* _detectStorageDirectory() - Detect where the storage directory is from a variaty of possiblities
|
||||
*
|
||||
* @param bool $mustExist Should the returned value already exist in the file system
|
||||
* @param bool $returnMessages Should it log messages for output later
|
||||
* @return string
|
||||
*/
|
||||
protected function _detectStorageDirectory($mustExist = true, $returnMessages = true)
|
||||
{
|
||||
$storageDirectory = false;
|
||||
|
||||
$storageDirectory = getenv('ZF_STORAGE_DIR');
|
||||
if ($storageDirectory) {
|
||||
$this->_logMessage('Storage directory path found in environment variable ZF_STORAGE_DIR with value ' . $storageDirectory, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
|
||||
return $storageDirectory;
|
||||
} else {
|
||||
$this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
$homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false);
|
||||
|
||||
if ($homeDirectory) {
|
||||
$storageDirectory = $homeDirectory . '/.zf/';
|
||||
$this->_logMessage('Storage directory assumed in home directory at location ' . $storageDirectory, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($storageDirectory))) {
|
||||
return $storageDirectory;
|
||||
} else {
|
||||
$this->_logMessage('Storage directory does not exist at ' . $storageDirectory, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* _detectConfigFile() - Detect config file location from a variety of possibilities
|
||||
*
|
||||
* @param bool $mustExist Should the returned value already exist in the file system
|
||||
* @param bool $returnMessages Should it log messages for output later
|
||||
* @return string
|
||||
*/
|
||||
protected function _detectConfigFile($mustExist = true, $returnMessages = true)
|
||||
{
|
||||
$configFile = null;
|
||||
|
||||
$configFile = getenv('ZF_CONFIG_FILE');
|
||||
if ($configFile) {
|
||||
$this->_logMessage('Config file found environment variable ZF_CONFIG_FILE at ' . $configFile, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($configFile))) {
|
||||
return $configFile;
|
||||
} else {
|
||||
$this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
$homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false);
|
||||
if ($homeDirectory) {
|
||||
$configFile = $homeDirectory . '/.zf.ini';
|
||||
$this->_logMessage('Config file assumed in home directory at location ' . $configFile, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($configFile))) {
|
||||
return $configFile;
|
||||
} else {
|
||||
$this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
$storageDirectory = ($this->_storageDirectory) ? $this->_storageDirectory : $this->_detectStorageDirectory(true, false);
|
||||
if ($storageDirectory) {
|
||||
$configFile = $storageDirectory . '/zf.ini';
|
||||
$this->_logMessage('Config file assumed in storage directory at location ' . $configFile, $returnMessages);
|
||||
if (!$mustExist || ($mustExist && file_exists($configFile))) {
|
||||
return $configFile;
|
||||
} else {
|
||||
$this->_logMessage('Config file does not exist at ' . $configFile, $returnMessages);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _setupPHPRuntime() - parse the config file if it exists for php ini values to set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _setupPHPRuntime()
|
||||
{
|
||||
// set php runtime settings
|
||||
ini_set('display_errors', true);
|
||||
|
||||
// support the changing of the current working directory, necessary for some providers
|
||||
$cwd = getenv('ZEND_TOOL_CURRENT_WORKING_DIRECTORY');
|
||||
if ($cwd != '' && realpath($cwd)) {
|
||||
chdir($cwd);
|
||||
}
|
||||
|
||||
if (!$this->_configFile) {
|
||||
return;
|
||||
}
|
||||
$zfINISettings = parse_ini_file($this->_configFile);
|
||||
$phpINISettings = ini_get_all();
|
||||
foreach ($zfINISettings as $zfINIKey => $zfINIValue) {
|
||||
if (substr($zfINIKey, 0, 4) === 'php.') {
|
||||
$phpINIKey = substr($zfINIKey, 4);
|
||||
if (array_key_exists($phpINIKey, $phpINISettings)) {
|
||||
ini_set($phpINIKey, $zfINIValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* _setupToolRuntime() - setup the tools include_path and load the proper framwork parts that
|
||||
* enable Zend_Tool to work.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _setupToolRuntime()
|
||||
{
|
||||
|
||||
$includePathPrepend = getenv('ZEND_TOOL_INCLUDE_PATH_PREPEND');
|
||||
$includePathFull = getenv('ZEND_TOOL_INCLUDE_PATH');
|
||||
|
||||
// check if the user has not provided anything
|
||||
if (!($includePathPrepend || $includePathFull)) {
|
||||
if ($this->_tryClientLoad()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if ZF is not in the include_path, but relative to this file, put it in the include_path
|
||||
if ($includePathPrepend || $includePathFull) {
|
||||
if (isset($includePathPrepend) && ($includePathPrepend !== false)) {
|
||||
set_include_path($includePathPrepend . PATH_SEPARATOR . get_include_path());
|
||||
} elseif (isset($includePathFull) && ($includePathFull !== false)) {
|
||||
set_include_path($includePathFull);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_tryClientLoad()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$zfIncludePath['relativePath'] = dirname(__FILE__) . '/../library/';
|
||||
if (file_exists($zfIncludePath['relativePath'] . 'Zend/Tool/Framework/Client/Console.php')) {
|
||||
set_include_path(realpath($zfIncludePath['relativePath']) . PATH_SEPARATOR . get_include_path());
|
||||
}
|
||||
|
||||
if (!$this->_tryClientLoad()) {
|
||||
$this->_mode = 'runError';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* _tryClientLoad() - Attempt to load the Zend_Tool_Framework_Client_Console to enable the tool to run.
|
||||
*
|
||||
* This method will return false if its not loaded to allow the consumer to alter the environment in such
|
||||
* a way that it can be called again to try loading the proper file/class.
|
||||
*
|
||||
* @return bool if the client is actuall loaded or not
|
||||
*/
|
||||
protected function _tryClientLoad()
|
||||
{
|
||||
$this->_clientLoaded = false;
|
||||
$fh = @fopen('Zend/Tool/Framework/Client/Console.php', 'r', true);
|
||||
if (!$fh) {
|
||||
return $this->_clientLoaded; // false
|
||||
} else {
|
||||
fclose($fh);
|
||||
unset($fh);
|
||||
include 'Zend/Tool/Framework/Client/Console.php';
|
||||
$this->_clientLoaded = class_exists('Zend_Tool_Framework_Client_Console');
|
||||
}
|
||||
|
||||
return $this->_clientLoaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* _runError() - Output the error screen that tells the user that the tool was not setup
|
||||
* in a sane way
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _runError()
|
||||
{
|
||||
|
||||
echo <<<EOS
|
||||
|
||||
***************************** ZF ERROR ********************************
|
||||
In order to run the zf command, you need to ensure that Zend Framework
|
||||
is inside your include_path. There are a variety of ways that you can
|
||||
ensure that this zf command line tool knows where the Zend Framework
|
||||
library is on your system, but not all of them can be described here.
|
||||
|
||||
The easiest way to get the zf command running is to give it the include
|
||||
path via an environment variable ZEND_TOOL_INCLUDE_PATH or
|
||||
ZEND_TOOL_INCLUDE_PATH_PREPEND with the proper include path to use,
|
||||
then run the command "zf --setup". This command is designed to create
|
||||
a storage location for your user, as well as create the zf.ini file
|
||||
that the zf command will consult in order to run properly on your
|
||||
system.
|
||||
|
||||
Example you would run:
|
||||
|
||||
$ ZEND_TOOL_INCLUDE_PATH=/path/to/library zf --setup
|
||||
|
||||
Your are encourged to read more in the link that follows.
|
||||
|
||||
EOS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* _runInfo() - this command will produce information about the setup of this script and
|
||||
* Zend_Tool
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _runInfo()
|
||||
{
|
||||
echo 'Zend_Tool & CLI Setup Information' . PHP_EOL
|
||||
. '(available via the command line "zf --info")'
|
||||
. PHP_EOL;
|
||||
|
||||
echo ' * ' . implode(PHP_EOL . ' * ', $this->_messages) . PHP_EOL;
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
echo 'To change the setup of this tool, run: "zf --setup"';
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* _runSetup() - parse the request to see which setup command to run
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _runSetup()
|
||||
{
|
||||
$setupCommand = (isset($_SERVER['argv'][2])) ? $_SERVER['argv'][2] : null;
|
||||
|
||||
switch ($setupCommand) {
|
||||
case 'storage-directory':
|
||||
$this->_runSetupStorageDirectory();
|
||||
break;
|
||||
case 'config-file':
|
||||
$this->_runSetupConfigFile();
|
||||
break;
|
||||
default:
|
||||
$this->_runSetupMoreInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* _runSetupStorageDirectory() - if the storage directory does not exist, create it
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _runSetupStorageDirectory()
|
||||
{
|
||||
$storageDirectory = $this->_detectStorageDirectory(false, false);
|
||||
|
||||
if (file_exists($storageDirectory)) {
|
||||
echo 'Directory already exists at ' . $storageDirectory . PHP_EOL
|
||||
. 'Cannot create storage directory.';
|
||||
return;
|
||||
}
|
||||
|
||||
mkdir($storageDirectory);
|
||||
|
||||
echo 'Storage directory created at ' . $storageDirectory . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* _runSetupConfigFile()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _runSetupConfigFile()
|
||||
{
|
||||
$configFile = $this->_detectConfigFile(false, false);
|
||||
|
||||
if (file_exists($configFile)) {
|
||||
echo 'File already exists at ' . $configFile . PHP_EOL
|
||||
. 'Cannot write new config file.';
|
||||
return;
|
||||
}
|
||||
|
||||
$includePath = get_include_path();
|
||||
|
||||
$contents = 'php.include_path = "' . $includePath . '"';
|
||||
|
||||
file_put_contents($configFile, $contents);
|
||||
|
||||
$iniValues = ini_get_all();
|
||||
if ($iniValues['include_path']['global_value'] != $iniValues['include_path']['local_value']) {
|
||||
echo 'NOTE: the php include_path to be used with the tool has been written' . PHP_EOL
|
||||
. 'to the config file, using ZEND_TOOL_INCLUDE_PATH (or other include_path setters)' . PHP_EOL
|
||||
. 'is no longer necessary.' . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
echo 'Config file written to ' . $configFile . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* _runSetupMoreInfo() - return more information about what can be setup, and what is setup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _runSetupMoreInfo()
|
||||
{
|
||||
$homeDirectory = $this->_detectHomeDirectory(false, false);
|
||||
$storageDirectory = $this->_detectStorageDirectory(false, false);
|
||||
$configFile = $this->_detectConfigFile(false, false);
|
||||
|
||||
echo <<<EOS
|
||||
|
||||
ZF Command Line Tool - Setup
|
||||
----------------------------
|
||||
|
||||
Current Paths (Existing or not):
|
||||
Home Directory: {$homeDirectory}
|
||||
Storage Directory: {$storageDirectory}
|
||||
Config File: {$configFile}
|
||||
|
||||
Important Environment Variables:
|
||||
ZF_HOME
|
||||
- the directory this tool will look for a home directory
|
||||
- directory must exist
|
||||
ZF_STORAGE_DIR
|
||||
- where this tool will look for a storage directory
|
||||
- directory must exist
|
||||
ZF_CONFIG_FILE
|
||||
- where this tool will look for a configuration file
|
||||
ZF_TOOL_INCLUDE_PATH
|
||||
- set the include_path for this tool to use this value
|
||||
ZF_TOOL_INCLUDE_PATH_PREPEND
|
||||
- prepend the current php.ini include_path with this value
|
||||
|
||||
Search Order:
|
||||
Home Directory:
|
||||
- ZF_HOME, then HOME (*nix), then HOMEPATH (windows)
|
||||
Storage Directory:
|
||||
- ZF_STORAGE_DIR, then {home}/.zf/
|
||||
Config File:
|
||||
- ZF_CONFIG_FILE, then {home}/.zf.ini, then {home}/zf.ini,
|
||||
then {storage}/zf.ini
|
||||
|
||||
Commands:
|
||||
zf --setup storage-directory
|
||||
- setup the storage directory, directory will be created
|
||||
zf --setup config-file
|
||||
- create the config file with some default values
|
||||
|
||||
|
||||
EOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* _runTool() - This is where the magic happens, dispatch Zend_Tool
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _runTool()
|
||||
{
|
||||
|
||||
$configOptions = array();
|
||||
if (isset($this->_configFile) && $this->_configFile) {
|
||||
$configOptions['configOptions']['configFilepath'] = $this->_configFile;
|
||||
}
|
||||
if (isset($this->_storageDirectory) && $this->_storageDirectory) {
|
||||
$configOptions['storageOptions']['directory'] = $this->_storageDirectory;
|
||||
}
|
||||
|
||||
// ensure that zf.php loads the Zend_Tool_Project features
|
||||
$configOptions['classesToLoad'] = 'Zend_Tool_Project_Provider_Manifest';
|
||||
|
||||
$console = new Zend_Tool_Framework_Client_Console($configOptions);
|
||||
$console->dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* _logMessage() - Internal method used to log setup and information messages.
|
||||
*
|
||||
* @param string $message
|
||||
* @param bool $storeMessage
|
||||
* @return void
|
||||
*/
|
||||
protected function _logMessage($message, $storeMessage = true)
|
||||
{
|
||||
if (!$storeMessage) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_messages[] = $message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!getenv('ZF_NO_MAIN')) {
|
||||
ZF::main();
|
||||
}
|
45
bin/zf.sh
Normal file
45
bin/zf.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
#############################################################################
|
||||
# Zend Framework
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# This source file is subject to the new BSD license that is bundled
|
||||
# with this package in the file LICENSE.txt.
|
||||
# It is also available through the world-wide-web at this URL:
|
||||
# http://framework.zend.com/license/new-bsd
|
||||
# If you did not receive a copy of the license and are unable to
|
||||
# obtain it through the world-wide-web, please send an email
|
||||
# to license@zend.com so we can send you a copy immediately.
|
||||
#
|
||||
# Zend
|
||||
# Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
# http://framework.zend.com/license/new-bsd New BSD License
|
||||
#############################################################################
|
||||
|
||||
|
||||
# find php: pear first, command -v second, straight up php lastly
|
||||
if test "@php_bin@" != '@'php_bin'@'; then
|
||||
PHP_BIN="@php_bin@"
|
||||
elif command -v php 1>/dev/null 2>/dev/null; then
|
||||
PHP_BIN=`command -v php`
|
||||
else
|
||||
PHP_BIN=php
|
||||
fi
|
||||
|
||||
# find zf.php: pear first, same directory 2nd,
|
||||
if test "@php_dir@" != '@'php_dir'@'; then
|
||||
PHP_DIR="@php_dir@"
|
||||
else
|
||||
SELF_LINK="$0"
|
||||
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
|
||||
while test -n "$SELF_LINK_TMP"; do
|
||||
SELF_LINK="$SELF_LINK_TMP"
|
||||
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
|
||||
done
|
||||
PHP_DIR="$(dirname "$SELF_LINK")"
|
||||
fi
|
||||
|
||||
"$PHP_BIN" -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$@"
|
||||
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"name": "scores/webservice",
|
||||
"description": "Webservice API",
|
||||
"require": {
|
||||
"zendframework/zendframework1": "^1.12",
|
||||
"geshi/geshi": "dev-master",
|
||||
"league/csv": "^8.1",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
||||
"guzzlehttp/guzzle": "^6.2",
|
||||
"monolog/monolog": "^1.22",
|
||||
"scores/library": "dev-develop"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "git@gitlab.factory.insight.doubletrade.com:scores/library.git"
|
||||
}
|
||||
],
|
||||
"include-path": ["library/"],
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"application/",
|
||||
"library/Application/"
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Scores et Decisions",
|
||||
"email": "supportdev@scores-decisions.com"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"name": "scores/webservice",
|
||||
"description": "Webservice API",
|
||||
"require": {
|
||||
"zendframework/zendframework1": "^1.12",
|
||||
"geshi/geshi": "dev-master",
|
||||
"league/csv": "^8.1",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"mikehaertl/phpwkhtmltopdf": "^2.2",
|
||||
"guzzlehttp/guzzle": "^6.2",
|
||||
"monolog/monolog": "^1.22",
|
||||
"scores/library": "dev-master"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "git@gitlab.factory.insight.doubletrade.com:scores/library.git"
|
||||
}
|
||||
],
|
||||
"include-path": ["library/"],
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"application/",
|
||||
"library/Application/"
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Scores et Decisions",
|
||||
"email": "supportdev@scores-decisions.com"
|
||||
}
|
||||
]
|
||||
}
|
1151
composer.lock
generated
1151
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,55 +0,0 @@
|
||||
Le fichier Zend/Soap/Wsdl/Strategy/DefaultComplexType.php a été modifié pour
|
||||
générer la documentation automatiquement.
|
||||
|
||||
/**
|
||||
* Traitement éléments de documentation à placer dans le WSDL
|
||||
* Supprime les retours chariots.
|
||||
* Récupére les éléments de documentation
|
||||
*/
|
||||
$comment = '';
|
||||
$docBlock = preg_replace('/\n/', '', $property->getDocComment() );
|
||||
if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+\s+(?:\*|@)/m', $docBlock, $docBlockMatches)) {
|
||||
$comment.= preg_replace(
|
||||
array('/\r/', '/\t\s\*/'),
|
||||
array('', ''), $docBlockMatches[1]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout des éléments de documentation au WSDL
|
||||
*/
|
||||
if (!empty($comment)){
|
||||
$annotation = $dom->createElement('xsd:annotation');
|
||||
$documentation = $dom->createElement('xsd:documentation', trim($comment));
|
||||
$annotation->appendChild($documentation);
|
||||
$element->appendChild($annotation);
|
||||
}
|
||||
|
||||
===============================================================================>
|
||||
|
||||
Le fichier Zend/Soap/AutoDiscover.php a été modifié
|
||||
function _addFunctionToWsdl
|
||||
|
||||
$sequenceElement = array(
|
||||
'name' => $param->getName(),
|
||||
'type' => $wsdl->getType($param->getType()),
|
||||
'desc' => $param->getDescription()
|
||||
);
|
||||
|
||||
===============================================================================>
|
||||
|
||||
Le fichier Zend/Soap/Wsdl.php a été modifié
|
||||
function _parseElement
|
||||
|
||||
} elseif ($key == 'desc') {
|
||||
if (!empty($value)) {
|
||||
$annotation = $this->_dom->createElement('xsd:annotation');
|
||||
$documentation = $this->_dom->createElement('xsd:documentation', trim($value));
|
||||
$annotation->appendChild($documentation);
|
||||
$elementXml->appendChild($annotation);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
|
@ -1,95 +1,20 @@
|
||||
WebService
|
||||
==========
|
||||
README
|
||||
======
|
||||
|
||||
- Créer le vhost, voir le fichier VHOST pour les exemples
|
||||
Display the documentation of our services, manage the SOAP services
|
||||
Based on ZendFramework version 1.x
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName webservice.sd.dev
|
||||
AddDefaultCharset utf-8
|
||||
|
||||
<IfModule mod_xsendfile.c>
|
||||
XSendFile On
|
||||
XSendFilePath /home/vhosts/webservice/shared
|
||||
</IfModule>
|
||||
|
||||
DocumentRoot /home/vhosts/webservice/public
|
||||
<Directory /home/vhosts/webservice/public/>
|
||||
EnableSendfile Off
|
||||
AllowOverride none
|
||||
Require all granted
|
||||
<Files ~ "^\.user.ini">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</Files>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
<Directory /home/vhosts/webservice/public/assets/>
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
|
||||
LogLevel error
|
||||
ErrorLog ${APACHE_LOG_DIR}/webservice-error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/webservice-access.log combined
|
||||
</VirtualHost>
|
||||
|
||||
- Installer les librairies avec composer
|
||||
|
||||
$ composer install
|
||||
|
||||
|
||||
- Configurer l'application
|
||||
|
||||
La config (fichier application.ini) est à placer dans "application/configs/"
|
||||
|
||||
Exemple de la config dans "docs/config/application.ini" (Modifier selon les besoins)
|
||||
|
||||
|
||||
- APPLICATION_ENV
|
||||
|
||||
Différent niveau peuvent être utilisé dans l'application pour gérer les erreurs et le comportement.
|
||||
|
||||
production
|
||||
staging
|
||||
development
|
||||
testing
|
||||
|
||||
Cette variable est accessible dans PHP.
|
||||
|
||||
. mod_php
|
||||
|
||||
Add in <VirtualHost/>
|
||||
SetEnv APPLICATION_ENV "development"
|
||||
|
||||
. php-fpm
|
||||
|
||||
Add a file in document root path (public/) a file .user.ini
|
||||
env[APPLICATION_ENV] = "development"
|
||||
|
||||
See the .user.ini file
|
||||
|
||||
|
||||
- Créer les repertoires de données nécessaires
|
||||
|
||||
[WORKSPACE]/data/webservice/
|
||||
- cache
|
||||
- logs
|
||||
- sessions
|
||||
- wsdl
|
||||
- files
|
||||
- greffes
|
||||
Fichier de configuration
|
||||
========================
|
||||
La configuration est décomposé en plusieurs fichiers,
|
||||
avec adaptation suivant la machine
|
||||
- mysql.php
|
||||
- smtp.php
|
||||
- sphinx.php
|
||||
- stockage.php
|
||||
|
||||
sans adaptation suivant la machine
|
||||
- partenaires.php
|
||||
|
||||
Fonctionnement
|
||||
==============
|
||||
@ -160,4 +85,97 @@ Pour spécifier des éléments de taille (non pris en compte sur le WSDL)
|
||||
@xsd minLength=9
|
||||
@xsd maxLength=15
|
||||
|
||||
Configuration PHP
|
||||
=================
|
||||
apt-get install php5-mysql
|
||||
apt-get install php-apc
|
||||
apt-get install php5-curl
|
||||
apt-get install php5-xmlrpc
|
||||
|
||||
Paquet PEAR
|
||||
- Mail
|
||||
- Mail_Mime
|
||||
|
||||
WKHTMLTOPDF
|
||||
===========
|
||||
apt-get install libXrender1
|
||||
apt-get install libfontconfig
|
||||
|
||||
Configuration VHOST
|
||||
===================
|
||||
a2enmod rewrite
|
||||
|
||||
Exemple de vhost en mode développement
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName scoresws.sd.dev
|
||||
AddDefaultCharset utf-8
|
||||
|
||||
# Pour la gestion des ports : $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']
|
||||
UseCanonicalName On
|
||||
UseCanonicalPhysicalPort On
|
||||
|
||||
DocumentRoot "D:/www/webservice/public"
|
||||
SetEnv APPLICATION_ENV "development"
|
||||
<Directory "D:/www/webservice/public/">
|
||||
DirectoryIndex index.php
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
|
||||
LogLevel debug
|
||||
ErrorLog "logs/scoresws.sd.dev-error.log"
|
||||
CustomLog "logs/scoresws.sd.dev-access.log" common
|
||||
</VirtualHost>
|
||||
|
||||
|
||||
Vhost réel
|
||||
|
||||
<VirtualHost *:8081>
|
||||
ServerName wse.scores-decisions.com
|
||||
ServerAlias wse1.scores-decisions.com
|
||||
|
||||
# Pour la gestion des ports : $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']
|
||||
UseCanonicalName On
|
||||
UseCanonicalPhysicalPort On
|
||||
|
||||
ServerSignature Off
|
||||
AddDefaultCharset utf-8
|
||||
DocumentRoot /home/vhosts/webservice/public
|
||||
SetEnv APPLICATION_ENV "production"
|
||||
<Directory /home/vhosts/webservice/public/>
|
||||
DirectoryIndex index.php
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
RewriteRule ^.*$ index.php [NC,L]
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
|
||||
LogLevel error
|
||||
ErrorLog /var/log/apache2/webservice-error.log
|
||||
CustomLog /var/log/apache2/webservice-access.log common
|
||||
</VirtualHost>
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
upload_max_filesize=513M
|
||||
post_max_size=513M
|
||||
memory_limit=512M
|
||||
mbstring.func_overload=0
|
||||
always_populate_raw_post_data=-1
|
||||
default_charset='UTF-8'
|
||||
date.timezone='Europe/Paris'
|
||||
soap.wsdl_cache_enabled=0
|
||||
env[APPLICATION_ENV] = "development"
|
@ -13,19 +13,18 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
$action = $request->getActionName();
|
||||
|
||||
$checkAuth = true;
|
||||
// --- Pas d'authentification sur la demande d'authentification
|
||||
//Pas d'authentification sur la demande d'authentification
|
||||
if ( $controller == 'user' && $action == 'login' ) {
|
||||
$checkAuth = false;
|
||||
}
|
||||
|
||||
// --- Pas d'authentification sur ces services
|
||||
// Pas d'authentification sur ces services
|
||||
if ( in_array($controller, array('service', 'import'))
|
||||
|| ( $controller == 'fichier' && $action == 'logs' )
|
||||
|| ( $controller == 'fichier' && $action == 'kbis' )
|
||||
|| ( $controller == 'fichier' && $action == 'csv' )
|
||||
|| ( $controller == 'fichier' && $action == 'associations' )
|
||||
|| ( $controller == 'fichier' && $action == 'greffes' )
|
||||
|| ( $controller == 'fichier' && $action == 'crm' )) {
|
||||
|| ( $controller == 'fichier' && $action == 'greffes' )) {
|
||||
$checkAuth = false;
|
||||
}
|
||||
|
||||
@ -45,43 +44,56 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
|
||||
// --- On vérifie le tout lors d'une connexion par url
|
||||
//On vérifie le tout lors d'une connexion par url
|
||||
if ( !empty($login) && !empty($pass) ) {
|
||||
|
||||
$authAdapter = new Scores_Auth_Adapter_Db($login, $pass, $checkWs);
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if ($result->isValid()) {
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$session = new Zend_Session_Namespace($storage->getNamespace());
|
||||
//$session->setExpirationSeconds(86400);
|
||||
$auth->setStorage($storage);
|
||||
if (!$result->isValid()) {
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if ( !$layout->isEnabled() ){
|
||||
echo "Identification incorrect ou périmé.";
|
||||
} else {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('logout');
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$session = new Zend_Session_Namespace($storage->getNamespace());
|
||||
//$session->setExpirationSeconds(86400);
|
||||
$auth->setStorage($storage);
|
||||
|
||||
}
|
||||
else {
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if ( !$layout->isEnabled() ){
|
||||
echo "Identification incorrect ou périmé.";
|
||||
} else {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('logout');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sinon on reste sur le standard
|
||||
else {
|
||||
// Pas authentifié
|
||||
|
||||
//Sinon on reste sur le standard
|
||||
} else {
|
||||
//Pas authentifié
|
||||
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
|
||||
$auth->clearIdentity();
|
||||
$session = new Zend_Session_Namespace('login');
|
||||
$session->url = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if (!$layout->isEnabled()){
|
||||
echo "Identification incorrect ou périmé.";
|
||||
} else {
|
||||
$this->_response->setRedirect('/user/login')->sendResponse();
|
||||
}
|
||||
}
|
||||
// Authentifié => on met à jour la session
|
||||
else {
|
||||
$identity = $auth->getIdentity();
|
||||
//Authentifié => on met à jour la session
|
||||
} else {
|
||||
|
||||
$identity = $auth->getIdentity();
|
||||
$identity->time = time() + $identity->timeout;
|
||||
$auth->getStorage()->write($identity);
|
||||
|
||||
if (Zend_Session::namespaceIsset('login')){
|
||||
Zend_Session::namespaceUnset('login');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Créer le menu en fonction des besoins et des paramètres en entrée
|
||||
* @param Zend_Controller_Request_Abstract $request
|
||||
*/
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
$activateLayout = true;
|
||||
if ( $controller == 'user' && in_array($action, array('login', 'logout')) ) {
|
||||
$activateLayout = false;
|
||||
}
|
||||
|
||||
if ( $layout->isEnabled() && $activateLayout ) {
|
||||
|
||||
$view = $layout->getView();
|
||||
$config = include APPLICATION_PATH . '/configs/menu.config.php';
|
||||
$container = new Zend_Navigation($config);
|
||||
|
||||
// --- Secure demo mode
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->idClient != 1) {
|
||||
$toSecure = $container->findOneBy('Label', "Démonstration");
|
||||
$container->removePage($toSecure);
|
||||
}
|
||||
}
|
||||
|
||||
$view->navigation($container);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -12,65 +12,60 @@ class Application_Controller_Plugin_Services extends Zend_Controller_Plugin_Abst
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
if ( in_array($controller, array('service'))
|
||||
|| ( $controller == 'user' && in_array($action, array('login', 'logout')) ) ) {
|
||||
//Do nothing
|
||||
if ( $controller === 'service' ) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ( $auth->hasIdentity() ) {
|
||||
$username = $auth->getIdentity()->username;
|
||||
$idClient = $auth->getIdentity()->idClient;
|
||||
|
||||
$username = $auth->getIdentity()->username;
|
||||
$idClient = $auth->getIdentity()->idClient;
|
||||
$wsServices = array();
|
||||
|
||||
$wsServices = array();
|
||||
|
||||
//Get all webservice client
|
||||
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach( $clients as $section => $params ) {
|
||||
if ( $params['actif']
|
||||
&& (isset($params['idClient']) && in_array($idClient,$params['idClient'])) ) {
|
||||
|
||||
$params['name'] = $section;
|
||||
$params['type'] = 'client';
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'Client - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
//Standard service
|
||||
if ( count($wsServices)==0 || $idClient==1 ) {
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach( $services as $section => $params )
|
||||
{
|
||||
if ( $params['actif'] ) {
|
||||
$params['name'] = ucfirst($section);
|
||||
$params['type'] = 'sd';
|
||||
if ( isset($params['idClient']) && in_array($idClient,$params['idClient']) ) {
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'SD - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
elseif ( !isset($params['idClient']) ) {
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'SD - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
$view = $layout->getView();
|
||||
$view->WsServices = $wsServices;
|
||||
//Get all webservice client
|
||||
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
|
||||
foreach( $clients as $section => $params ) {
|
||||
if ( $params['actif']
|
||||
&& (isset($params['idClient']) && in_array($idClient,$params['idClient'])) ) {
|
||||
|
||||
$params['name'] = $section;
|
||||
$params['type'] = 'client';
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'Client - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
} // Zend_Auth::hasIdentity
|
||||
//Standard service
|
||||
if ( count($wsServices)==0 || $idClient==1 ) {
|
||||
$services = include APPLICATION_PATH . '/../library/WsScore/ServicesConfig.php';
|
||||
foreach( $services as $section => $params )
|
||||
{
|
||||
if ( $params['actif'] ) {
|
||||
$params['name'] = ucfirst($section);
|
||||
$params['type'] = 'sd';
|
||||
if ( isset($params['idClient']) && in_array($idClient,$params['idClient']) ) {
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'SD - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
elseif ( !isset($params['idClient']) ) {
|
||||
if ( $idClient == 1 ) {
|
||||
$params['name'] = 'SD - '.ucfirst($section);
|
||||
}
|
||||
$wsServices[$section] = $params;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
$view = $layout->getView();
|
||||
$view->WsServices = $wsServices;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user