1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

Apply inc/display.php@0a2dfed from vichan/infinity

This commit is contained in:
Fred Brennan 2023-01-24 02:31:19 -05:00 committed by Fredrick Brennan
parent 491f71ce3a
commit a69337e243

View File

@ -348,8 +348,18 @@ class Post {
$this->{$key} = $value; $this->{$key} = $value;
} }
if (isset($this->files) && $this->files) if (isset($this->files) && $this->files) {
$this->files = @json_decode($this->files); $this->files = is_string($this->files) ? json_decode($this->files) : $this->files;
// Compatibility for posts before individual file hashing
foreach ($this->files as $i => &$file) {
if (empty($file)) {
unset($this->files[$i]);
continue;
}
if (!isset($file->hash))
$file->hash = $this->filehash;
}
}
$this->subject = utf8tohtml($this->subject); $this->subject = utf8tohtml($this->subject);
$this->name = utf8tohtml($this->name); $this->name = utf8tohtml($this->name);
@ -399,7 +409,7 @@ class Thread {
} }
if (isset($this->files)) if (isset($this->files))
$this->files = @json_decode($this->files); $this->files = is_string($this->files) ? json_decode($this->files) : $this->files;
$this->subject = utf8tohtml($this->subject); $this->subject = utf8tohtml($this->subject);
$this->name = utf8tohtml($this->name); $this->name = utf8tohtml($this->name);