karadav/lib/KaraDAV/WebDAV.php

30 lines
748 B
PHP
Raw Normal View History

<?php
namespace KaraDAV;
use KD2\WebDAV\Server as WebDAV_Server;
class WebDAV extends WebDAV_Server
{
2022-10-10 12:01:20 +00:00
protected function html_directory(string $uri, iterable $list): ?string
{
2022-10-10 12:01:20 +00:00
$out = parent::html_directory($uri, $list);
if (null !== $out) {
2022-10-10 12:01:20 +00:00
$out = str_replace('<body>', sprintf('<body style="opacity: 0"><script type="text/javascript" src="%swebdav.js"></script>', WWW_URL), $out);
}
return $out;
}
2022-10-10 12:01:20 +00:00
public function http_options(): void
{
parent::http_options();
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Headers: Authorization, *');
header('Access-Control-Allow-Methods: GET,HEAD,PUT,DELETE,COPY,MOVE,PROPFIND,MKCOL,LOCK,UNLOCK');
}
}