This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/pm_triggers/main.php
thoughever f15407bc75 X-Real-IP support and Varnish PURGE config options
X-Real-IP for core functionality

Global config define REVERSE_PROXY_X_HEADERS

Config host and port for varnish PURGE

config option to specify PURGE protocol

exception in curl purge now shows error code

ipv6 x-real-ip addresses are now validated properly

X-Forwarded-Proto enabled by define
2022-01-20 22:25:22 +00:00

27 lines
612 B
PHP

<?php
declare(strict_types=1);
class PMTrigger extends Extension
{
public function onImageDeletion(ImageDeletionEvent $event)
{
$this->send(
$event->image->owner_id,
"[System] A post you uploaded has been deleted",
"Post le gone~ (#{$event->image->id}, {$event->image->get_tag_list()})"
);
}
private function send($to_id, $subject, $body)
{
global $user;
send_event(new SendPMEvent(new PM(
$user->id,
get_real_ip(),
$to_id,
$subject,
$body
)));
}
}