Misc: Removed use of GLOB_BRACE as doesn't work on some systems, use non-GLOB_BRACE method instead. Thanks [xming] and Risk64. Should resolve Issue 916, as well.

This commit is contained in:
Nate Jones
2015-05-12 18:11:05 +00:00
parent acaac84edc
commit fe8032b1c3
4 changed files with 21 additions and 28 deletions

View File

@@ -138,18 +138,13 @@ include "root.php";
public function xml() {
//build the list of categories
$music_on_hold_dir = $_SESSION['switch']['sounds']['dir'].'/music';
//default category
if (defined("GLOB_BRACE")) {
$array = glob($music_on_hold_dir."/{8000,16000,32000,48000}", GLOB_ONLYDIR|GLOB_BRACE);
}
else {
$array_1 = glob($music_on_hold_dir."/8000".$class_name.".php", GLOB_ONLYDIR);
$array_2 = glob($music_on_hold_dir."/16000".$class_name.".php", GLOB_ONLYDIR);
$array_3 = glob($music_on_hold_dir."/32000".$class_name.".php", GLOB_ONLYDIR);
$array_4 = glob($music_on_hold_dir."/48000".$class_name.".php", GLOB_ONLYDIR);
$array = array_merge((array)$array_1,(array)$array_2,(array)$array_3,(array)$array_4);
unset($array_1,$array_2,$array_3,$array_4);
}
//default category (note: GLOB_BRACE doesn't work on some systems)
$array_1 = glob($music_on_hold_dir."/8000".$class_name.".php", GLOB_ONLYDIR);
$array_2 = glob($music_on_hold_dir."/16000".$class_name.".php", GLOB_ONLYDIR);
$array_3 = glob($music_on_hold_dir."/32000".$class_name.".php", GLOB_ONLYDIR);
$array_4 = glob($music_on_hold_dir."/48000".$class_name.".php", GLOB_ONLYDIR);
$array = array_merge((array)$array_1,(array)$array_2,(array)$array_3,(array)$array_4);
unset($array_1,$array_2,$array_3,$array_4);
//other categories
if (count($_SESSION['domains']) > 1) {
$array = array_merge($array, glob($music_on_hold_dir."/*/*/*", GLOB_ONLYDIR));

View File

@@ -46,11 +46,11 @@
$prep_statement->execute();
}
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//unset the previous settings
//unset all settings
foreach ($result as $row) {
unset($_SESSION[$row['default_setting_category']]);
}
//set the settings as a session
//set the enabled settings as a session
foreach ($result as $row) {
if ($row['default_setting_enabled'] == 'true') {
$name = $row['default_setting_name'];
@@ -99,7 +99,7 @@
unset($_SESSION[$category][$subcategory]);
}
}
//set the settings as a session
//set the enabled settings as a session
foreach ($result as $row) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
@@ -220,8 +220,11 @@
//get the PROJECT PATH
include "root.php";
//get the list of installed apps from the core and app directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_{config,menu}.php",GLOB_BRACE);
//get the list of installed apps from the core and app directories (note: GLOB_BRACE doesn't work on some systems)
$config_list1 = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_config.php");
$config_list2 = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_menu.php");
$config_list = array_merge((array)$config_list1, (array)$config_list2);
unset($config_list1,$config_list2);
$x=0;
foreach ($config_list as &$config_path) {
include($config_path);

View File

@@ -64,7 +64,7 @@
$db = $this->db;
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_{menu}.php",GLOB_BRACE);
$config_list = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_menu.php");
$x = 0;
foreach ($config_list as &$config_path) {
$y = 0;

View File

@@ -48,16 +48,11 @@
spl_autoload_register(array($this, 'loader'));
}
private function loader($class_name) {
//use glob to check "/resources/classes", "/{core,app}/*/resources/classes";
if (defined("GLOB_BRACE")) {
$results = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "{/*/*,}/resources/classes/".$class_name.".php", GLOB_BRACE);
}
else {
$array_1 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/resources/classes/".$class_name.".php");
$array_2 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/classes/".$class_name.".php");
$results = array_merge((array)$array_1,(array)$array_2);
unset($array_1, $array_2);
}
//use glob to get classes (note: GLOB_BRACE doesn't work on some systems)
$results1 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/resources/classes/".$class_name.".php");
$results2 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/classes/".$class_name.".php");
$results = array_merge((array)$results1,(array)$results2);
unset($results1, $results2);
//include the class
foreach ($results as &$class_file) {