Suppression config spécial environnement

Ajout compatibilité serveur
This commit is contained in:
Michael RICOIS 2009-02-20 15:14:13 +00:00
parent 4873000360
commit 442bd3ebf0
6 changed files with 6 additions and 341 deletions

View File

@ -1,134 +0,0 @@
<?php
/**
* Fonction globale récupérant le microtime de la machine en format float.
* @return float Valeur courante du microtime() de la machine en format décimal
*/
function getmicrotime(){
list($usec, $sec) = explode (' ', microtime());
return ( (float)$sec + (float)$usec );
}
/**********************************************************************
* Ce script est chargé par tous les scripts PHP
**********************************************************************
* $Id: $
* $Author: $
* $Revision: $
**********************************************************************/
/** On ne prend l'heure qu'une seule fois par script PHP et on initialise des constantes.
*
* DATETIME YmdHis
* DATETIME_LOG Y-m-d H:i:s Date du jour pour les insertions en BDD
* NOW His Heure d'exécution du script
* NOW_FORMAT H:i:s Heure d'exécution du script
* TODAY Ymd Année, Mois, Jour d'ex�cution du script
* TODAY_FORMAT Y-m-d
* TODAY_AFF d/m/Y
*/
define ('DATETIME', date('YmdHis'));
define ('DATETIME_LOG', substr(DATETIME,0,4).'-'.substr(DATETIME, 4,2).'-'.substr(DATETIME, 6,2).' '.substr(DATETIME,8,2).'-'.substr(DATETIME,10,2).'-'.substr(DATETIME,12,2) );
define ('TODAY', substr(DATETIME,0,8));
define ('NOW', substr(DATETIME,8,6));
define ('TODAY_FORMAT', substr(DATETIME,0,4).'-'.substr(DATETIME,4,2).'-'.substr(DATETIME,6,2));
define ('TODAY_AFF', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
define ('NOW_FORMAT', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
/**
* Les librairies suivantes sont chargées automatiquement car tous les scripts les utilisent !
*/
if( !defined('ROOT_PATH') )
{
define ('ROOT_PATH', realpath(dirname(__FILE__) . '/../') );
define ('WWW_PATH', realpath(ROOT_PATH.'/www/') );
define ('LOG_PATH', realpath(ROOT_PATH.'/log/') );
define ('INCLUDE_PATH', realpath(ROOT_PATH.'/includes/') );
define ('PEAR_PATH', realpath('/usr/share/php/') );
include_once realpath(INCLUDE_PATH.'/phplib/db_mysql.inc');
include_once realpath(INCLUDE_PATH.'/auth/sessions.inc');
//include_once realpath(INCLUDE_PATH.'/auth/sessions.local.inc');
include_once realpath(ROOT_PATH.'/config/config.inc');
}
/*
if ( LOG_BENCH != 'NONE' ){
include_once realpath(PEAR_PATH . '/Benchmark/Timer.php');
}else{
class Benchmark_Timer
{
function start() {}
function setMarker() {}
function stop() {}
function getProfiling() {}
function display() {}
}
}
*/
/* @todo: A enlever pour la prod
$timer = new Benchmark_Timer();
$timer->start();
$timer->setMarker('Debut du script (prepend.php)');
*/
/** Instance de la connexion � la base de donn�es
* Cette instance est utilis�e par tous les scripts pour acc�der � la base de donn�es
*/
class DB extends DB_MySQL
{
function DB() {
$this->Host = MYSQL_HOST;
$this->Database = MYSQL_DB;
$this->User = MYSQL_USER;
$this->Password = MYSQL_PASS;
}
function getRow() {
$ret= $this->Record;
for( $i= 0; $i<count($this->Record); $i++ ) { if( !isset($ret[$i]) ) break; unset($ret[$i]); }
return $ret;
}
function query($q) {
if ( LOG_MYSQL != 'NONE' ) $time_start=getmicrotime();
$ret=DB_MySQL::query($q);
if ( LOG_MYSQL == 'NONE' ) return $ret;
$time_end= getmicrotime();
$time_total= $time_end-$time_start;
$time_total= substr((string)$time_total,0,10);
$now= date('Y/m/d H:i:s', $time_start);
if ($ret<1)
$mysqlerror = mysql_errno() .' : '. mysql_error();
else
$mysqlerror = '';
$sqlAction=strtoupper(substr(trim($q),0,6));
if ( LOG_MYSQL=='SELECT' && $sqlAction=='SELECT' )
$logOption='_select';
elseif ( LOG_MYSQL=='UPDATE' && ( $sqlAction=='UPDATE' || $sqlAction=='INSERT' || $sqlAction=='DELETE' ) )
$logOption='_update';
else
$logOption='';
$fh=@fopen( LOG_PATH . 'db_mysql'.$logOption.'.log', 'a+');
if ($fh) {
@fwrite($fh, "$now\t$time_total\t" . MYSQL_HOST ."\t". MYSQL_USER ."\t". MYSQL_DB ."\t$mysqlerror\t$q\r\n");
@fclose($fh);
}
$mySqlErrTab=explode(' : ', $mysqlerror);
$mySqlErrno=(int)$mySqlErrTab[0];
if ( $mySqlErrno > 0 && $mySqlErrno !=1062 ) {
// mail_admin( 'Erreur MySQL '.$mySqlErrno, $mysqlerror ."\n\n". $q );
}
return $ret;
}
}
?>

View File

@ -1,134 +0,0 @@
<?php
/**
* Fonction globale récupérant le microtime de la machine en format float.
* @return float Valeur courante du microtime() de la machine en format décimal
*/
function getmicrotime(){
list($usec, $sec) = explode (' ', microtime());
return ( (float)$sec + (float)$usec );
}
/**********************************************************************
* Ce script est chargé par tous les scripts PHP
**********************************************************************
* $Id: $
* $Author: $
* $Revision: $
**********************************************************************/
/** On ne prend l'heure qu'une seule fois par script PHP et on initialise des constantes.
*
* DATETIME YmdHis
* DATETIME_LOG Y-m-d H:i:s Date du jour pour les insertions en BDD
* NOW His Heure d'exécution du script
* NOW_FORMAT H:i:s Heure d'exécution du script
* TODAY Ymd Année, Mois, Jour d'ex�cution du script
* TODAY_FORMAT Y-m-d
* TODAY_AFF d/m/Y
*/
define ('DATETIME', date('YmdHis'));
define ('DATETIME_LOG', substr(DATETIME,0,4).'-'.substr(DATETIME, 4,2).'-'.substr(DATETIME, 6,2).' '.substr(DATETIME,8,2).'-'.substr(DATETIME,10,2).'-'.substr(DATETIME,12,2) );
define ('TODAY', substr(DATETIME,0,8));
define ('NOW', substr(DATETIME,8,6));
define ('TODAY_FORMAT', substr(DATETIME,0,4).'-'.substr(DATETIME,4,2).'-'.substr(DATETIME,6,2));
define ('TODAY_AFF', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
define ('NOW_FORMAT', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
/**
* Les librairies suivantes sont chargées automatiquement car tous les scripts les utilisent !
*/
if( !defined('ROOT_PATH') )
{
define ('ROOT_PATH', realpath(dirname(__FILE__) . '/../') );
define ('WWW_PATH', realpath(ROOT_PATH.'/www/') );
define ('LOG_PATH', realpath(ROOT_PATH.'/log/') );
define ('INCLUDE_PATH', realpath(ROOT_PATH.'/includes/') );
define ('PEAR_PATH', realpath('/usr/share/php/') );
include_once realpath(INCLUDE_PATH.'/phplib/db_mysql.inc');
include_once realpath(INCLUDE_PATH.'/auth/sessions.inc');
//include_once realpath(INCLUDE_PATH.'/auth/sessions.local.inc');
include_once realpath(ROOT_PATH.'/config/config.inc');
}
/*
if ( LOG_BENCH != 'NONE' ){
include_once realpath(PEAR_PATH . '/Benchmark/Timer.php');
}else{
class Benchmark_Timer
{
function start() {}
function setMarker() {}
function stop() {}
function getProfiling() {}
function display() {}
}
}
*/
/* @todo: A enlever pour la prod
$timer = new Benchmark_Timer();
$timer->start();
$timer->setMarker('Debut du script (prepend.php)');
*/
/** Instance de la connexion � la base de donn�es
* Cette instance est utilis�e par tous les scripts pour acc�der � la base de donn�es
*/
class DB extends DB_MySQL
{
function DB() {
$this->Host = MYSQL_HOST;
$this->Database = MYSQL_DB;
$this->User = MYSQL_USER;
$this->Password = MYSQL_PASS;
}
function getRow() {
$ret= $this->Record;
for( $i= 0; $i<count($this->Record); $i++ ) { if( !isset($ret[$i]) ) break; unset($ret[$i]); }
return $ret;
}
function query($q) {
if ( LOG_MYSQL != 'NONE' ) $time_start=getmicrotime();
$ret=DB_MySQL::query($q);
if ( LOG_MYSQL == 'NONE' ) return $ret;
$time_end= getmicrotime();
$time_total= $time_end-$time_start;
$time_total= substr((string)$time_total,0,10);
$now= date('Y/m/d H:i:s', $time_start);
if ($ret<1)
$mysqlerror = mysql_errno() .' : '. mysql_error();
else
$mysqlerror = '';
$sqlAction=strtoupper(substr(trim($q),0,6));
if ( LOG_MYSQL=='SELECT' && $sqlAction=='SELECT' )
$logOption='_select';
elseif ( LOG_MYSQL=='UPDATE' && ( $sqlAction=='UPDATE' || $sqlAction=='INSERT' || $sqlAction=='DELETE' ) )
$logOption='_update';
else
$logOption='';
$fh=@fopen( LOG_PATH . 'db_mysql'.$logOption.'.log', 'a+');
if ($fh) {
@fwrite($fh, "$now\t$time_total\t" . MYSQL_HOST ."\t". MYSQL_USER ."\t". MYSQL_DB ."\t$mysqlerror\t$q\r\n");
@fclose($fh);
}
$mySqlErrTab=explode(' : ', $mysqlerror);
$mySqlErrno=(int)$mySqlErrTab[0];
if ( $mySqlErrno > 0 && $mySqlErrno !=1062 ) {
// mail_admin( 'Erreur MySQL '.$mySqlErrno, $mysqlerror ."\n\n". $q );
}
return $ret;
}
}
?>

View File

@ -1,5 +1,10 @@
<?php
//Remplacement du php_value include_path dans le .htaccess
/*
* Remplacement du php_value include_path dans le .htaccess
* Attention à bien placer l'include_path dans le php.ini
* Pour windows/wamp : include_path = ".;c:\wamp\bin\php\php5.2.8\PEAR"
* Pour serveur linux : include_path = ".:/usr/share/php"
*/
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR .
realpath(dirname(__FILE__) . '/../framework/') . PATH_SEPARATOR .
realpath(dirname(__FILE__) . '/../includes/')

View File

@ -1,24 +0,0 @@
php_value include_path ".:C:\wamp\www\extranet\framework:C:\wamp\www\extranet\includes:C:\wamp\bin\php\php5.2.8\pear"
php_value auto_prepend_file "C:\wamp\www\extranet\config\prepend.php"
php_value auto_append_file "C:\wamp\www\extranet\config\append.php"
#ErrorDocument 400 /error.php?errtyp=400
#ErrorDocument 401 /error.php?errtyp=401
#ErrorDocument 402 /error.php?errtyp=402
#ErrorDocument 403 /error.php?errtyp=403
#ErrorDocument 404 /error.php?errtyp=404
#ErrorDocument 500 /error.php?errtyp=500
#ErrorDocument 501 /error.php?errtyp=501
#ErrorDocument 502 /error.php?errtyp=502
#Options +FollowSymlinks
#RewriteEngine on
#RewriteRule ^(.*).htm$ http://www2.scores-decisions.com/index.php?page=$1 [nc]
#RewriteRule !(index\.php|test\.php|^documents/pdf/courriers(.*)|\.html|\.htm|\.gif|\.css|\.jpg|\.png|\.jar|\.js|\.ico|\.pdf)$ /index.php [L]
#RewriteRule ^img/(.*) /img/$1 [L]
#RewriteRule ^js/(.*) /scripts/$1 [L]
#RewriteRule ^css/(.*) /design/stylesheets/$1 [L]
#RewriteRule ^etatspdf/(.*) /documents/pdf/etats/$1 [L]
#RewriteRule ^(.*)\.htm$ /html/$1.html [L]
#Order Deny,Allow
#Deny from all
#Allow from 82.234.126.118

View File

@ -1,24 +0,0 @@
php_value include_path ".:/var/www/extranet/framework:/var/www/extranet/includes:/usr/share/php"
php_value auto_prepend_file "/var/www/extranet/config/prepend.php"
php_value auto_append_file "/var/www/extranet/config/append.php"
#ErrorDocument 400 /error.php?errtyp=400
#ErrorDocument 401 /error.php?errtyp=401
#ErrorDocument 402 /error.php?errtyp=402
#ErrorDocument 403 /error.php?errtyp=403
#ErrorDocument 404 /error.php?errtyp=404
#ErrorDocument 500 /error.php?errtyp=500
#ErrorDocument 501 /error.php?errtyp=501
#ErrorDocument 502 /error.php?errtyp=502
#Options +FollowSymlinks
#RewriteEngine on
#RewriteRule ^(.*).htm$ http://www2.scores-decisions.com/index.php?page=$1 [nc]
#RewriteRule !(index\.php|test\.php|^documents/pdf/courriers(.*)|\.html|\.htm|\.gif|\.css|\.jpg|\.png|\.jar|\.js|\.ico|\.pdf)$ /index.php [L]
#RewriteRule ^img/(.*) /img/$1 [L]
#RewriteRule ^js/(.*) /scripts/$1 [L]
#RewriteRule ^css/(.*) /design/stylesheets/$1 [L]
#RewriteRule ^etatspdf/(.*) /documents/pdf/etats/$1 [L]
#RewriteRule ^(.*)\.htm$ /html/$1.html [L]
#Order Deny,Allow
#Deny from all
#Allow from 82.234.126.118

View File

@ -1,24 +0,0 @@
php_value include_path ".:/sites/extranet/framework:/sites/extranet/includes:/usr/share/php"
php_value auto_prepend_file "/sites/extranet/config/prepend.php"
php_value auto_append_file "/sites/extranet/config/append.php"
#ErrorDocument 400 /error.php?errtyp=400
#ErrorDocument 401 /error.php?errtyp=401
#ErrorDocument 402 /error.php?errtyp=402
#ErrorDocument 403 /error.php?errtyp=403
#ErrorDocument 404 /error.php?errtyp=404
#ErrorDocument 500 /error.php?errtyp=500
#ErrorDocument 501 /error.php?errtyp=501
#ErrorDocument 502 /error.php?errtyp=502
#Options +FollowSymlinks
#RewriteEngine on
#RewriteRule ^(.*).htm$ http://www2.scores-decisions.com/index.php?page=$1 [nc]
#RewriteRule !(index\.php|test\.php|^documents/pdf/courriers(.*)|\.html|\.htm|\.gif|\.css|\.jpg|\.png|\.jar|\.js|\.ico|\.pdf)$ /index.php [L]
#RewriteRule ^img/(.*) /img/$1 [L]
#RewriteRule ^js/(.*) /scripts/$1 [L]
#RewriteRule ^css/(.*) /design/stylesheets/$1 [L]
#RewriteRule ^etatspdf/(.*) /documents/pdf/etats/$1 [L]
#RewriteRule ^(.*)\.htm$ /html/$1.html [L]
#Order Deny,Allow
#Deny from all
#Allow from 82.234.126.118