['label' => 'Half Day (4 hrs)', 'amount' => 99.00, 'days' => 0], 'full-day' => ['label' => 'Full Day (8 hrs)', 'amount' => 169.00, 'days' => 0], 'weekend' => ['label' => 'Weekend (48 hrs)', 'amount' => 299.00, 'days' => 1], ]); function db(): PDO { static $pdo; if (!$pdo) { $pdo = new PDO( 'mysql:host=' . PARKER_DB_HOST . ';dbname=' . PARKER_DB_NAME . ';charset=utf8mb4', PARKER_DB_USER, PARKER_DB_PASS, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC] ); } return $pdo; } function squareApi(string $method, string $path, array $body = []): array { $ch = curl_init('https://connect.squareup.com/v2' . $path); $headers = [ 'Authorization: Bearer ' . SQUARE_ACCESS_TOKEN, 'Content-Type: application/json', 'Square-Version: ' . SQUARE_VERSION, ]; $opts = [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false]; if ($method === 'POST') { $opts[CURLOPT_POST] = true; $opts[CURLOPT_POSTFIELDS] = $body ? json_encode($body) : '{}'; } curl_setopt_array($ch, $opts); $resp = curl_exec($ch); curl_close($ch); return json_decode($resp ?: '{}', true); } function generateRef(): string { return 'PSR-' . strtoupper(substr(uniqid(), -6)); } function sendEmail(string $to, string $toName, string $subject, string $html): bool { $apiKey = defined('CYBERMAIL_API_KEY') ? CYBERMAIL_API_KEY : ''; if (!$apiKey || strpos($apiKey, 'YOUR_KEY') !== false) return false; $payload = json_encode([ 'from' => MAIL_FROM, 'to' => $to, 'subject' => $subject, 'html' => $html, ]); $ch = curl_init('https://platform.cyberpersons.com/email/v1/send'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $payload, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $apiKey, 'Content-Type: application/json', ], CURLOPT_TIMEOUT => 15, CURLOPT_SSL_VERIFYPEER => false, ]); $resp = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return $code === 202; }