Snog
Well-known member
- Affected version
- 2.0.2
XFMG\Attachment\Media.php->Function onAssociation contains this...
Which is all fine and dandy, but XFMG\Service\Watermarker.php->function watermark contains this...
Which overrides the
This may or may not be associated with the permission problem I reported here...
https://xenforo.com/community/threads/permission-problem.143236/
EDIT: I would suggest that any permission checks be done in the functions calling the service. Not in the service itself.
Code:
if ($container->canAddWatermark(false) && !$container->canAddMediaWithoutWatermark())
{
$mediaRepo = \XF::repository('XFMG:Media');
$watermarkPath = $mediaRepo->getAbstractedWatermarkPath($options->xfmgWatermarking['watermark_hash']);
if (\XF::app()->fs()->has($watermarkPath))
{
$tempWatermark = \XF\Util\File::copyAbstractedPathToTempFile($watermarkPath);
/** @var \XFMG\Service\Media\Watermarker $watermarker */
$watermarker = \XF::service('XFMG:Media\Watermarker', $container, $tempWatermark);
$watermarker->watermark();
}
}
Which is all fine and dandy, but XFMG\Service\Watermarker.php->function watermark contains this...
Code:
if (!$this->canWatermark())
{
return false;
}
Which overrides the
$container->canAddWatermark(false)
and checks permissions before watermarking a new upload which can lead to an upload not being watermarked in some cases.This may or may not be associated with the permission problem I reported here...
https://xenforo.com/community/threads/permission-problem.143236/
EDIT: I would suggest that any permission checks be done in the functions calling the service. Not in the service itself.
Last edited: