77 lines
2.3 KiB
PHP
77 lines
2.3 KiB
PHP
<?php
|
|
if (isset($_GET['query'])) {
|
|
$query = $_GET['query'];
|
|
$results = searchFiles($query);
|
|
}
|
|
|
|
function searchFiles($query) {
|
|
$directory = './'; // Adresář s vašimi stránkami
|
|
$files = glob($directory . '*.php'); // Vyhledá všechny PHP soubory v adresáři
|
|
$results = [];
|
|
|
|
foreach ($files as $file) {
|
|
$content = file_get_contents($file);
|
|
if (stripos($content, $query) !== false) {
|
|
$results[] = $file;
|
|
}
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="cs">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta content="EndeavourOS svobodný operační systém....Novinky" name="description" />
|
|
<meta content="EndeavourOS, Novinky" name="keywords" />
|
|
<meta content="Kankys" name="author" />
|
|
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
<link href="assets/style.css" rel="stylesheet" />
|
|
<link href="img/icons.png" rel="shortcut icon" />
|
|
<script crossorigin="anonymous" src="https://kit.fontawesome.com/0a43c6cd1f.js"></script>
|
|
<!--icons dark, go to up-->
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet" />
|
|
|
|
<!--ubuntu fonts-->
|
|
<style>
|
|
@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap");
|
|
</style>
|
|
|
|
<title>EndeavourOS - Vyhledávání </title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php require "assets/header.php" ?>
|
|
<main>
|
|
<section class="welcome">
|
|
<h2>Vyhledávání</h2>
|
|
<form method="GET" action="">
|
|
<input type="text" name="query" placeholder="Zadejte hledaný výraz">
|
|
<input type="submit" value="Vyhledat">
|
|
</form>
|
|
|
|
<?php if (isset($results) && !empty($results)): ?>
|
|
<h3>Výsledky vyhledávání:</h3>
|
|
<ul>
|
|
<?php foreach ($results as $result): ?>
|
|
<li style="list-style-type:none;"><a href="<?php echo $result; ?>"><?php echo basename($result); ?></a></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php elseif (isset($results) && empty($results)): ?>
|
|
<p>Žádné výsledky nebyly nalezeny.</p>
|
|
<?php endif; ?>
|
|
</section>
|
|
</main>
|
|
|
|
<?php require "assets/returnbutton.php" ?>
|
|
<?php require "assets/footer.php" ?>
|
|
|
|
<script src="assets/script.js"></script>
|
|
</body>
|
|
|
|
</html>
|