| 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 : |
<?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'=>'Tylko POST']);exit;}
verify_csrf();
require_once dirname(__DIR__).'/includes/polana_v15_menu_queue.php';
if(session_status()===PHP_SESSION_ACTIVE)session_write_close();
try{
$action=(string)($_POST['action']??'tick');
if($action==='scan_all'){
$report=['created'=>0,'missing'=>0,'skipped'=>0];
foreach(array_keys(p15_active_menu_ids()) as $mid){
$r=p15_scan_menu((int)$mid,['en','de','es'],false);
foreach($report as $key=>&$val)$val+=$r[$key];unset($val);
}
echo json_encode(['ok'=>true,'scanned'=>$report],JSON_UNESCAPED_UNICODE);exit;
}
$menuId=(int)($_POST['menu_id']??0);
if($menuId<1)throw new RuntimeException('Wybierz kartę');
$result=p15_process_menu_one($menuId);
$stats=p15_menu_queue_stats($menuId);
echo json_encode(['ok'=>true,'result'=>$result,'stats'=>$stats],JSON_UNESCAPED_UNICODE|JSON_INVALID_UTF8_SUBSTITUTE);
}catch(Throwable $e){error_log('Polana V15 menu API: '.$e->getMessage());http_response_code(400);echo json_encode(['ok'=>false,'error'=>'Błąd przetwarzania; sprawdź log PHP lub poprawność karty'],JSON_UNESCAPED_UNICODE);}