[TYPO3-templavoila] Bug creating new CE as "normal" user.

Bernhard Kraft kraftb at kraftb.at
Thu Mar 9 14:44:24 CET 2006


Hello,


Can anyone confirm that it doesn't work to create Content-Elements using
TemplaVoila 0.6.0 from TER and TV 4.0.0beta3 when the following conditions
are met:

* You are an ordinary user and no admin
* You create a default-language content elemen
* You have no special settings regarding languages (why should I if I create a default language element)


The problem is I get the following error when trying to create the elment:

 Sorry, you didn't have proper permissions to perform this change.

This is just the result of the problem ... In this in the alt_doc.php which shows up the uid to display is
set to 0 because the previous POST to tcemain which should create the elemnt didn't succeed.

I could track the error down to the following problem:
in t3lib_tcemain.php in process_datamap (line 631) the following check is done:
$recordAccess = $this->BE_USER->recordEditAccessInternals($table,$incomingFieldArray,TRUE);

in t3lib_userauthgroup.php in recordEditAccessInternal:
        // Checking languages:
      if ($TCA[$table]['ctrl']['languageField'])  {
        if (isset($idOrRow[$TCA[$table]['ctrl']['languageField']])) { // Language field must be found in input row - otherwise it does not make sense.
          if (!$this->checkLanguageAccess($idOrRow[$TCA[$table]['ctrl']['languageField']])) {
            $this->errorMsg = 'ERROR: Language was not allowed.';
            return FALSE;
          }
        } else {
          $this->errorMsg = 'ERROR: The "languageField" field named "'.$TCA[$table]['ctrl']['languageField'].'" was not found in testing record!';
          return FALSE;
        }
      }

This checks for 'sys_language_uid' in the posted values. Unfortunately at the beginning of t3lib_tcemain::fillInFieldArray
sys_language_uid gets set to "NULL" by default.

Now it is the case that the following line:
        if (isset($idOrRow[$TCA[$table]['ctrl']['languageField']])) { // Language field must be found in input row - otherwise it does not make sense.
of the above snipet fails if the value equals NULL ...

try:

<?php
$a = array(1 => NULL);
echo isset($a[1])?'ok':'seems wrong';
?>

it will result in "seems wrong" ... it seems as NULL is not set :)


don't know wheter we should change this in the core or in templavoila ....

a patch to fix this can be found here:
http://think-open.org/kraftb/createCE_defaultLanguage_2006-03-09.diff






greets,
Bernhard



More information about the TYPO3-project-templavoila mailing list