Commit 5c621367 authored by Tino Goratsch's avatar Tino Goratsch

Merge branch 'release/v4.8.0'

parents 2b24ea61 c7dcd8fd
/.idea
/.php_cs
/.php_cs.cache
/ACP3/config.yml
/build/logs/
/cache/*
......
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('ACP3/Modules/ACP3/Filemanager/libraries')
->exclude('build')
->exclude('cache')
->exclude('designs')
->exclude('node_modules')
->exclude('uploads')
->exclude('vendor')
->in(__DIR__);
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder)
;
<?php
namespace ACP3\Core\ACL\Model\Repository;
interface UserRoleRepositoryInterface
{
/**
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Application;
use ACP3\Core\Application\BootstrapCache\Event\Listener\UserContextSubscriber;
use ACP3\Core\Session\SessionHandlerInterface;
use ACP3\Core\View\Renderer\Smarty\Filters\MoveToBottom;
......@@ -35,7 +34,7 @@ class BootstrapCache extends EventDispatchingHttpCache
HttpKernelInterface $kernel,
StoreInterface $store,
SurrogateInterface $surrogate = null,
array $options = array())
array $options = [])
{
parent::__construct($kernel, $store, $surrogate, $options);
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Application\BootstrapCache;
class Esi extends \Symfony\Component\HttpKernel\HttpCache\Esi
{
}
......@@ -127,7 +127,7 @@ class UserContextSubscriber implements EventSubscriberInterface
$hashLookupRequest->cookies->set(AuthenticationModel::AUTH_NAME, $authCookie);
}
$sessionIds = array();
$sessionIds = [];
foreach ($originalRequest->cookies as $name => $value) {
if ($this->isSessionName($name)) {
$sessionIds[$name] = $value;
......
......@@ -14,7 +14,7 @@ interface BootstrapInterface extends HttpKernelInterface
/**
* Contains the current ACP3 version string
*/
const VERSION = '4.7.1';
const VERSION = '4.8.0';
/**
* Performs some startup checks
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Application\Event;
use Symfony\Component\HttpFoundation\Response;
class ControllerActionAfterDispatchEvent extends ControllerActionBeforeDispatchEvent
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Application\Event\Listener;
use ACP3\Core\Application\Event\ControllerActionAfterDispatchEvent;
use ACP3\Core\Controller\AreaEnum;
use ACP3\Core\Http\Request;
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Assets\Event;
use ACP3\Core\Assets\Libraries;
use Symfony\Component\EventDispatcher\Event;
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Assets;
use ACP3\Core\Assets\Event\AddLibraryEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
......
......@@ -12,5 +12,4 @@ namespace ACP3\Core\Authentication\Exception;
*/
class AuthenticationException extends \Exception
{
}
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Breadcrumb\Event;
use ACP3\Core\Breadcrumb\Title;
use Symfony\Component\EventDispatcher\Event;
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Breadcrumb\Event;
use ACP3\Core\Breadcrumb\Steps;
use Symfony\Component\EventDispatcher\Event;
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Cache;
use ACP3\Core\Environment\ApplicationMode;
use ACP3\Core\Environment\ApplicationPath;
use Symfony\Component\DependencyInjection\ContainerInterface;
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Cache;
use ACP3\Core\Filesystem;
/**
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Controller\Event;
use ACP3\Core\View;
use Symfony\Component\EventDispatcher\Event;
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Enum;
use ReflectionClass;
class BaseEnum
......
......@@ -69,7 +69,7 @@ class ErrorHandler
/**
* @param \Exception $e
*/
public function handleException( $e)
public function handleException($e)
{
$this->logger->error('exception', $e);
......
......@@ -6,7 +6,6 @@
namespace ACP3\Core\Helpers;
use ACP3\Core\Settings\SettingsInterface;
use ACP3\Modules\ACP3\System\Installer\Schema;
......
......@@ -25,7 +25,7 @@ class SendEmail
/**
* Generates and sends an E-mail
*
* @param string $recipientName
* @param string|Core\Mailer\MailerMessage $recipientName
* @param string $recipientEmail
* @param string $from
* @param string $subject
......@@ -33,9 +33,23 @@ class SendEmail
* @param string $mailSignature
*
* @return bool
* @deprecated since version 4.8.0, to be removed with version 5.0.0. Use the 'core.mailer' service directly instead
*/
public function execute($recipientName, $recipientEmail, $from, $subject, $body, $mailSignature = '')
{
public function execute(
$recipientName,
$recipientEmail = '',
$from = '',
$subject = '',
$body = '',
$mailSignature = ''
) {
if ($recipientName instanceof Core\Mailer\MailerMessage) {
return $this->mailer
->reset()
->setData($recipientName)
->send();
}
if (!empty($recipientName)) {
$to = [
'name' => $recipientName,
......
......@@ -3,6 +3,7 @@
namespace ACP3\Core;
use ACP3\Core\Helpers\StringFormatter;
use ACP3\Core\Mailer\MailerMessage;
use ACP3\Core\Settings\SettingsInterface;
use ACP3\Modules\ACP3\System\Installer\Schema;
use InlineStyle\InlineStyle;
......@@ -97,6 +98,7 @@ class Mailer
* @param string|array $from
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setFrom($from)
{
......@@ -109,6 +111,7 @@ class Mailer
* @param string $mailSignature
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setMailSignature($mailSignature)
{
......@@ -121,6 +124,7 @@ class Mailer
* @param string $htmlText
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setHtmlBody($htmlText)
{
......@@ -133,6 +137,7 @@ class Mailer
* @param string $urlWeb
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setUrlWeb($urlWeb)
{
......@@ -145,6 +150,7 @@ class Mailer
* @param bool $bcc
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setBcc($bcc)
{
......@@ -157,6 +163,7 @@ class Mailer
* @param string $subject
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setSubject($subject)
{
......@@ -169,6 +176,7 @@ class Mailer
* @param string $body
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setBody($body)
{
......@@ -181,6 +189,7 @@ class Mailer
* @param array|string $recipients
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setRecipients($recipients)
{
......@@ -193,6 +202,7 @@ class Mailer
* @param string $attachment
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setAttachments($attachment)
{
......@@ -205,6 +215,7 @@ class Mailer
* @param string $template
*
* @return $this
* @deprecated since version 4.8.0, to be removed with version 5.0.0
*/
public function setTemplate($template)
{
......@@ -213,6 +224,26 @@ class Mailer
return $this;
}
/**
* @param MailerMessage $data
* @return $this
*/
public function setData(MailerMessage $data)
{
$this
->setAttachments($data->getAttachments())
->setBody($data->getBody())
->setFrom($data->getFrom())
->setHtmlBody($data->getHtmlBody())
->setMailSignature($data->getMailSignature())
->setRecipients($data->getRecipients())
->setSubject($data->getSubject())
->setTemplate($data->getTemplate())
->setUrlWeb($data->getUrlWeb());
return $this;
}
/**
* Sends the email
*
......@@ -269,11 +300,11 @@ class Mailer
*/
private function generateBody()
{
if (!empty($this->htmlBody) && !empty($this->template)) {
if (!empty($this->template)) {
$mail = [
'charset' => 'UTF-8',
'title' => $this->subject,
'body' => $this->htmlBody,
'body' => !empty($this->htmlBody) ? $this->htmlBody : $this->stringFormatter->nl2p($this->body),
'signature' => $this->getHtmlSignature(),
'url_web_view' => $this->urlWeb
];
......@@ -288,8 +319,10 @@ class Mailer
if (!empty($this->body)) {
$this->phpMailer->AltBody = $this->decodeHtmlEntities($this->body . $this->getTextSignature());
} else {
$this->phpMailer->AltBody = $this->phpMailer->html2text($this->htmlBody . $this->getHtmlSignature(),
true);
$this->phpMailer->AltBody = $this->phpMailer->html2text(
$this->htmlBody . $this->getHtmlSignature(),
true
);
}
} else {
$this->phpMailer->Body = $this->decodeHtmlEntities($this->body . $this->getTextSignature());
......@@ -365,7 +398,7 @@ class Mailer
private function addRecipients($recipients, $bcc = false)
{
if (is_array($recipients) === true) {
if (empty($recipients['email']) === false && empty($recipients['name']) === false) {
if (isset($recipients['email'], $recipients['name']) === true) {
$this->addRecipient($recipients['email'], $recipients['name'], $bcc);
} else {
foreach ($recipients as $recipient) {
......
<?php
/**
* Copyright (c) 2017 by the ACP3 Developers.
* See the LICENCE file at the top-level module directory for licencing details.
*/
namespace ACP3\Core\Mailer;
class MailerMessage
{
/**
* @var string
*/
private $subject = '';
/**
* @var string
*/
private $body = '';
/**
* @var string
*/
private $htmlBody = '';
/**
* @var string
*/
private $urlWeb = '';
/**
* @var string
*/
private $mailSignature = '';
/**
* @var string|array
*/
private $from;
/**
* @var string|array
*/
private $recipients;
/**
* @var bool
*/
private $bcc = false;
/**
* @var array
*/
private $attachments = [];
/**
* @var string
*/
private $template = '';
/**
* @return string
*/
public function getSubject()
{
return $this->subject;
}
/**
* @param string $subject
* @return MailerMessage
*/
public function setSubject($subject)
{
$this->subject = $subject;
return $this;
}
/**
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* @param string $body
* @return MailerMessage
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
/**
* @return string
*/
public function getHtmlBody()
{
return $this->htmlBody;
}
/**
* @param string $htmlBody
* @return $this
*/
public function setHtmlBody($htmlBody)
{
$this->htmlBody = $htmlBody;
return $this;
}
/**
* @return string
*/
public function getUrlWeb()
{
return $this->urlWeb;
}
/**
* @param string $urlWeb
* @return $this
*/
public function setUrlWeb($urlWeb)
{
$this->urlWeb = $urlWeb;
return $this;
}
/**
* @return string
*/
public function getMailSignature()
{
return $this->mailSignature;
}
/**
* @param string $mailSignature
* @return $this
*/
public function setMailSignature($mailSignature)
{
$this->mailSignature = $mailSignature;
return $this;
}
/**
* @return array|string
*/
public function getFrom()
{
return $this->from;
}
/**
* @param array|string $from
* @return $this
*/
public function setFrom($from)
{
$this->from = $from;
return $this;
}
/**
* @return array|string
*/
public function getRecipients()
{
return $this->recipients;
}
/**
* @param array|string $recipients
* @return $this
*/
public function setRecipients($recipients)
{
$this->recipients = $recipients;
return $this;
}
/**
* @return bool
*/
public function isBcc()
{
return $this->bcc;
}
/**
* @param bool $bcc
* @return $this
*/
public function setBcc($bcc)
{
$this->bcc = $bcc;
return $this