Improved working with OS for serverType

This commit is contained in:
mattpass
2020-06-27 16:27:25 +01:00
parent c201ed4471
commit df5d148ac5
6 changed files with 14 additions and 19 deletions

View File

@@ -222,7 +222,7 @@ class File
parent.parent.ICEcoder.content.contentWindow[\'cM\' + parent.parent.ICEcoder.cMInstances[parent.parent.ICEcoder.selectedTab - 1]].removeLineClass(parent.parent.ICEcoder[\'cMActiveLinecM\' + parent.parent.ICEcoder.cMInstances[parent.parent.ICEcoder.selectedTab - 1]], "background");
parent.parent.ICEcoder[\'cMActiveLinecM\'+parent.parent.ICEcoder.selectedTab] = parent.parent.ICEcoder.content.contentWindow[\'cM\' + parent.parent.ICEcoder.cMInstances[parent.parent.ICEcoder.selectedTab - 1]].addLineClass(0, "background", "cm-s-activeLine");
parent.parent.ICEcoder.nextcMInstance++;
parent.parent.ICEcoder.openFileMDTs.push(\'' . ("Linux" === $serverType ? filemtime($file) : "1000000") . '\');
parent.parent.ICEcoder.openFileMDTs.push(\'' . ("Windows" !== $serverType ? filemtime($file) : "1000000") . '\');
parent.parent.ICEcoder.openFileVersions.push(' . getVersionsCount($fileLoc, $fileName)['count'] .');
parent.parent.ICEcoder.updateVersionsDisplay();
@@ -391,7 +391,7 @@ class File
chmod($file, octdec($ICEcoder['newFilePerms']));
}
clearstatcache();
$filemtime = "Linux" === $serverType ? filemtime($file) : "1000000";
$filemtime = "Windows" !== $serverType ? filemtime($file) : "1000000";
$doNext .= 'ICEcoder.openFileMDTs[' . ($tabNum ?? 'ICEcoder.selectedTab') .' - 1] = "' . $filemtime . '";';
$doNext .= '(function() {var x = ICEcoder.openFileVersions; var y = ' . ($tabNum ?? 'ICEcoder.selectedTab') .' - 1; x[y] = "undefined" != typeof x[y] ? x[y] + 1 : 1})(); ICEcoder.updateVersionsDisplay();';
}

View File

@@ -14,20 +14,15 @@ class System
}
}
const OS_UNKNOWN = 'Linux';
const OS_WIN = 'Windows';
const OS_LINUX = 'Linux';
const OS_OSX = 'Mac';
/**
* @return int
* @return string
*/
public function getOS() {
switch (true) {
case stristr(PHP_OS, 'DAR'): return self::OS_OSX;
case stristr(PHP_OS, 'WIN'): return self::OS_WIN;
case stristr(PHP_OS, 'LINUX'): return self::OS_LINUX;
default : return self::OS_UNKNOWN;
case stristr(PHP_OS, 'DAR'): return 'Mac';
case stristr(PHP_OS, 'WIN'): return 'Windows';
case stristr(PHP_OS, 'LINUX'): return 'Linux';
default : return 'Linux';
}
}

View File

@@ -28,7 +28,7 @@ $t = $text['files'];
<ul class="fileManager">
<li class="pft-directory dirOpen"><a nohref title="/" ondragover="parent.ICEcoder.overFileFolder('folder', '|'); parent.ICEcoder.highlightFileFolder('|', true);" ondragleave="parent.ICEcoder.overFileFolder('folder', ''); parent.ICEcoder.highlightFileFolder('|', false);" onmouseover="parent.ICEcoder.overFileFolder('folder', '|')" onmouseout="parent.ICEcoder.overFileFolder('folder', '')" onclick="parent.ICEcoder.openCloseDir(this)" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="|">/ <?php
echo $iceRoot == "" ? $t['ROOT'] : trim($iceRoot, "/");
$thisPermVal = "Linux" === $serverType ? substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3) : "";
$thisPermVal = "Windows" !== $serverType ? substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3) : "";
$permColors = 777 == $thisPermVal ? 'background: #800; color: #eee' : 'color: #888';
?></span> <span style="<?php echo $permColors;?>; font-size: 8px" id="|_perms"><?php echo $thisPermVal;;?></span></a></li><?php
// tree file items generated by the iFrame 'fileControl' below which loads in the items at location=| (ie, the root)

View File

@@ -136,7 +136,7 @@ if (!$error && "save" === $_GET['action']) {
if (!$demoMode && (isset($ftpSite) || (file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && "" != $_POST['newFileName'])) {
$filemtime = !isset($ftpSite) && "Linux" === $serverType ? filemtime($file) : "1000000";
$filemtime = !isset($ftpSite) && "Windows" !== $serverType ? filemtime($file) : "1000000";
// =======================
// MDT'S MATCH, WRITE FILE
@@ -479,7 +479,7 @@ if (!isset($ftpSite) && !$error && "checkExists" === $_GET['action']) {
// No $filemtime yet? Get it now!
if (false === isset($filemtime) && !is_dir($file)) {
$filemtime = "Linux" === $serverType ? filemtime($file) : 1000000;
$filemtime = "Windows" !== $serverType ? filemtime($file) : 1000000;
}
if (false === isset($filemtime)) {
$filemtime = 1000000;

View File

@@ -32,9 +32,9 @@ function phpGrep($path, $base) {
global $indexableFileExts, $prevIndexData, $indexData;
$fp = opendir($path);
global $ICEcoder, $serverType, $docRoot, $ICEcoderDir;
global $ICEcoder, $docRoot, $ICEcoderDir;
if (!isset($ret)) {$ret = "";};
$slash = $serverType == -1 < strpos($path, "\\") ? "\\" : "/";
$slash = -1 < strpos($path, "\\") ? "\\" : "/";
while($f = readdir($fp)) {
// Ignore . and .. paths
if ("." === $f || ".." === $f) continue;

View File

@@ -140,9 +140,9 @@ if (true === isset($_GET['target']) && false !== strpos($_GET['target'], "filena
$r = 0;
function phpGrep($q, $path, $base) {
$fp = opendir($path);
global $t, $r, $ICEcoder, $serverType, $selectedFiles, $docRoot, $ICEcoderDir;
global $t, $r, $ICEcoder, $selectedFiles, $docRoot, $ICEcoderDir;
if (false === isset($ret)) {$ret="";};
$slash = $serverType == -1 < strpos($path, "\\") ? "\\" : "/";
$slash = -1 < strpos($path, "\\") ? "\\" : "/";
while ($f = readdir($fp)) {
if (preg_match("#^\.+$#", $f)) continue;
$fullPath = $path . $slash . $f;