在TYPO3 6.0.2中,我得到了一个Extbase / Fluid-Extension。 Controller中的功能如下所示:
$this->contentObj = $this->configurationManager->getContentObject();
$data = $this->contentObj->data;
print_r($data);
这将返回tt_content
- 包含image => /path/to/image
的对象。一切都很好。
[bodytext] => Lorem ipsum dolor
[image] => ../../fileadmin/user_upload/images/businessman.jpg
今天将源代码更改为TYPO3 6.0.3一切都相同,但图片只是"1"
。
[bodytext] => Lorem ipsum dolor
[image] => 1
我该怎么办?谢谢!
答案 0 :(得分:2)
我发现这是为了获取没有sql查询的文件
public function myAction(){
// get data of the content object
$data = $this->contentObj = $this->configurationManager->getContentObject()->data;
// Neu ab Typo3 6.0.3 -> Bild in tt_content-Object wird nicht mehr mit zurueckgeliefert, daher:
$fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$fileObjects = $fileRepository->findByRelation('tt_content', 'image', $data['uid']);
$files = array();
foreach ($fileObjects as $key => $value) {
$files[$key]['reference'] = $value->getReferenceProperties();
$files[$key]['original'] = $value->getOriginalFile()->getProperties();
}
#t3lib_utility_Debug::debug($files);
#die('Ende');
// Files in Fluid ausgeben
$this->view->assign('files', $files);
// Daten in Fluid ausgeben
$this->view->assign('data', $data);
}
流体
<f:for each="{files}" as="file">
<li>
<a href="{file.reference.link}"><img src="fileadmin{file.original.identifier}" alt="" /></a>
<p class="flex-caption"><f:format.nl2br>{file.reference.description}</f:format.nl2br></p>
</li>
</f:for>
答案 1 :(得分:0)
该错误似乎是安全更新的结果,其中典型的jumpURL系统已更改(SQL注入)。我在这里提交了一个错误:http://forge.typo3.org/issues/46090
答案 2 :(得分:0)
自TYPO3 6以来,方法“function getContentObject($name)
”位于
* TYPO3 \ sysext \ CMS \ tslib的\ class.tslib_content.php *。
此档案的内容:
/*
* @deprecated since 6.0, the classname tslib_cObj and this file is obsolete
* and will be removed with 6.2. The class was renamed and is now located at:
* typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
*/
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('frontend') . 'Classes/ContentObject/ContentObjectRenderer.php';
但我没有看到旧文件与包含我的问题的新文件之间存在任何差异。
我没有找到如何获取tt_content-entry“native”的文件引用,所以我写了一个SQL查询:
public function bla() {
// get data of the content object
$this->contentObj = $this->configurationManager->getContentObject();
$data = $this->contentObj->data;
// Neu ab Typo3 6.0.3 -> Bild in tt_content-Object wird nicht mehr mit zurueckgeliefert, daher:
// https://forge.typo3.org/issues/46090
// http://stackoverflow.com/questions/15250351/missing-image-in-typo3-this-contentobj-in-6-0-3
$res = $GLOBALS['TYPO3_DB']->sql_query(
'select sys_file.identifier from sys_file_reference left join sys_file on sys_file_reference.uid_local = sys_file.uid where sys_file_reference.uid_foreign='.$data['uid'].' and sys_file_reference.deleted=0'
);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$data['image'] = $row['identifier'];
}
#print_r($data);
// assign the data to the fluid template
$this->view->assign('data', $data);
}