Showing with 25,009 additions and 282 deletions.
  1. +8 −0 CHANGELOG.md
  2. +1 −1 DEPRECATED.md
  3. +7 −0 UPGRADE.md
  4. +2 −2 composer.json
  5. +1 −1 src/Controller/BackendCsvImportController.php
  6. +12 −5 src/Cors/WebsiteRootsConfigProvider.php
  7. +16 −2 src/EventListener/CommandSchedulerListener.php
  8. +1 −1 src/Resources/contao/classes/Ajax.php
  9. +6 −0 src/Resources/contao/classes/Backend.php
  10. +28 −17 src/Resources/contao/classes/BackendUser.php
  11. +34 −47 src/Resources/contao/classes/DataContainer.php
  12. +2 −2 src/Resources/contao/classes/PurgeData.php
  13. +2 −2 src/Resources/contao/classes/RebuildIndex.php
  14. +1 −1 src/Resources/contao/config/constants.php
  15. +4 −5 src/Resources/contao/dca/tl_article.php
  16. +16 −4 src/Resources/contao/dca/tl_files.php
  17. +1 −1 src/Resources/contao/dca/tl_form_field.php
  18. +13 −13 src/Resources/contao/dca/tl_page.php
  19. +1 −1 src/Resources/contao/dca/tl_settings.php
  20. +1 −1 src/Resources/contao/dca/tl_style.php
  21. +1 −1 src/Resources/contao/dca/tl_user_group.php
  22. +24 −60 src/Resources/contao/drivers/DC_Folder.php
  23. +10 −49 src/Resources/contao/drivers/DC_Table.php
  24. +1 −2 src/Resources/contao/languages/cs/tl_settings.xlf
  25. +1 −2 src/Resources/contao/languages/da/tl_settings.xlf
  26. +2 −2 src/Resources/contao/languages/de/tl_settings.xlf
  27. +1 −1 src/Resources/contao/languages/en/tl_settings.xlf
  28. +1 −2 src/Resources/contao/languages/es/tl_settings.xlf
  29. +4 −0 src/Resources/contao/languages/fa/default.xlf
  30. +1 −1 src/Resources/contao/languages/fa/explain.xlf
  31. +2 −2 src/Resources/contao/languages/fa/languages.xlf
  32. +2 −0 src/Resources/contao/languages/fa/modules.xlf
  33. +3 −0 src/Resources/contao/languages/fa/tl_content.xlf
  34. +1 −0 src/Resources/contao/languages/fa/tl_files.xlf
  35. +1 −0 src/Resources/contao/languages/fa/tl_form_field.xlf
  36. +16 −1 src/Resources/contao/languages/fa/tl_image_size_item.xlf
  37. +2 −0 src/Resources/contao/languages/fa/tl_layout.xlf
  38. +3 −0 src/Resources/contao/languages/fa/tl_page.xlf
  39. +1 −2 src/Resources/contao/languages/fa/tl_settings.xlf
  40. +2 −2 src/Resources/contao/languages/fa/tl_style_sheet.xlf
  41. +1 −0 src/Resources/contao/languages/fa/tl_theme.xlf
  42. +1 −0 src/Resources/contao/languages/fa/tl_user.xlf
  43. +1 −0 src/Resources/contao/languages/fr/default.xlf
  44. +2 −0 src/Resources/contao/languages/fr/tl_content.xlf
  45. +2 −0 src/Resources/contao/languages/fr/tl_files.xlf
  46. +1 −0 src/Resources/contao/languages/fr/tl_page.xlf
  47. +1 −2 src/Resources/contao/languages/fr/tl_settings.xlf
  48. +2 −0 src/Resources/contao/languages/fr/tl_user.xlf
  49. +1 −2 src/Resources/contao/languages/hu/tl_settings.xlf
  50. +2 −2 src/Resources/contao/languages/it/tl_settings.xlf
  51. +2 −2 src/Resources/contao/languages/ja/tl_settings.xlf
  52. +1,005 −0 src/Resources/contao/languages/lv/countries.xlf
  53. +2,402 −0 src/Resources/contao/languages/lv/default.xlf
  54. +133 −0 src/Resources/contao/languages/lv/exception.xlf
  55. +107 −0 src/Resources/contao/languages/lv/explain.xlf
  56. +1,128 −0 src/Resources/contao/languages/lv/languages.xlf
  57. +390 −0 src/Resources/contao/languages/lv/modules.xlf
  58. +282 −0 src/Resources/contao/languages/lv/tl_article.xlf
  59. +797 −0 src/Resources/contao/languages/lv/tl_content.xlf
  60. +266 −0 src/Resources/contao/languages/lv/tl_files.xlf
  61. +246 −0 src/Resources/contao/languages/lv/tl_form.xlf
  62. +562 −0 src/Resources/contao/languages/lv/tl_form_field.xlf
  63. +168 −0 src/Resources/contao/languages/lv/tl_image_size.xlf
  64. +122 −0 src/Resources/contao/languages/lv/tl_image_size_item.xlf
  65. +557 −0 src/Resources/contao/languages/lv/tl_layout.xlf
  66. +94 −0 src/Resources/contao/languages/lv/tl_log.xlf
  67. +157 −0 src/Resources/contao/languages/lv/tl_maintenance.xlf
  68. +298 −0 src/Resources/contao/languages/lv/tl_member.xlf
  69. +114 −0 src/Resources/contao/languages/lv/tl_member_group.xlf
  70. +752 −0 src/Resources/contao/languages/lv/tl_module.xlf
  71. +582 −0 src/Resources/contao/languages/lv/tl_page.xlf
  72. +401 −0 src/Resources/contao/languages/lv/tl_settings.xlf
  73. +642 −0 src/Resources/contao/languages/lv/tl_style.xlf
  74. +166 −0 src/Resources/contao/languages/lv/tl_style_sheet.xlf
  75. +78 −0 src/Resources/contao/languages/lv/tl_templates.xlf
  76. +218 −0 src/Resources/contao/languages/lv/tl_theme.xlf
  77. +62 −0 src/Resources/contao/languages/lv/tl_undo.xlf
  78. +394 −0 src/Resources/contao/languages/lv/tl_user.xlf
  79. +130 −0 src/Resources/contao/languages/lv/tl_user_group.xlf
  80. +1 −2 src/Resources/contao/languages/nl/tl_settings.xlf
  81. +1,026 −0 src/Resources/contao/languages/pl/countries.xlf
  82. +2,412 −0 src/Resources/contao/languages/pl/default.xlf
  83. +150 −0 src/Resources/contao/languages/pl/exception.xlf
  84. +110 −0 src/Resources/contao/languages/pl/explain.xlf
  85. +1,190 −0 src/Resources/contao/languages/pl/languages.xlf
  86. +390 −0 src/Resources/contao/languages/pl/modules.xlf
  87. +282 −0 src/Resources/contao/languages/pl/tl_article.xlf
  88. +806 −0 src/Resources/contao/languages/pl/tl_content.xlf
  89. +266 −0 src/Resources/contao/languages/pl/tl_files.xlf
  90. +246 −0 src/Resources/contao/languages/pl/tl_form.xlf
  91. +562 −0 src/Resources/contao/languages/pl/tl_form_field.xlf
  92. +170 −0 src/Resources/contao/languages/pl/tl_image_size.xlf
  93. +122 −0 src/Resources/contao/languages/pl/tl_image_size_item.xlf
  94. +574 −0 src/Resources/contao/languages/pl/tl_layout.xlf
  95. +94 −0 src/Resources/contao/languages/pl/tl_log.xlf
  96. +166 −0 src/Resources/contao/languages/pl/tl_maintenance.xlf
  97. +298 −0 src/Resources/contao/languages/pl/tl_member.xlf
  98. +114 −0 src/Resources/contao/languages/pl/tl_member_group.xlf
  99. +752 −0 src/Resources/contao/languages/pl/tl_module.xlf
  100. +582 −0 src/Resources/contao/languages/pl/tl_page.xlf
  101. +405 −0 src/Resources/contao/languages/pl/tl_settings.xlf
  102. +642 −0 src/Resources/contao/languages/pl/tl_style.xlf
  103. +166 −0 src/Resources/contao/languages/pl/tl_style_sheet.xlf
  104. +78 −0 src/Resources/contao/languages/pl/tl_templates.xlf
  105. +218 −0 src/Resources/contao/languages/pl/tl_theme.xlf
  106. +62 −0 src/Resources/contao/languages/pl/tl_undo.xlf
  107. +394 −0 src/Resources/contao/languages/pl/tl_user.xlf
  108. +130 −0 src/Resources/contao/languages/pl/tl_user_group.xlf
  109. +1 −1 src/Resources/contao/languages/ru/tl_maintenance.xlf
  110. +2 −3 src/Resources/contao/languages/ru/tl_settings.xlf
  111. +1 −1 src/Resources/contao/languages/ru/tl_user.xlf
  112. +1 −2 src/Resources/contao/languages/sl/tl_settings.xlf
  113. +1 −2 src/Resources/contao/languages/sr/tl_settings.xlf
  114. +1 −0 src/Resources/contao/languages/zh/default.xlf
  115. +1 −0 src/Resources/contao/languages/zh/tl_files.xlf
  116. +1 −0 src/Resources/contao/languages/zh/tl_page.xlf
  117. +1 −2 src/Resources/contao/languages/zh/tl_settings.xlf
  118. +3 −2 src/Resources/contao/library/Contao/Controller.php
  119. +5 −0 src/Resources/contao/library/Contao/DcaLoader.php
  120. +11 −2 src/Resources/contao/library/Contao/Email.php
  121. +3 −1 src/Resources/contao/modules/ModuleArticleList.php
  122. +1 −0 src/Resources/contao/templates/backend/be_alerts.html5
  123. +1 −0 src/Resources/contao/templates/backend/be_confirm.html5
  124. +1 −0 src/Resources/contao/templates/backend/be_conflict.html5
  125. +1 −0 src/Resources/contao/templates/backend/be_diff.html5
  126. +1 −0 src/Resources/contao/templates/backend/be_help.html5
  127. +1 −0 src/Resources/contao/templates/backend/be_login.html5
  128. +6 −3 src/Resources/contao/templates/backend/be_main.html5
  129. +1 −0 src/Resources/contao/templates/backend/be_password.html5
  130. +1 −0 src/Resources/contao/templates/backend/be_picker.html5
  131. +1 −0 src/Resources/contao/templates/backend/be_popup.html5
  132. +1 −0 src/Resources/contao/templates/backend/be_switch.html5
  133. +1 −1 src/Resources/contao/themes/flexible/basic.css
  134. +1 −1 src/Resources/contao/themes/flexible/main.css
  135. +0 −1 src/Resources/contao/themes/flexible/src/basic.css
  136. +4 −1 src/Resources/contao/themes/flexible/src/main.css
  137. +17 −5 src/Resources/contao/widgets/FileTree.php
  138. +10 −2 src/Resources/contao/widgets/MetaWizard.php
  139. +8 −2 src/Resources/contao/widgets/PageTree.php
  140. +3 −3 src/Resources/public/core.js
  141. +1 −1 src/Resources/public/core.min.js
  142. BIN src/Resources/public/favicon.ico
  143. +3 −3 tests/Cors/WebsiteRootsConfigProviderTest.php
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Contao core bundle change log

