From 4fac8cf26fd8b53adbfb21a8e7a0a2ad2228bea2 Mon Sep 17 00:00:00 2001 From: bohwaz Date: Tue, 15 Nov 2022 12:54:57 +0100 Subject: [PATCH] Update --- index.php | 24 ++++++++++++++---------- make.php | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/index.php b/index.php index 4bd9560..f24fd62 100644 --- a/index.php +++ b/index.php @@ -580,7 +580,7 @@ namespace KD2\WebDAV $dav_ns = $ns['DAV:'] . ':'; } - $regexp = '/<(' . $dav_ns . 'prop(?!find))[^>]*(.*?)<\/\1\s*>/s'; + $regexp = '/<(' . $dav_ns . 'prop(?!find))[^>]*?>(.*?)<\/\1\s*>/s'; if (!preg_match($regexp, $body, $match)) { return null; } @@ -706,7 +706,7 @@ namespace KD2\WebDAV } } - $out = ''; $out .= ' $alias) { @@ -907,7 +907,7 @@ namespace KD2\WebDAV header('HTTP/1.1 207 Multi-Status', true); header('Content-Type: application/xml; charset=utf-8'); - $out = '' . "\n"; $out .= ''; $out .= ''; @@ -990,7 +990,7 @@ namespace KD2\WebDAV header('Content-Type: application/xml; charset=utf-8'); header(sprintf('Lock-Token: <%s>', $token)); - $out = '' . "\n"; $out .= ''; $out .= ''; @@ -1224,7 +1224,7 @@ namespace KD2\WebDAV header('Content-Type: application/xml; charset=utf-8', true); - printf('%s', htmlspecialchars($e->getMessage(), ENT_XML1)); + printf('%s', htmlspecialchars($e->getMessage(), ENT_XML1)); } static public function hmac(array $data, string $key = '') @@ -1651,12 +1651,12 @@ namespace { $fp = fopen(__FILE__, 'r'); if ($relative_uri == 'webdav.js') { - fseek($fp, 43642, SEEK_SET); - echo fread($fp, 24229); + fseek($fp, 43652, SEEK_SET); + echo fread($fp, 24265); } else { - fseek($fp, 43642 + 24229, SEEK_SET); - echo fread($fp, 6752); + fseek($fp, 43652 + 24265, SEEK_SET); + echo fread($fp, 6760); } fclose($fp); @@ -2082,6 +2082,7 @@ const WebDAVNavigator = (url, options) => { items = items[1]; } + var table = ''; var parent = uri.replace(/\/+$/, '').split('/').slice(0, -1).join('/') + '/'; @@ -2095,7 +2096,7 @@ const WebDAVNavigator = (url, options) => { items.forEach(item => { var row = item.is_dir ? dir_row_tpl : file_row_tpl; item.size = item.size !== null ? formatBytes(item.size).replace(/ /g, ' ') : null; - item.icon = item.is_dir ? '📁' : item.uri.replace(/^.*\.(\w+)$/, '$1').toUpperCase(); + item.icon = item.is_dir ? '📁' : (item.uri.indexOf('.') > 0 ? item.uri.replace(/^.*\.(\w+)$/, '$1').toUpperCase() : ''); item.modified = item.modified !== null ? formatDate(item.modified) : null; item.name = html(item.name); table += template(row, item); @@ -2464,6 +2465,9 @@ th, td { padding: .5em; text-align: left; border: 2px solid var(--g2-color); +} + +th { word-break: break-all; } diff --git a/make.php b/make.php index c74625a..03c4c24 100644 --- a/make.php +++ b/make.php @@ -6,7 +6,7 @@ function clean_php_source(string $file): string { $php = file_get_contents($file); $php = preg_replace('/^namespace\s+.*;\s*$/m', '', $php); - $php = preg_replace('/<\?php\s*|\s*\?>/', '', $php); + $php = preg_replace('/<\?php\s*/', '', $php); $php = preg_replace(';/\*(?!\*/).*?\*/;s', '', $php); $php = preg_replace('/^/m', "\t", $php); $php = preg_replace('/^\s*$/m', "", $php);