Franz Holzinger

Verse of the day

Denn es ist ein Gott und ein Mittler zwischen Gott und den Menschen, nämlich der Mensch Christus Jesus, der sich selbst gegeben hat für alle zur Erlösung, daß solches zu seiner Zeit gepredigt würde;
1 Timotheus 2:5-6

© Bible Gateway's Verse of the Day


Entwickler Version

Bitte testen Sie es immer vor dem Stellen einer Frage auch mit der aktuellen Entwicklerversion

autor  
9-10-09 19:57:27 PHP-Warning nach Update von Version 2.5.18 auf 2.5.23
Heiko Hänsge
Hi Franz,

nach dem Update auf 2.5.23 bekomme ich beim Ändern von Benutzerdaten über das Frontend nach dem Bestätigen der Vorschau folgende PHP-Warnung en mass:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in ...typo3conf/ext/sr_feuser_register/marker/class.tx_srfeuserregister_marker.php on line 316

Diese Warnung erscheint nur, wenn die folgende Konstante auf den Wert 2 gesetzt ist. Desweiteren werden die geänderten Benutzerdaten nicht mehr in die versendete eMail gerendert

###########################

# 2 => Send only 'updated fields' on frontend user data update
enableEmailOnUpdate = 2

###########################

Caches wurden nach dem Update alle gelöscht. Typo3 Version ist 4.2.8. Die Hast du dafür eine Erklärung? Und evtl. eine Lösung?
Ich setze dies auch gleich mal in den Bugtracker...

Viele Grüße
Heiko
12-10-09 09:37:21 Korrektur
Franz Holzinger
Der Fehler tritt vermutlich beim Versenden der Email auf.
Damit sollte es wieder klappen:


