$config->manticore->server->host, 'port' => $config->manticore->server->port, ] ); // Init index $index = $client->index( $config->manticore->index->document->name ); // Get totals $total = $index->search('') ->option('cutoff', 0) ->limit(0) ->get() ->getTotal(); $placeholder = sprintf( _('Search in %s documents %s'), number_format( $total ), $config->webui->search->index->request->url->enabled ? _('or enter new address to crawl...') : false ); // Get document data $document = $index->getDocumentById( isset($_GET['i']) ? $_GET['i'] : 0 ); // Get icon $hostname = parse_url( $document->url, PHP_URL_HOST ); $identicon = new \Jdenticon\Identicon(); $identicon->setValue( $hostname ); $identicon->setSize(36); $identicon->setStyle( [ 'backgroundColor' => 'rgba(255, 255, 255, 0)', 'padding' => 0 ] ); $icon = $identicon->getImageDataUri('webp'); // Get snaps info $snaps = []; /// Prepare location $filepath = implode( '/', str_split( $document->getId() ) ); /// Local snaps if ($config->snap->storage->local->enabled) { /// absolute if ('/' === substr($config->snap->storage->local->directory, 0, 1)) { $prefix = $config->snap->storage->local->directory; } /// relative else { $prefix = __DIR__ . '/../../' . $config->snap->storage->local->directory; } $directory = sprintf('%s/%s', $prefix, $filepath); if (is_dir($directory)) { foreach ((array) scandir($directory) as $filename) { if (!str_ends_with($filename, '.tar.gz')) { continue; } $basename = basename( $filename ); $time = preg_replace( '/^([\d]+)\.tar\.gz$/', '$1', $basename ); $snaps[_('Local')][] = (object) [ 'source' => 'local', 'id' => $document->getId(), 'name' => $basename, 'time' => $time, 'size' => filesize( sprintf( '%s/%s', $directory, $filename ) ), ]; } } } /// 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) { if (!str_ends_with($filename, '.tar.gz')) { continue; } $basename = basename( $filename ); $time = preg_replace( '/^([\d]+)\.tar\.gz$/', '$1', $basename ); $snaps[sprintf(_('Server #%s'), $i + 1)][] = (object) [ 'source' => $i, 'id' => $document->getId(), 'name' => $basename, 'time' => $time, 'size' => $remote->size($filename), ]; } $remote->close(); } } // Process index request if ($config->webui->index->enabled) { session_start(); if (isset($_POST['captcha']) && $_POST['captcha'] == $_SESSION['captcha']) { $index->updateDocument( [ 'index' => time() ], $document->getId() ); header( sprintf( 'Location: explore.php?i=%d', $document->getId() ) ); } $captcha = new \Gregwar\Captcha\CaptchaBuilder(); $captcha->setBackgroundColor(46, 52, 54); $captcha->build(); $_SESSION['captcha'] = $captcha->getPhrase(); } ?> <?php echo _('Yo! explore') ?>

webui->search->extended->enabled) { ?>
time)) { ?>
title)) { ?>

title) ?>

description)) { ?>
description) ?>
keywords)) { ?>
keywords) ?>
url)) ?>
identicon
code)) { ?>

code == 200) { ?>
code ?>
code ?>
mime)) { ?>

mime ?>
size)) { ?>

size ?>
time)) { ?>

time) ?>

body)) { ?>

body) ?>
webui->index->enabled) { ?>

get('index')) { ?> get('index'))) ?> captcha