commit
08acfd2ac4
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user