uploads: add source_url field

This commit is contained in:
E. S. 2025-02-08 04:02:14 +03:00
parent 7eae81acb0
commit 7361b3005f

View File

@ -19,7 +19,7 @@ class uploads {
return in_array($ext, UPLOADS_ALLOWED_EXTENSIONS); return in_array($ext, UPLOADS_ALLOWED_EXTENSIONS);
} }
static function add(string $tmp_name, string $name, string $note_en, string $note_ru): ?int { static function add(string $tmp_name, string $name, string $note_en, string $note_ru, string $source_url = ''): ?int {
global $config; global $config;
$name = sanitize_filename($name); $name = sanitize_filename($name);
@ -47,6 +47,7 @@ class uploads {
'note_ru' => $note_ru, 'note_ru' => $note_ru,
'note_en' => $note_en, 'note_en' => $note_en,
'downloads' => 0, 'downloads' => 0,
'source_url' => $source_url,
])) { ])) {
return null; return null;
} }
@ -166,6 +167,7 @@ class Upload extends model {
public int $imageH; public int $imageH;
public string $noteRu; public string $noteRu;
public string $noteEn; public string $noteEn;
public string $sourceUrl;
function getDirectory(): string { function getDirectory(): string {
global $config; global $config;