Skip to content

Commit

Permalink
Merge branch 'hotfix/4.4.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Oct 12, 2017
2 parents 05295bf + f0df954 commit a3b6814
Show file tree
Hide file tree
Showing 47 changed files with 232 additions and 118 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -2,5 +2,8 @@
/composer.lock
/vendor/

# Node
/node_modules/

# PhpUnit
/phpunit.xml
7 changes: 7 additions & 0 deletions 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).
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -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": "*",
Expand Down
27 changes: 19 additions & 8 deletions src/Cache/ContaoCacheWarmer.php
Expand Up @@ -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 = [];
Expand Down
14 changes: 12 additions & 2 deletions src/Cors/WebsiteRootsConfigProvider.php
Expand Up @@ -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 [];
}

Expand Down
22 changes: 11 additions & 11 deletions src/Doctrine/Schema/DcaSchemaProvider.php
Expand Up @@ -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));
}
}

Expand Down Expand Up @@ -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,
];

Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/StoreRefererListener.php
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/Monolog/ContaoTableHandler.php
Expand Up @@ -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)
');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/config/constants.php
Expand Up @@ -10,7 +10,7 @@

// Core version
define('VERSION', '4.4');
define('BUILD', '6');
define('BUILD', '7');
define('LONG_TERM_SUPPORT', true);

// Link constants
Expand Down
6 changes: 5 additions & 1 deletion src/Resources/contao/controllers/BackendAlerts.php
Expand Up @@ -10,6 +10,7 @@

namespace Contao;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Response;


Expand All @@ -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');
}
Expand Down
6 changes: 5 additions & 1 deletion src/Resources/contao/controllers/BackendConfirm.php
Expand Up @@ -10,6 +10,7 @@

namespace Contao;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

Expand All @@ -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');
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/contao/controllers/BackendFile.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
}

Expand Down
6 changes: 5 additions & 1 deletion src/Resources/contao/controllers/BackendHelp.php
Expand Up @@ -10,6 +10,7 @@

namespace Contao;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Response;


Expand All @@ -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');
Expand Down
6 changes: 5 additions & 1 deletion src/Resources/contao/controllers/BackendMain.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/contao/controllers/BackendPage.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
}

Expand Down
6 changes: 5 additions & 1 deletion src/Resources/contao/controllers/BackendPassword.php
Expand Up @@ -10,6 +10,7 @@

namespace Contao;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Patchwork\Utf8;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -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');
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/contao/controllers/BackendPopup.php
Expand Up @@ -10,6 +10,7 @@

namespace Contao;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Response;


Expand Down Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/contao/controllers/BackendPreview.php
Expand Up @@ -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;

Expand All @@ -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');
}

Expand Down
7 changes: 6 additions & 1 deletion src/Resources/contao/controllers/BackendSwitch.php
Expand Up @@ -10,6 +10,7 @@

namespace Contao;

use Contao\CoreBundle\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Response;


Expand All @@ -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');
}

Expand Down

0 comments on commit a3b6814

Please sign in to comment.