Merge branch 'image2post'

This commit is contained in:
Shish
2020-10-27 22:42:47 +00:00
112 changed files with 377 additions and 376 deletions

View File

@ -560,7 +560,7 @@ EOD;
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
return "
Images &copy; their respective owners,
Media &copy; their respective owners,
<a href=\"https://code.shishnet.org/shimmie2/\">Shimmie</a> &copy;
<a href=\"https://www.shishnet.org/\">Shish</a> &amp;
<a href=\"https://github.com/shish/shimmie2/graphs/contributors\">The Team</a>

View File

@ -313,17 +313,17 @@ abstract class DataHandlerExtension extends Extension
$existing = Image::by_id($event->replace_id);
if (is_null($existing)) {
throw new UploadException("Image to replace does not exist!");
throw new UploadException("Post to replace does not exist!");
}
if ($existing->hash === $event->metadata['hash']) {
throw new UploadException("The uploaded image is the same as the one to replace.");
throw new UploadException("The uploaded post is the same as the one to replace.");
}
// even more hax..
$event->metadata['tags'] = $existing->get_tag_list();
$image = $this->create_image_from_data(warehouse_path(Image::IMAGE_DIR, $event->metadata['hash']), $event->metadata);
if (is_null($image)) {
throw new UploadException("Data handler failed to create image object from data");
throw new UploadException("Data handler failed to create post object from data");
}
if (empty($image->get_mime())) {
throw new UploadException("Unable to determine MIME for ". $event->tmpname);
@ -339,7 +339,7 @@ abstract class DataHandlerExtension extends Extension
} else {
$image = $this->create_image_from_data(warehouse_path(Image::IMAGE_DIR, $event->hash), $event->metadata);
if (is_null($image)) {
throw new UploadException("Data handler failed to create image object from data");
throw new UploadException("Data handler failed to create post object from data");
}
if (empty($image->get_mime())) {
throw new UploadException("Unable to determine MIME for ". $event->tmpname);

View File

@ -396,7 +396,7 @@ class Image
SET owner_id=:owner_id
WHERE id=:id
", ["owner_id"=>$owner->id, "id"=>$this->id]);
log_info("core_image", "Owner for Image #{$this->id} set to {$owner->name}");
log_info("core_image", "Owner for Post #{$this->id} set to {$owner->name}");
}
}
@ -648,7 +648,7 @@ class Image
}
if ($new_source != $old_source) {
$database->execute("UPDATE images SET source=:source WHERE id=:id", ["source"=>$new_source, "id"=>$this->id]);
log_info("core_image", "Source for Image #{$this->id} set to: $new_source (was $old_source)");
log_info("core_image", "Source for Post #{$this->id} set to: $new_source (was $old_source)");
}
}
@ -665,7 +665,7 @@ class Image
global $database;
if ($locked !== $this->locked) {
$database->execute("UPDATE images SET locked=:yn WHERE id=:id", ["yn"=>$locked, "id"=>$this->id]);
log_info("core_image", "Setting Image #{$this->id} lock to: $locked");
log_info("core_image", "Setting Post #{$this->id} lock to: $locked");
}
}
@ -782,7 +782,7 @@ class Image
);
}
log_info("core_image", "Tags for Image #{$this->id} set to: ".Tag::implode($tags));
log_info("core_image", "Tags for Post #{$this->id} set to: ".Tag::implode($tags));
$cache->delete("image-{$this->id}-tags");
}
}
@ -795,7 +795,7 @@ class Image
global $database;
$this->delete_tags_from_image();
$database->execute("DELETE FROM images WHERE id=:id", ["id"=>$this->id]);
log_info("core_image", 'Deleted Image #'.$this->id.' ('.$this->hash.')');
log_info("core_image", 'Deleted Post #'.$this->id.' ('.$this->hash.')');
unlink($this->get_image_filename());
unlink($this->get_thumb_filename());
@ -807,7 +807,7 @@ class Image
*/
public function remove_image_only(): void
{
log_info("core_image", 'Removed Image File ('.$this->hash.')');
log_info("core_image", 'Removed Post File ('.$this->hash.')');
@unlink($this->get_image_filename());
@unlink($this->get_thumb_filename());
}