mirror of
https://github.com/itflow-org/itflow
synced 2026-11-19 10:57:24 +00:00
30 lines
1.1 KiB
PHP
30 lines
1.1 KiB
PHP
<?php
|
|
/*
|
|
* API - Calendars - Read
|
|
* GET /api/v1/calendars/read.php
|
|
*
|
|
* The calendars events go on (Admin > Calendars) - their ids, names and colours.
|
|
* Not their subscription links, which are an admin's.
|
|
*
|
|
* calendar_id optional - Just this calendar
|
|
* archived optional - 1 to include archived calendars
|
|
*/
|
|
|
|
require_once '../validate_api_key.php';
|
|
require_once '../require_get_method.php';
|
|
require_once "../../../includes/load_global_settings.php";
|
|
|
|
// Calendar switched off (Admin > Settings > Modules)
|
|
if (!moduleOn('calendar')) {
|
|
http_response_code(403);
|
|
echo json_encode(['success' => 'False', 'message' => moduleOffText('calendar')]);
|
|
exit();
|
|
}
|
|
|
|
$where = isset($_GET['calendar_id']) ? 'calendar_id = ' . intval($_GET['calendar_id']) : (!empty($_GET['archived']) ? '1 = 1' : 'calendar_archived_at IS NULL');
|
|
|
|
$sql = mysqli_query($mysqli, "SELECT calendar_id, calendar_name, calendar_color, calendar_created_at, calendar_updated_at, calendar_archived_at FROM calendars WHERE $where ORDER BY calendar_name");
|
|
|
|
// Output
|
|
require_once "../read_output.php";
|