Commit 2599ffcf authored by Elias Villiger's avatar Elias Villiger
Browse files

Merge branch 'master' into B2998-improved-radio-button-bootstrap

parents 7094d30a fe2dde33
Pipeline #1022 passed with stage
in 1 minute and 34 seconds
......@@ -37,6 +37,28 @@ Bug Fixes
^^^^^^^^^
Version 18.10.1
---------------
Date: 12.10.18
Notes
^^^^^
Features
^^^^^^^^
* #5578 / Safari only handles one filetype in upload dialog.
* #6991 / Optional process 'readonly' FE during save. New FE parameter 'processReadOnly = 0|1'.
Bug Fixes
^^^^^^^^^
* #6880 / Fixed Exceptions with too many details to end user.
* 'Drag and drop' failed due to fillStoreForm requests {{form:S}} which was not necessary for drag and drop.
* Upload: rename 'chmod' to 'chmodFile'. Implement 'chmodDir'. Permissions applied for all new created directories.
* Upload: replace 'rename' with 'copy/unlink'
Version 18.10.0
---------------
......
......@@ -44,12 +44,12 @@ Neue Versionsnummer
* Update the version number in this document (topic 6)
* Commit & Push new version changes to master branch:
New version 18.10.0
New version 18.10.1
6) **New Tag**:
git tag v18.10.0
git push -u origin v18.10.0
git tag v18.10.1
git push -u origin v18.10.1
7) PhpStorm: **Sync** all files to VM qfq.
......
This diff is collapsed.
......@@ -37,6 +37,28 @@ Bug Fixes
^^^^^^^^^
Version 18.10.1
---------------
Date: 12.10.18
Notes
^^^^^
Features
^^^^^^^^
* #5578 / Safari only handles one filetype in upload dialog.
* #6991 / Optional process 'readonly' FE during save. New FE parameter 'processReadOnly = 0|1'.
Bug Fixes
^^^^^^^^^
* #6880 / Fixed Exceptions with too many details to end user.
* 'Drag and drop' failed due to fillStoreForm requests {{form:S}} which was not necessary for drag and drop.
* Upload: rename 'chmod' to 'chmodFile'. Implement 'chmodDir'. Permissions applied for all new created directories.
* Upload: replace 'rename' with 'copy/unlink'
Version 18.10.0
---------------
......
......@@ -3,7 +3,7 @@
project = QFQ - Quick Form Query
version = 18.10
release = 18.10.0
release = 18.10.1
t3author = Carsten Rose
copyright = since 2017 by the author
......
......@@ -59,7 +59,7 @@ copyright = u'2017, Carsten Rose'
# The short X.Y version.
version = '18.10'
# The full version, including alpha/beta/rc tags.
release = '18.10.0'
release = '18.10.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......
......@@ -37,6 +37,28 @@ Bug Fixes
^^^^^^^^^
Version 18.10.1
---------------
Date: 12.10.18
Notes
^^^^^
Features
^^^^^^^^
* #5578 / Safari only handles one filetype in upload dialog.
* #6991 / Optional process 'readonly' FE during save. New FE parameter 'processReadOnly = 0|1'.
Bug Fixes
^^^^^^^^^
* #6880 / Fixed Exceptions with too many details to end user.
* 'Drag and drop' failed due to fillStoreForm requests {{form:S}} which was not necessary for drag and drop.
* Upload: rename 'chmod' to 'chmodFile'. Implement 'chmodDir'. Permissions applied for all new created directories.
* Upload: replace 'rename' with 'copy/unlink'
Version 18.10.0
---------------
......
......@@ -11,7 +11,7 @@ $EM_CONF[$_EXTKEY] = array(
'dependencies' => 'fluid,extbase',
'clearcacheonload' => true,
'state' => 'stable',
'version' => '18.10.0',
'version' => '18.10.1',
'constraints' => [
'depends' => [
'typo3' => '6.0.0-9.2.99',
......
......@@ -82,7 +82,7 @@ try {
// in case everything is fine, an empty string is returned. Else an Array.
$flagSuccess = ($answer === '');
$targetUrl = Store::getVar(SIP_TARGET_URL, STORE_SIP);
$targetUrl = str_replace('--amp--', '&', Store::getVar(SIP_TARGET_URL, STORE_SIP));
$modeAnswer = Store::getVar(SIP_MODE_ANSWER, STORE_SIP);
switch ($modeAnswer) {
......
......@@ -1758,7 +1758,6 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('value', $formElement[FE_CHECKBOX_CHECKED], false);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attribute .= Support::doAttribute(FE_INPUT_AUTOCOMPLETE, 'off');
......@@ -1783,8 +1782,9 @@ abstract class AbstractBuildForm {
$htmlElement .= $formElement['checked'];
}
$html .= Support::wrapTag("<label class='btn " . $formElement[FE_BUTTON_CLASS] . "$classActive'>",
$htmlElement, true);
$labelAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$labelAttribute .= Support::doAttribute('class', 'btn ' . $formElement[FE_BUTTON_CLASS] . $classActive);
$html .= Support::wrapTag("<label $labelAttribute>", $htmlElement, true);
$html = Support::wrapTag('<div class="btn-group" data-toggle="buttons">', $html);
$json = $this->getFormElementForJson($htmlFormElementName, $valueJson, $formElement);
......@@ -1818,7 +1818,6 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
$attribute .= Support::doAttribute('name', $htmlFormElementName);
$attribute .= Support::doAttribute('value', $formElement[FE_CHECKBOX_CHECKED], false);
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
if ($formElement[FE_CHECKBOX_CHECKED] === $value) {
......@@ -1839,7 +1838,8 @@ abstract class AbstractBuildForm {
$html .= $formElement['label2'];
}
$html = Support::wrapTag("<label>", $html, true);
$labelAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$html = Support::wrapTag("<label $labelAttribute>", $html, true);
$html = Support::wrapTag("<div class='checkbox'>", $html, true);
$json = $this->getFormElementForJson($htmlFormElementName, $valueJson, $formElement);
......@@ -2181,7 +2181,6 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii);
$attribute .= Support::doAttribute('value', $itemKey[$ii], false); // Always set value, even to '' - #3832
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
if ($itemKey[$ii] == $value) {
$attribute .= Support::doAttribute('checked', 'checked');
......@@ -2201,8 +2200,9 @@ abstract class AbstractBuildForm {
$htmlElement = '<input ' . $attribute . '>' . $itemValue[$ii];
$htmlElement = Support::wrapTag("<label class='btn " . $formElement[FE_BUTTON_CLASS] .
"$classReadonly$classActive'>", $htmlElement);
$labelAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$labelAttribute .= Support::doAttribute('class', 'btn ' . $formElement[FE_BUTTON_CLASS] . $classReadonly . $classActive);
$htmlElement = Support::wrapTag("<label $labelAttribute>", $htmlElement);
$html .= $htmlElement;
......@@ -2274,7 +2274,6 @@ abstract class AbstractBuildForm {
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii);
$attribute .= Support::doAttribute('value', $itemKey[$ii], false); // Always set value, even to '' - #3832
$attribute .= Support::doAttribute('title', $formElement[FE_TOOLTIP]);
if ($itemKey[$ii] == $value) {
$attribute .= Support::doAttribute('checked', 'checked');
......@@ -2300,7 +2299,9 @@ abstract class AbstractBuildForm {
}
}
$htmlElement = Support::wrapTag("<$radioOuterTag class='$radioClass'>", $htmlElement) . $br;
$wrapAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]);
$wrapAttribute .= Support::doAttribute('class', $radioClass);
$htmlElement = Support::wrapTag("<$radioOuterTag $wrapAttribute>", $htmlElement) . $br;
$html .= $htmlElement;
......@@ -3453,7 +3454,7 @@ abstract class AbstractBuildForm {
// plugins
if (!isset($formElement[FE_EDITOR_PREFIX . 'plugins'])) {
$formElement[FE_EDITOR_PREFIX . 'plugins'] = 'code link searchreplace table textcolor textpattern visualchars';
$formElement[FE_EDITOR_PREFIX . 'plugins'] = 'code link lists searchreplace table textcolor textpattern visualchars';
}
// toolbar: https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
......
......@@ -720,41 +720,37 @@ EOF;
$htmlLabel = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL], $addClass);
}
$html .= $this->customWrap($formElement, $htmlLabel, FE_WRAP_LABEL, $formElement[FE_BS_LABEL_COLUMNS],
[$this->wrap[WRAP_SETUP_LABEL][WRAP_SETUP_START], $this->wrap[WRAP_SETUP_LABEL][WRAP_SETUP_END]], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL);
$html .= $this->customWrap($formElement, $htmlLabel, WRAP_SETUP_LABEL, FE_WRAP_LABEL, $formElement[FE_BS_LABEL_COLUMNS],
$formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL);
// Input
$html .= $this->customWrap($formElement, $htmlElement, FE_WRAP_INPUT, $formElement[FE_BS_INPUT_COLUMNS],
[$this->wrap[WRAP_SETUP_INPUT][WRAP_SETUP_START], $this->wrap[WRAP_SETUP_INPUT][WRAP_SETUP_END]],
$html .= $this->customWrap($formElement, $htmlElement, WRAP_SETUP_INPUT, FE_WRAP_INPUT, $formElement[FE_BS_INPUT_COLUMNS],
$formElement[FE_HTML_ID] . HTML_ID_EXTENSION_INPUT, $classHideElement);
// Note
$note = $formElement[FE_NOTE];
$html .= $this->customWrap($formElement, $note, FE_WRAP_NOTE, $formElement[FE_BS_NOTE_COLUMNS],
[$this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_START], $this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_END]], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_NOTE);
$html .= $this->customWrap($formElement, $note, WRAP_SETUP_NOTE, FE_WRAP_NOTE, $formElement[FE_BS_NOTE_COLUMNS],
$formElement[FE_HTML_ID] . HTML_ID_EXTENSION_NOTE);
// Row
$openTag = $formElement[FE_FLAG_ROW_OPEN_TAG] ? $this->getRowOpenTag($classHideRow) : '';
$closeTag = $formElement[FE_FLAG_ROW_CLOSE_TAG] ? $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END] : '';
$html = $this->customWrap($formElement, $html, FE_WRAP_ROW, -1, [$openTag, $closeTag], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_ROW);
$html = $this->customWrap($formElement, $html, WRAP_SETUP_ELEMENT, FE_WRAP_ROW -1, $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_ROW, $classHideRow);
return $html;
}
/**
* Wrap content with $wrapArray or, if specified use $formElement[$wrapName]. Inject $htmlId in wrap.
* Wrap content as defined in this->wrap or, if specified use $formElement[$wrapName]. Inject $htmlId in wrap.
*
* Result:
* - if $bsColumns==0 and empty $formElement[$wrapName]: no wrap
* - if $formElement[$wrapName] is given: wrap with that one. Else: wrap with $wrapArray
* - if $htmlId is give, inject it in $wrap.
* - if $formElement[$customWrapName] is given: wrap with that one.
* - if $htmlId is given, inject it in $wrap.
*
* @param array $formElement Complete FormElement, especially some FE_WRAP
* @param string $htmlElement Content to wrap.
* @param string $wrapType WRAP_SETUP_ELEMENT, WRAP_SETUP_LABEL, WRAP_SETUP_INPUT, WRAP_SETUP_NOTE
* @param string $wrapName FE_WRAP_ROW, FE_WRAP_LABEL, FE_WRAP_INPUT, FE_WRAP_NOTE
* @param int $bsColumns
* @param array $wrapArray Systemwide Defaults: [ 'open wrap', 'close wrap' ]
* @param string $htmlId
* @param string $class
*
......@@ -762,29 +758,46 @@ EOF;
* @throws CodeException
* @throws \qfq\UserFormException
*/
private function customWrap(array $formElement, $htmlElement, $wrapName, $bsColumns, array $wrapArray, $htmlId = '', $class = '') {
private function customWrap(array $formElement, $htmlElement, $wrapType, $wrapName, $bsColumns, $htmlId = '', $class = '') {
$openTag = '';
$closeTag = '';
// If $bsColumns==0: do not wrap with default.
if ($bsColumns == 0) {
$wrapArray[0] = '';
$wrapArray[1] = '';
if ($bsColumns != 0) {
switch ($wrapType) {
case WRAP_SETUP_ELEMENT;
$openTag = $formElement[FE_FLAG_ROW_OPEN_TAG] ? $this->getRowOpenTag($class) : '';
$closeTag = $formElement[FE_FLAG_ROW_CLOSE_TAG] ? $this->wrap[$wrapType][WRAP_SETUP_END] : '';
break;
case WRAP_SETUP_LABEL:
case WRAP_SETUP_INPUT:
case WRAP_SETUP_NOTE:
$hasOpen = Support::findInSet($wrapType, $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$hasClose = Support::findInSet("/$wrapType", $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$openTag = $hasOpen ? $this->wrap[$wrapType][WRAP_SETUP_START] : '';
$closeTag = $hasClose ? $this->wrap[$wrapType][WRAP_SETUP_END] : '';
break;
default:
throw new UserFormException("Unknown wrap for FormElement.parameter '$wrapType'.", ERROR_MISSING_VALUE);
break;
}
}
// If there is a 'per FormElement'-wrap, take it.
if (isset($formElement[$wrapName])) {
$wrapArray = explode('|', $formElement[$wrapName], 2);
$openTag = $wrapArray[0] ?? '';
$closeTag = $wrapArray[1] ?? '';
}
if (count($wrapArray) != 2) {
throw new UserFormException("Need open & close wrap token for FormElement.parameter" . $wrapName . " - E.g.: <div ...>|</div>", ERROR_MISSING_VALUE);
}
if ($wrapArray[0] != '') {
$wrapArray[0] = Support::insertAttribute($wrapArray[0], 'id', $htmlId);
$wrapArray[0] = Support::insertAttribute($wrapArray[0], 'class', $class); // might be problematic, if there is already a 'class' defined.
if ($openTag != '') {
$openTag = Support::insertAttribute($openTag, 'id', $htmlId);
$openTag = Support::insertAttribute($openTag, 'class', $class); // might be problematic, if there is already a 'class' defined.
}
return $wrapArray[0] . $htmlElement . $wrapArray[1];
return $openTag . $htmlElement . $closeTag;
}
......
......@@ -987,6 +987,8 @@ const FE_FILE_AUTO_ORIENT_CMD_DEFAULT = 'convert -auto-orient {{fileDestination:
const FE_FILE_AUTO_ORIENT_MIME_TYPE = 'autoOrientMimeType';
const FE_FILE_CHMOD_FILE = 'chmodFile';
const FE_FILE_CHMOD_DIR = 'chmodDir';
const FE_TRIM = 'trim'; // 'none' | list of characters
const FE_TRIM_NONE = 'none';
// Excel Import
const FE_IMPORT_TO_TABLE = 'importToTable';
......@@ -1091,6 +1093,7 @@ const FE_FILE_BUTTON_TEXT_DEFAULT = 'Choose File';
const FE_INPUT_TYPE = 'inputType';
const FE_STEP = 'step';
const FE_ACCEPT_ZERO_AS_REQUIRED = 'acceptZeroAsRequired';
const FE_PROCESS_READ_ONLY = 'processReadOnly';
const FE_IMAGE_CUT_RESIZE_WIDTH = 'resizeWidth';
const FE_IMAGE_CUT_KEEP_ORIGINAL = 'keepOriginal';
......@@ -1448,6 +1451,7 @@ const PARAM_TOKEN_DELIMITER = ':';
const TOKEN_URL = 'u';
const TOKEN_MAIL = 'm';
const TOKEN_PAGE = 'p';
const TOKEN_UID = 'uid';
const TOKEN_DOWNLOAD = 'd';
const TOKEN_COPY_TO_CLIPBOARD = 'y';
......
......@@ -87,13 +87,18 @@ class QuickFormQuery {
/**
* @var array
*/
private $t3data = array(); // FormEelement Definition: all formElement.class='native' of the loaded form
private $t3data = array(); // FormElement Definition: all formElement.class='native' of the loaded form
/**
* @var bool
*/
private $phpUnit = false;
/**
* @var bool
*/
private $inlineReport = false;
/**
* @var Session
*/
......@@ -122,15 +127,16 @@ class QuickFormQuery {
*
* @param array $t3data
* @param bool $phpUnit
* @param bool $inlineReport
*
* @throws CodeException
* @throws DbException
* @throws UserFormException
* @throws UserReportException
*/
public function __construct(array $t3data = array(), $phpUnit = false) {
public function __construct(array $t3data = array(), $phpUnit = false, $inlineReport = true) {
$this->phpUnit = $phpUnit;
$this->inlineReport = $inlineReport;
mb_internal_encoding("UTF-8");
......@@ -472,7 +478,8 @@ class QuickFormQuery {
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
// Action: Before
$formAction->elements($recordId, $this->feSpecAction, FE_TYPE_BEFORE_INSERT . ',' . FE_TYPE_BEFORE_UPDATE . ',' . FE_TYPE_BEFORE_SAVE);
$feTypeList = FE_TYPE_BEFORE_SAVE . ',' . ($recordId == 0 ? FE_TYPE_BEFORE_INSERT : FE_TYPE_BEFORE_UPDATE);
$formAction->elements($recordId, $this->feSpecAction, $feTypeList);
// If an old record exist: load it. Necessary to delete uploaded files which should be overwritten.
$this->store->fillStoreWithRecord($this->formSpec[F_TABLE_NAME], $recordId,
......@@ -492,7 +499,8 @@ class QuickFormQuery {
$save->processAllUploads($rc);
// Action: After
$status = $formAction->elements($rc, $this->feSpecAction, FE_TYPE_AFTER_INSERT . ',' . FE_TYPE_AFTER_UPDATE . ',' . FE_TYPE_AFTER_SAVE);
$feTypeList = FE_TYPE_AFTER_SAVE . ',' . ($recordId == 0 ? FE_TYPE_AFTER_INSERT : FE_TYPE_AFTER_UPDATE);
$status = $formAction->elements($rc, $this->feSpecAction, $feTypeList);
if ($status != ACTION_ELEMENT_NO_CHANGE) {
// Reload fresh saved record and fill STORE_RECORD with it.
$this->store->fillStoreWithRecord($this->formSpec[F_TABLE_NAME], $rc, $this->dbArray[$this->dbIndexData], $this->formSpec[F_PRIMARY_KEY]);
......@@ -1369,7 +1377,8 @@ class QuickFormQuery {
$report = new Report($this->t3data, $this->eval, $this->phpUnit);
$html = '';
if ($this->store->getVar(TYPO3_BE_USER, STORE_TYPO3, SANITIZE_ALLOW_ALNUMX)) {
$beUserLoggedIn = $this->store->getVar(TYPO3_BE_USER, STORE_TYPO3, SANITIZE_ALLOW_ALNUMX);
if ($beUserLoggedIn && $this->inlineReport) {
$html .= $this->buildInlineReport();
}
$html .= $report->process($this->t3data[T3DATA_BODYTEXT]);
......@@ -1435,11 +1444,7 @@ class QuickFormQuery {
}
$bodytext = Support::htmlEntityEncodeDecode(MODE_DECODE, $_POST[REPORT_INLINE_BODYTEXT]);
$dbT3 = $this->store->getVar(SYSTEM_T3_DB_NAME, STORE_SYSTEM . STORE_EMPTY, SANITIZE_ALLOW_ALNUMX);
if ($dbT3 == '') {
$dbData = $this->store->getVar(SYSTEM_DB_NAME_DATA, STORE_SYSTEM, SANITIZE_ALLOW_ALNUMX);
$dbT3 = substr($dbData, 0, strrpos($dbData, "_") + 1) . 't3';
}
$dbT3 = $this->store->getDbT3Name();
// Update bodytext
$sql = "UPDATE $dbT3.tt_content SET bodytext = ?, tstamp = UNIX_TIMESTAMP(NOW()) WHERE uid = ?";
......
......@@ -378,6 +378,8 @@ class Save {
$newValues[COLUMN_MIME_TYPE] = $vars[VAR_FILE_MIME_TYPE];
}
}
} elseif (isset($formElement[FE_IMPORT_TO_TABLE]) && !isset($formElement[FE_SLAVE_ID])) {
// Excel import on nonexisting column -> no upload
} else {
// 'Advanced Upload'
$this->doUploadSlave($formElement, $modeUpload);
......@@ -793,7 +795,7 @@ class Save {
}
$overwrite = isset($formElement[FE_FILE_REPLACE_MODE]) && $formElement[FE_FILE_REPLACE_MODE] == FE_FILE_REPLACE_MODE_ALWAYS;
Support::copyFile($srcFile, $pathFileName, $overwrite, $chmodDir);
Support::moveFile($srcFile, $pathFileName, $overwrite, $chmodDir);
// If given, get chmodFile. Needs to be prefixed with a 0 (=octal) - it should not be quoted! Symbolic mode is not allowed. E.g.: 0660, or 01777
if (empty($formElement[FE_FILE_CHMOD_FILE])) {
......
......@@ -323,6 +323,11 @@ class Database {
$msg .= "HINT: Maybe the tables after 'FROM' should be enclosed by '()' \n";
}
// Check for double comma
if (stripos($errorMsg, 'the right syntax to use near') && preg_match('/,[ ]*,/', $sql)) {
$msg .= "HINT: There seems to be a double comma in your query.\n";
}
return $msg;
}
......
......@@ -129,8 +129,22 @@ class AbstractException extends \Exception {
$editForm = $this->buildFormLink($storeSystem);
}
$arrMerged = OnArray::htmlentitiesOnArray(array_merge($arrMsg, $arrDebugShow));
if (!empty($os = $arrMerged[ERROR_MESSAGE_OS])) {
$beforeMatch = htmlentities("the right syntax to use near '", ENT_QUOTES);
$afterMatch = htmlentities("' at line [0-9]*$", ENT_QUOTES);
if(preg_match("/mysqli: 1064.*$beforeMatch.*$afterMatch/", $os)) {
$match = explode("$beforeMatch", $os, 2)[1];
$match = preg_split("/$afterMatch/", $match)[0];
$splitSql = explode($match, $arrMerged[EXCEPTION_SQL_FINAL]);
$match = Support::wrapTag('<span class="qfq-wavy-underline">', $match);
$highlightedSql = implode($match, $splitSql);
$arrMerged[EXCEPTION_SQL_FINAL] = $highlightedSql;
}
}
$htmlDebug = OnArray::arrayToHtmlTable(
array_merge(OnArray::htmlentitiesOnArray(array_merge($arrMsg, $arrDebugShow)), [ 'Edit' => $editForm ]), 'Debug', EXCEPTION_TABLE_CLASS);
array_merge($arrMerged, [ 'Edit' => $editForm ]), 'Debug', EXCEPTION_TABLE_CLASS);
$htmlDebug = str_replace("\n", "<br>", $htmlDebug);
$arrDebugHiddenClean = OnArray::htmlentitiesOnArray($arrDebugHidden);
......
......@@ -174,23 +174,27 @@ class FormAction {
$this->store->setStore($arr, STORE_LDAP, true);
}
$this->validate($fe);
// If given: fire a sqlBefore query
$this->evaluate->parse($fe[FE_SQL_BEFORE]);
if ($fe[FE_TYPE] === FE_TYPE_SENDMAIL) {
$this->doSendMail($fe);
//no further processing of current element necessary.
continue;
} else {
$rcTmp = $this->doSlave($fe, $recordId);
switch ($rcTmp) {
case ACTION_ELEMENT_MODIFIED:
case ACTION_ELEMENT_DELETED:
$rc = $rcTmp;
break;
default:
break;
}
}
$this->validate($fe);
$rcTmp = $this->doSlave($fe, $recordId);
switch ($rcTmp) {
case ACTION_ELEMENT_MODIFIED:
case ACTION_ELEMENT_DELETED:
$rc = $rcTmp;
break;
default:
break;
}
// If given: fire a $sqlAfter query
$this->evaluate->parse($fe[FE_SQL_AFTER]);
}
return $rc;
......@@ -327,7 +331,6 @@ class FormAction {
* @return int ACTION_ELEMENT_MODIFIED if there are potential(!) changes on the DB like INSERT / UPDATE,
* ACTION_ELEMENT_NO_CHANGE if nothing happened
* ACTION_ELEMENT_DELETED: if a record has been deleted
* $sqlAfter won't affect the $rc.
* @throws CodeException
* @throws DbException
* @throws UserFormException
......@@ -352,9 +355,6 @@ class FormAction {
// Store the slaveId: it's used and replaced in the update statement.
$this->store->setVar(VAR_SLAVE_ID, $slaveId, STORE_VAR, true);
// If given: fire a sqlBefore query
$this->evaluate->parse($fe[FE_SQL_BEFORE]);
$doInsert = ($slaveId == 0);
$doUpdate = ($slaveId != 0);
$doDelete = ($slaveId != 0) && $fe[FE_SQL_DELETE] != '';
......@@ -393,9 +393,6 @@ class FormAction {
$this->db->sql("UPDATE " . $this->primaryTableName . " SET " . $fe[FE_NAME] . " = $slaveId WHERE id = ? LIMIT 1", ROW_REGULAR, [$recordId]);
}
// If given: fire a $sqlAfter query. $sqlAfter won't affect $rc
$this->evaluate->parse($fe[FE_SQL_AFTER]);
return $rcStatus;
}
......
......@@ -28,7 +28,7 @@ class Sanitize {
SANITIZE_ALLOW_NUMERICAL => '^[\d.+-]*$',
SANITIZE_ALLOW_EMAIL => '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$',
SANITIZE_ALLOW_PATTERN => '',
SANITIZE_ALLOW_ALLBUT => '^[^\[\]{}%&\\\\#]*$',
SANITIZE_ALLOW_ALLBUT => '^[^\[\]{}%\\\\#]*$',
SANITIZE_ALLOW_ALL => '.*',
];
......@@ -38,7 +38,7 @@ class Sanitize {
SANITIZE_ALLOW_NUMERICAL => 'Allowed characters: 0...9 and .+-',
SANITIZE_ALLOW_EMAIL => 'Requested format: string@domain.tld',
SANITIZE_ALLOW_PATTERN => 'Please match the requested format',
SANITIZE_ALLOW_ALLBUT => 'Forbidden characters: ^[]{}%&\#',
SANITIZE_ALLOW_ALLBUT => 'Forbidden characters: ^[]{}%\#',
SANITIZE_ALLOW_ALL => '',
];
......@@ -252,33 +252,7 @@ class Sanitize {
return $item;
}
/**
* urlencode() any input and decode again. This normalizes all characters and guarantees that there are no more
* urlencoded characters.
*
* @param array|string $item