New: add directory for external module and other customization
This commit is contained in:
parent
bdbc82de66
commit
4a577412d5
@ -277,17 +277,26 @@ if ($resql)
|
|||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
||||||
{
|
{
|
||||||
$module = $regs[1];
|
$boxname = $regs[1];
|
||||||
$sourcefile = "/".$regs[2]."/inc/boxes/".$module.".php";
|
$module = $regs[2];
|
||||||
|
|
||||||
|
if (file_exists(DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php"))
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_EXTMODULE_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$module=preg_replace('/.php$/i','',$obj->file);
|
$boxname=preg_replace('/.php$/i','',$obj->file);
|
||||||
$sourcefile = "/includes/boxes/".$module.".php";
|
$sourcefile = DOL_DOCUMENT_ROOT."/includes/boxes/".$boxname.".php";
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.$sourcefile);
|
include_once($sourcefile);
|
||||||
$box=new $module($db,$obj->note);
|
$box=new $boxname($db,$obj->note);
|
||||||
|
|
||||||
// if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
// if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
||||||
if (in_array($obj->rowid, $actives))
|
if (in_array($obj->rowid, $actives))
|
||||||
@ -379,17 +388,26 @@ if ($resql)
|
|||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
||||||
{
|
{
|
||||||
$module = $regs[1];
|
$boxname = $regs[1];
|
||||||
$sourcefile = "/".$regs[2]."/inc/boxes/".$module.".php";
|
$module = $regs[2];
|
||||||
|
|
||||||
|
if (file_exists(DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php"))
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_EXTMODULE_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$module=preg_replace('/.php$/i','',$obj->file);
|
$boxname=preg_replace('/.php$/i','',$obj->file);
|
||||||
$sourcefile = "/includes/boxes/".$module.".php";
|
$sourcefile = DOL_DOCUMENT_ROOT."/includes/boxes/".$boxname.".php";
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.$sourcefile);
|
include_once($sourcefile);
|
||||||
$box=new $module($db,$obj->note);
|
$box=new $boxname($db,$obj->note);
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 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
|
||||||
@ -217,17 +217,26 @@ class InfoBox
|
|||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
||||||
{
|
{
|
||||||
$module = $regs[1];
|
$boxname = $regs[1];
|
||||||
$sourcefile = "/".$regs[2]."/inc/boxes/".$module.".php";
|
$module = $regs[2];
|
||||||
|
|
||||||
|
if (file_exists(DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php"))
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_EXTMODULE_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$module=preg_replace('/.php$/i','',$obj->file);
|
$boxname=preg_replace('/.php$/i','',$obj->file);
|
||||||
$sourcefile = "/includes/boxes/".$module.".php";
|
$sourcefile = DOL_DOCUMENT_ROOT."/includes/boxes/".$boxname.".php";
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.$sourcefile);
|
include_once($sourcefile);
|
||||||
$box=new $module($db,$obj->note);
|
$box=new $boxname($db,$obj->note);
|
||||||
|
|
||||||
$box->rowid=$obj->rowid;
|
$box->rowid=$obj->rowid;
|
||||||
$box->box_id=$obj->box_id;
|
$box->box_id=$obj->box_id;
|
||||||
@ -277,17 +286,26 @@ class InfoBox
|
|||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$obj->file,$regs))
|
||||||
{
|
{
|
||||||
$module = $regs[1];
|
$boxname = $regs[1];
|
||||||
$sourcefile = "/".$regs[2]."/inc/boxes/".$module.".php";
|
$module = $regs[2];
|
||||||
|
|
||||||
|
if (file_exists(DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php"))
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_DOCUMENT_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sourcefile = DOL_EXTMODULE_ROOT."/".$module."/inc/boxes/".$boxname.".php";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$module=preg_replace('/.php$/i','',$obj->file);
|
$boxname=preg_replace('/.php$/i','',$obj->file);
|
||||||
$sourcefile = "/includes/boxes/".$module.".php";
|
$sourcefile = DOL_DOCUMENT_ROOT."/includes/boxes/".$boxname.".php";
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.$sourcefile);
|
include_once($sourcefile);
|
||||||
$box=new $module($db,$obj->note);
|
$box=new $boxname($db,$obj->note);
|
||||||
|
|
||||||
$box->rowid=$obj->rowid;
|
$box->rowid=$obj->rowid;
|
||||||
$box->box_id=$obj->box_id;
|
$box->box_id=$obj->box_id;
|
||||||
|
|||||||
@ -117,7 +117,7 @@ $suburi = strstr ($uri, '/'); // $suburi contains url without domain
|
|||||||
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
||||||
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
||||||
if (! empty($dolibarr_main_url_root_static)) define('DOL_URL_ROOT_FULL_STATIC', $dolibarr_main_url_root_static); // Used to put static images on another domain
|
if (! empty($dolibarr_main_url_root_static)) define('DOL_URL_ROOT_FULL_STATIC', $dolibarr_main_url_root_static); // Used to put static images on another domain
|
||||||
|
define('DOL_URL_EXTMODULE', DOL_URL_ROOT . '/custom/modules'); // URL relative for external modules
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Include functions
|
* Include functions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user