%s', $filename, $css_class, $name);
}
function filter_files_dir($files_array, string $path) : array {
$ret_array = ['dir' => [], 'file' => []];
foreach($files_array as $file) {
// Hidden Files are not shown
if(substr($file, 0, 1) == '.') {
continue;
}
if(is_dir($path . $file)) {
// Append dir to array
$ret_array['dir'][] = $file;
}
else {
// Append file to array
$ret_array['file'][] = $file;
}
}
return $ret_array;
}
// HTML Head
echo($header);
echo("\n");
/* Misc. Variables */
$not_found_error = '
File not found, error 404
';
$basedir = 'content';
$request_uri = $_SERVER['REQUEST_URI'];
$path = $basedir . $request_uri;
/**/
// Check if URI is correct
if(!is_dir($path)) {
echo($not_found_error);
die();
}
$files_in_folder = scandir($path);
$resource_array = filter_files_dir($files_in_folder, $path);
/* Debug */
/* var_dump($_SERVER);
* var_dump($files_in_folder); */
?>
Magatzem de Dusk
Directoris');
}
echo('');
foreach($resource_array['dir'] as $dir) {
echo('- ' . link_from_file($request_uri . $dir, null, "dir_link") . '
');
echo('
');
}
echo('
');
}
echo("\n");
//Show file links
{
if(!empty($resource_array['file'])) {
echo('Fitxers
');
}
echo('');
foreach($resource_array['file'] as $file) {
echo('- ' . link_from_file($request_uri . $file, null, 'file_link') . '
');
echo('
');
}
echo('
');
}
echo("\n");
$base_url = base_url(get_protocol());
$parent_url = parent_url(get_protocol());
//Navigation
echo <<
NAV;
?>