### 4.4.1 (2017-07-12)

* Prevent arbitrary PHP file inclusions in the back end (see CVE-2017-10993).
* Correctly handle subpalettes in "edit multiple" mode (see #946).
* Correctly show the DCA picker in the site structure (see #906).
* Correctly update the style sheets if a format definition is enabled/disabled (see #893).
* Always show the "show from" and "show until" fields (see #908).

### 4.4.0 (2017-06-15)

* Fix the "save and go back" function (see #870).
Expand Down
2 changes: 1 addition & 1 deletion DEPRECATED.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Contao 4.0 and will no longer be supported in Contao 5.0. Add the DCA files
with your modifications to the `app/Resources/contao/dca` folder instead.


#### initconfig.php
### initconfig.php

Using the `initconfig.php` file to customize the initialization process is
deprecated in Contao 4.0 and will no longer be supported in Contao 5.0.
Expand Down
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,10 @@ In Contao 3, the user files in the `files/` directory were publicly available
via HTTP by default and it was possible to protect certain subfolders. Now, due
to a technical change, the user files are protected by default and subfolders
have to be published explicitly to be available via HTTP.


### Article CSS IDs

In Contao 3, the alias of an article was automatically used as its CSS ID, if
no custom CSS ID was defined. In Contao 4 the default CSS ID will be generated
from its numeric ID, e.g. `article-1`.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=5.6.0",
"php": "^5.6|^7.0",
"ext-dom": "*",
"ext-gd": "*",
"ext-pcre": "*",
Expand Down Expand Up @@ -38,7 +38,6 @@
"patchwork/utf8": "^1.2",
"phpspec/php-diff": "^1.0",
"phpunit/php-token-stream": "^1.4",
"php-http/guzzle6-adapter": "^1.1",
"psr/log": "^1.0",
"simplepie/simplepie": "^1.3",
"tecnickcom/tcpdf": "^6.0",
Expand Down Expand Up @@ -80,6 +79,7 @@
"lexik/maintenance-bundle": "^2.0",
"monolog/monolog": "^1.22",
"phpunit/phpunit": "^5.0",
"php-http/guzzle6-adapter": "^1.1",
"php-http/message-factory": "^1.0.2",
"satooshi/php-coveralls": "^1.0",
"symfony/phpunit-bridge": "^3.2"
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/BackendCsvImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private function importFromTemplate(callable $callback, $table, $field, $id, $su
);

$response = new RedirectResponse($this->getBackUrl($request));
$response->headers->setCookie(new Cookie('BE_PAGE_OFFSET', 0, 0));
$response->headers->setCookie(new Cookie('BE_PAGE_OFFSET', 0, 0, $request->getBasePath(), null, false, false));

return $response;
}
Expand Down
17 changes: 12 additions & 5 deletions src/Cors/WebsiteRootsConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Contao\CoreBundle\Cors;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception\ConnectionException;
use Nelmio\CorsBundle\Options\ProviderInterface;
use Symfony\Component\HttpFoundation\Request;

Expand Down Expand Up @@ -41,7 +42,7 @@ public function __construct(Connection $connection)
*/
public function getOptions(Request $request)
{
if (!$this->hasOrigin($request) || !$this->canRunDbQuery()) {
if (!$this->isCorsRequest($request) || !$this->canRunDbQuery()) {
return [];
}

Expand All @@ -67,18 +68,24 @@ public function getOptions(Request $request)
*
* @return bool
*/
private function hasOrigin(Request $request)
private function isCorsRequest(Request $request)
{
return $request->headers->has('Origin') && '' !== $request->headers->get('Origin');
return $request->headers->has('Origin')
&& $request->headers->get('Origin') !== $request->getSchemeAndHttpHost()
;
}

/**
* Checks if the database connection and the table exist.
* Checks if a database connection can be established and the table exist.
*
* @return bool
*/
private function canRunDbQuery()
{
return $this->connection->isConnected() && $this->connection->getSchemaManager()->tablesExist(['tl_page']);
try {
return $this->connection->isConnected() && $this->connection->getSchemaManager()->tablesExist(['tl_page']);
} catch (ConnectionException $e) {
return false;
}
}
}
18 changes: 16 additions & 2 deletions src/EventListener/CommandSchedulerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Contao\CoreBundle\Framework\ContaoFrameworkInterface;
use Contao\FrontendCron;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception\ConnectionException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;

Expand Down Expand Up @@ -77,8 +78,21 @@ private function canRunController(Request $request)
return $config->isComplete()
&& !$config->get('disableCron')
&& in_array($request->attributes->get('_route'), ['contao_backend', 'contao_frontend'], true)
&& $this->connection->isConnected()
&& $this->connection->getSchemaManager()->tablesExist(['tl_cron'])
&& $this->canRunDbQuery()
;
}

/**
* Checks if a database connection can be established and the table exist.
*
* @return bool
*/
private function canRunDbQuery()
{
try {
return $this->connection->isConnected() && $this->connection->getSchemaManager()->tablesExist(['tl_cron']);
} catch (ConnectionException $e) {
return false;
}
}
}
2 changes: 1 addition & 1 deletion src/Resources/contao/classes/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public function executePostActions(DataContainer $dc)

if (\Input::post('load'))
{
echo $dc->editAll($this->strAjaxId, \Input::post('id'));
throw new ResponseException($this->convertToResponse($dc->editAll($this->strAjaxId, \Input::post('id'))));
}
}
else
Expand Down
6 changes: 6 additions & 0 deletions src/Resources/contao/classes/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ protected function getBackendModule($module)
throw new AccessDeniedException('Back end module "' . $module . '" is not allowed for user "' . $this->User->username . '".');
}

// The module does not exist
if (empty($arrModule))
{
throw new \InvalidArgumentException('Back end module "' . $module . '" is not defined in the BE_MOD array');
}

/** @var SessionInterface $objSession */
$objSession = \System::getContainer()->get('session');

Expand Down
45 changes: 28 additions & 17 deletions src/Resources/contao/classes/BackendUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,7 @@ public function navigation($blnShowAll=false)
$arrModules[$strGroupName]['label'] = (($label = is_array($GLOBALS['TL_LANG']['MOD'][$strGroupName]) ? $GLOBALS['TL_LANG']['MOD'][$strGroupName][0] : $GLOBALS['TL_LANG']['MOD'][$strGroupName]) != false) ? $label : $strGroupName;
$arrModules[$strGroupName]['href'] = $router->generate('contao_backend', array('do'=>\Input::get('do'), 'mtg'=>$strGroupName, 'ref'=>TL_REFERER_ID));
$arrModules[$strGroupName]['ajaxUrl'] = $router->generate('contao_backend');
$arrModules[$strGroupName]['isClosed'] = false;

// Do not show the modules if the group is closed
if (!$blnShowAll && isset($session['backend_modules'][$strGroupName]) && $session['backend_modules'][$strGroupName] < 1)
{
$arrModules[$strGroupName]['class'] = ' node-collapsed';
$arrModules[$strGroupName]['title'] = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['expandNode']);
$arrModules[$strGroupName]['isClosed'] = true;
}
$arrModules[$strGroupName]['icon'] = 'modPlus.gif'; // backwards compatibility with e.g. EasyThemes

