37 require_once
"DAV/_parse_propfind.php";
38 require_once
"DAV/_parse_proppatch.php";
39 require_once
"DAV/_parse_lockinfo.php";
117 ini_set(
"display_errors", 0);
136 if (strstr($this->_SERVER[
"REQUEST_URI"],
'#')) {
141 $uri = (@$this->_SERVER[
"HTTPS"] ===
"on" ?
"https:" :
"http:");
142 $uri.= sprintf(
"//%s%s", $this->_SERVER[
"HTTP_HOST"], $this->_SERVER[
"SCRIPT_NAME"]);
144 $path_info = empty($this->_SERVER[
"PATH_INFO"]) ?
"/" : $this->_SERVER[
"PATH_INFO"];
146 $this->base_uri =
$uri;
147 $this->uri =
$uri . $path_info;
150 if (!strlen($this->path)) {
151 if ($this->_SERVER[
"REQUEST_METHOD"] ==
"GET") {
155 header(
"Location: " . $this->base_uri .
"/");
163 if (ini_get(
"magic_quotes_gpc")) {
164 $this->path = stripslashes($this->path);
167 if (empty($this->dav_powered_by)) {
168 header(
"X-Dav-Powered-By: PHP class: " . get_class($this));
170 header(
"X-Dav-Powered-By: " . $this->dav_powered_by);
175 if ((!(($this->_SERVER[
'REQUEST_METHOD'] ==
'OPTIONS') && ($this->path ==
"/"))) && (!$this->
_check_auth())) {
180 header(
'WWW-Authenticate: Basic realm="' . ($this->
http_auth_realm) .
'"');
192 $method = strtolower($this->_SERVER[
"REQUEST_METHOD"]);
195 if (
$method ==
"head" && !method_exists($this,
"head")) {
199 if (method_exists($this, $wrapper) && (
$method ==
"options" || method_exists($this,
$method))) {
203 $this->logContents();
210 if ($this->_SERVER[
"REQUEST_METHOD"] ==
"LOCK") {
214 header(
"Allow: " . join(
", ", $this->
_allow()));
220 private function logContents()
222 $a = ob_get_contents();
223 if (substr(
$a, 0, 5) ==
'<?xml') {
224 $c = explode(
"\n",
$a);
244 header(
"MS-Author-Via: DAV");
251 if (isset($allow[
'LOCK'])) {
257 header(
"DAV: " . join(
", ", $dav));
258 header(
"Allow: " . join(
", ", $allow));
260 header(
"Content-length: 0");
278 if (isset($this->_SERVER[
'HTTP_DEPTH'])) {
279 $options[
"depth"] = $this->_SERVER[
"HTTP_DEPTH"];
281 $options[
"depth"] =
"infinity";
285 if (!$propinfo->success) {
289 $options[
'props'] = $propinfo->props;
291 if (!$this->PROPFIND($options, $files)) {
295 if (method_exists($this,
"checkLock")) {
297 $lock = $this->checkLock($this->path);
299 if (is_array($lock) && count($lock)) {
300 $created = isset($lock[
'created']) ? $lock[
'created'] : time();
301 $modified = isset($lock[
'modified']) ? $lock[
'modified'] : time();
302 $files[
'files'][] = array(
303 "path" => $this->
_slashify($this->path) ,
305 $this->
mkprop(
"displayname", $this->path) ,
306 $this->
mkprop(
"creationdate", $created) ,
307 $this->
mkprop(
"getlastmodified", $modified) ,
308 $this->
mkprop(
"resourcetype",
"") ,
309 $this->
mkprop(
"getcontenttype",
"") ,
310 $this->
mkprop(
"getcontentlength", 0)
316 if (empty($files[
'files'])) {
324 $ns_defs =
"xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\"";
326 foreach ($files[
"files"] as $filekey =>
$file) {
328 if (!isset(
$file[
"props"]) || !is_array(
$file[
"props"])) {
332 foreach (
$file[
"props"] as $key => $prop) {
336 switch ($options[
'props']) {
344 unset($files[
"files"][$filekey][
"props"][$key][
"val"]);
350 foreach ((array)$options[
"props"] as $reqprop) {
351 if ($reqprop[
"name"] == $prop[
"name"] && @$reqprop[
"xmlns"] == $prop[
"ns"]) {
358 $files[
"files"][$filekey][
"props"][$key] =
"";
364 if (empty($prop[
"ns"]))
continue;
366 if ($ns ==
"DAV:")
continue;
367 if (isset($ns_hash[$ns]))
continue;
369 $ns_name =
"ns" . (count($ns_hash) + 1);
370 $ns_hash[$ns] = $ns_name;
371 $ns_defs.=
" xmlns:$ns_name=\"$ns\"";
375 if (is_array($options[
'props'])) {
376 foreach ($options[
"props"] as $reqprop) {
377 if ($reqprop[
'name'] ==
"")
continue;
380 foreach (
$file[
"props"] as $prop) {
381 if ($reqprop[
"name"] == $prop[
"name"] && @$reqprop[
"xmlns"] == $prop[
"ns"]) {
388 if ($reqprop[
"xmlns"] ===
"DAV:" && $reqprop[
"name"] ===
"lockdiscovery") {
390 $files[
"files"][$filekey][
"props"][] = $this->
mkprop(
"DAV:",
"lockdiscovery", $this->
lockdiscovery($files[
"files"][$filekey][
'path']));
393 $files[
"files"][$filekey][
"noprops"][] = $this->
mkprop($reqprop[
"xmlns"], $reqprop[
"name"],
"");
395 if ($reqprop[
"xmlns"] !=
"DAV:" && !isset($ns_hash[$reqprop[
"xmlns"]])) {
396 $ns_name =
"ns" . (count($ns_hash) + 1);
397 $ns_hash[$reqprop[
"xmlns"]] = $ns_name;
398 $ns_defs.=
" xmlns:$ns_name=\"$reqprop[xmlns]\"";
407 header(
'Content-Type: text/xml; charset="utf-8"');
409 echo
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
410 echo
"<D:multistatus xmlns:D=\"DAV:\">\n";
412 foreach ($files[
"files"] as
$file) {
414 if (!is_array($file) || empty($file) || !isset($file[
"path"]))
continue;
415 $path = $file[
'path'];
416 if (!is_string(
$path) ||
$path ===
"")
continue;
418 echo
" <D:response $ns_defs>\n";
424 echo
" <D:href>" . $this->
_urlencode($href) .
"</D:href>\n";
426 if (isset($file[
"props"]) && is_array($file[
"props"])) {
427 echo
" <D:propstat>\n";
430 foreach ($file[
"props"] as $key => $prop) {
432 if (!is_array($prop))
continue;
433 if (!isset($prop[
"name"]))
continue;
435 if (!isset($prop[
"val"]) || $prop[
"val"] ===
"" || $prop[
"val"] ===
false) {
437 if ($prop[
"ns"] ==
"DAV:") {
438 echo
" <D:$prop[name]/>\n";
439 }
else if (!empty($prop[
"ns"])) {
440 echo
" <" . $ns_hash[$prop[
"ns"]] .
":$prop[name]/>\n";
442 echo
" <$prop[name] xmlns=\"\"/>";
444 }
else if ($prop[
"ns"] ==
"DAV:") {
446 switch ($prop[
"name"]) {
448 echo
" <D:creationdate ns0:dt=\"dateTime.tz\">" . gmdate(
"Y-m-d\\TH:i:s\\Z", $prop[
'val']) .
"</D:creationdate>\n";
451 case "getlastmodified":
452 echo
" <D:getlastmodified ns0:dt=\"dateTime.rfc1123\">" . gmdate(
"D, d M Y H:i:s ", $prop[
'val']) .
"GMT</D:getlastmodified>\n";
456 echo
" <D:resourcetype><D:$prop[val]/></D:resourcetype>\n";
459 case "supportedlock":
460 echo
" <D:supportedlock>$prop[val]</D:supportedlock>\n";
463 case "lockdiscovery":
464 echo
" <D:lockdiscovery>\n";
466 echo
" </D:lockdiscovery>\n";
470 echo
" <D:$prop[name]>" . $this->
_prop_encode(htmlspecialchars($prop[
'val'])) .
"</D:$prop[name]>\n";
476 echo
" <" . $ns_hash[$prop[
"ns"]] .
":$prop[name]>" . $this->
_prop_encode(htmlspecialchars($prop[
'val'])) .
"</" . $ns_hash[$prop[
"ns"]] .
":$prop[name]>\n";
478 echo
" <$prop[name] xmlns=\"\">" . $this->
_prop_encode(htmlspecialchars($prop[
'val'])) .
"</$prop[name]>\n";
484 echo
" <D:status>HTTP/1.1 200 OK</D:status>\n";
485 echo
" </D:propstat>\n";
488 if (isset($file[
"noprops"])) {
489 echo
" <D:propstat>\n";
492 foreach ($file[
"noprops"] as $key => $prop) {
493 if ($prop[
"ns"] ==
"DAV:") {
494 echo
" <D:$prop[name]/>\n";
495 }
else if ($prop[
"ns"] ==
"") {
496 echo
" <$prop[name] xmlns=\"\"/>\n";
498 echo
" <" . $ns_hash[$prop[
"ns"]] .
":$prop[name]/>\n";
503 echo
" <D:status>HTTP/1.1 404 Not Found</D:status>\n";
504 echo
" </D:propstat>\n";
507 echo
" </D:response>\n";
510 echo
"</D:multistatus>\n";
530 if (!$propinfo->success) {
535 $options[
'props'] = $propinfo->props;
537 $responsedescr = $this->PROPPATCH($options);
540 header(
'Content-Type: text/xml; charset="utf-8"');
542 echo
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
544 echo
"<D:multistatus xmlns:D=\"DAV:\">\n";
545 echo
" <D:response>\n";
546 echo
" <D:href>" . $this->
_urlencode($this->
_mergePathes($this->_SERVER[
"SCRIPT_NAME"], $this->path)) .
"</D:href>\n";
548 foreach ($options[
"props"] as $prop) {
549 echo
" <D:propstat>\n";
550 echo
" <D:prop><$prop[name] xmlns=\"$prop[ns]\"/></D:prop>\n";
551 echo
" <D:status>HTTP/1.1 $prop[status]</D:status>\n";
552 echo
" </D:propstat>\n";
555 if ($responsedescr) {
556 echo
" <D:responsedescription>" . $this->
_prop_encode(htmlspecialchars($responsedescr)) .
"</D:responsedescription>\n";
559 echo
" </D:response>\n";
560 echo
"</D:multistatus>\n";
580 $stat = $this->MKCOL($options);
601 if (
true === (
$status = $this->GET($options))) {
602 if (!headers_sent()) {
605 if (!isset($options[
'mimetype'])) {
606 $options[
'mimetype'] =
"application/octet-stream";
608 header(
"Content-type: $options[mimetype]");
610 if (isset($options[
'mtime'])) {
611 header(
"Last-modified:" . gmdate(
"D, d M Y H:i:s ", $options[
'mtime']) .
"GMT");
614 if (isset($options[
'stream'])) {
616 if (!empty($options[
'ranges']) && (0 === fseek($options[
'stream'], 0, SEEK_SET))) {
618 if (count($options[
'ranges']) === 1) {
619 $range = $options[
'ranges'][0];
621 if (isset($range[
'start'])) {
622 fseek($options[
'stream'], $range[
'start'], SEEK_SET);
623 if (feof($options[
'stream'])) {
624 $this->
http_status(
"416 Requested range not satisfiable");
628 if (isset($range[
'end'])) {
629 $size = $range[
'end'] - $range[
'start'] + 1;
631 header(
"Content-length: $size");
632 header(
"Content-range: $range[start]-$range[end]/" . (isset($options[
'size']) ? $options[
'size'] :
"*"));
633 while (
$size && !feof($options[
'stream'])) {
634 $buffer = fread($options[
'stream'], 4096);
635 $size-= strlen($buffer);
640 if (isset($options[
'size'])) {
641 header(
"Content-length: " . ($options[
'size'] - $range[
'start']));
642 header(
"Content-range: " . $range[
'start'] .
"-" . $range[
'end'] .
"/" . (isset($options[
'size']) ? $options[
'size'] :
"*"));
644 fpassthru($options[
'stream']);
647 header(
"Content-length: " . $range[
'last']);
648 fseek($options[
'stream'], -$range[
'last'], SEEK_END);
649 fpassthru($options[
'stream']);
653 foreach ($options[
'ranges'] as $range) {
655 if (isset($range[
'start'])) {
656 $from = $range[
'start'];
657 $to = !empty($range[
'end']) ? $range[
'end'] : $options[
'size'] - 1;
659 $from = $options[
'size'] - $range[
'last'] - 1;
660 $to = $options[
'size'] - 1;
662 $total = isset($options[
'size']) ? $options[
'size'] :
"*";
666 fseek($options[
'stream'], $from, SEEK_SET);
667 while (
$size && !feof($options[
'stream'])) {
668 $buffer = fread($options[
'stream'], 4096);
669 $size-= strlen($buffer);
678 if (isset($options[
'size'])) {
679 header(
"Content-length: " . $options[
'size']);
681 fpassthru($options[
'stream']);
685 } elseif (isset($options[
'data'])) {
686 if (is_array($options[
'data'])) {
690 header(
"Content-length: " . strlen($options[
'data']));
691 echo $options[
'data'];
697 if (!headers_sent()) {
715 if (isset($this->_SERVER[
'HTTP_RANGE'])) {
717 if (preg_match(
'/bytes\s*=\s*(.+)/', $this->_SERVER[
'HTTP_RANGE'], $matches)) {
718 $options[
"ranges"] = array();
720 foreach (explode(
",", $matches[1]) as $range) {
722 list(
$start, $end) = explode(
"-", $range);
723 $options[
"ranges"][] = (
$start ===
"") ? array(
749 if (!isset($this->multipart_separator)) {
753 $this->multipart_separator =
"SEPARATOR_" . md5(microtime());
755 header(
"Content-type: multipart/byteranges; boundary=" . $this->multipart_separator);
759 echo
"\n--{$this->multipart_separator}--";
763 echo
"\n--{$this->multipart_separator}\n";
764 echo
"Content-type: $mimetype\n";
765 echo
"Content-range: $from-$to/" . ($total ===
false ?
"*" : $total);
784 if (method_exists($this,
"HEAD")) {
785 $status = $this->head($options);
786 }
else if (method_exists($this,
"GET")) {
788 $status = $this->GET($options);
789 if (!isset($options[
'size'])) {
790 $options[
'size'] = ob_get_length();
795 if (!isset($options[
'mimetype'])) {
796 $options[
'mimetype'] =
"application/octet-stream";
798 header(
"Content-type: $options[mimetype]");
800 if (isset($options[
'mtime'])) {
801 header(
"Last-modified:" . gmdate(
"D, d M Y H:i:s ", $options[
'mtime']) .
"GMT");
804 if (isset($options[
'size'])) {
805 header(
"Content-length: " . $options[
'size']);
827 $options[
"content_length"] = $this->_SERVER[
"CONTENT_LENGTH"];
829 if (isset($this->_SERVER[
"CONTENT_TYPE"])) {
831 if (!strncmp($this->_SERVER[
"CONTENT_TYPE"],
"multipart/", 10)) {
833 echo
"The service does not support mulipart PUT requests";
836 $options[
"content_type"] = $this->_SERVER[
"CONTENT_TYPE"];
839 $options[
"content_type"] =
"application/octet-stream";
846 foreach ($this->_SERVER as $key => $val) {
847 if (strncmp($key,
"HTTP_CONTENT", 11))
continue;
849 case 'HTTP_CONTENT_ENCODING':
852 echo
"The service does not support '$val' content encoding";
854 case 'HTTP_CONTENT_LANGUAGE':
857 $options[
"content_language"] = $val;
860 case 'HTTP_CONTENT_LOCATION':
866 case 'HTTP_CONTENT_RANGE':
870 if (!preg_match(
'@bytes\s+(\d+)-(\d+)/((\d+)|\*)@', $val, $matches)) {
872 echo
"The service does only support single byte ranges";
877 "start" => $matches[1],
880 if (is_numeric($matches[3])) {
881 $range[
"total_length"] = $matches[3];
883 $option[
"ranges"][] = $range;
889 case 'HTTP_CONTENT_MD5':
892 echo
"The service does not support content MD5 checksum verification";
897 echo
"The service does not support '$key'";
902 $options[
"stream"] = fopen(
"php://input",
"r");
904 $stat = $this->PUT($options);
906 if ($stat ===
false) {
907 $stat =
"403 Forbidden";
908 }
else if (is_resource($stat) && get_resource_type($stat) ==
"stream") {
911 $stat = $options[
"new"] ?
"201 Created" :
"204 No Content";
913 if (!empty($options[
"ranges"])) {
915 if (0 == fseek($stream, $range[0][
"start"], SEEK_SET)) {
916 $length = $range[0][
"end"] - $range[0][
"start"] + 1;
917 if (!fwrite($stream, fread($options[
"stream"], $length))) {
918 $stat =
"403 Forbidden";
921 $stat =
"403 Forbidden";
924 while (!feof($options[
"stream"])) {
925 if (
false === fwrite($stream, fread($options[
"stream"], 4096))) {
926 $stat =
"403 Forbidden";
952 if (isset($this->_SERVER[
"HTTP_DEPTH"])) {
953 if ($this->_SERVER[
"HTTP_DEPTH"] !=
"infinity") {
964 $stat = $this->DELETE($options);
1019 if (isset($this->_SERVER[
'HTTP_DEPTH'])) {
1020 $options[
"depth"] = $this->_SERVER[
"HTTP_DEPTH"];
1022 $options[
"depth"] =
"infinity";
1025 if (isset($this->_SERVER[
"HTTP_TIMEOUT"])) {
1026 $options[
"timeout"] = explode(
",", $this->_SERVER[
"HTTP_TIMEOUT"]);
1029 if (empty($this->_SERVER[
'CONTENT_LENGTH']) && !empty($this->_SERVER[
'HTTP_IF'])) {
1036 $options[
"locktoken"] = substr($this->_SERVER[
'HTTP_IF'], 2, -2);
1037 $options[
"update"] = $options[
"locktoken"];
1039 $options[
'owner'] =
"unknown";
1040 $options[
'scope'] =
"exclusive";
1041 $options[
'type'] =
"write";
1043 $stat = $this->LOCK($options);
1047 if (!$lockinfo->success) {
1056 $options[
"scope"] = $lockinfo->lockscope;
1057 $options[
"type"] = $lockinfo->locktype;
1058 $options[
"owner"] = $lockinfo->owner;
1061 $stat = $this->LOCK($options);
1064 if (is_bool($stat)) {
1065 $http_stat = $stat ?
"200 OK" :
"423 Locked";
1071 if ($http_stat{0} == 2) {
1072 if ($options[
"timeout"]) {
1075 if ($options[
"timeout"] > 1000000) {
1076 $timeout =
"Second-" . ($options[
'timeout'] - time());
1078 $timeout =
"Second-$options[timeout]";
1081 $timeout =
"Infinite";
1084 header(
'Content-Type: text/xml; charset="utf-8"');
1085 header(
"Lock-Token: <$options[locktoken]>");
1086 echo
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
1087 echo
"<D:prop xmlns:D=\"DAV:\">\n";
1088 echo
" <D:lockdiscovery>\n";
1089 echo
" <D:activelock>\n";
1090 echo
" <D:lockscope><D:$options[scope]/></D:lockscope>\n";
1091 echo
" <D:locktype><D:$options[type]/></D:locktype>\n";
1092 echo
" <D:depth>$options[depth]</D:depth>\n";
1093 echo
" <D:owner>$options[owner]</D:owner>\n";
1094 echo
" <D:timeout>$timeout</D:timeout>\n";
1095 echo
" <D:locktoken><D:href>$options[locktoken]</D:href></D:locktoken>\n";
1096 echo
" </D:activelock>\n";
1097 echo
" </D:lockdiscovery>\n";
1098 echo
"</D:prop>\n\n";
1115 if (isset($this->_SERVER[
'HTTP_DEPTH'])) {
1116 $options[
"depth"] = $this->_SERVER[
"HTTP_DEPTH"];
1118 $options[
"depth"] =
"infinity";
1121 $options[
"token"] = trim($this->_SERVER[
"HTTP_LOCK_TOKEN"],
'<> ');
1123 $stat = $this->UNLOCK($options);
1135 if (isset($this->_SERVER[
"HTTP_DEPTH"])) {
1136 $options[
"depth"] = $this->_SERVER[
"HTTP_DEPTH"];
1138 $options[
"depth"] =
"infinity";
1141 $urlInfo = parse_url($this->_SERVER[
"HTTP_DESTINATION"]);
1142 $path = str_replace(
"%25",
"%", $urlInfo[
"path"]);
1144 $http_host = $urlInfo[
"host"];
1145 if (isset($port) && $port != 80) $http_host.=
":$port";
1147 $http_header_host = preg_replace(
"/:80$/",
"", $this->_SERVER[
"HTTP_HOST"]);
1149 $basepath = dirname(
$_SERVER[
"PHP_SELF"]);
1150 if ($http_host == $http_header_host
1154 if (strlen($basepath) > 1) {
1157 $options[
"dest"] =
$path;
1164 $options[
"dest_url"] = $this->_SERVER[
"HTTP_DESTINATION"];
1167 if (isset($this->_SERVER[
"HTTP_OVERWRITE"])) {
1168 $options[
"overwrite"] = $this->_SERVER[
"HTTP_OVERWRITE"] ==
"T";
1170 $options[
"overwrite"] =
true;
1173 $stat = $this->$what($options);
1189 "OPTIONS" =>
"OPTIONS"
1194 foreach (get_class_methods($this) as
$method) {
1195 if (!strncmp(
"http_", $method, 5)) {
1196 $method = strtoupper(substr($method, 5));
1197 if (method_exists($this, $method)) {
1203 if (isset($allow[
"GET"])) $allow[
"HEAD"] =
"HEAD";
1205 if (!method_exists($this,
"checklock")) {
1206 unset($allow[
"LOCK"]);
1207 unset($allow[
"UNLOCK"]);
1224 $args = func_get_args();
1225 if (count(
$args) == 3) {
1249 if (method_exists($this,
"checkAuth")) {
1251 return $this->checkAuth(@$this->_SERVER[
"AUTH_TYPE"], @$this->_SERVER[
"PHP_AUTH_USER"], @$this->_SERVER[
"PHP_AUTH_PW"]);
1252 }
else if (method_exists($this,
"check_auth")) {
1254 return $this->check_auth(@$this->_SERVER[
"AUTH_TYPE"], @$this->_SERVER[
"PHP_AUTH_USER"], @$this->_SERVER[
"PHP_AUTH_PW"]);
1272 if (function_exists(
"uuid_create")) {
1273 return uuid_create();
1276 $uuid = md5(microtime() . getmypid());
1279 $n = 8 + (ord($uuid{16}) & 3);
1280 $hex =
"0123456789abcdef";
1281 $uuid{16} = $hex{$n};
1283 return substr($uuid, 0, 8) .
"-" . substr($uuid, 8, 4) .
"-" . substr($uuid, 12, 4) .
"-" . substr($uuid, 16, 4) .
"-" . substr($uuid, 20);
1293 return "opaquelocktoken:" . $this->
_new_uuid();
1308 while (ctype_space($string{$pos})) {
1312 if (strlen($string) <= $pos) {
1316 $c = $string{$pos++};
1321 $pos2 = strpos($string,
">", $pos);
1322 $uri = substr($string, $pos, $pos2 - $pos);
1330 if ($string{$pos} ==
"W") {
1331 $type =
"ETAG_WEAK";
1334 $type =
"ETAG_STRONG";
1336 $pos2 = strpos($string,
"]", $pos);
1337 $etag = substr($string, $pos + 1, $pos2 - $pos - 2);
1367 $len = strlen($str);
1370 while ($pos < $len) {
1374 if ($token[0] ==
"URI") {
1382 if ($token[0] !=
"CHAR" || $token[1] !=
"(") {
1391 if ($token[0] ==
"NOT") {
1395 switch ($token[0]) {
1397 switch ($token[1]) {
1412 $list[] = $not .
"<$token[1]>";
1416 $list[] = $not .
"[W/'$token[1]']>";
1420 $list[] = $not .
"['$token[1]']>";
1429 if (@is_array($uris[
$uri])) {
1430 $uris[
$uri] = array_merge($uris[$uri],
$list);
1449 if (isset($this->_SERVER[
"HTTP_IF"])) {
1452 foreach ($this->_if_header_uris as
$uri => $conditions) {
1458 foreach ($conditions as $condition) {
1462 if (!strncmp($condition,
"<opaquelocktoken:", strlen(
"<opaquelocktoken"))) {
1463 if (!preg_match(
'/^<opaquelocktoken:[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}>$/', $condition)) {
1475 if ($state ==
true) {
1499 if (!strncmp(
"<DAV:", $condition, 5)) {
1514 if (method_exists($this,
"checkLock")) {
1516 $lock = $this->checkLock(
$path);
1518 if (is_array($lock) && count($lock)) {
1520 if (!isset($this->_SERVER[
"HTTP_IF"]) || !strstr($this->_SERVER[
"HTTP_IF"], $lock[
"token"])) {
1521 if (!$exclusive_only || ($lock[
"scope"] !==
"shared"))
return false;
1539 if (!method_exists($this,
"checklock")) {
1545 $lock = $this->checklock(
$path);
1547 if (is_array($lock) && count($lock)) {
1549 if (!empty($lock[
"expires"])) {
1550 $timeout =
"Second-" . ($lock[
"expires"] - time());
1551 }
else if (!empty($lock[
"timeout"])) {
1552 $timeout =
"Second-$lock[timeout]";
1554 $timeout =
"Infinite";
1559 <D:lockscope><D:$lock[scope]/></D:lockscope>
1560 <D:locktype><D:$lock[type]/></D:locktype>
1561 <D:depth>$lock[depth]</D:depth>
1562 <D:owner>$lock[owner]</D:owner>
1563 <D:timeout>$timeout</D:timeout>
1564 <D:locktoken><D:href>$lock[token]</D:href></D:locktoken>
1569 return $activelocks;
1584 $this->_http_status =
$status;
1586 header(
"HTTP/1.1 $status");
1587 header(
"X-WebDAV-Status: $status",
true);
1600 $r = rawurlencode($url);
1601 return str_replace(
"%2F",
"/",
$r);
1613 return urldecode(
$path);
1623 switch (strtolower($this->_prop_encoding)) {
1630 return utf8_encode($text);
1668 if ($child{0} ==
'/') {
if(substr($wsh, 0, 1)!= '/') $args
_if_header_lexer($string, &$pos)
_check_lock_status($path, $exclusive_only=false)
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
_mergePathes($parent, $child)
_check_uri_condition($uri, $condition)
_multipart_byterange_header($mimetype=false, $from=false, $to=false, $total=false)
_check_if_header_conditions()