2020-04-22 22:48:56 +03:00
|
|
|
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
2018-06-24 20:08:45 +03:00
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
2024-01-01 01:14:38 +03:00
|
|
|
|
* MaketRandevu - MAKET Randevu Portalı
|
2018-06-24 20:08:45 +03:00
|
|
|
|
*
|
|
|
|
|
* @package EasyAppointments
|
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2021-12-18 19:43:45 +03:00
|
|
|
|
* @copyright Copyright (c) Alex Tselegidis
|
2020-11-14 22:36:25 +03:00
|
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
|
* @link https://easyappointments.org
|
2018-06-24 20:08:45 +03:00
|
|
|
|
* @since v1.3.2
|
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
/**
|
2021-11-06 18:21:27 +03:00
|
|
|
|
* Privacy controller.
|
2021-10-28 15:01:17 +03:00
|
|
|
|
*
|
|
|
|
|
* Handles the privacy related operations.
|
2018-06-24 20:08:45 +03:00
|
|
|
|
*
|
|
|
|
|
* @package Controllers
|
|
|
|
|
*/
|
2023-11-29 12:24:09 +03:00
|
|
|
|
class Privacy extends EA_Controller
|
|
|
|
|
{
|
2020-12-05 12:55:09 +03:00
|
|
|
|
/**
|
2021-11-06 18:21:27 +03:00
|
|
|
|
* Privacy constructor.
|
2020-12-05 12:55:09 +03:00
|
|
|
|
*/
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
2020-12-09 15:55:27 +03:00
|
|
|
|
parent::__construct();
|
2021-10-28 15:01:17 +03:00
|
|
|
|
|
2020-12-05 12:55:09 +03:00
|
|
|
|
$this->load->driver('cache', ['adapter' => 'file']);
|
2021-10-28 15:01:17 +03:00
|
|
|
|
|
2020-12-05 12:55:09 +03:00
|
|
|
|
$this->load->model('customers_model');
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-24 20:08:45 +03:00
|
|
|
|
/**
|
2021-10-28 15:01:17 +03:00
|
|
|
|
* Remove all customer data (including appointments) from the system.
|
2018-06-24 20:08:45 +03:00
|
|
|
|
*/
|
2022-01-17 21:44:44 +03:00
|
|
|
|
public function delete_personal_information()
|
2018-06-24 20:08:45 +03:00
|
|
|
|
{
|
2023-11-29 12:24:09 +03:00
|
|
|
|
try {
|
2022-01-24 17:31:42 +03:00
|
|
|
|
$display_delete_personal_information = setting('display_delete_personal_information');
|
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
|
if (!$display_delete_personal_information) {
|
2022-01-24 17:31:42 +03:00
|
|
|
|
abort(403, 'Forbidden');
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-28 15:01:17 +03:00
|
|
|
|
$customer_token = request('customer_token');
|
2018-06-24 20:08:45 +03:00
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
|
if (empty($customer_token)) {
|
2018-06-24 20:08:45 +03:00
|
|
|
|
throw new InvalidArgumentException('Invalid customer token value provided.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$customer_id = $this->cache->get('customer-token-' . $customer_token);
|
|
|
|
|
|
2023-11-29 12:24:09 +03:00
|
|
|
|
if (empty($customer_id)) {
|
|
|
|
|
throw new InvalidArgumentException(
|
2023-12-22 13:35:41 +03:00
|
|
|
|
'Customer ID does not exist, please reload the page ' . 'and try again.',
|
2023-11-29 12:24:09 +03:00
|
|
|
|
);
|
2018-06-24 20:08:45 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->customers_model->delete($customer_id);
|
|
|
|
|
|
2021-10-28 15:01:17 +03:00
|
|
|
|
json_response([
|
2023-12-22 13:35:41 +03:00
|
|
|
|
'success' => true,
|
2021-10-28 15:01:17 +03:00
|
|
|
|
]);
|
2023-11-29 12:24:09 +03:00
|
|
|
|
} catch (Throwable $e) {
|
2021-10-28 15:01:17 +03:00
|
|
|
|
json_exception($e);
|
2018-06-24 20:08:45 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|