Fix: problem with external modules
This commit is contained in:
parent
97a56316d0
commit
e1adeec907
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -72,11 +72,32 @@ class Export
|
|||||||
$var=true;
|
$var=true;
|
||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
//$dir=DOL_DOCUMENT_ROOT."/includes/modules";
|
foreach ($conf->file->dol_document_root as $type => $dirroot)
|
||||||
foreach($conf->file->dol_document_root as $dirroot)
|
|
||||||
{
|
{
|
||||||
$dir = $dirroot.'/includes/modules';
|
$modulesdir[] = $dirroot . "/includes/modules/";
|
||||||
|
|
||||||
|
if ($type == 'alt')
|
||||||
|
{
|
||||||
|
$handle=@opendir($dirroot);
|
||||||
|
if (is_resource($handle))
|
||||||
|
{
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
|
||||||
|
{
|
||||||
|
if (is_dir($dirroot . '/' . $file . '/includes/modules/'))
|
||||||
|
{
|
||||||
|
$modulesdir[] = $dirroot . '/' . $file . '/includes/modules/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($modulesdir as $dir)
|
||||||
|
{
|
||||||
// Search available exports
|
// Search available exports
|
||||||
$handle=@opendir($dir);
|
$handle=@opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
@ -84,7 +105,7 @@ class Export
|
|||||||
// Search module files
|
// Search module files
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (preg_match("/^(mod.*)\.class\.php$/i",$file,$reg))
|
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i",$file,$reg))
|
||||||
{
|
{
|
||||||
$modulename=$reg[1];
|
$modulename=$reg[1];
|
||||||
|
|
||||||
@ -96,7 +117,7 @@ class Export
|
|||||||
if ($enabled)
|
if ($enabled)
|
||||||
{
|
{
|
||||||
// Chargement de la classe
|
// Chargement de la classe
|
||||||
$file = $dir."/".$modulename.".class.php";
|
$file = $dir.$modulename.".class.php";
|
||||||
$classname = $modulename;
|
$classname = $modulename;
|
||||||
require_once($file);
|
require_once($file);
|
||||||
$module = new $classname($this->db);
|
$module = new $classname($this->db);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user