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('MYSQL_DEFAULT_DB', 'jo'); define('MYSQL_SQL_LOG', 'NONE'); define('DOC_WEB_LOCAL' , $config->profil->path->shared.'/files/'); define('DOC_WEB_URL' , '/fichier/'); 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)); define('INFOGREFFE_DISPO_WEB', false); define('INFOGREFFE_DISPO_WS', false); define('INFOGREFFE_WS_URL', 'https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE'); define('INFOGREFFE_WS_USER', '85000109'); define('INFOGREFFE_WS_PASS', '166'); return $config; } //Initialisation global des paramètres de vue protected function _initViewSettings() { $this->bootstrap('view'); $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') ->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-3.3.6/css/bootstrap.min.css', 'all') ->appendStylesheet('/themes/default/css/docs.css', 'all') ->appendStylesheet('/themes/default/css/main.css', 'all'); $view->headScript() ->appendFile('/libs/html5shiv.min.js', 'text/javascript', array('conditional' => 'lt IE 9')) ->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9')) ->appendFile('/libs/jquery-1.12.0.min.js', 'text/javascript') ->appendFile('/libs/bootstrap-3.3.6/js/bootstrap.min.js', 'text/javascript'); $view->headTitle()->setSeparator(' - '); $view->headTitle('Web Service API - Scores & Decisions'); } 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); $route = new Zend_Controller_Router_Route('jsonrpc/'.$section.'/:version', array( 'controller' => 'jsonrpc', 'action' => 'index', 'service' => $section, 'version' => '', )); $router->addRoute('jsonrpc-'.$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); $fichierRoute = new Zend_Controller_Router_Route('fichier/:action/:fichier', array( 'controller' => 'fichier', 'fichier' => '', )); $router->addRoute('fichier', $fichierRoute); return $router; } 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 '
'; print_r($e); echo ''; } else { echo "Le service rencontre actuellement un problème technique."; } exit; } /** * Set the default adapter to use with all model */ Zend_Db_Table::setDefaultAdapter($db); } protected function _initWsDebug() { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('WsDebug'); $options = array( 'plugins' => array( 'Exception', ), ); $debug = new WsDebug_Controller_Plugin_Debug($options); $this->bootstrap('frontController'); $frontController = $this->getResource('frontController'); $frontController->registerPlugin($debug); } 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); } } }