Added check tor stat results

When `$file` is a folder, the commands `filesize` and `filemtime` would result in the following warnings :

PHP Warning:  filemtime(): stat failed for /var/www/html/css in /var/www/html/ice/lib/file-control-xhr.php on line 921
PHP Warning:  filesize(): stat failed for /var/www/html/css in /var/www/html/ice/lib/file-control-xhr.php on line 940

This patch corrects this.
This commit is contained in:
MicroVB INC
2016-03-18 08:28:40 -04:00
parent 76010bb5cf
commit 4307dc1ae6

View File

@@ -917,7 +917,7 @@ if (!isset($ftpSite) && !$error && $_GET['action']=="checkExists") {
// ===================
// No $filemtime yet? Get it now!
if (!isset($filemtime)) {
if (!isset($filemtime) && !is_dir($file)) {
$filemtime = $serverType=="Linux" ? filemtime($file) : "1000000";
}
// Set $timeStart, use 0 if not available
@@ -937,7 +937,7 @@ if (isset($ftpSite)) {
} else {
$itemAbsPath = $file;
$itemPath = dirname($file);
$itemBytes = filesize($file);
$itemBytes = is_dir($file) ? null : filesize($file);
$itemType = (file_exists($file) ? (is_dir($file) ? "dir" : "file") : "unknown");
$itemExists = (file_exists($file) ? "true" : "false");
}