Files
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

52 lines
1.6 KiB
PHP

<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.plugin.ticket
*/
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
$user_id = api_get_user_id();
if (!isset($_GET['id']) || !isset($_GET['ticket_id'])) {
api_not_allowed(true);
}
$ticket_id = (int) $_GET['ticket_id'];
$ticketInfo = TicketManager::get_ticket_detail_by_id($ticket_id);
if (empty($ticketInfo)) {
api_not_allowed(true);
}
$messageAttachment = TicketManager::getTicketMessageAttachment($_GET['id']);
if (empty($messageAttachment)) {
api_not_allowed(true);
}
if (!api_is_platform_admin()) {
$table_support_messages = Database::get_main_table(TABLE_TICKET_MESSAGE);
$table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
$table_support_message_attachments = Database::get_main_table(TABLE_TICKET_MESSAGE_ATTACHMENTS);
$sql = "SELECT DISTINCT ticket.request_user
FROM $table_support_tickets ticket,
$table_support_messages message,
$table_support_message_attachments attch
WHERE ticket.ticket_id = message.ticket_id
AND attch.message_id = message.message_id
AND ticket.ticket_id = $ticket_id";
$rs = Database::query($sql);
$row_users = Database::fetch_array($rs, 'ASSOC');
$user_request_id = $row_users['request_user'];
if (intval($user_request_id) != $user_id) {
api_not_allowed(true);
}
}
api_download_uploaded_file(
'ticket_attachment',
$ticket_id,
$messageAttachment->getPath(),
$messageAttachment->getFilename()
);
exit;