mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
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.
This commit is contained in:
@@ -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 .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">";
|
||||
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found ".substr_count(strtolower(file_get_contents($fullPath)),$q)." times</div>";
|
||||
if (isset($_GET['replace'])) {
|
||||
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>".PHP_EOL;
|
||||
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>";
|
||||
};
|
||||
$ret .= '<hr>';
|
||||
echo 'foundArray.push("'.$fullPath.'");'.PHP_EOL;
|
||||
|
||||
Reference in New Issue
Block a user