/**
  * If a "languageField" is specified for $table this function will add a possible value to the incoming array if none is found in there already.
  *
  * @param	string		Table name
  * @param	array		Incoming array (passed by reference)
  * @return	void
  */
 function addDefaultPermittedLanguageIfNotSet($table, &$incomingFieldArray)
 {
     global $TCA;
     // Checking languages:
     if ($TCA[$table]['ctrl']['languageField']) {
         if (!isset($incomingFieldArray[$TCA[$table]['ctrl']['languageField']])) {
             // Language field must be found in input row - otherwise it does not make sense.
             $rows = array_merge(array(array('uid' => 0)), $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'sys_language', 'pid=0' . t3lib_BEfunc::deleteClause('sys_language')), array(array('uid' => -1)));
             foreach ($rows as $r) {
                 if ($this->BE_USER->checkLanguageAccess($r['uid'])) {
                     $incomingFieldArray[$TCA[$table]['ctrl']['languageField']] = $r['uid'];
                     break;
                 }
             }
         }
     }
 }