2020-01-26 19:23:58 +00:00
|
|
|
<?php
|
2020-02-09 14:45:35 +00:00
|
|
|
/**
|
|
|
|
* @copyright Copyright (C) 2020, Friendica
|
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
2020-01-26 19:23:58 +00:00
|
|
|
|
|
|
|
namespace Friendica\Addon\notifyall;
|
|
|
|
|
|
|
|
use Friendica\App\BaseURL;
|
|
|
|
use Friendica\Content\Text\BBCode;
|
2021-10-26 19:44:28 +00:00
|
|
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
2020-01-26 19:23:58 +00:00
|
|
|
use Friendica\Core\L10n;
|
2023-07-16 10:37:33 +00:00
|
|
|
use Friendica\Model\User;
|
2020-01-26 22:47:15 +00:00
|
|
|
use Friendica\Object\Email;
|
2020-01-26 19:23:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class for creating a Notify-All EMail
|
|
|
|
*/
|
2020-01-26 22:47:15 +00:00
|
|
|
class NotifyAllEmail extends Email
|
2020-01-26 19:23:58 +00:00
|
|
|
{
|
2021-10-26 19:44:28 +00:00
|
|
|
public function __construct(L10n $l10n, IManageConfigValues $config, BaseURL $baseUrl, string $text)
|
2020-01-26 19:23:58 +00:00
|
|
|
{
|
|
|
|
$sitename = $config->get('config', 'sitename');
|
|
|
|
|
|
|
|
if (empty($config->get('config', 'admin_name'))) {
|
|
|
|
$sender_name = '"' . $l10n->t('%s Administrator', $sitename) . '"';
|
|
|
|
} else {
|
|
|
|
$sender_name = '"' . $l10n->t('%1$s, %2$s Administrator', $config->get('config', 'admin_name'), $sitename) . '"';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$config->get('config', 'sender_email')) {
|
2023-02-18 19:57:09 +00:00
|
|
|
$sender_email = 'noreply@' . $baseUrl->getHost();
|
2020-01-26 19:23:58 +00:00
|
|
|
} else {
|
|
|
|
$sender_email = $config->get('config', 'sender_email');
|
|
|
|
}
|
|
|
|
|
|
|
|
$subject = $_REQUEST['subject'];
|
|
|
|
|
2023-07-16 10:37:33 +00:00
|
|
|
$textversion = strip_tags(html_entity_decode(BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "\n"], $text))), ENT_QUOTES, 'UTF-8'));
|
2020-01-26 19:23:58 +00:00
|
|
|
|
2023-07-16 10:37:33 +00:00
|
|
|
$htmlversion = BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "<br />\n"], $text)));
|
2020-01-26 19:23:58 +00:00
|
|
|
|
|
|
|
parent::__construct($sender_name, $sender_email, $sender_email, '', $subject, $htmlversion, $textversion);
|
|
|
|
}
|
|
|
|
}
|