Home » Networking » Net_UserAgent_Detect » Bug #1311
[Patch] Detect webDAV client
Details
| Request #1311 | [Patch] Detect webDAV client |
|---|---|
| Submitted | 2004-04-29 08:59 UTC |
| From | dostick at ctco dot lv |
| Status | Closed |
| Package | Net_UserAgent_Detect |
| PHP Version | 4.3.6 |
| OS | unix |
| Roadmaps | (Not assigned) |
Comments
[2004-04-29 08:59 UTC] dostick at ctco dot lv
Description:
------------
This function adds detection of WebDAV clients.
Used to distinguish if webdav request need ot be serverd or it's a regulat http request.
Very useful for systems where same script (e.g. index.php) serves both as regular web application and as WebDAV server.
Usage Example:
if (Net_UserAgent_Detect::isWebDAVClient()) {
require_once "HTTP/WebDAV/Server/Filesystem.php";
//WebDAV stuff...
exit;
}
echo "hello browser!";
//... HTTP response code
Patch:
--- Detect.php Tue Mar 16 17:37:32 2004
+++ /Detect.php Thu Apr 29 11:04:25 2004
@@ -656,6 +656,30 @@
}
// }}}
+ // {{{ isWebDAVClient()
+
+ /**
+ * This function will detect if browser is WebDAV client
+ *
+ * Useful for systems where same script (e.g. index.php) serves both as
+ * regular web application and as WebDAV server
+ *
+ * @access public
+ * @return bool
+ */
+ function isWebDAVClient()
+ {
+ $str= &Net_UserAgent_Detect::_getStaticProperty('userAgent');
+ if ($str=="Microsoft Data Access Internet Publishing Provider DAV") {
+ return true;
+ }
+ if ($str=="Microsoft Data Access Internet Publishing Provider Protocol Discovery") {
+ return true;
+ }
+ return false;
+ }
+
+ // }}}
// {{{ setQuirk()
/**
[2004-05-08 09:23 UTC] dostick at ctco dot lv
Why remove method isWebDAVClient()?
It's very logical. there is method isBrowser().
DAV client is not browser but it returns specific userAgent.
just wrap code
$isWebdav = Net_UserAgent_Detect::getBrowser(array('webdav'));
return $isWebdav;
into isWebDAVCLient() method