Fix: Must not use DOL_DATA_ROOT directly

This commit is contained in:
Laurent Destailleur 2009-04-29 18:44:37 +00:00
parent d0426108f4
commit 04915533f2
7 changed files with 43 additions and 39 deletions

View File

@ -293,6 +293,10 @@ class Conf
$this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0; $this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0;
// Module Barcode // Module Barcode
$this->barcode->dir_temp=$rootfordata."/barcode/temp"; $this->barcode->dir_temp=$rootfordata."/barcode/temp";
// Module stock
$this->stock->dir_temp=$rootfordata."/stock/temp";
// Module prelevement
$this->prelevement->dir_output=$rootfordata."/prelevement";
/* /*
* Modification de quelques variable de conf en fonction des Constantes * Modification de quelques variable de conf en fonction des Constantes

View File

@ -36,7 +36,7 @@ define('EURO',chr(128));
// Definition des constantes syslog // Definition des constantes syslog
if (function_exists("define_syslog_variables")) if (function_exists("define_syslog_variables"))
{ {
define_syslog_variables(); define_syslog_variables();
} }
else else
{ {
@ -68,7 +68,7 @@ if (empty($dolibarr_main_db_host))
{ {
print 'Error: Dolibarr setup was run but was not completed.<br>'."\n"; print 'Error: Dolibarr setup was run but was not completed.<br>'."\n";
print 'Please, run <a href="install/index.php">Dolibarr install process</a> until the end...'."\n"; print 'Please, run <a href="install/index.php">Dolibarr install process</a> until the end...'."\n";
exit; exit;
} }
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
if (empty($dolibarr_main_data_root)) if (empty($dolibarr_main_data_root))
@ -91,7 +91,7 @@ define('DOL_URL_ROOT', $pos); // URL racine relative
*/ */
if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php")) if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"))
{ {
print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n"; print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n"; print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
exit; exit;
} }
@ -159,8 +159,8 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
// Detection browser // Detection browser
if (isset($_SERVER["HTTP_USER_AGENT"])) if (isset($_SERVER["HTTP_USER_AGENT"]))
{ {
if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1;
if (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; if (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1;
} }
// Chargement des includes principaux de librairies communes // Chargement des includes principaux de librairies communes
@ -262,17 +262,17 @@ if (! defined('NOREQUIRESOC'))
if (is_numeric($conf->global->MAIN_INFO_SOCIETE_PAYS)) if (is_numeric($conf->global->MAIN_INFO_SOCIETE_PAYS))
{ {
$mysoc->pays_id=$conf->global->MAIN_INFO_SOCIETE_PAYS; $mysoc->pays_id=$conf->global->MAIN_INFO_SOCIETE_PAYS;
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
$sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS; $sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS;
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
$obj = $db->fetch_object(); $obj = $db->fetch_object();
$mysoc->pays_code=$obj->code; $mysoc->pays_code=$obj->code;
} }
else { else {
dol_print_error($db); dol_print_error($db);
} }
} }
// Si dans MAIN_INFO_SOCIETE_PAYS on a deja un code, tout est fait // Si dans MAIN_INFO_SOCIETE_PAYS on a deja un code, tout est fait
else else

View File

