[BUGFIX] Allow user defined locales to work with TSFE->sL()

TYPO3 uses a list of "known" languages defined in
TYPO3\CMS\Core\Localization\Locales.

This list can be extended by the user, but these changes
are not taken into account when using
$GLOBALS['TSFE']->sL() to fetch the translation.

Make TypoScriptFrontendController call the needed method
"initialize()" to make it work.

Resolves: #53973
Releases: 6.2, 6.1
Change-Id: I9fc80ba976bf796f272591ac741d8bf4e92cbeb3
Reviewed-on: https://review.typo3.org/25685
Reviewed-by: Wouter Wolters
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
[BUGFIX] Remove the need of PackageStates.php in tests

Although there is code in the package manager tests
to mock a PackageStates.php file, it does not work
as the path to the file is hardcoded in the initialize
action.

Move the code for setting the path and creating
the package factory to the constructor
and move the mocking of the path before initializing
in the test.

Resolves: #57490
Releases: 6.2
Change-Id: I2ca29016de288017ec73ff36d0dbed1e2be0e67d
Reviewed-on: https://review.typo3.org/29021
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Thomas Maroschik
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[BUGFIX] Backup of LocalConfiguration.php missing on update

If you update from a 6.x installation there should be a backup of the
old, unmodified LocalConfiguration.php as it's getting changed during
PackageStates.php extraction. This is prevented with commit e755bcd
as a check for the PackageStates.php file was introduced, which might
not be available at this point during upgrade.

Resolves: #57458
Releases: 6.2
Change-Id: Ic3634ab58e3e4112df5d8544cca9c42e8f1db91f
Reviewed-on: https://review.typo3.org/28980
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[BUGFIX] Check if lock directory is writable

We should check if directory is writable. Else fopen in acquireLock
would only fail with error after waiting time. Also we do not aspect
write permission issue here.

Resolves: #57463
Releases: 6.2
Change-Id: Ia767a2355aecf1e816d4c130b151443e50e1a311
Reviewed-on: https://review.typo3.org/28988
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[BUGFIX] Make Extbase EnvironmentService a Singleton

EnvironmentService is a service and gets injected in different
classes, thus it has to be a Singleton.

Resolves: #57518
Releases: 6.2, 6.1
Change-Id: Ia8a3b8882be27c0f45569af818964036f0a9b16d
Reviewed-on: https://review.typo3.org/29042
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
[BUGFIX] Make Typo3DbQueryParser a Singleton

Typo3DbQueryParser gets injected in Typo3DbBackend, thus
it has to be a Singleton.

Resolves: #57338
Releases: 6.2
Change-Id: I5b845ef280d23b6893d308bc9013ef965637a1ef
Reviewed-on: https://review.typo3.org/28843
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
[BUGFIX] Fix relative path calculations in EM

The extension manager often uses the extension
relative path to calculate paths to different files,
but does not take into account that this path
already has a trailing slash.

Remove excess slashes to avoid double slashes in paths.

Resolves: #57327
Related: #57312
Releases: 6.2
Change-Id: I60519d4d7075a615d0505bfc4cbb2b6ee1b0c222
Reviewed-on: https://review.typo3.org/28825
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[BUGFIX] Use last result line of identify command

In GraphicalFunctions::imageMagickIdentify() the last line returned by
the executed command will be used as result.

This prevents the system from using possible error messages printed
before the actual result for further processing.

Resolves: #56574
Releases: 6.2
Change-Id: Ic179e0b68c7fa9a4f0f4b2342cb381c54fb740b9
Reviewed-on: https://review.typo3.org/28076
Reviewed-by: Xavier Perseguers
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[TASK] Readd search string in module "Configuration"

The input field of the configuration module's search 
is never populated with the search term.

Solution: move one line some lines up to get the value.

Releases: 6.2
Resolves: #57486
Change-Id: I7ff86e3336cb473df259c3aeb7d0c918fbc48bab
Reviewed-on: https://review.typo3.org/29015
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
[CLEANUP] Remove option "edit_wideDocument"

The historical option "wide document" can
be safely removed, as the wide screen options
from 10 years ago are default by now.

Resolves: #57295
Releases: 6.2
Change-Id: I0e5c81046733f4ddd10cc7d084f0ef7b952c3cb0
Reviewed-on: https://review.typo3.org/28769
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Simon Schaufelberger
Tested-by: Simon Schaufelberger
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
[BUGFIX] Marker missing for page.includeCSSLibs

The HTML templates are missing the marker for the
introduced page.includeCSSLibs TS feature in 6.2