foreach ($arrGroupModules as $strModuleName=>$arrModuleConfig)
{
Expand All @@ -505,13 +497,6 @@ public function navigation($blnShowAll=false)
$arrModules[$strGroupName]['modules'][$strModuleName]['class'] = 'navigation ' . $strModuleName;
$arrModules[$strGroupName]['modules'][$strModuleName]['href'] = $router->generate('contao_backend', array('do'=>$strModuleName, 'ref'=>TL_REFERER_ID));
$arrModules[$strGroupName]['modules'][$strModuleName]['isActive'] = false;

// Mark the active module and its group
if (\Input::get('do') == $strModuleName)
{
$arrModules[$strGroupName]['class'] .= ' trail';
$arrModules[$strGroupName]['modules'][$strModuleName]['isActive'] = true;
}
}
}
}
Expand All @@ -523,7 +508,33 @@ public function navigation($blnShowAll=false)
foreach ($GLOBALS['TL_HOOKS']['getUserNavigation'] as $callback)
{
$this->import($callback[0]);
$arrModules = $this->{$callback[0]}->{$callback[1]}($arrModules, $blnShowAll);
$arrModules = $this->{$callback[0]}->{$callback[1]}($arrModules, true);
}
}

foreach ($arrModules as $strGroupName => $arrGroupModules)
{
$arrModules[$strGroupName]['isClosed'] = false;

// Do not show the modules if the group is closed
if (!$blnShowAll && isset($session['backend_modules'][$strGroupName]) && $session['backend_modules'][$strGroupName] < 1)
{
$arrModules[$strGroupName]['class'] = str_replace('node-expanded', '', $arrModules[$strGroupName]['class']) . ' node-collapsed';
$arrModules[$strGroupName]['title'] = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['expandNode']);
$arrModules[$strGroupName]['isClosed'] = true;
}

