Fix: use dol_buildpath

This commit is contained in:
Regis Houssin 2012-03-01 04:07:01 +08:00
parent dd9e150743
commit 0b945f0716
4 changed files with 22 additions and 39 deletions

View File

@ -251,14 +251,11 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
// Check if there is external models to do asked by plugins $dirmodels=array_merge(array('/'),$conf->models_modules);
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
}
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/commande/"; $dir = dol_buildpath($reldir."core/modules/commande/");
if (is_dir($dir)) if (is_dir($dir))
{ {
@ -387,17 +384,14 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
// Check if there is external models to do asked by plugins $dirmodels=array_merge(array('/'),$conf->models_modules);
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
}
$var=true; $var=true;
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
foreach (array('','/doc') as $valdir) foreach (array('','/doc') as $valdir)
{ {
$dir = $dirroot . "/core/modules/commande".$valdir; $dir = dol_buildpath($reldir."core/modules/commande".$valdir);
if (is_dir($dir)) if (is_dir($dir))
{ {

View File

@ -318,21 +318,19 @@ print '</tr>'."\n";
clearstatcache(); clearstatcache();
// Check if there is external models to do asked by plugins $dirmodels=array_merge(array('/'),$conf->models_modules);
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
}
$var=true; foreach ($dirmodels as $reldir)
foreach ($conf->file->dol_document_root as $dirroot)
{ {
$dir = $dirroot . "/core/modules/facture/"; $dir = dol_buildpath($reldir."core/modules/commande/");
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
$var=true;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
@ -488,17 +486,14 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
// Check if there is external models to do asked by plugins $dirmodels=array_merge(array('/'),$conf->models_modules);
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
}
$var=true; $var=true;
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
foreach (array('','/doc') as $valdir) foreach (array('','/doc') as $valdir)
{ {
$dir = $dirroot . "/core/modules/facture".$valdir; $dir = dol_buildpath($reldir."core/modules/facture".$valdir);
if (is_dir($dir)) if (is_dir($dir))
{ {

View File

@ -74,7 +74,7 @@ if ($action == 'specimen')
$dirmodels=array_merge(array('/'),$conf->models_modules); $dirmodels=array_merge(array('/'),$conf->models_modules);
foreach($dirmodels as $reldir) foreach($dirmodels as $reldir)
{ {
$file=dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php",0); $file=dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php");
if (file_exists($file)) if (file_exists($file))
{ {
$filefound=1; $filefound=1;
@ -283,14 +283,11 @@ print '</tr>'."\n";
clearstatcache(); clearstatcache();
// Check if there is external models to do asked by plugins $dirmodels=array_merge(array('/'),$conf->models_modules);
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
}
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
$dir = $dirroot . "/core/modules/propale/"; $dir = dol_buildpath($reldir."core/modules/propale/");
if (is_dir($dir)) if (is_dir($dir))
{ {
@ -419,17 +416,14 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
// Check if there is external models to do asked by plugins $dirmodels=array_merge(array('/'),$conf->models_modules);
if (is_array($conf->models_modules) && ! empty($conf->models_modules)) {
$conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules);
}
$var=true; $var=true;
foreach ($conf->file->dol_document_root as $dirroot) foreach ($dirmodels as $reldir)
{ {
foreach (array('','/doc') as $valdir) foreach (array('','/doc') as $valdir)
{ {
$dir = $dirroot . "/core/modules/propale".$valdir; $dir = dol_buildpath($reldir."core/modules/propale".$valdir);
if (is_dir($dir)) if (is_dir($dir))
{ {

View File

@ -164,7 +164,7 @@ class Conf
if (! is_array($this->$varname)) { $this->$varname = array(); } if (! is_array($this->$varname)) { $this->$varname = array(); }
$arrValue = @unserialize($value); $arrValue = @unserialize($value);
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
else if ($partname == 'models' && $value == 1) $value = dol_buildpath('/'.$modulename); else if ($partname == 'models' && $value == 1) $value = '/'.$modulename.'/';
else $value = ($value == 1 ? '/'.$modulename.'/core/'.$partname.'/' : $value); else $value = ($value == 1 ? '/'.$modulename.'/core/'.$partname.'/' : $value);
$this->$varname = array_merge($this->$varname, array($modulename => $value)); $this->$varname = array_merge($this->$varname, array($modulename => $value));
} }