| 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_login();
$user=admin_user();
if(!$user || !schedule_is_manager($user)){http_response_code(403);header('Content-Type: application/json; charset=UTF-8');echo json_encode(['ok'=>false]);exit;}
$date=trim((string)($_GET['date']??''));
$dateObj=DateTimeImmutable::createFromFormat('!Y-m-d',$date);
if(!$dateObj || $dateObj->format('Y-m-d')!==$date){http_response_code(400);header('Content-Type: application/json; charset=UTF-8');echo json_encode(['ok'=>false]);exit;}
$entries=schedule_entries_for_date($date);
header('Content-Type: application/json; charset=UTF-8');header('Cache-Control: no-store');
echo json_encode(['ok'=>true,'user_ids'=>array_map('intval',array_column($entries,'user_id')),'entries'=>array_map(static fn(array $row):array=>['user_id'=>(int)$row['user_id'],'start_time'=>$row['start_time']?substr((string)$row['start_time'],0,5):'','end_time'=>$row['end_time']?substr((string)$row['end_time'],0,5):''],$entries)],JSON_UNESCAPED_UNICODE);