Suppression lecture de fichier configuration.ini

This commit is contained in:
Michael RICOIS 2012-05-02 19:14:50 +00:00
parent 10d5a73b4f
commit cec606ae72
7 changed files with 1727 additions and 16 deletions

View File

@ -48,7 +48,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initDb() protected function _initDb()
{ {
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases'); $dbConfig = Zend_Registry::get('configuration')->databases;
try { try {
$db = Zend_Db::factory($dbConfig->db); $db = Zend_Db::factory($dbConfig->db);
Zend_Db_Table::setDefaultAdapter ($db); Zend_Db_Table::setDefaultAdapter ($db);

View File

@ -96,7 +96,8 @@ class ComptageController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$object = new Object_Comptage(); $object = new Object_Comptage();
$sirets = $object->count(null, null, true); $sirets = $object->count(null, null, true);
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
$dbConfig = Zend_Registry::get('configuration')->databases;
try { try {
$dbMetier = Zend_Db::factory($dbConfig->jo); $dbMetier = Zend_Db::factory($dbConfig->jo);
} catch ( Exception $e ) { } catch ( Exception $e ) {

View File

@ -30,7 +30,6 @@ class DashboardController extends Zend_Controller_Action
public function ciblageAction() public function ciblageAction()
{ {
require_once('Scores/Field.php'); require_once('Scores/Field.php');
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
$object = new Object_Dashboard(); $object = new Object_Dashboard();
$request = $this->getRequest(); $request = $this->getRequest();
$comptage = $object->ciblagedetail($request->getParam('id')); $comptage = $object->ciblagedetail($request->getParam('id'));
@ -81,7 +80,6 @@ class DashboardController extends Zend_Controller_Action
{ {
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes //Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
$enrichissementsM = new Application_Model_EnrichissementIdentifiants(); $enrichissementsM = new Application_Model_EnrichissementIdentifiants();

View File

@ -227,7 +227,6 @@ class EnrichissementController extends Zend_Controller_Action
->where('id = ?', $id); ->where('id = ?', $id);
$result = $table->fetchRow($sql); $result = $table->fetchRow($sql);
if(!empty($result)) { if(!empty($result)) {
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
$result = $result->toArray(); $result = $result->toArray();
$date = explode(' ', $result['dateAdded']); $date = explode(' ', $result['dateAdded']);
$path = $config->path->data.'/'.substr($date[0], 0, 7).'/'; $path = $config->path->data.'/'.substr($date[0], 0, 7).'/';

View File

@ -1,5 +1,6 @@
<?php <?php
require_once 'sphinxapi/sphinxapi-2.0.2.php'; //require_once 'sphinxapi/sphinxapi-2.0.2.php';
require_once 'sphinxapi/sphinxapi-2.0.4.php';
Class Ciblage Class Ciblage
{ {

View File

@ -9,7 +9,7 @@ class Mail
*/ */
public function __construct() public function __construct()
{ {
$this->config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'mail'); $this->config = Zend_Registry::get('configuration')->mail;
$this->mail = new Zend_Mail(); $this->mail = new Zend_Mail();
if ($this->config->method == 'smtp') { if ($this->config->method == 'smtp') {
$tr = new Zend_Mail_Transport_Smtp($this->config->smtp_host); $tr = new Zend_Mail_Transport_Smtp($this->config->smtp_host);
@ -19,7 +19,7 @@ class Mail
$this->mail->setDefaultTransport($tr); $this->mail->setDefaultTransport($tr);
} }
} }
/** /**
* Champ From en fonction de la clé de configuration (configuration.ini) * Champ From en fonction de la clé de configuration (configuration.ini)
* @param string $configKey * @param string $configKey
@ -29,7 +29,7 @@ class Mail
$email = $this->config->$configKey; $email = $this->config->$configKey;
$this->mail->setFrom($email, ucfirst($configKey)); $this->mail->setFrom($email, ucfirst($configKey));
} }
/** /**
* Champ To en fonction de la clé de configuration (configuration.ini) * Champ To en fonction de la clé de configuration (configuration.ini)
* @param string $configKey * @param string $configKey
@ -39,7 +39,7 @@ class Mail
$email = $this->config->$configKey; $email = $this->config->$configKey;
$this->mail->addTo($email, ucfirst($configKey)); $this->mail->addTo($email, ucfirst($configKey));
} }
/** /**
* Ajout d'un champ To en spécifiant l'email et le nom qui doit apparaitre * Ajout d'un champ To en spécifiant l'email et le nom qui doit apparaitre
* @param string $email * @param string $email
@ -49,7 +49,7 @@ class Mail
{ {
$this->mail->addTo($email, $this->txtConvert($nom)); $this->mail->addTo($email, $this->txtConvert($nom));
} }
/** /**
* Définit le sujet de l'email * Définit le sujet de l'email
* @param string $texte * @param string $texte
@ -58,7 +58,7 @@ class Mail
{ {
$this->mail->setSubject($this->txtConvert($texte)); $this->mail->setSubject($this->txtConvert($texte));
} }
/** /**
* Définit le corps de l'email au format texte * Définit le corps de l'email au format texte
* @param string $texte * @param string $texte
@ -67,7 +67,7 @@ class Mail
{ {
$this->mail->setBodyText($this->txtConvert($texte)); $this->mail->setBodyText($this->txtConvert($texte));
} }
/** /**
* Définit le corps de l'email au format html * Définit le corps de l'email au format html
* @param string $html * @param string $html
@ -76,7 +76,7 @@ class Mail
{ {
$this->mail->setBodyHtml($this->txtConvert($html)); $this->mail->setBodyHtml($this->txtConvert($html));
} }
/** /**
* Envoi de l'emai * Envoi de l'emai
*/ */
@ -84,10 +84,10 @@ class Mail
{ {
$this->mail->send(); $this->mail->send();
} }
//We suppose that character encoding of strings is UTF-8 on PHP script. //We suppose that character encoding of strings is UTF-8 on PHP script.
protected function txtConvert($string) { protected function txtConvert($string) {
return mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8'); return mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8');
} }
} }

File diff suppressed because it is too large Load Diff