feat(v2.0.3): Marchés hybrides et améliorations multiples
Fonctionnalités principales : 1. Marchés hybrides - Onglet Mercurial - Ajout onglet Mercurial avec style distinct (vert, gras, blanc) - Affichage des produits mercuriaux pour marchés hybrides - Filtrage automatique des produits "Hors Marché 999" - Documentation Phase 2 avec CAS 1 et CAS 2 de marchés hybrides - Règles métier pour validation différenciée (devis 100% mercurial vs mixte) 2. Corrections bugs - Fix flag chkChange sur onglet "Sélection Produits" (callback asynchrone) - Plus d'alerte intempestive après sauvegarde des produits 3. Outils de déploiement - Nouveau script deploy-file.sh pour déploiement unitaire (DEV/PROD) - Amélioration deploy-cleo.sh 4. Gestion multi-contacts (v2.0.3) - Contrôleur AJAX cjxcontacts.php - Script migration clients_contacts - Documentation complète 5. Documentation - Mise à jour TODO.md avec Phase 2 marchés hybrides - Mise à jour README.md v2.0.3 - Ajout RULES.md - Ajout migration_clients_contacts.sql 6. Nettoyage - Suppression fichiers obsolètes (conf_new.php, conf_old.php, uof_linet_20250911.sql) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,19 +2,18 @@
|
||||
|
||||
require_once dirname(__FILE__) . '/Database.php';
|
||||
|
||||
class Conf
|
||||
{
|
||||
const admin = 1;
|
||||
const intra = 1;
|
||||
const erp = 1;
|
||||
const magazine = 0;
|
||||
|
||||
class Conf {
|
||||
const admin = 1;
|
||||
const intra = 1;
|
||||
const erp = 1;
|
||||
const magazine = 0;
|
||||
|
||||
public $_appname = "cleo";
|
||||
public $_appscript = "login";
|
||||
public $_appversion = "2.0.2";
|
||||
public $_appversion = "2.0.3";
|
||||
public $_appenv;
|
||||
public $_apptitle = "CLEO - Gestion de devis";
|
||||
|
||||
|
||||
public $_brandname;
|
||||
public $_brandadresse1;
|
||||
public $_brandadresse2;
|
||||
@@ -25,47 +24,46 @@ class Conf
|
||||
public $_brandlogo;
|
||||
public $_brandgroupe;
|
||||
public $_brandmulti;
|
||||
|
||||
|
||||
public $_piwikid;
|
||||
public $_googlid;
|
||||
|
||||
|
||||
public $_excludeIp;
|
||||
public $_clientIp;
|
||||
public $_devIp = false;
|
||||
|
||||
|
||||
public $_debug_level = 0;
|
||||
public $_log_sql = false;
|
||||
public $_log_performance = false;
|
||||
public $_log_file_path = '';
|
||||
|
||||
|
||||
public $_pathupload;
|
||||
|
||||
|
||||
public $_dbhost;
|
||||
public $_dbname;
|
||||
public $_dbuser;
|
||||
public $_dbpass;
|
||||
|
||||
|
||||
public $_entite = '';
|
||||
public $_new_version = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
$this->loadEnvironment();
|
||||
$this->loadConfiguration();
|
||||
$this->setupDebug();
|
||||
}
|
||||
|
||||
|
||||
private function loadEnvironment() {
|
||||
$envFile = dirname(__DIR__) . '/.env';
|
||||
if (file_exists($envFile)) {
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (strpos(trim($line), '#') === 0) continue;
|
||||
|
||||
|
||||
list($name, $value) = explode('=', $line, 2);
|
||||
$name = trim($name);
|
||||
$value = trim($value);
|
||||
|
||||
|
||||
if (!isset($_ENV[$name])) {
|
||||
putenv(sprintf('%s=%s', $name, $value));
|
||||
$_ENV[$name] = $value;
|
||||
@@ -73,35 +71,35 @@ class Conf
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_dbhost = $_ENV['DB_HOST'] ?? 'localhost';
|
||||
$this->_dbname = $_ENV['DB_DATABASE'] ?? 'cleo';
|
||||
$this->_dbuser = $_ENV['DB_USERNAME'] ?? 'cleo_user';
|
||||
$this->_dbpass = $_ENV['DB_PASSWORD'] ?? '';
|
||||
|
||||
|
||||
$this->_excludeIp = $_ENV['EXCLUDE_IP'] ?? '';
|
||||
$this->_pathupload = $_ENV['UPLOAD_PATH'] ?? '/pub/files/upload/';
|
||||
|
||||
|
||||
$this->_appenv = $_ENV['APP_ENV'] ?? 'production';
|
||||
$this->_debug_level = $_ENV['LOG_LEVEL'] === 'debug' ? 4 : 0;
|
||||
$this->_log_sql = filter_var($_ENV['LOG_SQL'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$this->_log_performance = filter_var($_ENV['LOG_PERFORMANCE'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
|
||||
private function loadConfiguration() {
|
||||
$http_host = $_SERVER['HTTP_HOST'];
|
||||
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
|
||||
|
||||
$sql = "SELECT * FROM users_entites WHERE http_host LIKE :host AND active = 1 LIMIT 1";
|
||||
$entite = $db->fetchOne($sql, ['host' => "%$http_host%"]);
|
||||
|
||||
|
||||
if (empty($entite)) {
|
||||
$sql = "SELECT * FROM users_entites WHERE rowid = 1";
|
||||
$entite = $db->fetchOne($sql);
|
||||
}
|
||||
|
||||
|
||||
if ($entite) {
|
||||
$this->_entite = $entite;
|
||||
$this->_appname = $entite["appname"] ?? "cleo";
|
||||
@@ -115,20 +113,19 @@ class Conf
|
||||
$this->_brandemail = $entite["email"] ?? "";
|
||||
$this->_brandlogo = $entite["appname"] ?? "cleo";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log("Erreur de configuration: " . $e->getMessage());
|
||||
$this->setDefaultConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function setDefaultConfiguration() {
|
||||
$this->_appname = "cleo";
|
||||
$this->_apptitle = "CLEO - Gestion de devis";
|
||||
$this->_brandname = "CLEO";
|
||||
$this->_brandemail = $_ENV['MAIL_FROM_ADDRESS'] ?? "noreply@example.com";
|
||||
}
|
||||
|
||||
|
||||
private function setupDebug() {
|
||||
if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
|
||||
$this->_clientIp = $_SERVER["HTTP_CLIENT_IP"];
|
||||
@@ -137,22 +134,22 @@ class Conf
|
||||
} else {
|
||||
$this->_clientIp = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
|
||||
$http_host = $_SERVER['HTTP_HOST'] ?? '';
|
||||
$isDev = strpos($http_host, 'dcleo.unikoffice.com') !== false;
|
||||
$isRecette = strpos($http_host, 'rcleo.unikoffice.com') !== false;
|
||||
$isDebugEnv = $_ENV['APP_DEBUG'] === 'true' || $_ENV['APP_ENV'] === 'development';
|
||||
|
||||
|
||||
if ($isDev || $isRecette || $isDebugEnv) {
|
||||
ini_set('error_reporting', -1);
|
||||
ini_set('display_errors', '1');
|
||||
$this->_devIp = true;
|
||||
|
||||
|
||||
$this->_debug_level = 4;
|
||||
$this->_log_sql = true;
|
||||
$this->_log_performance = true;
|
||||
$this->_log_file_path = dirname(__DIR__) . '/log/' . date('md') . '.log';
|
||||
|
||||
|
||||
ini_set('log_errors', '1');
|
||||
ini_set('error_log', $this->_log_file_path);
|
||||
ini_set('display_startup_errors', '1');
|
||||
@@ -165,24 +162,24 @@ class Conf
|
||||
$this->_log_performance = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function debug($data, $type = 'DEBUG', $level = 3) {
|
||||
if ($this->_debug_level < $level) return;
|
||||
|
||||
|
||||
$levels = ['ERROR', 'WARNING', 'INFO', 'DEBUG'];
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
$message = "[$timestamp] [$type] " . (is_array($data) ? json_encode($data) : $data) . PHP_EOL;
|
||||
|
||||
|
||||
if ($this->_log_file_path) {
|
||||
error_log($message, 3, $this->_log_file_path);
|
||||
}
|
||||
|
||||
|
||||
// Ne pas afficher les commentaires HTML pour les requêtes AJAX
|
||||
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
||||
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
|
||||
|
||||
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
||||
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
|
||||
|
||||
if ($this->_devIp && ini_get('display_errors') && !$isAjax) {
|
||||
echo "<!-- $message -->\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/Database.php';
|
||||
|
||||
class Conf
|
||||
{
|
||||
const admin = 1;
|
||||
const intra = 1;
|
||||
const erp = 1;
|
||||
const magazine = 0;
|
||||
|
||||
public $_appname = "cleo";
|
||||
public $_appscript = "login";
|
||||
public $_appversion = "2.0.1";
|
||||
public $_appenv;
|
||||
public $_apptitle = "CLEO - Gestion de devis";
|
||||
|
||||
public $_brandname;
|
||||
public $_brandadresse1;
|
||||
public $_brandadresse2;
|
||||
public $_brandcp;
|
||||
public $_brandville;
|
||||
public $_brandtel;
|
||||
public $_brandemail;
|
||||
public $_brandlogo;
|
||||
public $_brandgroupe;
|
||||
public $_brandmulti;
|
||||
|
||||
public $_piwikid;
|
||||
public $_googlid;
|
||||
|
||||
public $_excludeIp;
|
||||
public $_clientIp;
|
||||
public $_devIp = false;
|
||||
|
||||
public $_debug_level = 0;
|
||||
public $_log_sql = false;
|
||||
public $_log_performance = false;
|
||||
public $_log_file_path = '';
|
||||
|
||||
public $_pathupload;
|
||||
|
||||
public $_dbhost;
|
||||
public $_dbname;
|
||||
public $_dbuser;
|
||||
public $_dbpass;
|
||||
|
||||
public $_entite = '';
|
||||
public $_new_version = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->loadEnvironment();
|
||||
$this->loadConfiguration();
|
||||
$this->setupDebug();
|
||||
}
|
||||
|
||||
private function loadEnvironment() {
|
||||
$envFile = dirname(__DIR__) . '/.env';
|
||||
if (file_exists($envFile)) {
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (strpos(trim($line), '#') === 0) continue;
|
||||
|
||||
list($name, $value) = explode('=', $line, 2);
|
||||
$name = trim($name);
|
||||
$value = trim($value);
|
||||
|
||||
if (!isset($_ENV[$name])) {
|
||||
putenv(sprintf('%s=%s', $name, $value));
|
||||
$_ENV[$name] = $value;
|
||||
$_SERVER[$name] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_dbhost = $_ENV['DB_HOST'] ?? 'localhost';
|
||||
$this->_dbname = $_ENV['DB_DATABASE'] ?? 'cleo';
|
||||
$this->_dbuser = $_ENV['DB_USERNAME'] ?? 'cleo_user';
|
||||
$this->_dbpass = $_ENV['DB_PASSWORD'] ?? '';
|
||||
|
||||
$this->_excludeIp = $_ENV['EXCLUDE_IP'] ?? '';
|
||||
$this->_pathupload = $_ENV['UPLOAD_PATH'] ?? '/pub/files/upload/';
|
||||
|
||||
$this->_appenv = $_ENV['APP_ENV'] ?? 'production';
|
||||
$this->_debug_level = $_ENV['LOG_LEVEL'] === 'debug' ? 4 : 0;
|
||||
$this->_log_sql = filter_var($_ENV['LOG_SQL'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$this->_log_performance = filter_var($_ENV['LOG_PERFORMANCE'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
private function loadConfiguration() {
|
||||
$http_host = $_SERVER['HTTP_HOST'];
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
|
||||
$sql = "SELECT * FROM users_entites WHERE http_host LIKE :host AND active = 1 LIMIT 1";
|
||||
$entite = $db->fetchOne($sql, ['host' => "%$http_host%"]);
|
||||
|
||||
if (empty($entite)) {
|
||||
$sql = "SELECT * FROM users_entites WHERE rowid = 1";
|
||||
$entite = $db->fetchOne($sql);
|
||||
}
|
||||
|
||||
if ($entite) {
|
||||
$this->_entite = $entite;
|
||||
$this->_appname = $entite["appname"] ?? "cleo";
|
||||
$this->_apptitle = $entite["libelle"] ?? "CLEO";
|
||||
$this->_brandname = $entite["libelle"] ?? "";
|
||||
$this->_brandadresse1 = $entite["adresse1"] ?? "";
|
||||
$this->_brandadresse2 = $entite["adresse2"] ?? "";
|
||||
$this->_brandcp = $entite["cp"] ?? "";
|
||||
$this->_brandville = $entite["ville"] ?? "";
|
||||
$this->_brandtel = $entite["tel1"] ?? "";
|
||||
$this->_brandemail = $entite["email"] ?? "";
|
||||
$this->_brandlogo = $entite["appname"] ?? "cleo";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log("Erreur de configuration: " . $e->getMessage());
|
||||
$this->setDefaultConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private function setDefaultConfiguration() {
|
||||
$this->_appname = "cleo";
|
||||
$this->_apptitle = "CLEO - Gestion de devis";
|
||||
$this->_brandname = "CLEO";
|
||||
$this->_brandemail = $_ENV['MAIL_FROM_ADDRESS'] ?? "noreply@example.com";
|
||||
}
|
||||
|
||||
private function setupDebug() {
|
||||
if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
|
||||
$this->_clientIp = $_SERVER["HTTP_CLIENT_IP"];
|
||||
} elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
|
||||
$this->_clientIp = $_SERVER["HTTP_X_FORWARDED_FOR"];
|
||||
} else {
|
||||
$this->_clientIp = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
$http_host = $_SERVER['HTTP_HOST'] ?? '';
|
||||
$isDev = strpos($http_host, 'dcleo.unikoffice.com') !== false;
|
||||
$isRecette = strpos($http_host, 'rcleo.unikoffice.com') !== false;
|
||||
$isDebugEnv = $_ENV['APP_DEBUG'] === 'true' || $_ENV['APP_ENV'] === 'development';
|
||||
|
||||
if ($isDev || $isRecette || $isDebugEnv) {
|
||||
ini_set('error_reporting', -1);
|
||||
ini_set('display_errors', '1');
|
||||
$this->_devIp = true;
|
||||
|
||||
$this->_debug_level = 4;
|
||||
$this->_log_sql = true;
|
||||
$this->_log_performance = true;
|
||||
$this->_log_file_path = dirname(__DIR__) . '/log/' . $this->_appname . '_debug_' . date('Y-m-d') . '.log';
|
||||
|
||||
ini_set('log_errors', '1');
|
||||
ini_set('error_log', $this->_log_file_path);
|
||||
ini_set('display_startup_errors', '1');
|
||||
} else {
|
||||
ini_set('error_reporting', 0);
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '0');
|
||||
$this->_debug_level = 0;
|
||||
$this->_log_sql = false;
|
||||
$this->_log_performance = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function debug($data, $type = 'DEBUG', $level = 3) {
|
||||
if ($this->_debug_level < $level) return;
|
||||
|
||||
$levels = ['ERROR', 'WARNING', 'INFO', 'DEBUG'];
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
$message = "[$timestamp] [$type] " . (is_array($data) ? json_encode($data) : $data) . PHP_EOL;
|
||||
|
||||
if ($this->_log_file_path) {
|
||||
error_log($message, 3, $this->_log_file_path);
|
||||
}
|
||||
|
||||
if ($this->_devIp && ini_get('display_errors')) {
|
||||
echo "<!-- $message -->\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Conf
|
||||
{
|
||||
const admin = 1; // TRUE ou FALSE pour indiquer si l'application est admin ou non
|
||||
const intra = 1; // Est-ce un intranet privé TRUE 1, ou un site public FALSE 0
|
||||
const erp = 1; //! Est-ce un ERP ? Utile pour la gestion documentaire avec les paths spéciaux pour l'ERP
|
||||
const magazine = 0; //! Est-ce qu'on veut transformer les PDF en JPG pour la lecture Magazine dans le d6tools.upload ?
|
||||
|
||||
public $_appname;
|
||||
public $_appscript;
|
||||
public $_appversion;
|
||||
public $_appenv;
|
||||
public $_apptitle;
|
||||
|
||||
public $_brandname;
|
||||
public $_brandadresse1;
|
||||
public $_brandadresse2;
|
||||
public $_brandcp;
|
||||
public $_brandville;
|
||||
public $_brandtel;
|
||||
public $_brandemail;
|
||||
public $_brandlogo;
|
||||
public $_brandgroupe;
|
||||
public $_brandmulti;
|
||||
|
||||
public $_piwikid;
|
||||
public $_googlid;
|
||||
|
||||
public $_excludeIp = "82.67.142.214"; //! IP à exclure pour le comptage des visites et pour le debug
|
||||
public $_clientIp;
|
||||
public $_devIp = false;
|
||||
|
||||
//! Configuration du debug
|
||||
public $_debug_level = 0; //! 0=off, 1=errors, 2=warnings, 3=info, 4=debug
|
||||
public $_log_sql = false; //! Logger les requêtes SQL
|
||||
public $_log_performance = false; //! Logger les temps d'exécution
|
||||
public $_log_file_path = ''; //! Chemin du fichier de log
|
||||
|
||||
public $_pathupload = "/pub/files/upload/"; //! le path de base pour les uploads
|
||||
|
||||
//! les infos de connexion de la base de données
|
||||
public $_dbhost = 'localhost';
|
||||
public $_dbname = 'uof_frontal';
|
||||
public $_dbuser = 'uof_front_user';
|
||||
public $_dbpass = 'd66,UnikOffice.User';
|
||||
|
||||
public $_dbghost = 'localhost';
|
||||
public $_dbgname = '';
|
||||
public $_dbguser = 'uof_linet_user';
|
||||
public $_dbgpass = 'd66,UOF-LinetRH.User';
|
||||
|
||||
public $_dbuhost = 'localhost';
|
||||
public $_dbuname = '';
|
||||
public $_dbuuser = 'uof_linet_user';
|
||||
public $_dbupass = 'd66,UOF-LinetRH.User';
|
||||
|
||||
public $_tbusers = ""; // Spécifie la table des users de cette application, par défaut uof_frontal.users, mais sur Linet c'est dans uof_linet.commerciaux
|
||||
|
||||
//! les infos de l'entité de l'utilisateur
|
||||
public $_entite = '';
|
||||
|
||||
//! indique si c'est une nouvelle version pour les tests de nouveaux modules et librairies
|
||||
public $_new_version = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//! on va chercher la configuration de l'application dans la table ce_frontal.y_conf
|
||||
$mysqli = new mysqli($this->_dbhost, $this->_dbuser, $this->_dbpass, $this->_dbname);
|
||||
$sql = 'SELECT * FROM y_conf WHERE admin=' . self::admin . ' AND active=1 LIMIT 1;';
|
||||
$mysqli->set_charset("utf8");
|
||||
$res = $mysqli->query($sql);
|
||||
$resconf = $res->fetch_assoc();
|
||||
$this->_appenv = $resconf["appenv"];
|
||||
$this->_appversion = "2.0.1";
|
||||
$this->_appscript = $resconf["appscript"]; //! le script à appeler par défaut si l'utilisateur n'est pas reconnu
|
||||
|
||||
$this->_brandgroupe = $resconf["brandgroupe"];
|
||||
$this->_brandmulti = $resconf["brandmulti"];
|
||||
|
||||
//! On va chercher les infos de base de cette appname dans ce_frontal.users_entites en fonction du http_host
|
||||
$http_host = $_SERVER['HTTP_HOST'];
|
||||
error_log("http_host : ".$http_host);
|
||||
$sql = 'SELECT * FROM users_entites WHERE http_host LIKE "%' . $http_host . '%" AND active=1 LIMIT 1;';
|
||||
$res = $mysqli->query($sql);
|
||||
$mysqli->close();
|
||||
$resentite = $res->fetch_assoc();
|
||||
if (empty($resentite)) {
|
||||
//! on ne trouve pas ce http_host, on part sur la demo
|
||||
$this->_appname = "udo_demo";
|
||||
$mysqli = new mysqli($this->_dbhost, $this->_dbuser, $this->_dbpass, $this->_dbname);
|
||||
$sql = 'SELECT * FROM users_entites WHERE rowid=1;'; // appname="' . $this->_appname . '" AND active=1 LIMIT 1;';
|
||||
$res = $mysqli->query($sql);
|
||||
$mysqli->close();
|
||||
$resentite = $res->fetch_assoc();
|
||||
}
|
||||
$this->_entite = $resentite;
|
||||
$this->_appname = $resentite["appname"];
|
||||
$this->_apptitle = $resentite["libelle"];
|
||||
$this->_brandname = $resentite["libelle"];
|
||||
$this->_brandadresse1 = $resentite["adresse1"];
|
||||
$this->_brandadresse2 = $resentite["adresse2"];
|
||||
$this->_brandcp = $resentite["cp"];
|
||||
$this->_brandville = $resentite["ville"];
|
||||
$this->_brandtel = $resentite["tel1"];
|
||||
$this->_brandemail = $resentite["email"];
|
||||
$this->_brandlogo = $resentite["appname"];
|
||||
|
||||
$this->_dbgname = $resentite["groupebase"];
|
||||
$this->_dbuname = $resentite["genbase"];
|
||||
$this->_tbusers = $resentite["table_users_gen"]; //! Spécifie la table des users de cette application, par défaut dans uof_frontal.users
|
||||
|
||||
if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
|
||||
$this->_clientIp = $_SERVER["HTTP_CLIENT_IP"];
|
||||
} elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
|
||||
$this->_clientIp = $_SERVER["HTTP_X_FORWARDED_FOR"];
|
||||
} else {
|
||||
$this->_clientIp = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
// Active le debug uniquement pour dev et recette
|
||||
if (strpos($http_host, 'dcleo.unikoffice.com') !== false || strpos($http_host, 'rcleo.unikoffice.com') !== false) {
|
||||
ini_set('error_reporting', -1);
|
||||
ini_set('display_errors', '1');
|
||||
$this->_devIp = true;
|
||||
|
||||
// Configuration avancée du debug pour dev/recette
|
||||
$this->_debug_level = 4; // Niveau debug complet
|
||||
$this->_log_sql = true; // Logger les requêtes SQL
|
||||
$this->_log_performance = true; // Mesurer les performances
|
||||
$this->_log_file_path = dirname(__DIR__) . '/log/' . $this->_appname . '_debug_' . date('Y-m-d') . '.log';
|
||||
|
||||
// Options PHP supplémentaires pour le debug
|
||||
ini_set('log_errors', '1');
|
||||
ini_set('error_log', $this->_log_file_path);
|
||||
ini_set('display_startup_errors', '1');
|
||||
ini_set('track_errors', '1');
|
||||
ini_set('html_errors', '1');
|
||||
ini_set('xmlrpc_errors', '0');
|
||||
} else {
|
||||
ini_set('error_reporting', 0);
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '0');
|
||||
$this->_debug_level = 0;
|
||||
$this->_log_sql = false;
|
||||
$this->_log_performance = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user