mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix install_dir in include_dir and add optional regex
git-svn-id: http://www.observium.org/svn/observer/trunk@1369 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -697,17 +697,17 @@ function isHexString($str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Include all .inc.php files in $dir
|
# Include all .inc.php files in $dir
|
||||||
function include_dir($dir)
|
function include_dir($dir, $regex = "/\.inc\.php$/")
|
||||||
{
|
{
|
||||||
global $device, $config;
|
global $device, $config;
|
||||||
|
|
||||||
if ($handle = opendir($dir))
|
if ($handle = opendir($config['install_dir'] . '/' . $dir))
|
||||||
{
|
{
|
||||||
while (false !== ($file = readdir($handle)))
|
while (false !== ($file = readdir($handle)))
|
||||||
{
|
{
|
||||||
if (filetype($dir . '/' . $file) == 'file' && substr($file,strlen($file)-8) == '.inc.php')
|
if (filetype($config['install_dir'] . '/' . $dir . '/' . $file) == 'file' && preg_match($regex, $file))
|
||||||
{
|
{
|
||||||
include($dir . '/' . $file);
|
include($config['install_dir'] . '/' . $dir . '/' . $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user