diff --git a/core/src/core/classes/class.AJXP_Utils.php b/core/src/core/classes/class.AJXP_Utils.php index 419d0cfc75..e4656c21e2 100644 --- a/core/src/core/classes/class.AJXP_Utils.php +++ b/core/src/core/classes/class.AJXP_Utils.php @@ -181,6 +181,15 @@ public static function setApplicationFirstRunPassed(){ @file_put_contents(AJXP_CACHE_DIR."/first_run_passed", "true"); } + public static function forwardSlashDirname($path){ + return (DIRECTORY_SEPARATOR === "\\" ? str_replace("\\", "/", dirname($path)): dirname($path)); + } + + public static function forwardSlashBasename($path){ + return (DIRECTORY_SEPARATOR === "\\" ? str_replace("\\", "/", basename($path)): basename($path)); + } + + /** * Parse a Comma-Separated-Line value * @static diff --git a/core/src/plugins/access.ajxp_conf/class.ajxp_confAccessDriver.php b/core/src/plugins/access.ajxp_conf/class.ajxp_confAccessDriver.php index 5c4310b2de..ba437b28bc 100644 --- a/core/src/plugins/access.ajxp_conf/class.ajxp_confAccessDriver.php +++ b/core/src/plugins/access.ajxp_conf/class.ajxp_confAccessDriver.php @@ -375,7 +375,7 @@ function switchAction($action, $httpVars, $fileVars){ case "create_group": if(isSet($httpVars["group_path"])){ - $basePath = dirname($httpVars["group_path"]); + $basePath = AJXP_Utils::forwardSlashDirname($httpVars["group_path"]); if(empty($basePath)) $basePath = "/"; $gName = AJXP_Utils::sanitize(AJXP_Utils::decodeSecureMagic(basename($httpVars["group_path"])), AJXP_SANITIZE_ALPHANUM); }else{ @@ -414,7 +414,7 @@ function switchAction($action, $httpVars, $fileVars){ $roleGroup = false; if(strpos($roleId, "AJXP_GRP_") === 0){ $groupPath = AuthService::filterBaseGroup(substr($roleId, strlen("AJXP_GRP_/"))); - $groups = AuthService::listChildrenGroups(dirname($groupPath)); + $groups = AuthService::listChildrenGroups(AJXP_Utils::forwardSlashDirname($groupPath)); $key = "/".basename($groupPath); if(!array_key_exists($key, $groups)){ throw new Exception("Cannot find group with this id!"); @@ -485,7 +485,7 @@ function switchAction($action, $httpVars, $fileVars){ if(strpos($roleId, "AJXP_GRP_") === 0){ $groupPath = AuthService::filterBaseGroup(substr($roleId, strlen("AJXP_GRP_"))); $roleId = "AJXP_GRP_".$groupPath; - $groups = AuthService::listChildrenGroups(dirname($groupPath)); + $groups = AuthService::listChildrenGroups(AJXP_Utils::forwardSlashDirname($groupPath)); $key = "/".basename($groupPath); if(!array_key_exists($key, $groups)){ throw new Exception("Cannot find group with this id!"); @@ -1321,7 +1321,7 @@ function switchAction($action, $httpVars, $fileVars){ AJXP_XMLWriter::close(); }else if(isSet($httpVars["group"])){ $groupPath = $httpVars["group"]; - $basePath = substr(dirname($groupPath), strlen("/data/users")); + $basePath = substr(AJXP_Utils::forwardSlashDirname($groupPath), strlen("/data/users")); $gName = basename($groupPath); AuthService::deleteGroup($basePath, $gName); AJXP_XMLWriter::header();