if (isset($arrGroupModules['modules']) && is_array($arrGroupModules['modules']))
{
foreach ($arrGroupModules['modules'] as $strModuleName => $arrModuleConfig)
{
// Mark the active module and its group
if (\Input::get('do') == $strModuleName)
{
$arrModules[$strGroupName]['class'] .= ' trail';
$arrModules[$strGroupName]['modules'][$strModuleName]['isActive'] = true;
}
}
}
}

Expand Down
81 changes: 34 additions & 47 deletions src/Resources/contao/classes/DataContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ abstract class DataContainer extends \Backend
*/
protected $arrPickerValue = array();

/**
* The picker field type
* @var string
*/
protected $strPickerFieldType;

/**
* True if a new version has to be created
* @var boolean
*/
protected $blnCreateNewVersion = false;


/**
* Set an object property
Expand All @@ -151,7 +163,11 @@ public function __set($strKey, $varValue)
$this->objActiveRecord = $varValue;
break;

default;
case 'createNewVersion':
$this->blnCreateNewVersion = (bool) $varValue;
break;

default:
$this->$strKey = $varValue; // backwards compatibility
break;
}
Expand Down Expand Up @@ -196,6 +212,10 @@ public function __get($strKey)
case 'activeRecord':
return $this->objActiveRecord;
break;

case 'createNewVersion':
return $this->blnCreateNewVersion;
break;
}

return parent::__get($strKey);
Expand Down Expand Up @@ -886,60 +906,21 @@ protected function initPicker()

\Controller::loadDataContainer($this->strPickerTable);

$this->setPickerValue();

$strDriver = 'DC_' . $GLOBALS['TL_DCA'][$this->strPickerTable]['config']['dataContainer'];
$objDca = new $strDriver($this->strPickerTable);
$objDca->id = $this->intPickerId;
$objDca->field = $this->strPickerField;

// Set the active record
if ($this->intPickerId && $this->Database->tableExists($this->strPickerTable))
{
/** @var Model $strModel */
$strModel = \Model::getClassFromTable($this->strPickerTable);

