mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
preg_replace to remove full path prefix
Use preg_replace to only replace the first instance on a full path to make it local Avoids str_replace replacing all instances in the string
This commit is contained in:
@@ -129,7 +129,8 @@ if (startTab!=top.ICEcoder.selectedTab) {
|
||||
if (strpos($f,$ICEcoder['bannedFiles'][$i])!==false) {$bFile = true;};
|
||||
}
|
||||
// Exclude the folder ICEcoder is running from
|
||||
$localPath = str_replace(str_replace("\\","/",$docRoot),"",$fullPath);
|
||||
$rootPrefix = '/'.str_replace("/","\/",preg_quote(str_replace("\\","/",$docRoot))).'/';
|
||||
$localPath = preg_replace($rootPrefix, '', $fullPath, 1);
|
||||
if (strpos($localPath, $ICEcoderDir)===0) {
|
||||
$bFile = true;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,9 @@ if ($_SESSION['loggedIn']) {
|
||||
}
|
||||
|
||||
// Establish the dir ICEcoders running from
|
||||
$ICEcoderDir = rtrim(str_replace(str_replace("\\","/",$docRoot),"",str_replace("\\","/",dirname(__FILE__))),"/lib");
|
||||
$ICEcoderDirFullPath = rtrim(str_replace("\\","/",dirname(__FILE__)),"/lib");
|
||||
$rootPrefix = '/'.str_replace("/","\/",preg_quote(str_replace("\\","/",$docRoot))).'/';
|
||||
$ICEcoderDir = preg_replace($rootPrefix, '', $ICEcoderDirFullPath, 1);
|
||||
|
||||
// Setup our file security vars
|
||||
$settingsArray = array("findFilesExclude","bannedFiles","allowedIPs");
|
||||
|
||||
Reference in New Issue
Block a user