diff --git a/src/webui/explore.php b/src/webui/explore.php index ad5114e..3f087da 100644 --- a/src/webui/explore.php +++ b/src/webui/explore.php @@ -76,6 +76,61 @@ $icon = $identicon->getImageDataUri('webp'); // Get snaps info $snaps = []; +/// Prepare location +$md5url = md5($document->url); + +$filepath = implode( + '/', + str_split( + $md5url + ) +); + +/// Local snaps @TODO + +/// Remote snaps +foreach ($config->snap->storage->remote->ftp as $i => $ftp) +{ + // Resource enabled + if (!$ftp->enabled) + { + continue; + } + + $remote = new \Yggverse\Ftp\Client(); + + $connection = $remote->connect( + $ftp->connection->host, + $ftp->connection->port, + $ftp->connection->username, + $ftp->connection->password, + $ftp->connection->directory, + $ftp->connection->timeout, + $ftp->connection->passive + ); + + // Remote host connected + if ($connection) { + + foreach ((array) $remote->nlist($filepath) as $filename) + { + $basename = basename($filename); + $time = preg_replace('/\D/', '', $basename); + + $snaps[sprintf(_('Remote #%s'), $i + 1)][] = (object) + [ + 'source' => $i, + 'md5url' => $md5url, + 'name' => $basename, + 'time' => $time, + 'size' => $remote->size($filename), + ]; + } + + $remote->close(); + } +} + ?> @@ -156,6 +211,13 @@ $snaps = []; margin: 4px 0; } + h4 { + display: block; + font-size: 13px; + font-weight: normal; + margin: 4px 0; + } + form { display: block; max-width: 678px; @@ -226,6 +288,15 @@ $snaps = []; color: #54a3f7; } + ul { + margin: 0; + padding: 0; + } + + ul > li { + margin-left: 16px; + } + .text-warning { color: #db6161; } @@ -249,7 +320,7 @@ $snaps = [];
- title) && empty($document->description) && empty($document->keywords)) { ?> + time) || (empty($document->title) && empty($document->description) && empty($document->keywords))) { ?>
@@ -304,12 +375,17 @@ $snaps = [];

- $snap) { ?> -
- - time) ?> / time ?> - -
+ $snap) { ?> +

+