Resolves: #57467
Releases: 6.2
Change-Id: I83d7c7f34fc83c4c699bad7edfaa03c6684497fe
Reviewed-on: https://review.typo3.org/28997
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
[BUGFIX] FAL: Prevent invalid NULL value on metadata creation

The cruser_id field is now guaranteed to be an integer.
This patch checks if a BE_USER is available and uses zero
otherwise.

Resolves: #57495
Related: #46020
Releases: 6.2
Change-Id: I8260604eb30ca32d2a5e079fa6f5b10a6d04714e
Reviewed-on: https://review.typo3.org/29028
Reviewed-by: Nicole Cordes
Reviewed-by: Jigal van Hemert
Reviewed-by: Frans Saris
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Markus Klein
Tested-by: Markus Klein
[TASK] TceformsUpdateWizard: Throw exception if database query fails

Inform the user, if the database SELECT query fails during the wizard.

Resolves: #57572
Releases: 6.2
Change-Id: I0908aff5d58d6d309b471c810d924f26fc1ca577
Reviewed-on: https://review.typo3.org/29093
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Steffen Müller
Tested-by: Steffen Müller
[BUGFIX] Do not reset Page Renderer on partial rendering

Currently the Page Renderer is reset when calling
the render() method, even if only one part (header
or footer) is rendered, which causes a second call
to fail, when rendering another part.
This happens e.g in DocumentTemplate.php where
the render() method is called two times. Because of
the reset, the second call starts pageRenderer with
empty properties.

Solution is to only call reset if everything is rendered.

Resolves: #57294
Releases: 6.2
Change-Id: Ib4800e37ba0760617de71f9ca1181d1664463e33
Reviewed-on: https://review.typo3.org/28770
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[BUGFIX] Fetch RSA public key by Ajax before login

Currently public and private RSA keys are generated when rendering the
login form. This has several drawbacks.

It can lead to strange and hard to debug errors when a second request is
done in the same browser, which invalidates the key for the current
login form (#38660), opening a second login in a different tab
invalidates the key on the first tab and finally when the login form
stays open until the PHP session expires (parts of the private key are
stored in the PHP session), the key is also invalid for the form.

Solution is to create a new key pair on the fly when a user clicks the
submit button and fetch the public key via Ajax.

This change implements this for the backend login. Frontend login should
be tackled in a different patch.

Resolves: #37421
Releases: 6.2
Change-Id: I0cd9a049d892ee872436347153a0e1114b17585d
Reviewed-on: https://review.typo3.org/28893
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[BUGFIX] Correctly apply Extbase validator options and add tests

* Check supplied options
* Apply default-values of validator if needed
* Check for required options
* Provide options via constructor instead of via setOptions()
  (which is deprecated)
* Add tests for AbstractValidator and AbstractCompositeValidator

Resolves: #52208
Resolves: #57164
Releases: 6.2, 6.1
Change-Id: I589a30bea74144eed51948ecad3143ab145c958f
Reviewed-on: https://review.typo3.org/28938
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
Reviewed-by: Pascal Dürsteler
Tested-by: Pascal Dürsteler
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[SECURITY] Prevent XSS in scheduler form

The class name is submitted in a hidden form and is susceptible to XSS.
The patch introduced htmlspecialchars to prevent XSS possibility.

Resolves: #57603
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Change-Id: I4979e66f28a581e168c56d91327a1bbe2672448d
Reviewed-on: https://review.typo3.org/29121
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[BUGFIX] PHP warning due to missing preg_quote

Fixing a missing preg_quote() call in ExtensionManagementUtility,
which causes a PHP warning and a failing preg_match().

Resolves: #55662
Releases: 6.2
Change-Id: Iaf1e21546741ae282016f433bf83f7e5663e3c7b
Reviewed-on: https://review.typo3.org/29145
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Pascal Dürsteler
Tested-by: Pascal Dürsteler
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[TASK] Return to "Admin Tools > User Admin" when exiting simulated BE User

When exiting a simulated BE user, you return to the backend user module
instead of the default startup page.

Resolves: #22020
Releases: 6.2
Change-Id: I8de7b6f79e6ddb9bc03f62364f3246ef13a4ddf3
Reviewed-on: https://review.typo3.org/28689
Reviewed-by: Markus Klein
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
[TASK] Avoid sysLog calls in MailUtilityTest

Resolves: #57676
Releases: 6.2
Change-Id: I6f694a2c595756595b09aa4a8a91cb795e8a47b7
Reviewed-on: https://review.typo3.org/29192
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Oliver Klee
Reviewed-by: Pascal Dürsteler
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn