20) return true; if (strstr($l, '/')) { $s = explode('/', rtrim($l)); $filepath = $dir . '/' . $s[1]; if ($s[0] == 'D') { collect($filepath); $dirs["$dir"][] = $s[1]; $dirs["$dir"]['FILES'] = []; } else { if (is_file($filepath)) { $stat = stat($filepath); $files["$filepath"]["mtime"] = $stat['mtime']; $files["$filepath"]["ctime"] = $stat['ctime']; $files["$filepath"]["atime"] = $stat['atime']; $files["$filepath"]["size"] = $stat['size']; $files["$filepath"]["rev"] = $s[2]; $files["$filepath"]["date"] = $s[3]; $files["$filepath"]["flags"] = $s[4]; $files["$filepath"]["tag"] = $s[5]; clearstatcache(); $dirs["$dir"]['FILES'] = $files; } } } } } } /** * @param $fd * @param $fx * @param $outstring * @param string $style * @param string $mod * @param bool $br */ function echoline($fd, $fx, $outstring, $style = '', $mod = '', $br = true) { if ($br) { $br = "\n"; } else { $br = ''; } fwrite($fd, $outstring . $br); if ($mod == 'd') { $outstring = date('D M d H:m:s Y', trim($outstring)); } if ($style == 'eob') { $htmlstring = ""; } elseif ($style) { if ($style == 'dir') { $htmlstring = "" . sprintf(" %-16s : ", $style) . htmlspecialchars($outstring) . ""; $htmlstring .= "
$params) {
$dirname = basename($dir);
$path = dirname($dir);
echoline($fw, $fx, $dir, 'dir');
echoline($fw, $fx, '');
if (isset($dirs["$dir"]['FILES'])) {
foreach ($dirs["$dir"]['FILES'] as $file => $params) {
$fp = fopen($file, "r");
$data = fread($fp, filesize($file));
fclose($fp);
$requests = [];
$urls = [];
if (preg_match("/\.(tpl|ph(p|tml))$/", $file)) {
if (preg_match("/\.ph(p|tml)$/", $file)) {
echoline($fw, $fx, $file, "file php");
$data = preg_replace("/(?s)\/\*.*?\*\//", '', $data); // C comments
$data = preg_replace("/(?m)^\s*\/\/.*\$/", '', $data); // C++ comments
$data = preg_replace("/(?m)^\s*\#.*\$/", '', $data); // shell comments
$data = preg_replace('/(\r|\n)/', '', $data); // all one line
preg_match_all('/\$_(REQUEST|POST|GET|COOKIE|SESSION)\[([^\]]*)\]/', $data, $requests); // requests uses
$max = count($requests[0]);
for ($i = 0; $i < $max; $i++) {
echoline($fw, $fx, $requests[1][$i] . " = " . $requests[2][$i], 'sub var');
}
} elseif (preg_match("/\.tpl$/", $file)) {
echoline($fw, $fx, $file, 'file smarty');
$data = preg_replace('/(?s)\{\*.*?\*\}/', '', $data); // Smarty comment
$data = preg_replace('/(\r|\n)/', '', $data); // all one line
}
preg_match_all('/<(a[^>]*)>[^<]*<\/a>/im', $data, $urls); // href links
foreach ($urls[1] as $u) {
echoline($fw, $fx, $u, 'sub url');
}
preg_match_all('/<(form[^>]*)>/', $data, $forms); // form uses
foreach ($forms[1] as $f) {
echoline($fw, $fx, $f, 'sub action');
}
preg_match_all('/<((input|textarea|select)[^>]*)>/', $data, $elements); // form elements uses
$max = count($elements[0]);
for ($i = 0; $i < $max; $i++) {
echoline($fw, $fx, $elements[1][$i], 'sub form');
}
echoline($fw, $fx, trim($params['atime']), 'sub atime', 'd');
echoline($fw, $fx, trim($params['mtime']), 'sub mtime', 'd');
echoline($fw, $fx, trim($params['ctime']), 'sub ctime', 'd');
echoline($fw, $fx, trim($params['date']), 'sub date');
echoline($fw, $fx, trim($params['size']), 'sub size');
echoline($fw, $fx, trim($params['rev']), 'sub rev');
echoline($fw, $fx, substr(trim($params['tag']), 1), 'sub tag');
} elseif (preg_match('/\.(gif|jpg|png)$/i', $file)) {
echoline($fw, $fx, $file, 'file image');
} else {
echoline($fw, $fx, $file, 'file other');
}
echoline($fw, $fx, '');
flush();
}
}
echoline($fw, $fx, 'end of box', 'eob');
}
fclose($fw);
fclose($fx);
}
if (is_file($logfilehtml)) {
readfile($logfilehtml);
}
?>