uberpong/dev/lib/weltmeister/api/glob.php
2012-06-21 10:13:21 +02:00

18 lines
No EOL
453 B
PHP
Executable file

<?php
require_once( 'config.php' );
$globs = is_array($_GET['glob']) ? $_GET['glob'] : array($_GET['glob']);
$files = array();
foreach( $globs as $glob ) {
$pattern = WM_Config::$fileRoot . str_replace( '..', '', $glob );
$files = array_merge( $files, (array)glob( $pattern ) );
}
$fileRootLength = strlen( WM_Config::$fileRoot );
foreach( $files as $i => $f ) {
$files[$i] = substr( $f, $fileRootLength );
}
echo json_encode( $files );
?>