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-v16-api.php
<?php
declare(strict_types=1);
require_once dirname(__DIR__).'/includes/functions.php';
require_admin_role();
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: private, no-store');
header('X-Content-Type-Options: nosniff');
if(($_SERVER['REQUEST_METHOD']??'')!=='POST'){
    http_response_code(405);echo json_encode(['ok'=>false,'error'=>'Wymagane żądanie POST']);exit;
}
verify_csrf();
require_once dirname(__DIR__).'/includes/polana_v16_core.php';
if(session_status()===PHP_SESSION_ACTIVE)session_write_close();
try{
    v16_init();
    $action=(string)($_POST['action']??'');
    $area=v16_area((string)($_POST['area']??'menu'));
    $lang=v16_lang((string)($_POST['lang']??'all'));
    $menuId=v16_menu_id((int)($_POST['menu_id']??0));
    $data=[];
    switch($action){
        case 'status':
            $data=['counts'=>v16_status($area,0)];
            break;
        case 'scan_menu':
            if($area!=='menu')throw new RuntimeException('Nieprawidłowy moduł');
            $sum=['created'=>0,'missing'=>0,'skipped'=>0];
            foreach(array_keys(v16_menu_ids()) as $id){
                $r=p15_scan_menu((int)$id,['en','de','es']);
                foreach($sum as $key=>&$count)$count+=(int)$r[$key];unset($count);
            }
            $data=['scanned'=>$sum,'menu_ids'=>array_map('intval',array_keys(v16_menu_ids()))];
            break;
        case 'scan_menu_force':
            if($area!=='menu'||!$menuId)throw new RuntimeException('Wybierz aktualną kartę');
            $languages=$_POST['languages']??[];
            if(!is_array($languages))throw new RuntimeException('Wybierz języki');
            $languages=array_values(array_intersect(['en','de','es'],$languages));
            if(!$languages)throw new RuntimeException('Wybierz co najmniej jeden język');
            if(($_POST['confirm']??'')!=='PONOW')throw new RuntimeException('Wymagane potwierdzenie');
            $data=['scan'=>p15_scan_menu($menuId,$languages,true)];
            break;
        case 'tick_menu':
            if($area!=='menu'||!$menuId)throw new RuntimeException('Wybierz aktualną kartę');
            $data=['batch'=>p15_process_menu_one($menuId),'menu_stats'=>v16_status('menu',$menuId)];
            if(!empty($data['batch']['error']))$data['problems']=v16_problem_jobs('menu',$menuId,3);
            break;
        case 'scan_blog':
            if($area!=='blog')throw new RuntimeException('Nieprawidłowy moduł');
            $data=['scan'=>p13_blog_scan((int)($_POST['offset']??0),20)];
            break;
        case 'tick_blog':
            if($area!=='blog')throw new RuntimeException('Nieprawidłowy moduł');
            $data=['batch'=>p13_blog_work()];
            if(!empty($data['batch']['failed']))$data['problems']=v16_problem_jobs('blog',0,3);
            break;
        case 'tick_pages':
            if($area!=='pages')throw new RuntimeException('Nieprawidłowy moduł');
            $lock=(int)db()->query("SELECT GET_LOCK('polana_v12_translate',0)")->fetchColumn();
            if($lock===1){
                try{$data=['batch'=>p12_work(1)];if(!empty($data['batch']['errors']))$data['problems']=v16_problem_jobs('pages',0,3);}
                finally{db()->query("SELECT RELEASE_LOCK('polana_v12_translate')");}
            }else{$data=['busy'=>true];}
            break;
        case 'retry_failed':
            $data=['reset'=>v16_retry_failed($area,$menuId)];
            break;
        case 'diagnostics':
            $data=['problems'=>v16_problem_jobs($area,$menuId,20)];
            break;
        case 'bulk_preview':
            $bulkMenu=(int)($_POST['bulk_menu_id']??0);
            if($bulkMenu<0)throw new RuntimeException('Nieprawidłowa karta');
            $data=['preview'=>v163_bulk_preview($area,$lang,$bulkMenu)];
            break;
        case 'bulk_next':
            $bulkMenu=(int)($_POST['bulk_menu_id']??0);
            $cursor=max(0,(int)($_POST['cursor']??0));
            if($bulkMenu<0)throw new RuntimeException('Nieprawidłowa karta');
            if(($_POST['acknowledge']??'')!=='ZATWIERDZAM')throw new RuntimeException('Brak potwierdzenia');
            $data=['batch'=>v163_bulk_next($area,$lang,$bulkMenu,$cursor)];
            break;
        case 'approve':
            $ids=$_POST['ids']??[];$values=$_POST['values']??[];
            if(!is_array($ids)||!is_array($values))throw new RuntimeException('Nieprawidłowy formularz');
            $data=['result'=>v16_approve($area,$ids,$values,$menuId,$lang)];
            break;
        default:throw new RuntimeException('Nieznana operacja');
    }
    $data['counts']=v16_status($area,0);
    echo json_encode(['ok'=>true]+$data,JSON_UNESCAPED_UNICODE|JSON_INVALID_UTF8_SUBSTITUTE);
}catch(Throwable $e){
    error_log('Polana V16 API: '.$e->getMessage());
    http_response_code(400);
    echo json_encode(['ok'=>false,'error'=>$e->getMessage()],JSON_UNESCAPED_UNICODE|JSON_INVALID_UTF8_SUBSTITUTE);
}

Youez - 2016 - github.com/yon3zu
LinuXploit