diff --git a/.gitignore b/.gitignore index 52695ce89a..8028c843fc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,8 @@ /composer.lock /vendor/ +# Node +/node_modules/ + # PhpUnit /phpunit.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb85b5cf8..d17cf4e063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Contao core bundle change log +### 4.4.7 (2017-10-12) + + * Show broken images in the file manager (see #1116). + * Copy the existing referers if a new referer ID is initialized (see #1117). + * Stop using the TinyMCE gzip compressor (deprecated since 2014). + * Prevent the User::authenticate() method from running twice (see #1067). + ### 4.4.6 (2017-09-28) * Bind the lock file path to the installation root directory (see #1107). diff --git a/composer.json b/composer.json index 413ff49921..946aca451f 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,7 @@ "contao-components/swipe": "^2.0.3", "contao-components/tablesort": "^3.4.5", "contao-components/tablesorter": "^2.0.5.3", - "contao-components/tinymce4": "^4.6.3" + "contao-components/tinymce4": "4.6.*" }, "require-dev": { "ext-fileinfo": "*", diff --git a/src/Cache/ContaoCacheWarmer.php b/src/Cache/ContaoCacheWarmer.php index b9e41e7826..c862f44790 100644 --- a/src/Cache/ContaoCacheWarmer.php +++ b/src/Cache/ContaoCacheWarmer.php @@ -270,14 +270,25 @@ private function generateTemplateMapper($cacheDir) private function getLanguagesInUse() { // Get all languages in use (see #6013) - $query = " - SELECT language FROM tl_member - UNION SELECT language FROM tl_user - UNION SELECT REPLACE(language, '-', '_') FROM tl_page - WHERE type='root' - "; - - $statement = $this->connection->prepare($query); + $statement = $this->connection->prepare(" + SELECT + language + FROM + tl_member + UNION + SELECT + language + FROM + tl_user + UNION + SELECT + REPLACE(language, '-', '_') + FROM + tl_page + WHERE + type = 'root' + "); + $statement->execute(); $languages = []; diff --git a/src/Cors/WebsiteRootsConfigProvider.php b/src/Cors/WebsiteRootsConfigProvider.php index d56c4a52fe..4615918f5e 100644 --- a/src/Cors/WebsiteRootsConfigProvider.php +++ b/src/Cors/WebsiteRootsConfigProvider.php @@ -46,11 +46,21 @@ public function getOptions(Request $request) return []; } - $stmt = $this->connection->prepare("SELECT id FROM tl_page WHERE type='root' AND dns=:dns"); + $stmt = $this->connection->prepare(" + SELECT EXISTS ( + SELECT + id + FROM + tl_page + WHERE + type = 'root' AND dns = :dns + ) + "); + $stmt->bindValue('dns', preg_replace('@^https?://@', '', $request->headers->get('origin'))); $stmt->execute(); - if (0 === $stmt->rowCount()) { + if (!$stmt->fetchColumn()) { return []; } diff --git a/src/Doctrine/Schema/DcaSchemaProvider.php b/src/Doctrine/Schema/DcaSchemaProvider.php index 97d45cbc48..ad617c1be6 100644 --- a/src/Doctrine/Schema/DcaSchemaProvider.php +++ b/src/Doctrine/Schema/DcaSchemaProvider.php @@ -82,7 +82,7 @@ public function appendToSchema(Schema $schema) if (isset($definitions['TABLE_FIELDS'])) { foreach ($definitions['TABLE_FIELDS'] as $fieldName => $sql) { - $this->parseColumnSql($table, $fieldName, strtolower(substr($sql, strlen($fieldName) + 3))); + $this->parseColumnSql($table, $fieldName, substr($sql, strlen($fieldName) + 3)); } } @@ -161,19 +161,19 @@ private function parseColumnSql(Table $table, $columnName, $sql) $type = $this->doctrine->getConnection()->getDatabasePlatform()->getDoctrineTypeMapping($type); $length = (0 === (int) $length) ? null : (int) $length; - if (preg_match('/default (\'[^\']*\'|\d+)/', $def, $match)) { + if (preg_match('/default (\'[^\']*\'|\d+)/i', $def, $match)) { $default = trim($match[1], "'"); } $options = [ 'length' => $length, - 'unsigned' => false !== strpos($def, 'unsigned'), + 'unsigned' => false !== stripos($def, 'unsigned'), 'fixed' => $fixed, 'default' => $default, - 'notnull' => false !== strpos($def, 'not null'), + 'notnull' => false !== stripos($def, 'not null'), 'scale' => null, 'precision' => null, - 'autoincrement' => false !== strpos($def, 'auto_increment'), + 'autoincrement' => false !== stripos($def, 'auto_increment'), 'comment' => null, ]; @@ -188,12 +188,12 @@ private function parseColumnSql(Table $table, $columnName, $sql) /** * Sets the length, scale, precision and fixed values by field type. * - * @param string $type - * @param string $dbType - * @param int $length - * @param int $scale - * @param int $precision - * @param bool $fixed + * @param string $type + * @param string $dbType + * @param int|null $length + * @param int $scale + * @param int $precision + * @param bool $fixed */ private function setLengthAndPrecisionByType($type, $dbType, &$length, &$scale, &$precision, &$fixed) { diff --git a/src/EventListener/StoreRefererListener.php b/src/EventListener/StoreRefererListener.php index 290d5ca193..b37af1898d 100644 --- a/src/EventListener/StoreRefererListener.php +++ b/src/EventListener/StoreRefererListener.php @@ -148,7 +148,7 @@ private function prepareBackendReferer($refererId, array $referers = null) } if (!isset($referers[$refererId]) || !is_array($referers[$refererId])) { - $referers[$refererId] = ['last' => '']; + $referers[$refererId] = end($referers) ?: ['last' => '']; } // Make sure we never have more than 25 different referer URLs diff --git a/src/Monolog/ContaoTableHandler.php b/src/Monolog/ContaoTableHandler.php index 44a67b5d42..2167550099 100644 --- a/src/Monolog/ContaoTableHandler.php +++ b/src/Monolog/ContaoTableHandler.php @@ -134,8 +134,11 @@ private function createStatement() } $this->statement = $this->container->get($this->dbalServiceName)->prepare(' - INSERT INTO tl_log (tstamp, source, action, username, text, func, ip, browser) - VALUES (:tstamp, :source, :action, :username, :text, :func, :ip, :browser) + INSERT INTO + tl_log + (tstamp, source, action, username, text, func, ip, browser) + VALUES + (:tstamp, :source, :action, :username, :text, :func, :ip, :browser) '); } diff --git a/src/Resources/contao/config/constants.php b/src/Resources/contao/config/constants.php index 551062da7e..4e64169687 100644 --- a/src/Resources/contao/config/constants.php +++ b/src/Resources/contao/config/constants.php @@ -10,7 +10,7 @@ // Core version define('VERSION', '4.4'); -define('BUILD', '6'); +define('BUILD', '7'); define('LONG_TERM_SUPPORT', true); // Link constants diff --git a/src/Resources/contao/controllers/BackendAlerts.php b/src/Resources/contao/controllers/BackendAlerts.php index 1255a7d488..50a0d26b13 100644 --- a/src/Resources/contao/controllers/BackendAlerts.php +++ b/src/Resources/contao/controllers/BackendAlerts.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; @@ -35,7 +36,10 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } \System::loadLanguageFile('default'); } diff --git a/src/Resources/contao/controllers/BackendConfirm.php b/src/Resources/contao/controllers/BackendConfirm.php index a37b49f9ef..d647e25b98 100644 --- a/src/Resources/contao/controllers/BackendConfirm.php +++ b/src/Resources/contao/controllers/BackendConfirm.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -36,7 +37,10 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } \System::loadLanguageFile('default'); \System::loadLanguageFile('modules'); diff --git a/src/Resources/contao/controllers/BackendFile.php b/src/Resources/contao/controllers/BackendFile.php index a48807158a..dd2270b336 100644 --- a/src/Resources/contao/controllers/BackendFile.php +++ b/src/Resources/contao/controllers/BackendFile.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -44,7 +45,11 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } + \System::loadLanguageFile('default'); } diff --git a/src/Resources/contao/controllers/BackendHelp.php b/src/Resources/contao/controllers/BackendHelp.php index 08964715ee..e195e65485 100644 --- a/src/Resources/contao/controllers/BackendHelp.php +++ b/src/Resources/contao/controllers/BackendHelp.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; @@ -35,7 +36,10 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } \System::loadLanguageFile('default'); \System::loadLanguageFile('modules'); diff --git a/src/Resources/contao/controllers/BackendMain.php b/src/Resources/contao/controllers/BackendMain.php index 042df72638..a4a534a91c 100644 --- a/src/Resources/contao/controllers/BackendMain.php +++ b/src/Resources/contao/controllers/BackendMain.php @@ -12,6 +12,7 @@ use Contao\CoreBundle\Event\ContaoCoreEvents; use Contao\CoreBundle\Event\PreviewUrlCreateEvent; +use Contao\CoreBundle\Exception\AccessDeniedException; use Knp\Bundle\TimeBundle\DateTimeFormatter; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -51,7 +52,10 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } // Password change required if ($this->User->pwChange) diff --git a/src/Resources/contao/controllers/BackendPage.php b/src/Resources/contao/controllers/BackendPage.php index 76386c7a9a..3ba190ad87 100644 --- a/src/Resources/contao/controllers/BackendPage.php +++ b/src/Resources/contao/controllers/BackendPage.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -44,7 +45,11 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } + \System::loadLanguageFile('default'); } diff --git a/src/Resources/contao/controllers/BackendPassword.php b/src/Resources/contao/controllers/BackendPassword.php index 4ed2e63d8a..55218f6f38 100644 --- a/src/Resources/contao/controllers/BackendPassword.php +++ b/src/Resources/contao/controllers/BackendPassword.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Patchwork\Utf8; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -37,7 +38,10 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } \System::loadLanguageFile('default'); \System::loadLanguageFile('modules'); diff --git a/src/Resources/contao/controllers/BackendPopup.php b/src/Resources/contao/controllers/BackendPopup.php index 0434502cc1..d3b17f0d80 100644 --- a/src/Resources/contao/controllers/BackendPopup.php +++ b/src/Resources/contao/controllers/BackendPopup.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; @@ -42,7 +43,11 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } + \System::loadLanguageFile('default'); $strFile = \Input::get('src', true); diff --git a/src/Resources/contao/controllers/BackendPreview.php b/src/Resources/contao/controllers/BackendPreview.php index 357d7d25c5..bb52576d5d 100644 --- a/src/Resources/contao/controllers/BackendPreview.php +++ b/src/Resources/contao/controllers/BackendPreview.php @@ -12,6 +12,7 @@ use Contao\CoreBundle\Event\ContaoCoreEvents; use Contao\CoreBundle\Event\PreviewUrlConvertEvent; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; @@ -38,7 +39,11 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } + \System::loadLanguageFile('default'); } diff --git a/src/Resources/contao/controllers/BackendSwitch.php b/src/Resources/contao/controllers/BackendSwitch.php index 745602d27b..20d4179365 100644 --- a/src/Resources/contao/controllers/BackendSwitch.php +++ b/src/Resources/contao/controllers/BackendSwitch.php @@ -10,6 +10,7 @@ namespace Contao; +use Contao\CoreBundle\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; @@ -35,7 +36,11 @@ public function __construct() $this->import('BackendUser', 'User'); parent::__construct(); - $this->User->authenticate(); + if (!\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_USER')) + { + throw new AccessDeniedException('Access denied'); + } + \System::loadLanguageFile('default'); } diff --git a/src/Resources/contao/controllers/FrontendIndex.php b/src/Resources/contao/controllers/FrontendIndex.php index 8a92a730eb..4e7fd38924 100644 --- a/src/Resources/contao/controllers/FrontendIndex.php +++ b/src/Resources/contao/controllers/FrontendIndex.php @@ -63,7 +63,6 @@ public function run() // Throw a 404 error if the request is not a Contao request (see #2864) elseif ($pageId === false) { - $this->User->authenticate(); throw new PageNotFoundException('Page not found: ' . \Environment::get('uri')); } @@ -182,7 +181,6 @@ public function renderPage($pageModel) if (preg_match($regex, \Environment::get('relativeRequest'))) { - $this->User->authenticate(); throw new PageNotFoundException('Page not found: ' . \Environment::get('uri')); } } @@ -230,15 +228,13 @@ public function renderPage($pageModel) // Load an error 404 page object if ($objPage->domain != \Environment::get('host')) { - $this->User->authenticate(); $this->log('Page ID "' . $objPage->id . '" was requested via "' . \Environment::get('host') . '" but can only be accessed via "' . $objPage->domain . '" (' . \Environment::get('base') . \Environment::get('request') . ')', __METHOD__, TL_ERROR); - throw new PageNotFoundException('Page not found: ' . \Environment::get('uri')); } } // Authenticate the user - if (!$this->User->authenticate() && $objPage->protected) + if ($objPage->protected && !\System::getContainer()->get('security.authorization_checker')->isGranted('ROLE_MEMBER')) { throw new AccessDeniedException('Access denied: ' . \Environment::get('uri')); } diff --git a/src/Resources/contao/dca/tl_member.php b/src/Resources/contao/dca/tl_member.php index ed2d8f4a55..f635dbc144 100644 --- a/src/Resources/contao/dca/tl_member.php +++ b/src/Resources/contao/dca/tl_member.php @@ -340,7 +340,7 @@ ( array('tl_member', 'setNewPassword') ), - 'sql' => "varchar(128) NOT NULL default ''" + 'sql' => "varchar(255) NOT NULL default ''" ), 'assignDir' => array ( diff --git a/src/Resources/contao/dca/tl_user.php b/src/Resources/contao/dca/tl_user.php index b7f8a3d18f..18820b105e 100644 --- a/src/Resources/contao/dca/tl_user.php +++ b/src/Resources/contao/dca/tl_user.php @@ -258,7 +258,7 @@ 'exclude' => true, 'inputType' => 'password', 'eval' => array('mandatory'=>true, 'preserveTags'=>true, 'minlength'=>Config::get('minPasswordLength')), - 'sql' => "varchar(128) NOT NULL default ''" + 'sql' => "varchar(255) NOT NULL default ''" ), 'pwChange' => array ( diff --git a/src/Resources/contao/drivers/DC_Folder.php b/src/Resources/contao/drivers/DC_Folder.php index 81bbaddcfb..b2d584e968 100644 --- a/src/Resources/contao/drivers/DC_Folder.php +++ b/src/Resources/contao/drivers/DC_Folder.php @@ -16,6 +16,7 @@ use Contao\CoreBundle\Picker\PickerInterface; use Contao\CoreBundle\Util\SymlinkUtil; use Contao\Image\ResizeConfiguration; +use Imagine\Exception\RuntimeException; use Imagine\Gd\Imagine; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; @@ -326,12 +327,12 @@ public function showAll() { list($t, $f) = explode('.', $GLOBALS['TL_DCA'][$this->strTable]['fields']['name']['foreignKey']); - $objRoot = $this->Database->prepare("SELECT path, type, extension FROM {$this->strTable} WHERE (" . $strPattern . " OR " . sprintf($strPattern, "(SELECT $f FROM $t WHERE $t.id={$this->strTable}.name)") . ") GROUP BY path") + $objRoot = $this->Database->prepare("SELECT path, type, extension FROM {$this->strTable} WHERE (" . $strPattern . " OR " . sprintf($strPattern, "(SELECT $f FROM $t WHERE $t.id={$this->strTable}.name)") . ")") ->execute($for, $for); } else { - $objRoot = $this->Database->prepare("SELECT path, type, extension FROM {$this->strTable} WHERE " . $strPattern . " GROUP BY path") + $objRoot = $this->Database->prepare("SELECT path, type, extension FROM {$this->strTable} WHERE " . $strPattern) ->execute($for); } @@ -2699,7 +2700,7 @@ protected function generateTree($path, $intMargin, $mount=false, $blnProtected=t $thumbnail .= ')'; // Generate the thumbnail - if ($objFile->isImage && $objFile->viewHeight > 0 && \Config::get('thumbnails')) + if (\Config::get('thumbnails') && $objFile->isImage && (!$objFile->isSvgImage || $objFile->viewHeight > 0)) { $blnCanResize = true; @@ -2711,21 +2712,28 @@ protected function generateTree($path, $intMargin, $mount=false, $blnProtected=t if ($blnCanResize) { - // Inline the image if no preview image will be generated (see #636) - if ($objFile->height !== null && $objFile->height <= 50 && $objFile->width !== null && $objFile->width <= 400) + try { - $thumbnail .= '
'; - } - else - { - $thumbnail .= '
' . \Image::getHtml(\System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . rawurldecode($currentEncoded), array(400, 50, ResizeConfiguration::MODE_BOX))->getUrl(TL_ROOT), '', 'style="margin:0 0 2px -18px"'); - } + // Inline the image if no preview image will be generated (see #636) + if ($objFile->height !== null && $objFile->height <= 50 && $objFile->width !== null && $objFile->width <= 400) + { + $thumbnail .= '
'; + } + else + { + $thumbnail .= '
' . \Image::getHtml(\System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . rawurldecode($currentEncoded), array(400, 50, ResizeConfiguration::MODE_BOX))->getUrl(TL_ROOT), '', 'style="margin:0 0 2px -18px"'); + } - $importantPart = \System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . rawurldecode($currentEncoded))->getImportantPart(); + $importantPart = \System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . rawurldecode($currentEncoded))->getImportantPart(); - if ($importantPart->getPosition()->getX() > 0 || $importantPart->getPosition()->getY() > 0 || $importantPart->getSize()->getWidth() < $objFile->width || $importantPart->getSize()->getHeight() < $objFile->height) + if ($importantPart->getPosition()->getX() > 0 || $importantPart->getPosition()->getY() > 0 || $importantPart->getSize()->getWidth() < $objFile->width || $importantPart->getSize()->getHeight() < $objFile->height) + { + $thumbnail .= ' ' . \Image::getHtml(\System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . rawurldecode($currentEncoded), (new ResizeConfiguration())->setWidth(320)->setHeight(40)->setMode(ResizeConfiguration::MODE_BOX)->setZoomLevel(100))->getUrl(TL_ROOT), '', 'style="margin:0 0 2px 0;vertical-align:bottom"'); + } + } + catch (RuntimeException $e) { - $thumbnail .= ' ' . \Image::getHtml(\System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . rawurldecode($currentEncoded), (new ResizeConfiguration())->setWidth(320)->setHeight(40)->setMode(ResizeConfiguration::MODE_BOX)->setZoomLevel(100))->getUrl(TL_ROOT), '', 'style="margin:0 0 2px 0;vertical-align:bottom"'); + $thumbnail .= '