Index: class.tx_srfeuserregister_email.php
===================================================================
--- class.tx_srfeuserregister_email.php (révision 24591)
+++ class.tx_srfeuserregister_email.php (copie de travail)
@@ -25,7 +25,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
- * Part of the sr_feuser_register (Frontend User Registration) extension.
+ * Part of the sr_feuser_register (Front End User Registration) extension.
*
* email functions
*
@@ -244,6 +244,11 @@
}
$content['admin']['rec'] = $this->cObj->getSubpart($content['admin']['all'], '###SUB_RECORD###');
$bChangesOnly = ($this->conf['email.']['EDIT_SAVED'] == '2' && $cmd == 'edit');
+ if ($bChangesOnly) {
+ $keepFields = array('uid', 'pid', 'tstamp', 'name', 'username');
+ } else {
+ $keepFields = array();
+ }
$markerArray = $this->marker->fillInMarkerArray($markerArray, $DBrows[0], '', FALSE);
$this->marker->addLabelMarkers($markerArray, $theTable, $DBrows[0], $origRows[0], $keepFields, $this->controlData->getRequiredArray(), $this->data->getFieldList(), $this->tca->TCA['columns'], $bChangesOnly);
$content['user']['all'] = $this->cObj->substituteMarkerArray($content['user']['all'], $markerArray);
@@ -263,7 +268,6 @@
$currentRow = $row;
}
if ($bChangesOnly) {
- $keepFields = array('uid', 'pid', 'tstamp', 'name', 'username');
$mrow = array();
foreach ($row as $field => $v) {
if (in_array($field, $keepFields)) {
@@ -348,6 +352,7 @@
$file = ($this->conf['addAttachment.']['file']) ? $TSFE->tmpl->getFileName($this->conf['addAttachment.']['file']):'';
}

+debug ($content, '$content', __LINE__, __FILE__);
$this->send($recipient, $this->conf['email.']['admin'], $content['user']['final'], $content['admin']['final'], $content['html']['final'], $file);
}
12-10-09 10:58:03 Fast gelöst
Heiko Hänsge
Die PHP-Warnungen treten nun nicht mehr auf. Allerdings:
1. bei enableEmailOnUpdate = 1 werden die Benutzer-Daten VOR der Profil-Änderung versendet.
2. bei enableEmailOnUpdate = 2 werden die geänderten Benutzerdaten immer noch nicht in die versendete eMail gerendert.

Viele Grüße
Heiko Hänsge
12-10-09 12:40:38 Korrektur #2
Franz Holzinger
Index: class.tx_srfeuserregister_control.php
===================================================================
--- class.tx_srfeuserregister_control.php (révision 24591)
+++ class.tx_srfeuserregister_control.php (copie de travail)
/**
* All processing of the codes is done here
*
@@ -339,6 +342,9 @@
$cmdKey,
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$prefixId]['registrationProcess']
);
+ if ($newDataArray) {
+ $dataArray = $newDataArray;
+ }
}
} else {
$this->marker->setNoError($cmdKey, $markerArray);
@@ -431,7 +437,7 @@
$rc = $this->email->compile(
SETFIXED_PREFIX.'REVIEW',
$theTable,
- array($newDataArray),
+ array($dataArray),
array($origArray),
$this->conf['email.']['admin'],
$markerArray,
@@ -441,15 +447,15 @@
$this->data->inError,
$this->conf['setfixed.']
);
- } else {
+ } else if ($cmdKey == 'create' || $this->conf['email.']['EDIT_SAVED']) {
$emailField = $this->conf['email.']['field'];
- $recipient = (isset($newDataArray) && is_array($newDataArray) ? $newDataArray[$emailField] : $origArray[$emailField]);
+ $recipient = (isset($dataArray) && is_array($dataArray) ? $dataArray[$emailField] : $origArray[$emailField]);

// Send email message(s)
$rc = $this->email->compile(
$key,
$theTable,
- array($newDataArray),
+ array($dataArray),
array($origArray),
$recipient,
$markerArray,
13-10-09 08:49:48 Ganz nah dran!
Heiko Hänsge
bei enableEmailOnUpdate = 1 ist jetzt wieder alles okay.
bei enableEmailOnUpdate = 2 wird in der versendeten Mail an den Admin nur der Marker ###FIELD_username### noch nicht durch den Benutzernamen ersetzt. Sonst auch hier wieder alles okay.

Viele Grüße
Heiko Hänsge
13-10-09 10:33:03 Korrektur #3
Franz Holzinger
Index: class.tx_srfeuserregister_data.php
===================================================================
--- class.tx_srfeuserregister_data.php (révision 24591)
+++ class.tx_srfeuserregister_data.php (copie de travail)
@@ -25,7 +25,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
- * Part of the sr_feuser_register (Frontend User Registration) extension.
+ * Part of the sr_feuser_register (Front End User Registration) extension.
*
* data store functions
*
@@ -258,7 +258,7 @@
$dataValue = $theValue;
}
}
- $dataArray [$theField] = $dataValue;
+ $dataArray[$theField] = $dataValue;
}
}
} // overrideValues
@@ -857,7 +857,7 @@
*
* @return void sets $this->saved
*/
- function save ($theTable, $dataArray, $origArray, &$newDataArray, $cmd, $cmdKey, &$hookClassArray) {
+ function save ($theTable, $dataArray, $origArray, &$newRow, $cmd, $cmdKey, &$hookClassArray) {
global $TYPO3_DB, $TSFE;
$rc = 0;

@@ -882,7 +882,6 @@
if (!in_array('username', $fieldArray) && $dataArray['username'] == '') {
$newFieldArray = array_diff($newFieldArray, array('username'));
}
-
$authObj = &t3lib_div::getUserObj('&tx_srfeuserregister_auth');
if ($authObj->aCAuth($origArray) || $this->cObj->DBmayFEUserEdit($theTable, $origArray, $TSFE->fe_user->user, $this->conf['allowedGroups'], $this->conf['fe_userEditSelf'])) {

@@ -893,8 +892,7 @@
$this->updateMMRelations($dataArray);
$this->saved = TRUE;
$newRow = array_merge($origArray, $this->parseIncomingData($outGoingData));
- $dataArray = $newRow;
- $this->control->userProcess_alt($this->conf['edit.']['userFunc_afterSave'], $this->conf['edit.']['userFunc_afterSave.'], array('rec' => $dataArray, 'origRec' => $origArray));
+ $this->control->userProcess_alt($this->conf['edit.']['userFunc_afterSave'], $this->conf['edit.']['userFunc_afterSave.'], array('rec' => $newRow, 'origRec' => $origArray));

// Post-edit processing: call user functions and hooks
// Call all afterSaveEdit hooks after the record has been edited and saved
@@ -902,7 +900,7 @@
foreach($hookClassArray as $classRef) {
$hookObj= &t3lib_div::getUserObj($classRef);
if (method_exists($hookObj, 'registrationProcess_afterSaveEdit')) {
- $hookObj->registrationProcess_afterSaveEdit($dataArray, $this);
+ $hookObj->registrationProcess_afterSaveEdit($newRow, $this);
}
}
}
@@ -955,21 +953,20 @@
$this->saved = TRUE;

// Post-create processing: call user functions and hooks
- $newDataArray = $this->parseIncomingData($TSFE->sys_page->getRawRecord($theTable, $newId));
- $this->tca->modifyRow($newDataArray, TRUE);
- $this->control->userProcess_alt($this->conf['create.']['userFunc_afterSave'], $this->conf['create.']['userFunc_afterSave.'], array('rec' => $newDataArray));
+ $newRow = $this->parseIncomingData($TSFE->sys_page->getRawRecord($theTable, $newId));
+ $this->tca->modifyRow($newRow, TRUE);
+ $this->control->userProcess_alt($this->conf['create.']['userFunc_afterSave'], $this->conf['create.']['userFunc_afterSave.'], array('rec' => $newRow));

// Call all afterSaveCreate hooks after the record has been created and saved
if (is_array ($hookClassArray)) {
foreach ($hookClassArray as $classRef) {
$hookObj= &t3lib_div::getUserObj($classRef);
if (method_exists($hookObj, 'registrationProcess_afterSaveCreate')) {
- $hookObj->registrationProcess_afterSaveCreate($newDataArray, $this);
+ $hookObj->registrationProcess_afterSaveCreate($newRow, $this);
}
}
}
-
- $newDataArray['password'] = $password; // restore password before MD5 encryption
+ $newRow['password'] = $password; // restore password before MD5 encryption
}
break;
}
@@ -1298,13 +1295,10 @@
}

