1<?php 2 3 4namespace dokuwiki\Subscriptions; 5 6 7class MediaSubscriptionSender extends SubscriptionSender 8{ 9 10 /** 11 * Send the diff for some media change 12 * 13 * @fixme this should embed thumbnails of images in HTML version 14 * 15 * @param string $subscriber_mail The target mail address 16 * @param string $template Mail template ('uploadmail', ...) 17 * @param string $id Media file for which the notification is 18 * @param int|bool $rev Old revision if any 19 */ 20 public function sendMediaDiff($subscriber_mail, $template, $id, $rev = false) 21 { 22 global $conf; 23 24 $file = mediaFN($id); 25 list($mime, /* $ext */) = mimetype($id); 26 27 $trep = [ 28 'MIME' => $mime, 29 'MEDIA' => ml($id, '', true, '&', true), 30 'SIZE' => filesize_h(filesize($file)), 31 ]; 32 33 if ($rev && $conf['mediarevisions']) { 34 $trep['OLD'] = ml($id, "rev=$rev", true, '&', true); 35 } else { 36 $trep['OLD'] = '---'; 37 } 38 39 $headers = ['Message-Id' => $this->getMessageID($id, @filemtime($file))]; 40 if ($rev) { 41 $headers['In-Reply-To'] = $this->getMessageID($id, $rev); 42 } 43 44 $this->send($subscriber_mail, 'upload', $id, $template, $trep, null, $headers); 45 } 46} 47