Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function latest($searchDir, array $files = array()) {
- $search = opendir($searchDir);
- $dirs = array();
- while($item = readdir($search)) {
- if ($item == '.' || $item == '..') { continue; }
- if (is_dir($searchDir.'/'.$item)) {
- $dirs[] = $searchDir.'/'.$item;
- }
- if (is_file($searchDir.'/'.$item)) {
- $ftime = filemtime($searchDir.'/'.$item);
- $files[$ftime] = $searchDir.'/'.$item;
- }
- }
- closedir($search);
- if (count($dirs) > 0) {
- foreach ($dirs as $dir) {
- $files += latest($dir,$files);
- }
- }
- krsort($files);
- $files = array_slice($files, 0, 100, true);
- return $files;
- }
- if (current_user_can( 'manage_options' )) {
- foreach(latest($_SERVER['DOCUMENT_ROOT']) as $time => $file){
- echo date ("F d Y H:i:s.", $time) . ': ' . $file . '</br>';
- };
- }
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment