PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/impact/lib/weltmeister/api/glob.php

https://github.com/jrittelmeyer/ShadowInTheDark
PHP | 18 lines | 14 code | 4 blank | 0 comment | 0 complexity | 36b544ba45e09f150688fa8bf5f882d2 MD5 | raw file
  1. <?php
  2. require_once( 'config.php' );
  3. $globs = is_array($_GET['glob']) ? $_GET['glob'] : array($_GET['glob']);
  4. $files = array();
  5. foreach( $globs as $glob ) {
  6. $pattern = WM_Config::$fileRoot . str_replace( '..', '', $glob );
  7. $files = array_merge( $files, (array)glob( $pattern ) );
  8. }
  9. $fileRootLength = strlen( WM_Config::$fileRoot );
  10. foreach( $files as $i => $f ) {
  11. $files[$i] = substr( $f, $fileRootLength );
  12. }
  13. echo json_encode( $files );
  14. ?>