Skip to content

Commit

Permalink
Add support for PHP 8.4 (#1640)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextselegidis committed Dec 19, 2024
1 parent 3251923 commit 54529a2
Show file tree
Hide file tree
Showing 121 changed files with 679 additions and 599 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ developers to maintain and readjust their custom modifications on the main proje

## [Unreleased]

### Added

- Add support for PHP 8.4 (#1640)

### Fixed

- Fix the date parsing issue on Safari web browsers during the booking process (#1584)
- Fix working plan configuration am/pm hour parsing so that it works in all languages (#1606)
- Improve the CalDAV syncing mechanism so that it connects to more systems without problems (#1622)



## [1.5.0] - 2024-07-07

### Added
Expand Down
6 changes: 3 additions & 3 deletions application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
| URI string. The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO' Default - auto detects
| 'AUTO' Default - auto-detects
| 'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
Expand Down Expand Up @@ -236,7 +236,7 @@
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
| as few characters as possible. By default, only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
Expand Down Expand Up @@ -465,7 +465,7 @@
|--------------------------------------------------------------------------
|
| Toggle the rate limiting feature in your application. Using rate limiting
| will control the number of requests a client can sent to the app.
| will control the number of requests a client can send to the app.
|
*/
$config['rate_limiting'] = true;
Expand Down
14 changes: 7 additions & 7 deletions application/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['autoinit'] Whether or not to automatically initialize the database.
| ['autoinit'] Whether to automatically initialize the database.
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
|
Expand All @@ -47,23 +47,23 @@
*/

$active_group = 'default';
$query_builder = TRUE;
$query_builder = true;

$db['default']['hostname'] = Config::DB_HOST;
$db['default']['username'] = Config::DB_USERNAME;
$db['default']['password'] = Config::DB_PASSWORD;
$db['default']['database'] = Config::DB_NAME;
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = 'ea_';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['pconnect'] = true;
$db['default']['db_debug'] = true;
$db['default']['cache_on'] = false;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8mb4';
$db['default']['dbcollat'] = 'utf8mb4_unicode_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
$db['default']['autoinit'] = true;
$db['default']['stricton'] = false;

/* End of file database.php */
/* Location: ./application/config/database.php */
6 changes: 3 additions & 3 deletions application/config/migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| whenever you intend to do a schema migration.
|
*/
$config['migration_enabled'] = TRUE;
$config['migration_enabled'] = true;

/*
|--------------------------------------------------------------------------
Expand All @@ -28,9 +28,9 @@
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Path to your "migrations" folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
| Also, writing permission is required within the "migrations" path.
|
*/
$config['migration_path'] = APPPATH . 'migrations/';
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Appointments.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct()
*
* @deprecated Since 1.5
*/
public function index(string $appointment_hash = '')
public function index(string $appointment_hash = ''): void
{
redirect('booking/' . $appointment_hash);
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function users(): void
/**
* Display settings page.
*
* Notice: Since the "settings" page is split into multiple pages (general, business, booking etc), this method will
* Notice: Since the "settings" page is split into multiple pages (general, business, booking etc.), this method will
* redirect to "general" page by default.
*/
public function settings(): void
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ protected function check_datetime_availability(): ?int
*
* @throws Exception
*/
protected function search_any_provider(int $service_id, string $date, string $hour = null): ?int
protected function search_any_provider(int $service_id, string $date, ?string $hour = null): ?int
{
$available_providers = $this->providers_model->get_available_providers(true);

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Business_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function save(): void
/**
* Apply global working plan to all providers.
*/
public function apply_global_working_plan()
public function apply_global_working_plan(): void
{
try {
if (cannot('edit', PRIV_SYSTEM_SETTINGS)) {
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/Caldav.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* ---------------------------------------------------------------------------- */

use GuzzleHttp\Exception\GuzzleException;
use Jsvrcek\ICS\Exception\CalendarEventException;

/**
* Caldav controller.
Expand Down Expand Up @@ -87,7 +88,7 @@ public function connect_to_server(): void
*
* @return void
*
* @throws \Jsvrcek\ICS\Exception\CalendarEventException
* @throws CalendarEventException
* @throws Exception
* @throws Throwable
*/
Expand Down
6 changes: 6 additions & 0 deletions application/controllers/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* @since v1.3.2
* ---------------------------------------------------------------------------- */

use Jsvrcek\ICS\Exception\CalendarEventException;

require_once __DIR__ . '/Google.php';
require_once __DIR__ . '/Caldav.php';

Expand Down Expand Up @@ -133,6 +135,10 @@ public function backup(): void
* Usage:
*
* php index.php console sync
*
* @throws CalendarEventException
* @throws Exception
* @throws Throwable
*/
public function sync(): void
{
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct()
* needs to be relatively small, because a lot of API calls might be necessary and this will lead to consuming the
* Google limit for the Calendar API usage.
*/
public static function sync(string $provider_id = null): void
public static function sync(?string $provider_id = null): void
{
try {
/** @var EA_Controller $CI */
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function index(): void
/**
* Installs Easy!Appointments on the server.
*/
public function perform()
public function perform(): void
{
try {
if (is_app_installed()) {
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Recovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function index(): void
/**
* Recover the user password and notify the user via email.
*/
public function perform()
public function perform(): void
{
try {
$username = request('username');
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* ---------------------------------------------------------------------------- */

/*
* This file can only be used in a testing environment and only from the termninal.
* This file can only be used in a testing environment and only from the terminal.
*/

if (ENVIRONMENT !== 'testing' || !is_cli()) {
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function index(): void
*
* @deprecated Since 1.5 Use the Login controller instead.
*/
public function login()
public function login(): void
{
redirect('login');
}
Expand All @@ -54,7 +54,7 @@ public function login()
*
* @deprecated Since 1.5 Use the Logout controller instead.
*/
public function logout()
public function logout(): void
{
redirect('logout');
}
Expand All @@ -64,7 +64,7 @@ public function logout()
*
* @deprecated Since 1.5 Use the Logout controller instead.
*/
public function forgot_password()
public function forgot_password(): void
{
redirect('recovery');
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/api/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/api/v1/Admins_api_v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function index(): void
*
* @param int|null $id Admin ID.
*/
public function show(int $id = null): void
public function show(?int $id = null): void
{
try {
$occurrences = $this->admins_model->get(['id' => $id]);
Expand Down
25 changes: 11 additions & 14 deletions application/controllers/api/v1/Appointments_api_v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,23 @@ public function index(): void
$date = request('date');

if (!empty($date)) {
$where['DATE(start_datetime)'] = (new DateTime($date))->format('Y-m-d');
$where['DATE(start_datetime)'] = new DateTime($date)->format('Y-m-d');
}

// From query param.

$from = request('from');

if (!empty($from)) {
$where['DATE(start_datetime) >='] = (new DateTime($from))->format('Y-m-d');
$where['DATE(start_datetime) >='] = new DateTime($from)->format('Y-m-d');
}

// Till query param.

$till = request('till');

if (!empty($till)) {
$where['DATE(end_datetime) <='] = (new DateTime($till))->format('Y-m-d');
$where['DATE(end_datetime) <='] = new DateTime($till)->format('Y-m-d');
}

// Service ID query param.
Expand Down Expand Up @@ -150,15 +150,12 @@ private function aggregates(array &$appointment): void
if ($aggregates) {
$appointment['service'] = $this->services_model->find(
$appointment['id_services'] ?? ($appointment['serviceId'] ?? null),
true,
);
$appointment['provider'] = $this->providers_model->find(
$appointment['id_users_provider'] ?? ($appointment['providerId'] ?? null),
true,
);
$appointment['customer'] = $this->customers_model->find(
$appointment['id_users_customer'] ?? ($appointment['customerId'] ?? null),
true,
);
$this->services_model->api_encode($appointment['service']);
$this->providers_model->api_encode($appointment['provider']);
Expand All @@ -171,7 +168,7 @@ private function aggregates(array &$appointment): void
*
* @param int|null $id Appointment ID.
*/
public function show(int $id = null): void
public function show(?int $id = null): void
{
try {
$occurrences = $this->appointments_model->get(['id' => $id]);
Expand Down Expand Up @@ -262,15 +259,15 @@ private function calculate_end_datetime(array $appointment): string
* @param array $appointment Appointment data.
* @param string $action Performed action ("store" or "update").
*/
private function notify_and_sync_appointment(array $appointment, string $action = 'store')
private function notify_and_sync_appointment(array $appointment, string $action = 'store'): void
{
$manage_mode = $action === 'update';

$service = $this->services_model->find($appointment['id_services'], true);
$service = $this->services_model->find($appointment['id_services']);

$provider = $this->providers_model->find($appointment['id_users_provider'], true);
$provider = $this->providers_model->find($appointment['id_users_provider']);

$customer = $this->customers_model->find($appointment['id_users_customer'], true);
$customer = $this->customers_model->find($appointment['id_users_customer']);

$settings = [
'company_name' => setting('company_name'),
Expand Down Expand Up @@ -346,11 +343,11 @@ public function destroy(int $id): void

$deleted_appointment = $occurrences[0];

$service = $this->services_model->find($deleted_appointment['id_services'], true);
$service = $this->services_model->find($deleted_appointment['id_services']);

$provider = $this->providers_model->find($deleted_appointment['id_users_provider'], true);
$provider = $this->providers_model->find($deleted_appointment['id_users_provider']);

$customer = $this->customers_model->find($deleted_appointment['id_users_customer'], true);
$customer = $this->customers_model->find($deleted_appointment['id_users_customer']);

$settings = [
'company_name' => setting('company_name'),
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/api/v1/Customers_api_v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function index(): void
*
* @param int|null $id Customer ID.
*/
public function show(int $id = null): void
public function show(?int $id = null): void
{
try {
$occurrences = $this->customers_model->get(['id' => $id]);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/api/v1/Providers_api_v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function index(): void
*
* @param int|null $id Provider ID.
*/
public function show(int $id = null): void
public function show(?int $id = null): void
{
try {
$occurrences = $this->providers_model->get(['id' => $id]);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/api/v1/Secretaries_api_v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function index(): void
*
* @param int|null $id Secretary ID.
*/
public function show(int $id = null): void
public function show(?int $id = null): void
{
try {
$occurrences = $this->secretaries_model->get(['id' => $id]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function index(): void
*
* @param int|null $id Service-category ID.
*/
public function show(int $id = null): void
public function show(?int $id = null): void
{
try {
$occurrences = $this->service_categories_model->get(['id' => $id]);
Expand Down
Loading

0 comments on commit 54529a2

Please sign in to comment.