Commit bd6d3e0a authored by Kevin Ditscheid's avatar Kevin Ditscheid

[FEATURE] New checkbox for case sensitive redirect check

parent 3b6fa789
......@@ -120,8 +120,8 @@ class RoutingService {
$where = 'deleted = 0 AND pid = ' . $rootUid;
$resultArray = $databaseConnection->exec_SELECTgetRows(
'uid, pid, use_regular_expression, source_url, destination_url, ' .
'redirect_url_parameters, redirect_code, description',
'uid, pid, use_regular_expression, source_url, source_url_case_sensitive, ' .
'destination_url, redirect_url_parameters, redirect_code, description',
$tableName, $where, '',
'sorting'
);
......@@ -152,7 +152,16 @@ class RoutingService {
header('Location: ' . $redirectUri, TRUE, $redirect['redirect_code']);
exit();
}
} elseif (\rawurldecode($requestUri) === $trimmedSourceUrl) {
} elseif (
(
(bool)$redirect['source_url_case_sensitive'] &&
\rawurldecode($requestUri) === $trimmedSourceUrl
) ||
(
!(bool)$redirect['source_url_case_sensitive'] &&
\mb_strtolower(\rawurldecode($requestUri)) === \mb_strtolower($trimmedSourceUrl)
)
) {
$destinationUrl = $redirect['destination_url'];
if (strpos($destinationUrl, self::URL_WIZARD_ID) === 0) {
$destinationUrl = (int) substr($destinationUrl, 14);
......
......@@ -2,9 +2,9 @@
if (\SGalinski\SgRoutes\Service\LicensingService::checkKey()) {
$showFields = 'use_regular_expression, regular_expression_info, source_url, destination_url, redirect_url_parameters, redirect_code, description, categories';
$showFields = 'use_regular_expression, regular_expression_info, --palette--;LLL:EXT:sg_routes/Resources/Private/Language/locallang_db.xlf:tx_sgroutes_domain_model_route.palettes.source_url;source_url, destination_url, redirect_url_parameters, redirect_code, description, categories';
} else {
$showFields = 'source_url, destination_url, redirect_url_parameters, redirect_code, description, categories';
$showFields = '--palette--;LLL:EXT:sg_routes/Resources/Private/Language/locallang_db.xlf:tx_sgroutes_domain_model_route.palettes.source_url;source_url, destination_url, redirect_url_parameters, redirect_code, description, categories';
}
return [
......@@ -32,13 +32,18 @@ return [
'iconfile' => 'EXT:sg_routes/Resources/Public/Icons/tx_sgroutes_domain_model_route.svg'
],
'interface' => [
'showRecordFieldList' => 'hidden, use_regular_expression, source_url, destination_url, redirect_url_parameters, redirect_code, description',
'showRecordFieldList' => 'hidden, use_regular_expression, source_url, source_url_case_sensitive, destination_url, redirect_url_parameters, redirect_code, description',
],
'types' => [
'1' => [
'showitem' => $showFields,
],
],
'palettes' => [
'source_url' => [
'showitem' => 'source_url,source_url_case_sensitive'
]
],
'columns' => [
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel',
......@@ -84,6 +89,15 @@ return [
'eval' => 'trim'
],
],
'source_url_case_sensitive' => [
'exclude' => 0,
'label' => 'LLL:EXT:sg_routes/Resources/Private/Language/locallang_db.xlf:tx_sgroutes_domain_model_route.source_url_case_sensitive',
'config' => [
'type' => 'check',
'default' => '1'
],
'displayCond' => 'FIELD:use_regular_expression:=:REQ'
],
'destination_url' => [
'exclude' => 0,
'label' => 'LLL:EXT:sg_routes/Resources/Private/Language/locallang_db.xlf:tx_sgroutes_domain_model_route.destination_url',
......
......@@ -29,10 +29,18 @@
<source>Execution Duration (ms)</source>
<target>Ausführungsdauer (ms)</target>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_log.source_url">
<trans-unit id="tx_sgroutes_domain_model_route.palettes.source_url">
<source>Source URL</source>
<target>Quell-URL</target>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_log.source_url">
<source>Source URL (Examples: "/contact/" , "^/contact/(.*)$")</source>
<target>Quell-URL</target>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_route.source_url_case_sensitive">
<source>Case sensitive check</source>
<target>Groß- und Kleinschreibung beachten</target>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_log.destination_url">
<source>Destination URL</source>
<target>Ziel-URL</target>
......
......@@ -90,9 +90,15 @@
<trans-unit id="tx_sgroutes_domain_model_route.regular_expression_info_tester">
<source>Regular Expression Tester</source>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_route.palettes.source_url">
<source>Source URL</source>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_route.source_url">
<source>Source URL (Examples: "/contact/" , "^/contact/(.*)$")</source>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_route.source_url_case_sensitive">
<source>Case sensitive check</source>
</trans-unit>
<trans-unit id="tx_sgroutes_domain_model_route.temporary">
<source>302 (Temporary Redirect)</source>
</trans-unit>
......
......@@ -7,6 +7,7 @@ CREATE TABLE tx_sgroutes_domain_model_route (
use_regular_expression tinyint(4) unsigned DEFAULT '0' NOT NULL,
source_url varchar(255) DEFAULT '' NOT NULL,
source_url_case_sensitive tinyint(4) unsigned DEFAULT '0' NOT NULL,
destination_url varchar(255) DEFAULT '' NOT NULL,
redirect_url_parameters tinyint(4) unsigned DEFAULT '0' NOT NULL,
redirect_code varchar(255) DEFAULT '301' NOT NULL,
......
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