403Webshell
Server IP : 188.114.96.3  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux sv058.home.net.pl 6.8.2 husak_dirty_pages_fix #1 SMP PREEMPT_DYNAMIC Tue Apr 2 22:06:51 CEST 2024 x86_64
User :  ( 3194769)
PHP Version : 8.5.12
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /polana/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /polana/admin/polana-v13-integracja.php
<?php
declare(strict_types=1);
require_once dirname(__DIR__).'/includes/functions.php';
require_admin_role();
$target=__DIR__.'/blog-edit.php';
$backupDir=dirname(__DIR__).'/storage/v13-backup';
$metaPath=$backupDir.'/blog-v13.json';$result='';$error='';
if(($_SERVER['REQUEST_METHOD']??'')==='POST'){
 verify_csrf();
 try{
  $action=(string)($_POST['action']??'');
  if($action==='install'){
    if(is_file($metaPath))throw new RuntimeException('Integracja V13 została już włączona.');
    if(!is_file($target)||!is_readable($target)||!is_writable($target))throw new RuntimeException('Brak dostępu do admin/blog-edit.php');
    $original=(string)file_get_contents($target);
    if(str_contains($original,'POLANA_V13_BLOG_SAVE'))throw new RuntimeException('Integracja jest już obecna.');
    if(str_contains($original,'v9_enqueue_blog_post('))throw new RuntimeException('Edytor ma już automatyczne podpinanie V9. Nie instaluję drugiego, żeby nie tworzyć duplikatów.');
    $needle="        redirect('/admin/blog-edit.php?id='.\$id);";
    if(substr_count($original,$needle)!==1)throw new RuntimeException('Zmieniony edytor — nie znalazłem bezpiecznego punktu wpięcia.');
    $insert=<<<'INJECT'
        /* POLANA_V13_BLOG_SAVE: automatycznie oznacz zmienione pola do tłumaczenia */
        try {
            require_once dirname(__DIR__).'/includes/polana_v13_blog.php';
            p13_blog_enqueue_one($id);
        } catch (Throwable $translateError) {
            error_log('POLANA V13 BLOG SAVE: '.$translateError->getMessage());
        }
INJECT;
    $next=str_replace($needle,$insert."\n".$needle,$original);
    if(!is_dir($backupDir)&&!mkdir($backupDir,0700,true))throw new RuntimeException('Nie mogę utworzyć katalogu backupu.');
    file_put_contents($backupDir.'/.htaccess',"Require all denied\n",LOCK_EX);
    $backup=$backupDir.'/blog-edit-'.date('Ymd-His').'-'.bin2hex(random_bytes(3)).'.php.bak';
    if(file_put_contents($backup,$original,LOCK_EX)!==strlen($original))throw new RuntimeException('Backup nie powstał.');
    if(hash_file('sha256',$target)!==hash('sha256',$original))throw new RuntimeException('Edytor zmienił się w trakcie instalacji.');
    $temp=$target.'.v13_'.bin2hex(random_bytes(4));
    if(file_put_contents($temp,$next,LOCK_EX)!==strlen($next))throw new RuntimeException('Nie mogę zapisać tymczasowego pliku.');
    @chmod($temp,fileperms($target)&0777);
    if(!rename($temp,$target)){$result='';@unlink($temp);throw new RuntimeException('Nie mogę podmienić edytora.');}
    file_put_contents($metaPath,json_encode(['backup'=>$backup,'sha256'=>hash('sha256',$next)],JSON_UNESCAPED_SLASHES),LOCK_EX);
    $result='Gotowe. Po zapisie bloga zmienione pola trafiają do kolejki tłumaczeń.';
  }elseif($action==='rollback'){
    if(!is_file($metaPath))throw new RuntimeException('Nie ma manifestu V13.');
    $meta=json_decode((string)file_get_contents($metaPath),true,512,JSON_THROW_ON_ERROR);
    if(!is_file($meta['backup']??''))throw new RuntimeException('Brak kopii.');
    if(hash_file('sha256',$target)!==($meta['sha256']??''))throw new RuntimeException('Edytor zmienił się od instalacji. Nie nadpisuję nowszych poprawek.');
    if(!copy($meta['backup'],$target))throw new RuntimeException('Przywracanie nie powiodło się.');
    unlink($metaPath);$result='Przywrócono blog-edit.php z kopii.';
  }else throw new RuntimeException('Nieznana operacja.');
 }catch(Throwable $e){$error=$e->getMessage();error_log('POLANA V13 integracja: '.$error);}
}
render_admin_header('POLANA V13 — integracja bloga');
?>
<div style="max-width:850px;background:#fff;border:1px solid #ddd;border-radius:12px;padding:23px;margin:25px auto;color:#222">
<h1>POLANA V13 — zapisywanie nowych blogów</h1>
<p>Instalator nie podmienia edytora. Dopisuje jedną bezpieczną procedurę po zapisaniu wpisu, z kopią i rollbackiem. Jeśli masz już integrację V9, nie instaluje drugiej.</p>
<?php if($error):?><p style="color:#b22"><?=e($error)?></p><?php endif;?>
<?php if($result):?><p style="color:#185b28"><?=e($result)?></p><?php endif;?>
<form method="post"><?=csrf_field()?><button name="action" value="install">Podłącz automatyczne wykrywanie zmian</button></form>
<form method="post" style="margin-top:12px"><?=csrf_field()?><button name="action" value="rollback">Wycofaj integrację</button></form>
<p><a href="/admin/polana-v13-blog.php">Centrum tłumaczeń bloga →</a></p>
</div>
<?php render_admin_footer(); ?>

Youez - 2016 - github.com/yon3zu
LinuXploit