Uffff! Habe eine Lösung gefunden.
Hier habe ich für Nachwelt alles nochmal zusammengefasst:
Mit dem Code aus t3lib/class.t3lib_matchcondition.php habe ich 2 Funktionen genommen und in der formail_userfunc Extension, in der Datei pi/class.tx_mailformuserfunc_pi.php eingebaut.
Die 2 Funktionen aus t3lib/class.t3lib_matchcondition.php sind auch in TYPO3 4.x enthalten und müssten gut sein.
Ich habe die formmail_userfunc Grundfunktions-Codes gleich belassen, damit die Inputs wie im Manual beschrieben sind weiterhin funktionieren.
Die neuen Funktionen gehen etwas weiter und liefern gleich den Wert zurück, z.B. was in TSFE:fe_user>user>username drin ist, i.e. "Kasper" 🙂 . Alles was ab Stufe 3 wird nur verarbeitet (TYPO3 3.8.1 Bug), da Stufe 1 und 2 (TSFE:fe_user oder page:title) ja schon mit dem bestehenden Code von formail_userfunc erledigt wird.
(btw: Die geschweiften Klammern kommen als String rein und mussten nirgends umgewandelt werden)
In Zusammenspiel mit feuser_admin und newloginbox funz formmail_userfunc für mich jetzt endlich auch 😃 .
Ich hoffe ich konnte hiermit ein paar 3.8.1 User glücklicher machen (aber ohne Gewähr 8-) ).
Obwohl der Code, vermutlich je nach Umgebung des CMS, vielleicht sich anders verhaltet, kann er hilfreich sein einen Schritt weiterzukommen.
(Mein Tipp: Sicherheitshalber den alten Code immer schön abspeichern, bei Änderungen)
So sieht der neue Code dann aus (Auszug):
Den Unterschied sieht man am besten, wenn man den alten und neuen Code ausdruckt und miteinander vergleicht.
.
..
...
/***************************
*
* Main function
*
**************************/
/**
* Implements the "insertData" property of stdWrap meaning that if strings matching {...} is found in the input string they will be substituted with the return
value from getData (datatype) which is passed the content of the curly braces.
* Example: If input string is "This is the page title: {page:title}" then the part, '{page:title}', will be substituted with the current pages title field
value.
*
* @param string Input value
* @return string Processed input value
* @see tslib_cObj::insertData
*/
function insertData($str) {
// Load extension configuration
$confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
// It is required to substitute the splitChar itself and the splitChar with htmlspecialchars converted
$confArr['splitCharArr'] = array(
htmlspecialchars($confArr['splitChar']),
$confArr['splitChar'],
);
// Disable the frontend cache, if set in the extension configuration
if ($confArr['no_cache']) {
$GLOBALS['TSFE']->set_no_cache();
}
// Find all data values surrounded by braces "{ }"
preg_match_all('/\{[^\}]+\}/s', $str, $dataFields, PREG_SET_ORDER);
$braces = array('{','}'); // für Ersetzen weiter unten...
for ($i = 0; $i < count($dataFields); $i++) {
$dataFields[$i][1] = str_replace($confArr['splitCharArr'], '|', $dataFields[$i][0]);
$bars = explode('|',$dataFields[$i][1]); // '|' Zeichen?
$c = count($bars); // '|' zählen
if (1 < $c) {
$dataFields[$i][1] = str_replace($braces,'',$dataFields[$i][1]); // '{', '}' ersetzen/löschen
$dataFields[$i][1] = $this->getGP_ENV_TSFE($dataFields[$i][1]);
}
$str = str_replace($dataFields[$i][0], $dataFields[$i][1], $str);
}
return $str;
}
function getGlobal($var, $source=NULL) {
$vars = explode('|',$var);
$c = count($vars);
$k = trim($vars[0]);
$theVar = isset($source) ? $source[$k] : $GLOBALS[$k];
for ($a=1;$a<$c;$a++) {
if (!isset($theVar)) { break; }
$key = trim($vars[$a]);
if (is_object($theVar)) {
$theVar = $theVar->$key;
} elseif (is_array($theVar)) {
$theVar = $theVar[$key];
} else {
return '';
}
}
if (!is_array($theVar) && !is_object($theVar)) {
return $theVar;
} else {
return '';
}
}
function getGP_ENV_TSFE($var) {
$vars = explode(':',$var,2);
if (count($vars)==1) {
$val = $this->getGlobal($var);
} else {
$splitAgain=explode('|',$vars[1],2);
$k=trim($splitAgain[0]);
if ($k) {
switch((string)trim($vars[0])) {
case 'GP':
$val = t3lib_div::_GP($k);
break;
case 'TSFE':
$val = $this->getGlobal('TSFE|'.$vars[1]);
$splitAgain=0; // getGlobal resolves all parts of the key, so no further splitting is needed
break;
case 'ENV':
$val = getenv($k);
break;
case 'IENV':
$val = t3lib_div::getIndpEnv($k);
break;
case 'LIT':
return trim($vars[1]); // return litteral value...
break;
}
// If array:
if (count($splitAgain)>1) {
if (is_array($val) && trim($splitAgain[1])) {
$val=$this->getGlobal($splitAgain[1],$val);
} else {
$val='';
}
}
}
}
return $val;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/mailform_userfunc/pi/class.tx_mailformuserfunc_pi.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/mailform_userfunc/pi/class.tx_mailformuserfunc_pi.php']);
}