false, 'error' => 'Missing id']); exit; } // Basic cron validation — 5 fields, or known @event trigger, or empty if ($cron && !in_array($cron, ['@array_start', '@array_stop'], true) && !preg_match('/^(\S+\s+){4}\S+$/', $cron)) { echo json_encode(['ok' => false, 'error' => 'Invalid cron expression']); exit; } $ok = vv_schedule_update($id, $enabled, $cron, $log_enabled); echo json_encode(['ok' => $ok, 'error' => $ok ? null : 'Failed to write schedule']);