Merge pull request #695 from sanmadjack/pull

Bugfixes
This commit is contained in:
Shish 2020-02-24 15:01:04 +00:00 committed by GitHub
commit 08acfd2ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 2 deletions

View File

@ -107,6 +107,7 @@ class Image
public static function by_hash(string $hash): ?Image public static function by_hash(string $hash): ?Image
{ {
global $database; global $database;
$hash = strtolower($hash);
$row = $database->get_row("SELECT images.* FROM images WHERE hash=:hash", ["hash"=>$hash]); $row = $database->get_row("SELECT images.* FROM images WHERE hash=:hash", ["hash"=>$hash]);
return ($row ? new Image($row) : null); return ($row ? new Image($row) : null);
} }

View File

@ -67,6 +67,10 @@ class SVGFileHandler extends DataHandlerExtension
protected function check_contents(string $file): bool protected function check_contents(string $file): bool
{ {
if (getMimeType($file)!="image/svg+xml") {
return false;
}
$msp = new MiniSVGParser($file); $msp = new MiniSVGParser($file);
return bool_escape($msp->valid); return bool_escape($msp->valid);
} }

View File

@ -180,11 +180,13 @@ class ImageIO extends Extension
throw new ImageReplaceException($error); throw new ImageReplaceException($error);
} }
if (strlen(trim($image->source)) == 0) { if (strlen(trim($image->source ?? '')) == 0) {
$image->source = $existing->get_source(); $image->source = $existing->get_source();
} }
// Update the data in the database. // Update the data in the database.
$image->id = $id;
send_event(new MediaCheckPropertiesEvent($image));
$image->save_to_db(); $image->save_to_db();
/* /*

View File

@ -72,7 +72,7 @@ class Themelet extends BaseThemelet
$pages = []; $pages = [];
foreach (range($start, $end) as $i) { foreach (range($start, $end) as $i) {
$pages[] = $this->litetheme_gen_page_link_block($base_url, $query, $i, $current_page, $i); $pages[] = $this->litetheme_gen_page_link_block($base_url, $query, $i, $current_page, strval($i));
} }
$pages_html = implode(" ", $pages); $pages_html = implode(" ", $pages);