feat: h5ai 0.30.0 with PHP 8.4.26 security patch for PHP2Shell

This commit is contained in:
Patrick Asmus
2026-10-21 21:45:49 +02:00
parent 3568d43858
commit e6536444ad
133 changed files with 4363 additions and 29 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
class Search {
private $context;
public function __construct($context) {
$this->context = $context;
}
public function get_paths($root, $pattern = null, $ignorecase = false) {
$paths = [];
if ($pattern && $this->context->is_managed_path($root)) {
$re = Util::wrap_pattern($pattern);
if ($ignorecase) {
$re .= 'i';
}
$names = $this->context->read_dir($root);
foreach ($names as $name) {
$path = $root . '/' . $name;
if (preg_match($re, @basename($path))) {
$paths[] = $path;
}
if (@is_dir($path)) {
$paths = array_merge($paths, $this->get_paths($path, $pattern, $ignorecase));
}
}
}
return $paths;
}
public function get_items($href, $pattern = null, $ignorecase = false) {
$cache = [];
$root = $this->context->to_path($href);
$paths = $this->get_paths($root, $pattern, $ignorecase);
$items = array_map(function ($path) {
return Item::get($this->context, $path, $cache)->to_json_object();
}, $paths);
return $items;
}
}