From 281805991a2b869cbb7a4d865a4c79bf9434ac27 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 30 Mar 2010 16:40:00 +0000 Subject: [PATCH] Fix: add "set_include_path" --- htdocs/admin/modules.php | 10 +++++-- htdocs/core/conf.class.php | 29 +++++++++++++++---- .../modules/modMultiCompany.class.php | 2 +- .../{ => multicompany}/admin/multicompany.php | 8 ++--- 4 files changed, 37 insertions(+), 12 deletions(-) rename htdocs/{ => multicompany}/admin/multicompany.php (91%) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1e830d3afb1..77e8ea405eb 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -465,8 +465,14 @@ foreach ($orders as $key => $value) } else { - //print ''.$langs->trans("Setup").' '; - print ''.img_picto($langs->trans("Setup"),"setup").' '; + if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs)) + { + print ''.img_picto($langs->trans("Setup"),"setup").' '; + } + else + { + print ''.img_picto($langs->trans("Setup"),"setup").' '; + } } } print "\n"; diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php index 9f0cf91eb7d..a2c7e71aa22 100644 --- a/htdocs/core/conf.class.php +++ b/htdocs/core/conf.class.php @@ -53,12 +53,13 @@ class Conf //! Used to store entity for multi-company (default 1) var $entity=1; - var $css_modules=array(); - var $tabs_modules=array(); - var $need_smarty=array(); - var $modules=array(); + var $css_modules = array(); + var $tabs_modules = array(); + var $need_smarty = array(); + var $modules = array(); + var $include_path = array(); - var $logbuffer=array(); + var $logbuffer = array(); /** * Constructor @@ -80,6 +81,11 @@ class Conf function setValues($db) { dol_syslog("Conf::setValues"); + + // Add root path + $this->include_path[] = DOL_DOCUMENT_ROOT; + // Add library path + $this->include_path[] = DOL_DOCUMENT_ROOT."/lib/"; // Avoid warning if not defined if (empty($this->db->dolibarr_main_db_encryption)) $this->db->dolibarr_main_db_encryption=0; @@ -159,12 +165,25 @@ class Conf $this->$module->enabled=true; // Add this module in list of enabled modules $this->modules[]=$module; + // Add class path + if (file_exists(DOL_DOCUMENT_ROOT.'/'.$module.'/class/')) + { + $this->include_path[] = DOL_DOCUMENT_ROOT.'/'.$module.'/class/'; + } + // Add library path + if (file_exists(DOL_DOCUMENT_ROOT.'/'.$module.'/lib/')) + { + $this->include_path[] = DOL_DOCUMENT_ROOT.'/'.$module.'/lib/'; + } } } $i++; } } $db->free($result); + + // Set include_path + set_include_path(implode(PATH_SEPARATOR, $this->include_path)); // Clean some variables // conf->menu_top et conf->menu_left are defined in main.inc.php (according to user choice) diff --git a/htdocs/includes/modules/modMultiCompany.class.php b/htdocs/includes/modules/modMultiCompany.class.php index d4039147f25..a2ab36abfba 100644 --- a/htdocs/includes/modules/modMultiCompany.class.php +++ b/htdocs/includes/modules/modMultiCompany.class.php @@ -74,7 +74,7 @@ class modMultiCompany extends DolibarrModules $this->style_sheet = ''; // Config pages. Put here list of php page names stored in admmin directory used to setup module. - $this->config_page_url = array("multicompany.php"); + $this->config_page_url = array("multicompany.php@multicompany"); // Dependencies $this->depends = array(); // List of modules id that must be enabled if this module is enabled diff --git a/htdocs/admin/multicompany.php b/htdocs/multicompany/admin/multicompany.php similarity index 91% rename from htdocs/admin/multicompany.php rename to htdocs/multicompany/admin/multicompany.php index d453bb4067a..cd57264c320 100644 --- a/htdocs/admin/multicompany.php +++ b/htdocs/multicompany/admin/multicompany.php @@ -23,10 +23,10 @@ * \version $Id$ */ -require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); -require_once(DOL_DOCUMENT_ROOT.'/multicompany/class/multicompany.class.php'); +require("../../main.inc.php"); +require_once("multicompany.class.php"); +require_once("admin.lib.php"); +require_once("company.lib.php"); $langs->load("admin");