ajaxplorer/ajaxplorer-core — pull request #18 by chusopr (2013-03-14 12:59:16+00:00)
Title: WebDAV doesn't work with access.ftp

When trying to use WebDAV with an access.ftp repository I'm getting a 404 response.

This is because, it tries to stat() the directory in core/classes/class.AJXP_WebdavBackend.php to check if it exists:

```php
protected function nodeExists( $path ){
$path = $this->fixPath($path);
if(isset($this->statCache[$path]["node_exists"])){
return $this->statCache[$path]["node_exists"];
}
$url = $this->getAccessDriver()->getRessourceUrl($path);
$result = file_exists( $url );
AJXP_Logger::debug("nodeExists($path, $url): $result");
$this->statCache[$path]["node_exists"] = $result;
return $result;
}
```

When using an access.ftp repository, what it does is to send a LIST <node> request and check if <node> is among the returned results. But, when <node> is a directory, it will return its contents and not the directory itself.
I've found that this can be fixed by replacing LIST request by LIST -a:

```udiff
diff --git a/plugins/access.ftp/class.ftpAccessWrapper.php b/plugins/access.ftp/class.ftpAccessWrapper.php
index eed6f94..a1b2cd1 100644
--- a/plugins/access.ftp/class.ftpAccessWrapper.php
+++ b/plugins/access.ftp/class.ftpAccessWrapper.php
@@ -282,7 +282,7 @@ class ftpAccessWrapper {
else
{
ftp_chdir($link, $serverPath);
-	$contents = ftp_rawlist($link, ".");
+	$contents = ftp_rawlist($link, "-a .");
//AJXP_Logger::debug("RAW LIST RESULT ".print_r($contents, true));
}

```