Skip to content

Commit

Permalink
[TASK] Move excludedParameters config to ext_localconf.php, update do…
Browse files Browse the repository at this point in the history
…cumentation and TypoScript, format ext_tables.sql
  • Loading branch information
davkraid committed Jan 3, 2025
1 parent 42548e0 commit fe8fa18
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 50 deletions.
8 changes: 4 additions & 4 deletions Configuration/TypoScript/example_setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ config.tx_locate {
# If this option is enabled, it is possible to overwrite the verdict stored in the session.
overrideSessionValue = 1

# URL Parameter which has to be true when overrideCookie is allowed within action and cookieHandling is enabled
# URL Parameter which has to be true when overrideSessionValue is allowed within action and sessionHandling is enabled
overrideQueryParameter = setLang

# Simulate your IP address for countryByIP fact provider (for test purposes only), 109.10.163.98 is a french IP address
simulateIp = 109.10.163.98
simulateIp =

verdicts {
redirectToMainlandChina = Leuchtfeuer\Locate\Verdict\Redirect
Expand Down Expand Up @@ -70,8 +70,8 @@ config.tx_locate {
}

# Users with the French browser language should be redirected to the French language version of another page.
300 = Leuchtfeuer\Locate\Judge\Condition
300 {
400 = Leuchtfeuer\Locate\Judge\Condition
400 {
verdict = redirectToPageFR
fact = browserAcceptLanguage
prosecution = fr
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ config.tx_locate {
# If this option is enabled, it is possible to overwrite the verdict stored in the session.
overrideSessionValue = 0

# URL Parameter which has to be true when overrideCookie is allowed within action and cookieHandling is enabled
# URL Parameter which has to be true when overrideSessionValue is allowed within action and sessionHandling is enabled
overrideQueryParameter = setLang

# Simulate your IP address for countryByIP fact provider (for test purposes only)
Expand Down
8 changes: 4 additions & 4 deletions Documentation/About/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Compatibility
We are currently supporting following TYPO3 versions:

.. csv-table:: Version Matrix
:header: "Extension Version", "TYPO3 v12 Support", "TYPO3 v11 Support", "TYPO3 v10 Support", "TYPO3 v9 Support"
:header: "Extension Version", "TYPO3 v13 Support", "TYPO3 v12 Support", "TYPO3 v11 Support", "TYPO3 v10 Support"
:align: center

"12.x", "🙋️", "🙅️", "🙅️️", "🙅️️"
"11.x", "🙅️️", "🙋️", "🙋️", "🙅️️"
"10.x", "🙅️️", "🙅️️", "🙋️", "🙋️"
"13.x", "🙋️", "🙅️", "🙅️️", "🙅️️"
"12.x", "🙅", "🙋️", "🙅️️", "🙅️️"
"11.x", "🙅️️", "🙅", "🙋️", "🙋️"

.. _about-ip-database:

Expand Down
10 changes: 7 additions & 3 deletions Documentation/Functions/AssignLanguage/Examples/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ This is a complete example that redirects the user according to the following cr
excludeBots = 1
sessionHandling = 1
overrideSessionValue = 1
# URL Parameter which has to be true when overrideSessionValue is allowed within action and sessionHandling is enabled
overrideQueryParameter = setLang
# Simulate your IP address for countryByIP fact provider (for test purposes only), e.g. 109.10.163.98 is a french IP address
simulateIp =
Expand Down Expand Up @@ -70,8 +72,8 @@ This is a complete example that redirects the user according to the following cr
}
# Users with the French browser language should be redirected to the French language version of another page.
300 = Leuchtfeuer\Locate\Judge\Condition
300 {
400 = Leuchtfeuer\Locate\Judge\Condition
400 {
verdict = redirectToPageFR
fact = browserAcceptLanguage
prosecution = fr
Expand All @@ -83,6 +85,8 @@ This is a complete example that redirects the user according to the following cr
}
}
..
.. tip::

The full example is available at `GitHub <https://github.com/Leuchtfeuer/locate/blob/master/Configuration/TypoScript/setup-switch_language.txt>`__.
The full example is available at `GitHub <https://github.com/Leuchtfeuer/locate/blob/master/Configuration/TypoScript/example_setup.typoscript>`__.
32 changes: 28 additions & 4 deletions Documentation/Functions/AssignLanguage/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Exclude Bots
.. _functions-assignLanguage-configuration-simulateIp:

Simulate IP Address
~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~
.. container:: table-row

Property
Expand All @@ -230,6 +230,27 @@ Simulate IP Address
Simulate an IP address for countryByIP fact provider. This is meant to be for test purposes only.
It works with IPv4 and IPv6 addresses.

.. _functions-assignLanguage-configuration-overrideQueryParameter:

Override Query Parameter
~~~~~~~~~~~~~~~~~~~~~~~~
.. container:: table-row

Property
config.tx_locate.overrideQueryParameter
Data type
string
Default
setLang
Description
URL Parameter which has to be true when overrideSessionValue is allowed within action and sessionHandling is enabled.
If you change the overrideQueryParameter from its default value, you need to add the query parameter to excludedParameters
to make it work. For example in your ext_localconf.php of your site extension:

.. code-block:: php
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'yourQueryParameter';
.. _functions-assignLanguage-configuration-verdicts:

Verdicts
Expand Down Expand Up @@ -257,14 +278,17 @@ Facts
Data type
array
Default
unset
Description
This array contains the facts. The key is the name of the fact used in the judges section and the value is the php class
that should take care about the trial. Example:

.. code-block:: typoscript
{
browserAcceptLanguage = Leuchtfeuer\Locate\FactProvider\BrowserAcceptedLanguage
countryByIP = Leuchtfeuer\Locate\FactProvider\IP2Country
}
Description
This array contains the facts. The key is the name of the fact used in the judges section and the value is the php class
that should take care about the trial.
.. _functions-assignLanguage-configuration-judges:

Expand Down
4 changes: 4 additions & 0 deletions Documentation/Functions/GeoBlocking/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ status code will be returned, which you can process e.g. via a site

You can invert the selection. If you do this, the page will be unavailable in the specified regions.

.. note::

Not take action if you logged in as backend user or EXT:static_info_tables is not loaded.

.. _functions-geoBlocking-assignRegions-outlier:

Outlier
Expand Down
8 changes: 8 additions & 0 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

use Leuchtfeuer\Locate\Domain\DTO\Configuration;

defined('TYPO3') || die('Access denied.');

// override parameter needs to be excluded form cHash calculation due to enforceValidation = true setting
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = Configuration::OVERRIDE_PARAMETER;
2 changes: 0 additions & 2 deletions ext_tables.php

This file was deleted.

70 changes: 38 additions & 32 deletions ext_tables.sql
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
CREATE TABLE static_ip2country_v4 (
ip_from int(10) unsigned DEFAULT NULL,
ip_to int(10) unsigned DEFAULT NULL,
country_code char(2) NOT NULL DEFAULT '',
KEY idx_ip_from (ip_from),
KEY idx_ip_to (ip_to),
KEY idx_ip_from_to (ip_from,ip_to)
CREATE TABLE static_ip2country_v4
(
ip_from int(10) unsigned DEFAULT NULL,
ip_to int(10) unsigned DEFAULT NULL,
country_code char(2) NOT NULL DEFAULT '',
KEY idx_ip_from (ip_from),
KEY idx_ip_to (ip_to),
KEY idx_ip_from_to (ip_from,ip_to)
);

CREATE TABLE static_ip2country_v6 (
ip_from decimal(39,0) unsigned DEFAULT NULL,
ip_to decimal(39,0) unsigned NOT NULL,
country_code char(2) NOT NULL DEFAULT '',
KEY idx_ip_from (ip_from),
KEY idx_ip_to (ip_to),
KEY idx_ip_from_to (ip_from,ip_to)
CREATE TABLE static_ip2country_v6
(
ip_from decimal(39, 0) unsigned DEFAULT NULL,
ip_to decimal(39, 0) unsigned NOT NULL,
country_code char(2) NOT NULL DEFAULT '',
KEY idx_ip_from (ip_from),
KEY idx_ip_to (ip_to),
KEY idx_ip_from_to (ip_from,ip_to)
);

CREATE TABLE tx_locate_region_country_mm (
uid_local int(11) DEFAULT '0' NOT NULL,
uid_foreign int(11) DEFAULT '0' NOT NULL,
sorting int(11) DEFAULT '0' NOT NULL,
CREATE TABLE tx_locate_region_country_mm
(
uid_local int(11) DEFAULT '0' NOT NULL,
uid_foreign int(11) DEFAULT '0' NOT NULL,
sorting int(11) DEFAULT '0' NOT NULL,

KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);

CREATE TABLE tx_locate_page_region_mm (
uid_local int(11) DEFAULT '0' NOT NULL,
uid_foreign int(11) DEFAULT '0' NOT NULL,
sorting int(11) DEFAULT '0' NOT NULL,
CREATE TABLE tx_locate_page_region_mm
(
uid_local int(11) DEFAULT '0' NOT NULL,
uid_foreign int(11) DEFAULT '0' NOT NULL,
sorting int(11) DEFAULT '0' NOT NULL,

KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);

CREATE TABLE tx_locate_domain_model_region (
title varchar(255) DEFAULT '' NOT NULL,
countries int(11) DEFAULT '0' NOT NULL
CREATE TABLE tx_locate_domain_model_region
(
title varchar(255) DEFAULT '' NOT NULL,
countries int(11) DEFAULT '0' NOT NULL,
);

CREATE TABLE pages (
tx_locate_regions int DEFAULT 0 NOT NULL,
tx_locate_invert smallint(2) DEFAULT 0 NOT NULL
CREATE TABLE pages
(
tx_locate_regions int DEFAULT 0 NOT NULL,
tx_locate_invert smallint(2) DEFAULT 0 NOT NULL
);

0 comments on commit fe8fa18

Please sign in to comment.