Avoiding include in case of unexisting file
This commit is contained in:
parent
8eced58ba0
commit
ad4512cb24
@ -236,11 +236,15 @@ function dol_getprefix()
|
|||||||
*
|
*
|
||||||
* @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
|
* @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
|
||||||
* @param string $classname Class name
|
* @param string $classname Class name
|
||||||
* @return int false if include fails.
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function dol_include_once($relpath, $classname='')
|
function dol_include_once($relpath, $classname='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var']
|
|
||||||
|
if (!file_exists($relpath)) {
|
||||||
|
dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($classname) && ! class_exists($classname)) {
|
if (! empty($classname) && ! class_exists($classname)) {
|
||||||
return include dol_buildpath($relpath);
|
return include dol_buildpath($relpath);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user