function safefile($dir, $ext = '', $sub = 1) { global $md5_a; $exts = '/(' . $ext . ')$/i'; $fp = opendir($dir); while ($filename = readdir($fp)) { $path = $dir . $filename; if ($filename != '.' && $filename != '..' && (preg_match($exts, $filename) || $sub && is_dir($path))) { if ($sub && is_dir($path)) { safefile($path . '/', $ext); } else { $md5_a[$path] = md5_file($path); } } } closedir($fp); }
function safefile($dir, $ext = '', $sub = 1) { global $md5_a; $exts = '/(' . $ext . ')$/i'; $fp = opendir($dir); while ($filename = readdir($fp)) { $path = $dir . $filename; if ($filename != '.' && $filename != '..' && (preg_match($exts, $filename) || $sub && is_dir($path))) { if ($sub && is_dir($path)) { safefile($path . '/', $ext); } else { if (strpos($path, './pw_api.php') !== false || strpos($path, 'api/') !== false || strpos($path, 'mode/o/m_app.php') !== false || strpos($path, 'mode/o/m_myapp.php') !== false || strpos($path, 'mode/o/template/m_app.htm') !== false || strpos($path, 'mode/o/template/m_myapp.htm') !== false || strpos($path, './apps.php') !== false || strpos($path, 'template/wind/apps.htm') !== false) { $md5_a[$path] = md5_file($path) . md5('app'); } } } } closedir($fp); }