@ -48,7 +48,7 @@ else
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
// Pour autre que companylogo, on charge environnement + info issus de logon comme le user // Pour autre que companylogo, on charge environnement + info issus de logon comme le user
require("./main.inc.php"); require("./main.inc.php");
// master.inc.php is included in main.inc.php // master.inc.php is included in main.inc.php
@ -90,7 +90,7 @@ if ($modulepart)
$accessallowed=1; $accessallowed=1;
$original_file=$conf->adherent->dir_output.'/'.$original_file; $original_file=$conf->adherent->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu factures // Wrapping pour les apercu factures
elseif ($modulepart == 'apercufacture') elseif ($modulepart == 'apercufacture')
{ {
@ -112,7 +112,7 @@ if ($modulepart)
} }
$original_file=$conf->propale->dir_output.'/'.$original_file; $original_file=$conf->propale->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu commande // Wrapping pour les apercu commande
elseif ($modulepart == 'apercucommande') elseif ($modulepart == 'apercucommande')
{ {
@ -123,7 +123,7 @@ if ($modulepart)
} }
$original_file=$conf->commande->dir_output.'/'.$original_file; $original_file=$conf->commande->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu intervention // Wrapping pour les apercu intervention
elseif ($modulepart == 'apercufichinter') elseif ($modulepart == 'apercufichinter')
{ {
@ -165,7 +165,7 @@ if ($modulepart)
} }
$original_file=$conf->fournisseur->dir_commande_temp.'/'.$original_file; $original_file=$conf->fournisseur->dir_commande_temp.'/'.$original_file;
} }
// Wrapping pour les images des stats factures // Wrapping pour les images des stats factures
elseif ($modulepart == 'billstats') elseif ($modulepart == 'billstats')
{ {
@ -185,7 +185,7 @@ if ($modulepart)
} }
$original_file=$conf->fournisseur->dir_facture_temp.'/'.$original_file; $original_file=$conf->fournisseur->dir_facture_temp.'/'.$original_file;
} }
// Wrapping pour les images des stats expeditions // Wrapping pour les images des stats expeditions
elseif ($modulepart == 'expeditionstats') elseif ($modulepart == 'expeditionstats')
{ {
@ -271,7 +271,7 @@ if ($modulepart)
elseif ($modulepart == 'graph_stock') elseif ($modulepart == 'graph_stock')
{ {
$accessallowed=1; $accessallowed=1;
$original_file=DOL_DATA_ROOT.'/entrepot/temp/'.$original_file; $original_file=$conf->stock->dir_temp.'/'.$original_file;
} }
// Wrapping pour les graph fournisseurs // Wrapping pour les graph fournisseurs
@ -294,7 +294,7 @@ if ($modulepart)
$accessallowed=1; $accessallowed=1;
$original_file=''; // No files are built on disk $original_file=''; // No files are built on disk
} }
// images des stats du commercial // images des stats du commercial
elseif ($modulepart == 'graph_comm') elseif ($modulepart == 'graph_comm')
{ {
@ -318,7 +318,7 @@ if (! $accessallowed)
} }
// Security: // Security:
// On interdit les remont<EFBFBD>es de repertoire ainsi que les pipe dans // On interdit les remontees de repertoire ainsi que les pipe dans
// les noms de fichiers. // les noms de fichiers.
if (eregi('\.\.',$original_file) || eregi('[<>|]',$original_file)) if (eregi('\.\.',$original_file) || eregi('[<>|]',$original_file))
{ {
@ -353,7 +353,7 @@ if ($modulepart == 'barcode')
else else
{ {
// Ouvre et renvoi fichier // Ouvre et renvoi fichier
clearstatcache(); clearstatcache();
// Output files on disk // Output files on disk
$filename = basename($original_file); $filename = basename($original_file);

View File

@ -97,7 +97,7 @@ class pdf_courrier_editeur
$fichref = $year; $fichref = $year;
$dir = DOL_DATA_ROOT."/societe/courrier/" . get_exdir($id); $dir = $conf->societe->dir_output."/courrier/" . get_exdir($id);
$file = $dir . $fichref . ".pdf"; $file = $dir . $fichref . ".pdf";
if (! file_exists($dir)) if (! file_exists($dir))

View File

@ -71,7 +71,7 @@ $year = strftime('%Y',$now);
/* /*
* *
*/ */
$dir = DOL_DATA_ROOT."/product/temp"; $dir = $conf->produit->dir_output."/temp";
if (!is_dir($dir) ) if (!is_dir($dir) )
{ {
if (! create_exdir($dir,0755)) if (! create_exdir($dir,0755))
@ -186,7 +186,7 @@ foreach ( $products as $id => $fdir)
$legends[$i] = $row[0]; $legends[$i] = $row[0];
$num[$i] = $row[1]; $num[$i] = $row[1];
$ca[$i] = $row[2]; $ca[$i] = $row[2];
$i++; $i++;
} }
$db->free($resql); $db->free($resql);

View File

@ -70,7 +70,7 @@ for ($i = 1 ; $i < sizeof($argv) ; $i++)
} }
$dir = DOL_DATA_ROOT."/entrepot/temp"; $dir = $conf->stock->dir_temp;
$result=create_exdir($dir); $result=create_exdir($dir);
@ -204,7 +204,7 @@ function graph_datas($file, $title, $values, $legends)
$height=230; $height=230;
print "Build graph ".$file."\n"; print "Build graph ".$file."\n";
$newvalues=array(); $newvalues=array();
foreach ($values as $abs=>$ord) foreach ($values as $abs=>$ord)
{ {

View File

@ -200,12 +200,12 @@ if (sizeof($factures_prev) > 0)
if ($db->query($sql)) if ($db->query($sql))
{ {
$row = $db->fetch_row(); $row = $db->fetch_row();
} }
else else
{ {
$error++; $error++;
dol_syslog("Erreur recherche reference"); dol_syslog("Erreur recherche reference");
} }
$ref = $ref . substr("00".($row[0]+1), -2); $ref = $ref . substr("00".($row[0]+1), -2);
@ -222,15 +222,15 @@ if (sizeof($factures_prev) > 0)
if ($db->query($sql)) if ($db->query($sql))
{ {
$prev_id = $db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $prev_id = $db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
$bonprev = new BonPrelevement($db, DOL_DATA_ROOT."/prelevement/bon/".$filebonprev); $bonprev = new BonPrelevement($db, $this->prelevement."/bon/".$filebonprev);
$bonprev->id = $prev_id; $bonprev->id = $prev_id;
} }
else else
{ {
$error++; $error++;
dol_syslog("Erreur création du bon de prelevement"); dol_syslog("Erreur création du bon de prelevement");
} }
} }