From aaa7be7bffd2d99fe3981c73d7ca064d00ce0b60 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Mon, 4 Mar 2013 16:58:35 +0000 Subject: [PATCH] Identify path slashes differently & drop PHP_EOL Windows may use backslahes as it's dir seperator, but under some PHP installs it uses the Linux forward slash instead. We could use the directory seperator PHP var, but I've heard mixed opinions on this and would rather just detect by looking at what $path, which contains $docRoot, which is from the $_SERVER variable as this would be more reliable. It also wasn't showing the replace button due to a PHP_EOL which ended the JS string with quote termination. --- lib/multiple-results.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/multiple-results.php b/lib/multiple-results.php index 2d9514a..449929b 100644 --- a/lib/multiple-results.php +++ b/lib/multiple-results.php @@ -115,7 +115,7 @@ if (startTab!=top.ICEcoder.selectedTab) { $fp = opendir($path); global $r, $ICEcoder, $serverType, $selectedFiles; if (!isset($ret)) {$ret="";}; - $slash = $serverType == "Windows" ? "\\" : "/"; + $slash = $serverType == strpos($path,"\\")>-1 ? "\\" : "/"; while($f = readdir($fp)) { if(preg_match("#^\.+$#", $f)) continue; $fullPath = $path.$slash.$f; @@ -138,7 +138,7 @@ if (startTab!=top.ICEcoder.selectedTab) { $ret .= ""; $ret .= str_replace($base,"",$fullPath)."
Found ".substr_count(strtolower(file_get_contents($fullPath)),$q)." times
"; if (isset($_GET['replace'])) { - $ret .= "
replace
".PHP_EOL; + $ret .= "
replace
"; }; $ret .= '
'; echo 'foundArray.push("'.$fullPath.'");'.PHP_EOL;