Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 197598a

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents dd09a05 + a0b2c65 commit 197598a

File tree

2 files changed

+234
-99
lines changed

2 files changed

+234
-99
lines changed

core/src/core/classes/class.AJXP_Utils.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ public static function natkrsort(&$array)
9090
*/
9191
public static function securePath($path)
9292
{
93-
if ($path == null) $path = "";
93+
if ($path == null) return "";
9494
//
9595
// REMOVE ALL "../" TENTATIVES
9696
//
9797
$path = str_replace(chr(0), "", $path);
98-
$dirs = explode('/', $path);
98+
$dirs = self::safeExplode($path);
9999
for ($i = 0; $i < count($dirs); $i++) {
100100
if ($dirs[$i] == '.' or $dirs[$i] == '..') {
101101
$dirs[$i] = '';
@@ -113,13 +113,15 @@ public static function securePath($path)
113113
return $path;
114114
}
115115

116-
public static function safeDirname($path)
117-
{
116+
public static function safeExplode($path) {
117+
return (DIRECTORY_SEPARATOR === "\\" ? preg_split('/(\\\|\\/)/', $path) : explode('/', $path));
118+
}
119+
120+
public static function safeDirname($path) {
118121
return (DIRECTORY_SEPARATOR === "\\" ? str_replace("\\", "/", dirname($path)): dirname($path));
119122
}
120123

121-
public static function safeBasename($path)
122-
{
124+
public static function safeBasename($path) {
123125
return (DIRECTORY_SEPARATOR === "\\" ? str_replace("\\", "/", basename($path)): basename($path));
124126
}
125127

0 commit comments

Comments
 (0)