if (class_exists($strModel))
{
$objModel = $strModel::findByPk($this->intPickerId);

if ($objModel !== null)
{
$objDca->activeRecord = $objModel;
}
}
}

// Call the load_callback
if (is_array($GLOBALS['TL_DCA'][$this->strPickerTable]['fields'][$this->strPickerField]['load_callback']))
{
foreach ($GLOBALS['TL_DCA'][$this->strPickerTable]['fields'][$this->strPickerField]['load_callback'] as $callback)
{
if (is_array($callback))
{
$this->import($callback[0]);
$this->arrPickerValue = $this->{$callback[0]}->{$callback[1]}($this->arrPickerValue, $objDca);
}
elseif (is_callable($callback))
{
$this->arrPickerValue = $callback($this->arrPickerValue, $objDca);
}
}
}

if (!isset($GLOBALS['TL_DCA'][$this->strPickerTable]['fields'][$this->strPickerField]))
{
throw new InternalServerErrorException('Target field "' . $this->strPickerTable . '.' . $this->strPickerField . '" does not exist.');
}

$this->setPickerValue();

/** @var Widget $strClass */
$strClass = $GLOBALS['BE_FFL'][$GLOBALS['TL_DCA'][$this->strPickerTable]['fields'][$this->strPickerField]['inputType']];

