Commit 6caafa83 authored by Tino Goratsch's avatar Tino Goratsch

moved the site title from the SEO module to the system module

parent 11f4b42a
......@@ -70,10 +70,10 @@ class ContactFormModel
*/
protected function sendEmail(array $formData)
{
$seoSettings = $this->getSeoSettings();
$systemSettings = $this->getSystemSettings();
$settings = $this->getContactSettings();
$subject = $this->buildSubject('contact_subject', $seoSettings['title']);
$subject = $this->buildSubject('contact_subject', $systemSettings['site_title']);
$body = $this->buildEmailBody($formData, 'contact_body');
return $this->sendEmail->execute(
......@@ -88,9 +88,9 @@ class ContactFormModel
/**
* @return array
*/
protected function getSeoSettings()
protected function getSystemSettings()
{
return $this->config->getSettings(\ACP3\Modules\ACP3\Seo\Installer\Schema::MODULE_NAME);
return $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME);
}
/**
......@@ -135,10 +135,10 @@ class ContactFormModel
*/
protected function sendEmailCopy(array $formData)
{
$seoSettings = $this->getSeoSettings();
$systemSettings = $this->getSystemSettings();
$settings = $this->getContactSettings();
$subject = $this->buildSubject('sender_subject', $seoSettings['title']);
$subject = $this->buildSubject('sender_subject', $systemSettings['site_title']);
$body = $this->buildEmailBody($formData, 'sender_body');
return $this->sendEmail->execute(
......
......@@ -8,7 +8,7 @@ namespace ACP3\Modules\ACP3\Feeds\Controller\Frontend\Index;
use ACP3\Core;
use ACP3\Modules\ACP3\Feeds;
use ACP3\Modules\ACP3\Seo\Installer\Schema;
use ACP3\Modules\ACP3\System\Installer\Schema;
/**
* Class Index
......@@ -46,11 +46,11 @@ class Index extends Core\Controller\AbstractFrontendAction
{
if ($this->acl->hasPermission('frontend/' . $feed) === true) {
$this->setCacheResponseCacheable(
$this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME)['cache_lifetime']
$this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']
);
$this->feedGenerator
->setTitle($this->config->getSettings(Schema::MODULE_NAME)['title'])
->setTitle($this->config->getSettings(Schema::MODULE_NAME)['site_title'])
->setDescription($this->translator->t($feed, $feed));
$this->eventDispatcher->dispatch(
......
......@@ -8,7 +8,7 @@ namespace ACP3\Modules\ACP3\Guestbook\Controller\Frontend\Index;
use ACP3\Core;
use ACP3\Modules\ACP3\Guestbook;
use ACP3\Modules\ACP3\Newsletter;
use ACP3\Modules\ACP3\Seo\Installer\Schema;
use ACP3\Modules\ACP3\System\Installer\Schema;
/**
* Class Create
......@@ -98,7 +98,7 @@ class Create extends AbstractAction
1 => $this->translator->t(
'guestbook',
'subscribe_to_newsletter',
['%title%' => $this->config->getSettings(Schema::MODULE_NAME)['title']]
['%title%' => $this->config->getSettings(Schema::MODULE_NAME)['site_title']]
)
];
$this->view->assign(
......
......@@ -65,7 +65,7 @@ class SendNewsletter
$newsletter = $this->newsletterRepository->getOneById($newsletterId);
$sender = [
'email' => $settings['mail'],
'name' => $this->config->getSettings(\ACP3\Modules\ACP3\Seo\Installer\Schema::MODULE_NAME)['title']
'name' => $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME)['site_title']
];
$this->mailer
......
......@@ -141,16 +141,16 @@ class Subscribe
{
$url = $this->router->route('newsletter/index/activate/hash_' . $hash, true);
$seoSettings = $this->config->getSettings(\ACP3\Modules\ACP3\Seo\Installer\Schema::MODULE_NAME);
$systemSettings = $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME);
$settings = $this->config->getSettings(Schema::MODULE_NAME);
$subject = $this->translator->t('newsletter', 'subscribe_mail_subject', ['%title%' => $seoSettings['title']]);
$subject = $this->translator->t('newsletter', 'subscribe_mail_subject', ['%title%' => $systemSettings['site_title']]);
$body = $this->translator->t('newsletter', 'subscribe_mail_body',
['{host}' => $this->request->getHost()]) . "\n\n";
$from = [
'email' => $settings['mail'],
'name' => $seoSettings['title']
'name' => $systemSettings['site_title']
];
$this->mailer
......
......@@ -60,7 +60,6 @@ class Settings extends Core\Controller\AbstractAdminAction
$seoSettings = $this->config->getSettings(Seo\Installer\Schema::MODULE_NAME);
// Robots
$robots = [
1 => $this->translator->t('seo', 'robots_index_follow'),
2 => $this->translator->t('seo', 'robots_index_nofollow'),
......@@ -89,12 +88,9 @@ class Settings extends Core\Controller\AbstractAdminAction
'meta_description' => $this->get('core.helpers.secure')->strEncode($formData['meta_description']),
'meta_keywords' => $this->get('core.helpers.secure')->strEncode($formData['meta_keywords']),
'robots' => (int)$formData['robots'],
'title' => $this->get('core.helpers.secure')->strEncode($formData['title']),
];
$bool = $this->config->saveSettings($data, Seo\Installer\Schema::MODULE_NAME);
return $bool;
return $this->config->saveSettings($data, Seo\Installer\Schema::MODULE_NAME);
});
}
}
......@@ -6,11 +6,11 @@
namespace ACP3\Modules\ACP3\Seo\Core;
use ACP3\Core\Breadcrumb\Title;
use ACP3\Core\Controller\AreaEnum;
use ACP3\Core\Http\RequestInterface;
use ACP3\Core\I18n\Translator;
use ACP3\Core\Router\RouterInterface;
use ACP3\Modules\ACP3\Seo\Core\Breadcrumb\Title;
use ACP3\Modules\ACP3\Seo\Helper\MetaStatements;
use ACP3\Modules\ACP3\Users\Model\UserModel;
......@@ -27,13 +27,12 @@ class Pagination extends \ACP3\Core\Pagination
/**
* Pagination constructor.
*
* @param \ACP3\Modules\ACP3\Users\Model\UserModel $user
* @param \ACP3\Modules\ACP3\Seo\Core\Breadcrumb\Title $title
* @param \ACP3\Core\I18n\Translator $translator
* @param \ACP3\Core\Http\RequestInterface $request
* @param \ACP3\Core\Router\RouterInterface $router
* @param \ACP3\Modules\ACP3\Seo\Helper\MetaStatements $metaStatements
* @param UserModel $user
* @param Title $title
* @param Translator $translator
* @param RequestInterface $request
* @param RouterInterface $router
* @param MetaStatements $metaStatements
*/
public function __construct(
UserModel $user,
......@@ -43,7 +42,6 @@ class Pagination extends \ACP3\Core\Pagination
RouterInterface $router,
MetaStatements $metaStatements
) {
parent::__construct($user, $title, $translator, $request, $router);
$this->metaStatements = $metaStatements;
......
......@@ -36,6 +36,9 @@ class Migration implements Modules\Installer\MigrationInterface
],
7 => [
"INSERT INTO `{pre}acl_resources` (`id`, `module_id`, `area`, `controller`, `page`, `params`, `privilege_id`) VALUES('', '{moduleId}', 'admin', 'index', 'suggest', '', 4);",
],
8 => [
"DELETE FROM `{pre}settings` WHERE `module_id` = '{moduleId}' AND `name` = 'title';",
]
];
}
......
......@@ -33,7 +33,7 @@ class Schema implements Modules\Installer\SchemaInterface
*/
public function getSchemaVersion()
{
return 7;
return 8;
}
/**
......@@ -72,8 +72,7 @@ class Schema implements Modules\Installer\SchemaInterface
return [
'meta_description' => '',
'meta_keywords' => '',
'robots' => 1,
'title' => ''
'robots' => 1
];
}
}
{extends file="asset:System/layout.ajax-form.tpl"}
{block CONTENT_AJAX_FORM}
{include file="asset:System/Partials/form_group.input_text.tpl" name="title" value=$form.title required=true maxlength=120 label={lang t="system|title"}}
{include file="asset:System/Partials/form_group.input_text.tpl" name="meta_description" value=$form.meta_description maxlength=120 label={lang t="seo|description"}}
{include file="asset:System/Partials/form_group.textarea.tpl" name="meta_keywords" value=$form.meta_keywords label={lang t="seo|keywords"} help={lang t="seo|keywords_separate_with_commas"}}
{include file="asset:System/Partials/form_group.select.tpl" options=$robots required=true label={lang t="seo|robots"}}
......
services:
core.breadcrumb.title:
class: ACP3\Modules\ACP3\Seo\Core\Breadcrumb\Title
arguments:
- '@core.breadcrumb'
- '@core.event_dispatcher'
- '@core.config'
core.helpers.pageBreaks:
class: ACP3\Core\Helpers\PageBreaks
arguments:
......
......@@ -8,7 +8,7 @@ namespace ACP3\Modules\ACP3\Seo\Test\Core\Breadcrumb;
use ACP3\Core\Settings\SettingsInterface;
use ACP3\Modules\ACP3\Seo\Core\Breadcrumb\Title;
use ACP3\Modules\ACP3\System\Core\Breadcrumb\Title;
class TitleTest extends \ACP3\Core\Test\Breadcrumb\TitleTest
{
......
......@@ -17,13 +17,6 @@ class AdminSettingsFormValidation extends AbstractFormValidation
{
$this->validator
->addConstraint(Core\Validation\ValidationRules\FormTokenValidationRule::class)
->addConstraint(
Core\Validation\ValidationRules\NotEmptyValidationRule::class,
[
'data' => $formData,
'field' => 'title',
'message' => $this->translator->t('system', 'title_to_short'),
])
->addConstraint(
Core\Validation\ValidationRules\InArrayValidationRule::class,
[
......
......@@ -119,7 +119,6 @@ class Configuration extends Core\Controller\AbstractAdminAction
function () use ($formData) {
$this->systemValidator->validate($formData);
// Update the system config
$data = [
'cache_images' => (int)$formData['cache_images'],
'cache_lifetime' => (int)$formData['cache_lifetime'],
......@@ -141,6 +140,7 @@ class Configuration extends Core\Controller\AbstractAdminAction
'maintenance_message' => $formData['maintenance_message'],
'maintenance_mode' => (int)$formData['maintenance_mode'],
'page_cache_is_enabled' => (int)$formData['page_cache_is_enabled'],
'site_title' => $this->get('core.helpers.secure')->strEncode($formData['site_title']),
'wysiwyg' => $formData['wysiwyg']
];
......
......@@ -4,11 +4,11 @@
* See the LICENCE file at the top-level module directory for licencing details.
*/
namespace ACP3\Modules\ACP3\Seo\Core\Breadcrumb;
namespace ACP3\Modules\ACP3\System\Core\Breadcrumb;
use ACP3\Core\Breadcrumb\Steps;
use ACP3\Core\Settings\SettingsInterface;
use ACP3\Modules\ACP3\Seo\Installer\Schema;
use ACP3\Modules\ACP3\System\Installer\Schema;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
......@@ -28,8 +28,8 @@ class Title extends \ACP3\Core\Breadcrumb\Title
parent::__construct($steps, $eventDispatcher);
$settings = $config->getSettings(Schema::MODULE_NAME);
if (isset($settings['title'])) {
$this->siteTitle = $settings['title'];
if (isset($settings['site_title'])) {
$this->siteTitle = $settings['site_title'];
}
}
}
......@@ -132,7 +132,8 @@ class Migration extends Modules\Installer\AbstractMigration
"UPDATE `{pre}settings` SET `name` = 'cache_lifetime' WHERE `module_id` = {moduleId} AND `name` = 'cache_minify';"
],
60 => [
"INSERT INTO `{pre}settings` (`id`, `module_id`, `name`, `value`) VALUES ('', '{moduleId}', 'security_secret', '" . uniqid(mt_rand(), true) . "');",
"INSERT INTO `{pre}settings` (`id`, `module_id`, `name`, `value`) VALUES ('', '{moduleId}', 'security_secret', '" . uniqid(mt_rand(),
true) . "');",
],
61 => [
"INSERT INTO `{pre}settings` (`id`, `module_id`, `name`, `value`) VALUES ('', '{moduleId}', 'cache_vary_user', 0);",
......@@ -142,6 +143,10 @@ class Migration extends Modules\Installer\AbstractMigration
],
63 => [
"INSERT INTO `{pre}settings` (`id`, `module_id`, `name`, `value`) VALUES ('', '{moduleId}', 'page_cache_is_enabled', 1);",
],
64 => [
"INSERT INTO `{pre}settings` (`id`, `module_id`, `name`, `value`) VALUES ('', '{moduleId}', 'site_title', '');",
$this->migrateToVersion64()
]
];
}
......@@ -225,4 +230,28 @@ class Migration extends Modules\Installer\AbstractMigration
return $result;
};
}
/**
* @return \Closure
*/
protected function migrateToVersion64()
{
return function () {
$result = true;
$container = $this->schemaHelper->getContainer();
if ($container->get('core.modules')->isInstalled('seo')) {
$seoSettings = $container->get('core.config')->getSettings('seo');
if (isset($seoSettings['title'])) {
return $container->get('core.config')->saveSettings(
['site_title' => $seoSettings['title']],
Schema::MODULE_NAME
);
}
}
return $result;
};
}
}
......@@ -48,7 +48,7 @@ class Schema implements Modules\Installer\SchemaInterface
*/
public function getSchemaVersion()
{
return 63;
return 64;
}
/**
......@@ -121,6 +121,7 @@ class Schema implements Modules\Installer\SchemaInterface
'page_cache_is_enabled' => false,
'page_cache_is_valid' => true,
'security_secret' => uniqid(mt_rand(), true),
'site_title' => '',
'wysiwyg' => 'core.wysiwyg.textarea'
];
}
......
......@@ -14,6 +14,7 @@
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
{include file="asset:System/Partials/form_group.input_text.tpl" name="site_title" value=$form.site_title required=true label={lang t="system|title"}}
{include file="asset:System/Partials/form_group.input_text.tpl" name="homepage" value=$form.homepage required=true label={lang t="system|homepage"} help={lang t="system|homepage_description"}}
{include file="asset:System/Partials/form_group.select.tpl" options=$entries required=true label={lang t="system|records_per_page"}}
{include file="asset:System/Partials/form_group.input_number.tpl" name="flood" value=$form.flood required=true label={lang t="system|flood_barrier"} help={lang t="system|flood_barrier_description"}}
......
services:
core.breadcrumb.title:
class: ACP3\Modules\ACP3\System\Core\Breadcrumb\Title
arguments:
- '@core.breadcrumb'
- '@core.event_dispatcher'
- '@core.config'
......@@ -3,6 +3,7 @@ imports:
- { resource: components/events.yml }
- { resource: components/installer.yml }
- { resource: components/models.yml }
- { resource: components/overrides.yml }
- { resource: components/validation.yml }
services:
......
......@@ -34,6 +34,13 @@ class AdminSettingsFormValidation extends Core\Validation\AbstractFormValidation
protected function validateGeneralSettings(array $formData)
{
$this->validator
->addConstraint(
Core\Validation\ValidationRules\NotEmptyValidationRule::class,
[
'data' => $formData,
'field' => 'site_title',
'message' => $this->translator->t('system', 'title_to_short')
])
->addConstraint(
Core\Validation\ValidationRules\InternalUriValidationRule::class,
[
......
......@@ -7,7 +7,7 @@
namespace ACP3\Modules\ACP3\Users\Controller\Frontend\Index;
use ACP3\Core;
use ACP3\Modules\ACP3\Seo\Installer\Schema;
use ACP3\Modules\ACP3\System\Installer\Schema;
use ACP3\Modules\ACP3\Users;
/**
......@@ -146,13 +146,13 @@ class ForgotPwd extends Core\Controller\AbstractFrontendAction
protected function sendPasswordChangeEmail(array $user, $newPassword)
{
$host = $this->request->getHost();
$seoSettings = $this->config->getSettings(Schema::MODULE_NAME);
$systemSettings = $this->config->getSettings(Schema::MODULE_NAME);
$subject = $this->translator->t(
'users',
'forgot_pwd_mail_subject',
[
'{title}' => $seoSettings['title'],
'{title}' => $systemSettings['site_title'],
'{host}' => $host
]
);
......@@ -162,7 +162,7 @@ class ForgotPwd extends Core\Controller\AbstractFrontendAction
'{name}' => $user['nickname'],
'{mail}' => $user['mail'],
'{password}' => $newPassword,
'{title}' => $seoSettings['title'],
'{title}' => $systemSettings['site_title'],
'{host}' => $host
]
);
......
......@@ -49,14 +49,14 @@ class Register extends Core\Controller\AbstractFrontendAction
/**
* Register constructor.
*
* @param \ACP3\Core\Controller\Context\FrontendContext $context
* @param \ACP3\Core\Date $date
* @param \ACP3\Core\Helpers\FormToken $formTokenHelper
* @param \ACP3\Core\Helpers\Secure $secureHelper
* @param \ACP3\Modules\ACP3\Users\Model\Repository\UserRepository $userRepository
* @param \ACP3\Core\Controller\Context\FrontendContext $context
* @param \ACP3\Core\Date $date
* @param \ACP3\Core\Helpers\FormToken $formTokenHelper
* @param \ACP3\Core\Helpers\Secure $secureHelper
* @param \ACP3\Modules\ACP3\Users\Model\Repository\UserRepository $userRepository
* @param \ACP3\Modules\ACP3\Users\Validation\RegistrationFormValidation $registrationFormValidation
* @param \ACP3\Modules\ACP3\Permissions\Helpers $permissionsHelpers
* @param \ACP3\Core\Helpers\SendEmail $sendEmail
* @param \ACP3\Modules\ACP3\Permissions\Helpers $permissionsHelpers
* @param \ACP3\Core\Helpers\SendEmail $sendEmail
*/
public function __construct(
Core\Controller\Context\FrontendContext $context,
......@@ -92,21 +92,21 @@ class Register extends Core\Controller\AbstractFrontendAction
$this->setContent($this->get('core.helpers.alerts')->errorBox(
$this->translator->t('users', 'user_registration_disabled'))
);
} else {
if ($this->request->getPost()->count() !== 0) {
return $this->executePost($this->request->getPost()->all(), $settings);
}
$defaults = [
'nickname' => '',
'mail' => '',
];
return [
'form' => array_merge($defaults, $this->request->getPost()->all()),
'form_token' => $this->formTokenHelper->renderFormToken()
];
}
if ($this->request->getPost()->count() !== 0) {
return $this->executePost($this->request->getPost()->all(), $settings);
}
$defaults = [
'nickname' => '',
'mail' => '',
];
return [
'form' => array_merge($defaults, $this->request->getPost()->all()),
'form_token' => $this->formTokenHelper->renderFormToken()
];
}
/**
......@@ -122,13 +122,12 @@ class Register extends Core\Controller\AbstractFrontendAction
$this->registrationFormValidation->validate($formData);
$systemSettings = $this->config->getSettings(Schema::MODULE_NAME);
$seoSettings = $this->config->getSettings(\ACP3\Modules\ACP3\Seo\Installer\Schema::MODULE_NAME);
$subject = $this->translator->t(
'users',
'register_mail_subject',
[
'{title}' => $seoSettings['title'],
'{title}' => $systemSettings['site_title'],
'{host}' => $this->request->getHost(),
]);
$body = $this->translator->t(
......@@ -138,7 +137,7 @@ class Register extends Core\Controller\AbstractFrontendAction
'{name}' => $formData['nickname'],
'{mail}' => $formData['mail'],
'{password}' => $formData['pwd'],
'{title}' => $seoSettings['title'],
'{title}' => $systemSettings['site_title'],
'{host}' => $this->request->getHost()
]
);
......
......@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- The captcha validation is now handled by the new event `captcha.validation.validate_captcha`
- moved the site title from the SEO module to the system module
### Fixed
- fixed the Smarty modifier plugin `PrefixUri` when there is an URL given with a valid protocol
......
......@@ -149,10 +149,8 @@ class InstallModel
'date_time_zone' => $formData['date_time_zone'],
'maintenance_message' => $this->translator->t('install', 'offline_message'),
'lang' => $this->translator->getLocale(),
'design' => $formData['design']
],
\ACP3\Modules\ACP3\Seo\Installer\Schema::MODULE_NAME => [
'title' => !empty($formData['title']) ? $formData['title'] : 'ACP3'
'design' => $formData['design'],
'site_title' => !empty($formData['title']) ? $formData['title'] : 'ACP3'
],
\ACP3\Modules\ACP3\Users\Installer\Schema::MODULE_NAME => [
'mail' => $formData['mail']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment