Joywork/ajax/getEventFiles.php

33 lines
901 B
PHP
Raw Permalink Normal View History

2026-05-22 20:21:54 +02:00
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
if (isset($_GET['event_id'])) {
$get = clearInputData($_GET);
$docs_q = '';
$files = [];
if ($get['from'] == 'clients')
$docs_q = mysql_query("SELECT * FROM clients_files WHERE event_id = '".$get['event_id']."'");
if (!empty($docs_q)) {
while ($file = mysql_fetch_assoc($docs_q)) {
$path = 'https://uf.joywork.ru/upload/clients/'.$file['client_id'].'/'.$file['guid'].'.'.$file['type'];
if ($file['req_id'] > 0)
$path = 'https://uf.joywork.ru/upload/reqs/'.$file['req_id'].'/'.$file['guid'].'.'.$file['type'];
$files[] = [
'guid' => $file['guid'],
'name' => $file['name'],
'type' => $file['type'],
'path' => $path,
];
}
}
echo json_encode($files);
}