include_once(t3lib_extMgm::extPath('kb_md5fepw').'class.tx_kbmd5fepw_funcs.php');
- $dataArray['password'] = tx_kbmd5fepw_funcs::generatePassword($length );
- } else {
- $dataArray['password'] = $genPassword;
+ $genPassword = tx_kbmd5fepw_funcs::generatePassword($length );
}
- } else {
- $dataArray['password'] = $genPassword;
}
+ $dataArray['password'] = $genPassword;
$this->setPassword ($dataArray['password']);
}
} // setPassword
13-10-09 17:11:19 Bingo!
Heiko Hänsge
Hallo Franz,
jetzt scheint's wieder alles zu funktionieren. Bis auf den Umstand, dass bei TSconstant enableEmailOnUpdate = 2 in die an den Admin gesendete Mail die Marker für die Variable 'module_sys_dmail_category' auch dann gerendert werden, wenn der Benutzer die Newsletter-Kategoren nicht geändert hat.
Danke schon mal für den schnellen Support! Viele Grüße!
14-10-09 09:09:06 alle Korrekturen
Franz Holzinger
Index: control/class.tx_srfeuserregister_control.php
===================================================================
--- control/class.tx_srfeuserregister_control.php (révision 24591)
+++ control/class.tx_srfeuserregister_control.php (copie de travail)
@@ -339,6 +342,9 @@
$cmdKey,
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$prefixId]['registrationProcess']
);
+ if ($newDataArray) {
+ $dataArray = $newDataArray;
+ }
}
} else {
$this->marker->setNoError($cmdKey, $markerArray);
@@ -431,7 +437,7 @@
$rc = $this->email->compile(
SETFIXED_PREFIX.'REVIEW',
$theTable,
- array($newDataArray),
+ array($dataArray),
array($origArray),
$this->conf['email.']['admin'],
$markerArray,
@@ -441,15 +447,15 @@
$this->data->inError,
$this->conf['setfixed.']
);
- } else {
+ } else if ($cmdKey == 'create' || $this->conf['email.']['EDIT_SAVED']) {
$emailField = $this->conf['email.']['field'];
- $recipient = (isset($newDataArray) && is_array($newDataArray) ? $newDataArray[$emailField] : $origArray[$emailField]);
+ $recipient = (isset($dataArray) && is_array($dataArray) ? $dataArray[$emailField] : $origArray[$emailField]);

// Send email message(s)
$rc = $this->email->compile(
$key,
$theTable,
- array($newDataArray),
+ array($dataArray),
array($origArray),
$recipient,
$markerArray,
Index: model/class.tx_srfeuserregister_data.php
===================================================================
--- model/class.tx_srfeuserregister_data.php (révision 24591)
+++ model/class.tx_srfeuserregister_data.php (copie de travail)
@@ -857,7 +857,7 @@
*
* @return void sets $this->saved
*/
- function save ($theTable, $dataArray, $origArray, &$newDataArray, $cmd, $cmdKey, &$hookClassArray) {
+ function save ($theTable, $dataArray, $origArray, &$newRow, $cmd, $cmdKey, &$hookClassArray) {
global $TYPO3_DB, $TSFE;
$rc = 0;

@@ -892,9 +891,10 @@
$res = $this->cObj->DBgetUpdate($theTable, $theUid, $outGoingData, $newFieldList, TRUE);
$this->updateMMRelations($dataArray);
$this->saved = TRUE;
- $newRow = array_merge($origArray, $this->parseIncomingData($outGoingData));
- $dataArray = $newRow;
- $this->control->userProcess_alt($this->conf['edit.']['userFunc_afterSave'], $this->conf['edit.']['userFunc_afterSave.'], array('rec' => $dataArray, 'origRec' => $origArray));
+ $newRow = $this->parseIncomingData($outGoingData);
+ $this->tca->modifyRow($newRow, FALSE);
+ $newRow = array_merge($origArray, $newRow);
+ $this->control->userProcess_alt($this->conf['edit.']['userFunc_afterSave'], $this->conf['edit.']['userFunc_afterSave.'], array('rec' => $newRow, 'origRec' => $origArray));

// Post-edit processing: call user functions and hooks
// Call all afterSaveEdit hooks after the record has been edited and saved
@@ -902,7 +902,7 @@
foreach($hookClassArray as $classRef) {
$hookObj= &t3lib_div::getUserObj($classRef);
if (method_exists($hookObj, 'registrationProcess_afterSaveEdit')) {
- $hookObj->registrationProcess_afterSaveEdit($dataArray, $this);
+ $hookObj->registrationProcess_afterSaveEdit($newRow, $this);
}
}
}
@@ -955,21 +955,20 @@
$this->saved = TRUE;

// Post-create processing: call user functions and hooks
- $newDataArray = $this->parseIncomingData($TSFE->sys_page->getRawRecord($theTable, $newId));
- $this->tca->modifyRow($newDataArray, TRUE);
- $this->control->userProcess_alt($this->conf['create.']['userFunc_afterSave'], $this->conf['create.']['userFunc_afterSave.'], array('rec' => $newDataArray));
+ $newRow = $this->parseIncomingData($TSFE->sys_page->getRawRecord($theTable, $newId));
+ $this->tca->modifyRow($newRow, TRUE);
+ $this->control->userProcess_alt($this->conf['create.']['userFunc_afterSave'], $this->conf['create.']['userFunc_afterSave.'], array('rec' => $newRow));

// Call all afterSaveCreate hooks after the record has been created and saved
if (is_array ($hookClassArray)) {
foreach ($hookClassArray as $classRef) {
$hookObj= &t3lib_div::getUserObj($classRef);
if (method_exists($hookObj, 'registrationProcess_afterSaveCreate')) {
- $hookObj->registrationProcess_afterSaveCreate($newDataArray, $this);
+ $hookObj->registrationProcess_afterSaveCreate($newRow, $this);
}
}
}
-
- $newDataArray['password'] = $password; // restore password before MD5 encryption
+ $newRow['password'] = $password; // restore password before MD5 encryption
}
break;
}
@@ -1298,13 +1297,10 @@
}

