Skip to content

Commit cc33a58

Browse files
InvisibleKindhelhum
authored andcommitted
[BUGFIX] Add a workaround for noPHPscriptInclude = TRUE (#37)
Resolves: #34
1 parent 896032e commit cc33a58

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

Classes/Core/FrontendRenderingProvisioner.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ protected function configurePageRenderer(TypoScriptFrontendController $typoScrip
141141
protected function configureImageProcessing(TypoScriptFrontendController $typoScriptFrontendController)
142142
{
143143
$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($typoScriptFrontendController->config['config']['noScaleUp']) ? '' . $typoScriptFrontendController->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
144-
$typoScriptFrontendController->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
144+
if (property_exists($typoScriptFrontendController, 'TYPO3_CONF_VARS')) {
145+
$typoScriptFrontendController->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
146+
}
145147
}
146148
}

Classes/RenderingDispatcher.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ public function checkDataSubmission(TypoScriptFrontendController $typoScriptFron
7575

7676
$typoScriptFrontendController->content = $response->getContent();
7777
$typoScriptFrontendController->config['config']['pageGenScript'] = 'EXT:typoscript_rendering/Scripts/DummyRendering.php';
78+
// Force DummyRendering to be included, even if TYPO3 setup disallows inclusion of PHP scripts
79+
if (property_exists($typoScriptFrontendController, 'TYPO3_CONF_VARS')) {
80+
$typoScriptFrontendController->TYPO3_CONF_VARS['FE']['noPHPscriptInclude'] = false;
81+
} else {
82+
$GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude'] = false;
83+
}
7884
}
7985
}
8086

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
namespace Helhum\TyposcriptRendering\Tests\Functional;
3+
4+
/*
5+
* This file is part of the TypoScript Rendering TYPO3 extension.
6+
*
7+
* It is free software; you can redistribute it and/or modify it under
8+
* the terms of the GNU General Public License, either version 2
9+
* of the License, or any later version.
10+
*
11+
* For the full copyright and license information, please read
12+
* LICENSE file that was distributed with this source code.
13+
*
14+
*/
15+
16+
/**
17+
* Test case.
18+
*/
19+
class FeNoPhpScriptIncludeRenderingTest extends AbstractRenderingTestCase
20+
{
21+
/**
22+
* @var array
23+
*/
24+
protected $configurationToUseInTestInstance = array(
25+
'FE' => array(
26+
'noPHPscriptInclude' => true,
27+
),
28+
);
29+
30+
/**
31+
* @test
32+
*/
33+
public function contentIsRenderedWithNoPhpScriptInclusionEnabled()
34+
{
35+
$requestArguments = array('url' => $this->getRenderUrl(1, 1, 'lib.link'));
36+
$expectedContent = '<a href="/index.php?id=1&amp;L=1" target="_blank">link</a>';
37+
$this->assertSame($expectedContent, $this->fetchFrontendResponse($requestArguments)->getContent());
38+
}
39+
}

0 commit comments

Comments
 (0)