Commit 5d8f31db authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'master' into B6467SanitizingAHiddenFieldMakesTheFormUnsubmittable

# Conflicts:
#	extension/qfq/qfq/exceptions/ErrorHandler.php
parents f2a8d43d 2b379f1a
This diff is collapsed.
...@@ -30,6 +30,14 @@ Date: <date> ...@@ -30,6 +30,14 @@ Date: <date>
Notes Notes
^^^^^ ^^^^^
* Existing installations: update QFQ extension config form-layout.formBsColumns/formBsLabelColumns/formBsInputColumns,formBsNoteColumns.
old: 12, new: 'col-md-12 col-lg10' resp. smaller values for individual columnns.
* New config values:
* Config/flagProduction: yes/now - differentiate between development und production system. Will be used for
'throwExceptionGeneralError' too.
* Debug/throwExceptionGeneralError - shows/hide exception of general errors.
Features Features
^^^^^^^^ ^^^^^^^^
......
# cat=config/config; type=string; label=URL QFQ Documentation:Default is 'https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html'. Might be changed to a local repo. Every QFQ installation contains a local copy: <site path>/typo3conf/ext/qfq/Documentation/html/Manual.html (corresponds always to the QFQ version). # cat=config/config; type=string; label=URL QFQ Documentation:Default is 'https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html'. Might be changed to a local repo. Every QFQ installation contains a local copy: <site path>/typo3conf/ext/qfq/Documentation/html/Manual.html (corresponds always to the QFQ version).
documentation = https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html documentation = https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html
# cat=config/config; type=string; label=Marks a production installation:Possible values: 'yes', 'no'. Default is 'yes'. Used to differentiate between development & production systems.
flagProduction = yes
# cat=config/config; type=string; label=Thumbnail directory 'secure':Default is 'fileadmin/protected/qfqThumbnail'. Important: secure the directory (recursive) against direct access. Will be used by a special columnname '_thumbnail'. # cat=config/config; type=string; label=Thumbnail directory 'secure':Default is 'fileadmin/protected/qfqThumbnail'. Important: secure the directory (recursive) against direct access. Will be used by a special columnname '_thumbnail'.
thumbnailDirSecure = fileadmin/protected/qfqThumbnail thumbnailDirSecure = fileadmin/protected/qfqThumbnail
...@@ -45,6 +48,10 @@ fillStoreSystemBySql3 = ...@@ -45,6 +48,10 @@ fillStoreSystemBySql3 =
fillStoreSystemBySqlErrorMsg3 = fillStoreSystemBySqlErrorMsg3 =
# cat=debug/debug; type=string; label=Throw exception General Error:Possible values: 'yes', 'no', 'auto'. Default is 'auto'. If a) 'yes' or b) 'auto' and 'flagProduction!=yes', throw an exception in case of a 'General Error'.
throwExceptionGeneralError = auto
# cat=debug/mail; type=string; label=Redirect all mail to ...:Default is empty. If set, redirect all QFQ generated mails (Form, Report) to the specified email address. # cat=debug/mail; type=string; label=Redirect all mail to ...:Default is empty. If set, redirect all QFQ generated mails (Form, Report) to the specified email address.
redirectAllMailTo = redirectAllMailTo =
......
...@@ -564,7 +564,7 @@ abstract class AbstractBuildForm { ...@@ -564,7 +564,7 @@ abstract class AbstractBuildForm {
$storeRecord = $this->store->getStore(STORE_RECORD); $storeRecord = $this->store->getStore(STORE_RECORD);
$value = $this->report->process($this->bodytextParser->process($value)); $value = $this->report->process($this->bodytextParser->process($value));
$this->store->setStore($storeRecord, STORE_RECORD, true); $this->store->setStore($storeRecord, STORE_RECORD, true);
$this->store->setVar(SYSTEM_REPORT_FULL_LEVEL, '', STORE_SYSTEM); $this->store->setVar(SYSTEM_REPORT_FULL_LEVEL, '', STORE_SYSTEM); // debug
} }
return $value; return $value;
...@@ -1264,9 +1264,11 @@ abstract class AbstractBuildForm { ...@@ -1264,9 +1264,11 @@ abstract class AbstractBuildForm {
$value = ''; $value = '';
} }
if ($formElement[FE_DECIMAL_FORMAT] !== '') { if ($formElement[FE_DECIMAL_FORMAT] !== '' ) {
$decimalScale = explode(',', $formElement[FE_DECIMAL_FORMAT])[1]; // scale: Nachkommastellen if($value!=='') { // empty string causes exception in number_format()
$value = number_format($value, $decimalScale, '.', ''); $decimalScale = explode(',', $formElement[FE_DECIMAL_FORMAT])[1]; // scale: Nachkommastellen
$value = number_format($value, $decimalScale, '.', '');
}
} }
// In case the user specifies MIN & MAX with numbers, the html tag 'type' has to be 'number', to make the range check work in the browser. // In case the user specifies MIN & MAX with numbers, the html tag 'type' has to be 'number', to make the range check work in the browser.
...@@ -2109,7 +2111,7 @@ abstract class AbstractBuildForm { ...@@ -2109,7 +2111,7 @@ abstract class AbstractBuildForm {
public function buildExtra(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) { public function buildExtra(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
if ($mode === FORM_LOAD) { if ($mode === FORM_LOAD) {
$this->store->setVar($formElement[FE_NAME], $value, STORE_SIP, false); $this->store->setVar($formElement[FE_NAME], $value, STORE_SIP, true);
} }
return; return;
......
...@@ -454,6 +454,9 @@ const SYSTEM_REDIRECT_ALL_MAIL_TO = 'redirectAllMailTo'; ...@@ -454,6 +454,9 @@ const SYSTEM_REDIRECT_ALL_MAIL_TO = 'redirectAllMailTo';
const SYSTEM_MAIL_LOG = 'mailLog'; const SYSTEM_MAIL_LOG = 'mailLog';
const SYSTEM_MAIL_LOG_FILE = 'fileadmin/protected/log/mail.log'; const SYSTEM_MAIL_LOG_FILE = 'fileadmin/protected/log/mail.log';
const SYSTEM_THROW_GENERAL_ERROR = 'throwExceptionGeneralError';
const SYSTEM_FLAG_PRODUCTION = 'flagProduction';
const SYSTEM_SHOW_DEBUG_INFO = 'showDebugInfo'; const SYSTEM_SHOW_DEBUG_INFO = 'showDebugInfo';
const SYSTEM_SHOW_DEBUG_INFO_YES = 'yes'; const SYSTEM_SHOW_DEBUG_INFO_YES = 'yes';
const SYSTEM_SHOW_DEBUG_INFO_NO = 'no'; const SYSTEM_SHOW_DEBUG_INFO_NO = 'no';
...@@ -594,10 +597,10 @@ const SYSTEM_FORM_ELEMENT = 'formElement'; // '<formElementName> / ...@@ -594,10 +597,10 @@ const SYSTEM_FORM_ELEMENT = 'formElement'; // '<formElementName> /
const SYSTEM_FORM_ELEMENT_ID = 'formElementId'; // '<formElementName> / <formElementeId>' const SYSTEM_FORM_ELEMENT_ID = 'formElementId'; // '<formElementName> / <formElementeId>'
const SYSTEM_FORM_ELEMENT_COLUMN = 'formElementColumn'; // '<columnname of current processed formElement>' const SYSTEM_FORM_ELEMENT_COLUMN = 'formElementColumn'; // '<columnname of current processed formElement>'
const SYSTEM_FORM_ELEMENT_MESSAGE = 'formElementMessage'; // '<columnname of current processed formElement>' const SYSTEM_FORM_ELEMENT_MESSAGE = 'formElementMessage'; // '<columnname of current processed formElement>'
const SYSTEM_REPORT_COLUMN_INDEX = 'reportColumnIndex'; // Keyname of SQL-column processed at the moment. const SYSTEM_REPORT_COLUMN_INDEX = 'reportColumnIndex'; // Index of SQL-column processed at the moment.
const SYSTEM_REPORT_COLUMN_NAME = 'reportColumnName'; // Keyname of SQL-column processed at the moment. const SYSTEM_REPORT_COLUMN_NAME = 'reportColumnName'; // Name of SQL-column processed at the moment.
const SYSTEM_REPORT_COLUMN_VALUE = 'reportColumnValue'; // Keyname of SQL-column processed at the moment. const SYSTEM_REPORT_COLUMN_VALUE = 'reportColumnValue'; // Value of SQL-column processed at the moment.
const SYSTEM_REPORT_FULL_LEVEL = 'reportFullLevel'; // Keyname of SQL-column processed at the moment. const SYSTEM_REPORT_FULL_LEVEL = 'reportFullLevel'; // Full level of current report row. E.g.: 10.20.1. Used for error reports.
const SYSTEM_MESSAGE_DEBUG = 'messageDebug'; const SYSTEM_MESSAGE_DEBUG = 'messageDebug';
const SYSTEM_DOWNLOAD_POPUP = 'hasDownloadPopup'; // Marker which is set to 'true' if there is at least one Download Link rendered const SYSTEM_DOWNLOAD_POPUP = 'hasDownloadPopup'; // Marker which is set to 'true' if there is at least one Download Link rendered
const DOWNLOAD_POPUP_REQUEST = 'true'; const DOWNLOAD_POPUP_REQUEST = 'true';
......
...@@ -375,14 +375,13 @@ class Save { ...@@ -375,14 +375,13 @@ class Save {
$pathFileNameTmp=''; // see '4' $pathFileNameTmp=''; // see '4'
} else { } else {
if (empty($pathFileName)) { if (empty($pathFileName)) {
$pathFileNameTmp = $primaryRecord[$column]; // see '3' $pathFileNameTmp = $primaryRecord[$column]??''; // see '3'. Attention: in case of Advanced Upload, $primaryRecord[$column] does not exist.
} else { } else {
$pathFileNameTmp = $pathFileName; // see '1,2,5' $pathFileNameTmp = $pathFileName; // see '1,2,5'
} }
} }
// Get latest file information // Get latest file information
if($pathFileNameTmp=='') { if($pathFileNameTmp=='') {
// No new upload and no existing: take care to remove previous upload file statistics. // No new upload and no existing: take care to remove previous upload file statistics.
$this->store->unsetVar(VAR_FILE_MIME_TYPE, STORE_VAR); $this->store->unsetVar(VAR_FILE_MIME_TYPE, STORE_VAR);
...@@ -392,7 +391,6 @@ class Save { ...@@ -392,7 +391,6 @@ class Save {
$this->store->appendToStore($vars, STORE_VAR); $this->store->appendToStore($vars, STORE_VAR);
} }
// If given: fire a sqlBefore query // If given: fire a sqlBefore query
$this->evaluate->parse($formElement[FE_SQL_BEFORE]); $this->evaluate->parse($formElement[FE_SQL_BEFORE]);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace qfq; namespace qfq;
require_once(__DIR__ . '/../store/Store.php');
/** /**
* Class ErrorHandler * Class ErrorHandler
...@@ -23,6 +24,8 @@ class ErrorHandler { ...@@ -23,6 +24,8 @@ class ErrorHandler {
* @param $line * @param $line
* @return bool|string * @return bool|string
* @throws CodeException * @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/ */
public static function exception_error_handler($severity, $message, $file, $line) { public static function exception_error_handler($severity, $message, $file, $line) {
...@@ -30,11 +33,19 @@ class ErrorHandler { ...@@ -30,11 +33,19 @@ class ErrorHandler {
// This error code is not included in error_reporting // This error code is not included in error_reporting
return false; return false;
} }
// Do not show too much to the user. E.g. 'ldap_bind()' might have problems, but the user should not see the
// file and line number. Often the filename is part of the message >> don't show the message to the user. $store = Store::getInstance();
throw new CodeException(json_encode( if($store->getVar(SYSTEM_THROW_GENERAL_ERROR, STORE_SYSTEM) == 'yes'){
[ERROR_MESSAGE_TO_USER => 'General error - please report.',
ERROR_MESSAGE_SUPPORT => "File: $file / Line: $line / $message"]), $severity, null); // Do not show too much to the user. E.g. 'ldap_bind()' might have problems, but the user should not see the
// file and line number. Often the filename is part of the message >> don't show the message to the user.
throw new CodeException(json_encode(
[ERROR_MESSAGE_TO_USER => 'General error - please report.',
ERROR_MESSAGE_SUPPORT => "File: $file / Line: $line / $message"]), $severity, null);
}
return true;
} }
} }
\ No newline at end of file
...@@ -351,6 +351,9 @@ class Config { ...@@ -351,6 +351,9 @@ class Config {
F_FE_DATA_REQUIRED_ERROR => F_FE_DATA_REQUIRED_ERROR_DEFAULT, F_FE_DATA_REQUIRED_ERROR => F_FE_DATA_REQUIRED_ERROR_DEFAULT,
F_FE_DATA_MATCH_ERROR => F_FE_DATA_MATCH_ERROR_DEFAULT, F_FE_DATA_MATCH_ERROR => F_FE_DATA_MATCH_ERROR_DEFAULT,
F_FE_DATA_ERROR => 'error', F_FE_DATA_ERROR => 'error',
SYSTEM_FLAG_PRODUCTION => 'yes',
SYSTEM_THROW_GENERAL_ERROR => 'auto',
]; ];
// To let run legacy code // To let run legacy code
......
...@@ -300,6 +300,10 @@ class Store { ...@@ -300,6 +300,10 @@ class Store {
$config[SYSTEM_DB_1_NAME] = $config[SYSTEM_DB_NAME]; $config[SYSTEM_DB_1_NAME] = $config[SYSTEM_DB_NAME];
} }
if ($config[SYSTEM_THROW_GENERAL_ERROR] == 'auto') {
$config[SYSTEM_THROW_GENERAL_ERROR] = $config[SYSTEM_FLAG_PRODUCTION] == 'yes' ? 'no' : 'yes';
}
return $config; return $config;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment