Block the public booking operations if the booking page is disabled

This commit is contained in:
Alex Tselegidis 2023-12-22 12:48:06 +01:00
parent 2878d1299a
commit aeadbfbe98
2 changed files with 24 additions and 0 deletions

View file

@ -290,6 +290,12 @@ class Booking extends EA_Controller
public function register()
{
try {
$disable_booking = setting('disable_booking');
if ($disable_booking) {
abort(403);
}
$post_data = request('post_data');
$captcha = request('captcha');
$appointment = $post_data['appointment'];
@ -574,6 +580,12 @@ class Booking extends EA_Controller
public function get_available_hours()
{
try {
$disable_booking = setting('disable_booking');
if ($disable_booking) {
abort(403);
}
$provider_id = request('provider_id');
$service_id = request('service_id');
$selected_date = request('selected_date');
@ -650,6 +662,12 @@ class Booking extends EA_Controller
public function get_unavailable_dates()
{
try {
$disable_booking = setting('disable_booking');
if ($disable_booking) {
abort(403);
}
$provider_id = request('provider_id');
$service_id = request('service_id');
$appointment_id = request('appointment_id');

View file

@ -49,6 +49,12 @@ class Booking_cancellation extends EA_Controller
public function of(string $appointment_hash)
{
try {
$disable_booking = setting('disable_booking');
if ($disable_booking) {
abort(403);
}
$cancellation_reason = request('cancellation_reason');
if ($this->input->method() !== 'post' || empty($cancellation_reason)) {