/** @var Widget $objWidget */
$objWidget = new $strClass($strClass::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strPickerTable]['fields'][$this->strPickerField], $this->strPickerField, $this->arrPickerValue, $this->strPickerField, $this->strPickerTable, $objDca));

if ($objWidget instanceof DcaFilterInterface)
if (is_a($strClass, DcaFilterInterface::class, true))
{
/** @var DcaFilterInterface $objWidget */
$objWidget = new $strClass($strClass::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strPickerTable]['fields'][$this->strPickerField], $this->strPickerField, $this->arrPickerValue, $this->strPickerField, $this->strPickerTable));

$this->setDcaFilter($objWidget->getDcaFilter());
}

Expand Down Expand Up @@ -981,6 +962,11 @@ protected function setDcaFilter($arrFilter)
{
$GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['root'] = $arrFilter['root'];
}

if (isset($arrFilter['fieldType']))
{
$this->strPickerFieldType = $arrFilter['fieldType'];
}
}


Expand Down Expand Up @@ -1012,7 +998,7 @@ protected function getPickerInputField($value, $attributes='')
{
$id = is_numeric($value) ? $value : md5($value);

switch ($GLOBALS['TL_DCA'][$this->strPickerTable]['fields'][$this->strPickerField]['eval']['fieldType'])
switch ($this->strPickerFieldType)
{
case 'checkbox':
return ' <input type="checkbox" name="'.$this->strPickerField.'[]" id="'.$this->strPickerField.'_'.$id.'" class="tl_tree_checkbox" value="'.\StringUtil::specialchars($value).'" onfocus="Backend.getScrollOffset()"'.\Widget::optionChecked($value, $this->arrPickerValue).$attributes.'>';
Expand All @@ -1032,6 +1018,7 @@ protected function getPickerInputField($value, $attributes='')
*/
abstract public function getPalette();


/**
* Save the current value
*
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/contao/classes/PurgeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function run()
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_purge_data');
$objTemplate->isActive = $this->isActive();
$objTemplate->message = \Message::generateUnwrapped();
$objTemplate->message = \Message::generateUnwrapped(__CLASS__);

// Run the jobs
if (\Input::post('FORM_SUBMIT') == 'tl_purge')
Expand All @@ -64,7 +64,7 @@ public function run()
}
}

\Message::addConfirmation($GLOBALS['TL_LANG']['tl_maintenance']['cacheCleared']);
\Message::addConfirmation($GLOBALS['TL_LANG']['tl_maintenance']['cacheCleared'], __CLASS__);
$this->reload();
}

Expand Down
Loading