Reputation: 11
in TYPO3 6.0.2 I got an Extbase/Fluid-Extension. The function in the Controller looks like this:
$this->contentObj = $this->configurationManager->getContentObject();
$data = $this->contentObj->data;
print_r($data);
This will return a tt_content
- object including image => /path/to/image
. Everything fine.
[bodytext] => Lorem ipsum dolor
[image] => ../../fileadmin/user_upload/images/businessman.jpg
Today changing source to TYPO3 6.0.3 everything the same but the image is just a "1"
.
[bodytext] => Lorem ipsum dolor
[image] => 1
What can I do? Thanks!
Upvotes: 1
Views: 1727
Reputation: 21
i found this to get files without sql query
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);
}
fluid
<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>
Upvotes: 2
Reputation: 11
Since TYPO3 6 the method "function getContentObject($name)
" was located in
*typo3\sysext\cms\tslib\class.tslib_content.php*.
Content of this file:
/*
* @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';
But I don't see any differences between the old an the new file containing my problem.
I didn't find out how to get the file reference for the tt_content-entry "native", so I wrote a SQL-query:
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);
}
Upvotes: 0
Reputation: 1
the bug appears to be a result of the security update where the typical jumpURL system has changed (SQL Injection). I filed a bug here: http://forge.typo3.org/issues/46090
Upvotes: 0