Broken image!

'; } } } diff --git a/src/Resources/contao/drivers/DC_Table.php b/src/Resources/contao/drivers/DC_Table.php index cde8cdbb64..737fc37199 100644 --- a/src/Resources/contao/drivers/DC_Table.php +++ b/src/Resources/contao/drivers/DC_Table.php @@ -45,12 +45,6 @@ class DC_Table extends \DataContainer implements \listable, \editable */ protected $ctable; - /** - * ID of the button container - * @var string - */ - protected $bid; - /** * Limit (database query) * @var string @@ -293,7 +287,6 @@ public function showAll() { $return = ''; $this->limit = ''; - $this->bid = 'tl_buttons'; /** @var SessionInterface $objSession */ $objSession = \System::getContainer()->get('session'); @@ -4588,7 +4581,6 @@ protected function parentView() */ protected function listView() { - $return = ''; $table = ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 6) ? $this->ptable : $this->strTable; $orderBy = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['fields']; $firstOrderBy = preg_replace('/\s+.*$/', '', $orderBy[0]); @@ -4686,18 +4678,14 @@ protected function listView() } $objRow = $objRowStmt->execute($this->values); - $this->bid = ($return != '') ? $this->bid : 'tl_buttons'; // Display buttos - if (!$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] || !empty($GLOBALS['TL_DCA'][$this->strTable]['list']['global_operations'])) - { - $return .= \Message::generate() . ' -
'.((\Input::get('act') == 'select' || $this->ptable) ? ' + $return = \Message::generate() . ' +
'.((\Input::get('act') == 'select' || $this->ptable) ? ' '.$GLOBALS['TL_LANG']['MSC']['backBT'].' ' : (isset($GLOBALS['TL_DCA'][$this->strTable]['config']['backlink']) ? ' '.$GLOBALS['TL_LANG']['MSC']['backBT'].' ' : '')) . ((\Input::get('act') != 'select' && !$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] && !$GLOBALS['TL_DCA'][$this->strTable]['config']['notCreatable']) ? ' '.$GLOBALS['TL_LANG'][$this->strTable]['new'][0].' ' : '') . $this->generateGlobalButtons() . '
'; - } // Return "no records found" message if ($objRow->numRows < 1) @@ -5161,7 +5149,6 @@ protected function sortMenu() /** @var AttributeBagInterface $objSessionBag */ $objSessionBag = \System::getContainer()->get('session')->getBag('contao_backend'); - $this->bid = 'tl_buttons_a'; $session = $objSessionBag->all(); $orderBy = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['fields']; $firstOrderBy = preg_replace('/\s+.*$/', '', $orderBy[0]); @@ -5379,7 +5366,6 @@ protected function filterMenu($intFilterPanel) $objSessionBag = \System::getContainer()->get('session')->getBag('contao_backend'); $fields = ''; - $this->bid = 'tl_buttons_a'; $sortingFields = array(); $session = $objSessionBag->all(); $filter = ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4) ? $this->strTable.'_'.CURRENT_ID : $this->strTable; diff --git a/src/Resources/contao/languages/nl/default.xlf b/src/Resources/contao/languages/nl/default.xlf index d05a25af0f..e51e7c9caf 100644 --- a/src/Resources/contao/languages/nl/default.xlf +++ b/src/Resources/contao/languages/nl/default.xlf @@ -1385,9 +1385,11 @@ Deze e-mail is aangemaakt door Contao. U kunt niet rechtstreeks hierop antwoorde Profile + Profiel User profile + Gebruiker profiel Member @@ -1815,9 +1817,11 @@ Deze e-mail is aangemaakt door Contao. U kunt niet rechtstreeks hierop antwoorde Alerts + Meldingen Currently there are no alerts. + Momenteel geen meldingen. Clear clipboard diff --git a/src/Resources/contao/languages/nl/modules.xlf b/src/Resources/contao/languages/nl/modules.xlf index 887d683444..cc2988daf4 100644 --- a/src/Resources/contao/languages/nl/modules.xlf +++ b/src/Resources/contao/languages/nl/modules.xlf @@ -131,6 +131,7 @@ User profile + Gebruiker profiel Change your personal data or set a new password diff --git a/src/Resources/contao/languages/nl/tl_layout.xlf b/src/Resources/contao/languages/nl/tl_layout.xlf index 39d685eb34..f65716e57f 100644 --- a/src/Resources/contao/languages/nl/tl_layout.xlf +++ b/src/Resources/contao/languages/nl/tl_layout.xlf @@ -231,6 +231,7 @@ Combine the .css and .js files (recommended). + Combineer .css en .js bestanden (aanbevolen). Load external style sheets first diff --git a/src/Resources/contao/languages/ru/tl_layout.xlf b/src/Resources/contao/languages/ru/tl_layout.xlf index 832e63f28c..a95873d776 100644 --- a/src/Resources/contao/languages/ru/tl_layout.xlf +++ b/src/Resources/contao/languages/ru/tl_layout.xlf @@ -231,6 +231,7 @@ Combine the .css and .js files (recommended). + Объединять .css- и .js-файлы (рекомендуется). Load external style sheets first diff --git a/src/Resources/contao/languages/sr/modules.xlf b/src/Resources/contao/languages/sr/modules.xlf index 56bfafb56b..44914ea656 100644 --- a/src/Resources/contao/languages/sr/modules.xlf +++ b/src/Resources/contao/languages/sr/modules.xlf @@ -15,7 +15,7 @@ Form generator - Генератор формулара + Формулари Create custom forms and store or send the submitted data @@ -23,7 +23,7 @@ Layout - Распоред - Layout + Распореди Themes @@ -43,7 +43,7 @@ Templates - Шаблони - Templates + Шаблони Edit templates in the back end @@ -91,7 +91,7 @@ File manager - Менаџер фајлова - File manager + Управљање фајловима Manage files and folders or upload new files to the server @@ -99,7 +99,7 @@ System log - Системске биљешке - System log + Системски логови Browse the system log and analyze the activity on the website diff --git a/src/Resources/contao/library/Contao/Controller.php b/src/Resources/contao/library/Contao/Controller.php index 925bc0588a..937fccd551 100644 --- a/src/Resources/contao/library/Contao/Controller.php +++ b/src/Resources/contao/library/Contao/Controller.php @@ -788,11 +788,6 @@ public static function replaceDynamicScriptTags($strBuffer) if ($options->static) { - if ($options->mtime === null) - { - $options->mtime = filemtime(TL_ROOT . '/' . $stylesheet); - } - $objCombiner->add($stylesheet, $options->mtime, $options->media); } else @@ -853,11 +848,6 @@ public static function replaceDynamicScriptTags($strBuffer) if ($options->static) { - if ($options->mtime === null) - { - $options->mtime = filemtime(TL_ROOT . '/' . $javascript); - } - $options->async ? $objCombinerAsync->add($javascript, $options->mtime) : $objCombiner->add($javascript, $options->mtime); } else diff --git a/src/Resources/contao/library/Contao/Image.php b/src/Resources/contao/library/Contao/Image.php index d127695554..40013e8b91 100644 --- a/src/Resources/contao/library/Contao/Image.php +++ b/src/Resources/contao/library/Contao/Image.php @@ -703,7 +703,6 @@ public static function getHtml($src, $alt='', $attributes='') // Handle public bundle resources if (file_exists(TL_ROOT . '/' . $webDir . '/' . $src)) { - @trigger_error('Paths relative to the webdir are deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED); $src = $webDir . '/' . $src; } else diff --git a/src/Resources/contao/library/Contao/Search.php b/src/Resources/contao/library/Contao/Search.php index 58ab27139e..094ac27057 100644 --- a/src/Resources/contao/library/Contao/Search.php +++ b/src/Resources/contao/library/Contao/Search.php @@ -398,7 +398,7 @@ public static function searchFor($strKeywords, $blnOrSearch=false, $arrPid=array $arrValues = array(); // Remember found words so we can highlight them later - $strQuery = "SELECT tl_search_index.pid AS sid, GROUP_CONCAT(word) AS matches"; + $strQuery = "SELECT * FROM (SELECT tl_search_index.pid AS sid, GROUP_CONCAT(word) AS matches"; // Get the number of wildcard matches if (!$blnOrSearch && $intWildcards) @@ -413,9 +413,6 @@ public static function searchFor($strKeywords, $blnOrSearch=false, $arrPid=array // Get the relevance $strQuery .= ", SUM(relevance) AS relevance"; - // Get meta information from tl_search - $strQuery .= ", tl_search.*"; // see #4506 - // Prepare keywords array $arrAllKeywords = array(); @@ -454,7 +451,7 @@ public static function searchFor($strKeywords, $blnOrSearch=false, $arrPid=array $arrValues = array_merge($arrValues, $arrWildcards); } - $strQuery .= " FROM tl_search_index LEFT JOIN tl_search ON(tl_search_index.pid=tl_search.id) WHERE (" . implode(' OR ', $arrAllKeywords) . ")"; + $strQuery .= " FROM tl_search_index WHERE (" . implode(' OR ', $arrAllKeywords) . ")"; // Get phrases if ($intPhrases) @@ -485,22 +482,22 @@ public static function searchFor($strKeywords, $blnOrSearch=false, $arrPid=array $strQuery .= " GROUP BY tl_search_index.pid"; + // Sort by relevance + $strQuery .= " ORDER BY relevance DESC) matches LEFT JOIN tl_search ON(matches.sid=tl_search.id)"; + // Make sure to find all words if (!$blnOrSearch) { // Number of keywords without wildcards - $strQuery .= " HAVING count >= " . $intKeywords; + $strQuery .= " WHERE matches.count >= " . $intKeywords; // Dynamically add the number of wildcard matches if ($intWildcards) { - $strQuery .= " + IF(wildcards>" . $intWildcards . ", wildcards, " . $intWildcards . ")"; + $strQuery .= " + IF(matches.wildcards>" . $intWildcards . ", matches.wildcards, " . $intWildcards . ")"; } } - // Sort by relevance - $strQuery .= " ORDER BY relevance DESC"; - // Return result $objResultStmt = \Database::getInstance()->prepare($strQuery); diff --git a/src/Resources/contao/library/Contao/User.php b/src/Resources/contao/library/Contao/User.php index 3a3339bc0a..ddad255a2d 100644 --- a/src/Resources/contao/library/Contao/User.php +++ b/src/Resources/contao/library/Contao/User.php @@ -261,6 +261,12 @@ public function getData() */ public function authenticate() { + // No cookie + if ($this->strHash === null) + { + return false; + } + // Check the cookie hash if ($this->strHash != $this->getSessionHash($this->strCookie)) { @@ -566,8 +572,11 @@ public function findBy($strColumn, $varValue) */ public function save() { + $arrFields = $this->Database->getFieldNames($this->strTable); + $arrSet = array_intersect_key($this->arrData, array_flip($arrFields)); + $this->Database->prepare("UPDATE " . $this->strTable . " %s WHERE id=?") - ->set($this->arrData) + ->set($arrSet) ->execute($this->id); } diff --git a/src/Resources/contao/pages/PageRegular.php b/src/Resources/contao/pages/PageRegular.php index 3a40a6e4a8..57a15eec14 100644 --- a/src/Resources/contao/pages/PageRegular.php +++ b/src/Resources/contao/pages/PageRegular.php @@ -594,7 +594,7 @@ protected function createHeaderScripts($objPage, $objLayout) if ($objFile !== null) { - $GLOBALS['TL_USER_CSS'][] = $objFile->path . '|' . $media . '|static|' . filemtime(TL_ROOT . '/' . $objFile->path); + $GLOBALS['TL_USER_CSS'][] = $objFile->path . '|' . $media . '|static'; } } else diff --git a/src/Resources/contao/templates/backend/be_tinyFlash.html5 b/src/Resources/contao/templates/backend/be_tinyFlash.html5 index 8275406ed7..f7aeba33a3 100644 --- a/src/Resources/contao/templates/backend/be_tinyFlash.html5 +++ b/src/Resources/contao/templates/backend/be_tinyFlash.html5 @@ -5,7 +5,7 @@ namespace Contao; if ($GLOBALS['TL_CONFIG']['useRTE']): ?> - + + +