]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Site.php
Merge pull request #8272 from MrPetovan/bug/8254-regex-url-img
[friendica.git] / src / Module / Admin / Site.php
index 7cb3a9b8f7f07443d2d4c1cd3cde855eaf726d27..ec6f01afa0689d78dab38d02a97311d5afebc41e 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @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/>.
+ *
+ */
 
 namespace Friendica\Module\Admin;
 
@@ -13,6 +32,7 @@ use Friendica\Module\BaseAdmin;
 use Friendica\Module\Register;
 use Friendica\Protocol\PortableContact;
 use Friendica\Util\BasePath;
+use Friendica\Util\EMailer\MailBuilder;
 use Friendica\Util\Strings;
 use Friendica\Worker\Delivery;
 
@@ -110,6 +130,7 @@ class Site extends BaseAdmin
                $sitename         = (!empty($_POST['sitename'])         ? Strings::escapeTags(trim($_POST['sitename']))      : '');
                $sender_email     = (!empty($_POST['sender_email'])     ? Strings::escapeTags(trim($_POST['sender_email']))  : '');
                $banner           = (!empty($_POST['banner'])           ? trim($_POST['banner'])                             : false);
+               $email_banner     = (!empty($_POST['email_banner'])     ? trim($_POST['email_banner'])                       : false);
                $shortcut_icon    = (!empty($_POST['shortcut_icon'])    ? Strings::escapeTags(trim($_POST['shortcut_icon'])) : '');
                $touch_icon       = (!empty($_POST['touch_icon'])       ? Strings::escapeTags(trim($_POST['touch_icon']))    : '');
                $additional_info  = (!empty($_POST['additional_info'])  ? trim($_POST['additional_info'])                    : '');
@@ -301,6 +322,12 @@ class Site extends BaseAdmin
                        DI::config()->set('system', 'banner', $banner);
                }
 
+               if (empty($email_banner)) {
+                       DI::config()->delete('system', 'email_banner');
+               } else {
+                       DI::config()->set('system', 'email_banner', $email_banner);
+               }
+
                if (empty($additional_info)) {
                        DI::config()->delete('config', 'info');
                } else {
@@ -489,6 +516,12 @@ class Site extends BaseAdmin
                        $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
                }
 
+               $email_banner = DI::config()->get('system', 'email_banner');
+
+               if ($email_banner == false) {
+                       $email_banner = MailBuilder::DEFAULT_EMAIL_BANNER;
+               }
+
                $additional_info = DI::config()->get('config', 'info');
 
                // Automatically create temporary paths
@@ -542,6 +575,13 @@ class Site extends BaseAdmin
                if (!is_null($current_storage_backend) && $current_storage_backend != '') {
                        foreach ($current_storage_backend->getOptions() as $name => $info) {
                                $type = $info[0];
+                               // Backward compatibilty with yesno field description
+                               if ($type == 'yesno') {
+                                       $type = 'checkbox';
+                                       // Remove translated labels Yes No from field info
+                                       unset($info[4]);
+                               }
+
                                $info[0] = $storage_form_prefix . '_' . $name;
                                $info['type'] = $type;
                                $info['field'] = 'field_' . $type . '.tpl';
@@ -571,6 +611,7 @@ class Site extends BaseAdmin
                        '$sitename'         => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''],
                        '$sender_email'     => ['sender_email', DI::l10n()->t('Sender Email'), DI::config()->get('config', 'sender_email'), DI::l10n()->t('The email address your server shall use to send notification emails from.'), '', '', 'email'],
                        '$banner'           => ['banner', DI::l10n()->t('Banner/Logo'), $banner, ''],
+                       '$email_banner'     => ['email_banner', DI::l10n()->t('Email Banner/Logo'), $email_banner, ''],
                        '$shortcut_icon'    => ['shortcut_icon', DI::l10n()->t('Shortcut icon'), DI::config()->get('system', 'shortcut_icon'), DI::l10n()->t('Link to an icon that will be used for browsers.')],
                        '$touch_icon'       => ['touch_icon', DI::l10n()->t('Touch icon'), DI::config()->get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')],
                        '$additional_info'  => ['additional_info', DI::l10n()->t('Additional Info'), $additional_info, DI::l10n()->t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())],