32 lines
1.2 KiB
PHP
32 lines
1.2 KiB
PHP
<?php
|
|
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
function directoryToArray($directory, $recursive) {
|
|
$array_items = [];
|
|
if ($handle = opendir($directory)) {
|
|
while (false !== ($file = readdir($handle))) {
|
|
if ($file != '.' && $file != '..') {
|
|
if (is_dir($directory . '/' . $file)) {
|
|
if ($recursive) {
|
|
$array_items = array_merge($array_items, directoryToArray($directory . '/' . $file, $recursive));
|
|
}
|
|
$file = $directory . '/' . $file;
|
|
} else {
|
|
$file = $directory . '/' . $file;
|
|
$array_items[] = preg_replace("/\/\//si", '/', $file);
|
|
}
|
|
}
|
|
}
|
|
closedir($handle);
|
|
}
|
|
|
|
return $array_items;
|
|
}
|
|
$files = directoryToArray('./pages', true);
|
|
foreach ($files as $file) {
|
|
if (substr($file, -3) == '.pg' and (substr($file, 0, 17) != './pages/cs/error/' and substr($file, 0, 17) != './pages/en/error/' and substr($file, 0, 17) != './pages/de/error/')) {
|
|
$list .= substr($file, 0, -3) . "\n";
|
|
}
|
|
}
|
|
echo str_replace('./pages', 'http://' . $_SERVER['HTTP_HOST'], $list);
|