include_once(t3lib_extMgm::extPath('kb_md5fepw').'class.tx_kbmd5fepw_funcs.php');
- $dataArray['password'] = tx_kbmd5fepw_funcs::generatePassword($length );
- } else {
- $dataArray['password'] = $genPassword;
+ $genPassword = tx_kbmd5fepw_funcs::generatePassword($length );
}
- } else {
- $dataArray['password'] = $genPassword;
}
+ $dataArray['password'] = $genPassword;
$this->setPassword ($dataArray['password']);
}
} // setPassword
Index: lib/class.tx_srfeuserregister_email.php
===================================================================
--- lib/class.tx_srfeuserregister_email.php (révision 24591)
+++ lib/class.tx_srfeuserregister_email.php (copie de travail)
@@ -25,7 +25,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
- * Part of the sr_feuser_register (Frontend User Registration) extension.
+ * Part of the sr_feuser_register (Front End User Registration) extension.
*
* email functions
*
@@ -231,7 +231,7 @@
$subpartMarker = $this->emailMarkPrefix . $key . $this->emailMarkHTMLSuffix;

$content['html']['all'] = ($this->HTMLMailEnabled && $bHTMLallowed) ? trim($this->cObj->getSubpart($templateCode, '###' . $subpartMarker . '###')):'';
- $content['html']['all'] = $this->display->removeRequired($content['HTML']['all'],$errorFieldArray);
+ $content['html']['all'] = $this->display->removeRequired($content['html']['all'],$errorFieldArray);
}
if ($this->conf['notify.'][$key] ) {
$subpartMarker = '###'.$this->emailMarkPrefix.$key.$this->emailMarkAdminSuffix.'###';
@@ -244,6 +244,11 @@
}
$content['admin']['rec'] = $this->cObj->getSubpart($content['admin']['all'], '###SUB_RECORD###');
$bChangesOnly = ($this->conf['email.']['EDIT_SAVED'] == '2' && $cmd == 'edit');
+ if ($bChangesOnly) {
+ $keepFields = array('uid', 'pid', 'tstamp', 'name', 'username');
+ } else {
+ $keepFields = array();
+ }
$markerArray = $this->marker->fillInMarkerArray($markerArray, $DBrows[0], '', FALSE);
$this->marker->addLabelMarkers($markerArray, $theTable, $DBrows[0], $origRows[0], $keepFields, $this->controlData->getRequiredArray(), $this->data->getFieldList(), $this->tca->TCA['columns'], $bChangesOnly);
$content['user']['all'] = $this->cObj->substituteMarkerArray($content['user']['all'], $markerArray);
@@ -263,7 +268,6 @@
$currentRow = $row;
}
if ($bChangesOnly) {
- $keepFields = array('uid', 'pid', 'tstamp', 'name', 'username');
$mrow = array();
foreach ($row as $field => $v) {
if (in_array($field, $keepFields)) {
Index: lib/class.tx_srfeuserregister_tca.php
===================================================================
--- lib/class.tx_srfeuserregister_tca.php (révision 24591)
+++ lib/class.tx_srfeuserregister_tca.php (copie de travail)
@@ -25,7 +25,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
- * Part of the sr_feuser_register (Frontend User Registration) extension.
+ * Part of the sr_feuser_register (Front End User Registration) extension.
*
* TCA functions
*
@@ -168,7 +168,7 @@
'sorting'
);
while ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
- $valuesArray[$row['uid_foreign']] = $row['uid_foreign'];
+ $valuesArray[] = $row['uid_foreign'];
}
$dataArray[$colName] = $valuesArray;
} else {
< Zurück zum Forum