From 103187e4f4b4da758132072974de8d8ea786e2e5 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Fri, 16 Jul 2010 09:23:02 +0000 Subject: [PATCH] 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 --- includes/functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index b037e81134..b801dd3f52 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -697,17 +697,17 @@ function isHexString($str) } # Include all .inc.php files in $dir -function include_dir($dir) +function include_dir($dir, $regex = "/\.inc\.php$/") { global $device, $config; - if ($handle = opendir($dir)) + if ($handle = opendir($config['install_dir'] . '/' . $dir)) { 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); } }