function parseDir($dir, $parent) { $path = $parent . ($dir['name'] != '/' ? $dir['name'] . '/' : ''); foreach ($dir->file as $file) { if (in_array($file['role'], array('test', 'php'))) { showSource($path, $file['name']); } } foreach ($dir->dir as $child) { parseDir($child, $path); } return; }
<?php defined('_NOAH') or die('Restricted access'); /** * @project mygosuLib * @package ErrorHandler * @version 2.0.0 * @license BSD * @copyright (c) 2003,2004 Cezary Tomczak * @link http://gosu.pl/software/mygosulib.html */ $file = @$_GET['file']; $line = @$_GET['line']; $prev = @$_GET['prev'] ? $_GET['prev'] : 10; $next = @$_GET['next'] ? $_GET['next'] : 10; showSource($file, $line, $prev, $next); /** * Show source part of the file * @param string $file Filename * @param int $line Line to read * @param int $prev How many lines before main line to read * @param int $next How many lines after main line to read * @return string * @access public * @package ErrorHandler */ function showSource($file, $line, $prev = 10, $next = 10) { if (!(file_exists($file) && is_file($file))) { return trigger_error("showSource() failed, file does not exist `{$file}`", E_USER_ERROR); return false;