Commit 14ed99fc authored by Carsten  Rose's avatar Carsten Rose
Browse files

B6880. Fixed Exceptions with too many details to end user. fixes #6880

parent df216920
Pipeline #941 passed with stage
in 1 minute and 49 seconds
...@@ -191,22 +191,22 @@ Setup CSS & JS ...@@ -191,22 +191,22 @@ Setup CSS & JS
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
:: ::
page.meta { page.meta {
X-UA-Compatible = IE=edge X-UA-Compatible = IE=edge
X-UA-Compatible.attribute = http-equiv X-UA-Compatible.attribute = http-equiv
viewport=width=device-width, initial-scale=1 viewport=width=device-width, initial-scale=1
} }
page.includeCSS { page.includeCSS {
file01 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap.min.css file01 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap.min.css
file02 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-theme.min.css file02 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-theme.min.css
file03 = typo3conf/ext/qfq/Resources/Public/Css/jqx.base.css file03 = typo3conf/ext/qfq/Resources/Public/Css/jqx.base.css
file04 = typo3conf/ext/qfq/Resources/Public/Css/jqx.bootstrap.css file04 = typo3conf/ext/qfq/Resources/Public/Css/jqx.bootstrap.css
file05 = typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css file05 = typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css
file06 = typo3conf/ext/qfq/Resources/Public/Css/tablesorter-bootstrap.css file06 = typo3conf/ext/qfq/Resources/Public/Css/tablesorter-bootstrap.css
} }
page.includeJS { page.includeJS {
file01 = typo3conf/ext/qfq/Resources/Public/JavaScript/jquery.min.js file01 = typo3conf/ext/qfq/Resources/Public/JavaScript/jquery.min.js
file02 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap.min.js file02 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap.min.js
file03 = typo3conf/ext/qfq/Resources/Public/JavaScript/validator.min.js file03 = typo3conf/ext/qfq/Resources/Public/JavaScript/validator.min.js
...@@ -223,8 +223,7 @@ Setup CSS & JS ...@@ -223,8 +223,7 @@ Setup CSS & JS
# Only needed in case FormElement 'annotate' is used. # Only needed in case FormElement 'annotate' is used.
file20 = typo3conf/ext/qfq/Resources/Public/JavaScript/fabric.min.js file20 = typo3conf/ext/qfq/Resources/Public/JavaScript/fabric.min.js
file21 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq.fabric.min.js file21 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq.fabric.min.js
}
}
.. _form-editor: .. _form-editor:
......
...@@ -260,7 +260,11 @@ abstract class AbstractBuildForm { ...@@ -260,7 +260,11 @@ abstract class AbstractBuildForm {
} else { } else {
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP); $recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP);
if (!($recordId == '' || is_numeric($recordId))) { if (!($recordId == '' || is_numeric($recordId))) {
throw new UserFormException('Invalid record ID: r="' . $recordId, '"', ERROR_INVALID_VALUE); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Invalid record ID', ERROR_MESSAGE_SUPPORT => 'Invalid record ID: r="' . $recordId]),
ERROR_INVALID_VALUE);
} }
$htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse, $mode); $htmlElements = $this->elements($recordId, $filter, 0, $json, $modeCollectFe, $htmlElementNameIdZero, $storeUse, $mode);
...@@ -1392,7 +1396,10 @@ abstract class AbstractBuildForm { ...@@ -1392,7 +1396,10 @@ abstract class AbstractBuildForm {
} }
if (false === stristr(substr($sqlTest, 0, 7), 'SELECT ')) { if (false === stristr(substr($sqlTest, 0, 7), 'SELECT ')) {
throw new UserFormException("Expect a SELECT statement in " . FE_TYPEAHEAD_SQL . " - got: " . $sqlTest, ERROR_BROKEN_PARAMETER); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => '"Expect a SELECT statement', ERROR_MESSAGE_SUPPORT => "Expect a SELECT statement in " . FE_TYPEAHEAD_SQL . " - got: " . $sqlTest]),
ERROR_BROKEN_PARAMETER);
} }
if (false === stristr($sql, ' LIMIT ')) { if (false === stristr($sql, ' LIMIT ')) {
......
...@@ -42,9 +42,11 @@ class BodytextParser { ...@@ -42,9 +42,11 @@ class BodytextParser {
$bodytext = Support::decryptDoubleCurlyBraces($bodytext); $bodytext = Support::decryptDoubleCurlyBraces($bodytext);
if (strpos($bodytext, NESTING_TOKEN_OPEN) !== false) { if (strpos($bodytext, NESTING_TOKEN_OPEN) !== false) {
throw new UserFormException("Missing close delimiter: $bodytext", ERROR_MISSING_CLOSE_DELIMITER); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Report: Missing close delimiter', ERROR_MESSAGE_SUPPORT => $bodytext]), ERROR_MISSING_CLOSE_DELIMITER);
} }
return $bodytext; return $bodytext;
} }
...@@ -279,7 +281,10 @@ class BodytextParser { ...@@ -279,7 +281,10 @@ class BodytextParser {
if ($posMatchOpen === false) { if ($posMatchOpen === false) {
$result = $this->decryptNestingDelimeter($result, $nestingOpen, $nestingClose); $result = $this->decryptNestingDelimeter($result, $nestingOpen, $nestingClose);
throw new UserFormException("Missing open delimiter: $result", ERROR_MISSING_OPEN_DELIMITER); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Missing open delimiter', ERROR_MESSAGE_SUPPORT => "Missing open delimiter: $result"]),
ERROR_MISSING_OPEN_DELIMITER);
} }
$pre = substr($result, 0, $posMatchOpen); $pre = substr($result, 0, $posMatchOpen);
......
...@@ -71,7 +71,10 @@ class Delete { ...@@ -71,7 +71,10 @@ class Delete {
$cwd = getcwd(); $cwd = getcwd();
$sitePath = $this->store->getVar(SYSTEM_SITE_PATH, STORE_SYSTEM); $sitePath = $this->store->getVar(SYSTEM_SITE_PATH, STORE_SYSTEM);
if ($cwd === false || $sitePath === false || !chdir($sitePath)) { if ($cwd === false || $sitePath === false || !chdir($sitePath)) {
throw new UserFormException("getcwd() failed or SITE_PATH undefined or chdir('$sitePath') failed.", ERROR_IO_CHDIR); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'getcwd() failed or SITE_PATH undefined or chdir() failed', ERROR_MESSAGE_SUPPORT => "getcwd() failed or SITE_PATH undefined or chdir('$sitePath') failed."]),
ERROR_IO_CHDIR);
} }
// Read record first. // Read record first.
...@@ -82,7 +85,10 @@ class Delete { ...@@ -82,7 +85,10 @@ class Delete {
$this->db->sql("DELETE FROM $tableName WHERE $primaryKey =? LIMIT 1", ROW_REGULAR, [$recordId]); $this->db->sql("DELETE FROM $tableName WHERE $primaryKey =? LIMIT 1", ROW_REGULAR, [$recordId]);
} else { } else {
throw new UserFormException("Record $recordId not found in table '$tableName'.", ERROR_RECORD_NOT_FOUND); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Record not found in table', ERROR_MESSAGE_SUPPORT => "Record $recordId not found in table '$tableName'."]),
ERROR_RECORD_NOT_FOUND);
} }
chdir($cwd); chdir($cwd);
...@@ -119,7 +125,9 @@ class Delete { ...@@ -119,7 +125,9 @@ class Delete {
$samePathFileName = $this->db->sql("SELECT COUNT($primaryKey) AS cnt FROM $tableName WHERE $key LIKE ?", ROW_EXPECT_1, [$file]); $samePathFileName = $this->db->sql("SELECT COUNT($primaryKey) AS cnt FROM $tableName WHERE $key LIKE ?", ROW_EXPECT_1, [$file]);
if ($samePathFileName['cnt'] === 1) { if ($samePathFileName['cnt'] === 1) {
if (!unlink($file)) { if (!unlink($file)) {
throw new UserFormException("Error deleting file: $file", ERROR_IO_UNLINK); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Error deleting file', ERROR_MESSAGE_SUPPORT => "Error deleting file: $file"]),
ERROR_IO_UNLINK);
} }
} }
} }
......
...@@ -127,7 +127,9 @@ class Evaluate { ...@@ -127,7 +127,9 @@ class Evaluate {
$flagTokenReplaced = false; $flagTokenReplaced = false;
if ($recursion > 4) { if ($recursion > 4) {
throw new qfq\UserFormException("Recursion too deep ($recursion). Line: $line", ERROR_RECURSION_TOO_DEEP); throw new qfq\UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'Recursion too deep', ERROR_MESSAGE_SUPPORT => "Recursion too deep ($recursion). Line: $line"]),
ERROR_RECURSION_TOO_DEEP);
} }
$result = $line; $result = $line;
...@@ -143,7 +145,9 @@ class Evaluate { ...@@ -143,7 +145,9 @@ class Evaluate {
$posMatchOpen = strrpos(substr($result, 0, $posFirstClose), $this->startDelimiter); $posMatchOpen = strrpos(substr($result, 0, $posFirstClose), $this->startDelimiter);
if ($posMatchOpen === false) { if ($posMatchOpen === false) {
throw new UserFormException("Missing open delimiter: $result", ERROR_MISSING_OPEN_DELIMITER); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Missing open delimiter', ERROR_MESSAGE_SUPPORT => "Missing open delimiter: $result"]),
ERROR_MISSING_OPEN_DELIMITER);
} }
$pre = substr($result, 0, $posMatchOpen); $pre = substr($result, 0, $posMatchOpen);
......
...@@ -123,7 +123,9 @@ class File { ...@@ -123,7 +123,9 @@ class File {
$statusUpload = array_merge($statusUpload, $newArr); $statusUpload = array_merge($statusUpload, $newArr);
if ($statusUpload[FILES_ERROR] !== UPLOAD_ERR_OK) { if ($statusUpload[FILES_ERROR] !== UPLOAD_ERR_OK) {
throw new UserFormException($this->uploadErrMsg[$newArr[FILES_ERROR]], ERROR_UPLOAD); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Upload: Error', ERROR_MESSAGE_SUPPORT => $this->uploadErrMsg[$newArr[FILES_ERROR]]]),
ERROR_UPLOAD);
} }
$this->checkMaxFileSize($statusUpload['size']); $this->checkMaxFileSize($statusUpload['size']);
...@@ -154,7 +156,9 @@ class File { ...@@ -154,7 +156,9 @@ class File {
$file = Support::extendFilename($statusUpload[FILES_TMP_NAME], UPLOAD_CACHED); $file = Support::extendFilename($statusUpload[FILES_TMP_NAME], UPLOAD_CACHED);
if (file_exists($file)) { if (file_exists($file)) {
if (!unlink($file)) { if (!unlink($file)) {
throw new UserFormException('unlink file: ' . $file, ERROR_IO_UNLINK); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Unlink file', ERROR_MESSAGE_SUPPORT => 'unlink file: ' . $file]),
ERROR_IO_UNLINK);
} }
} }
$statusUpload[FILES_TMP_NAME] = ''; $statusUpload[FILES_TMP_NAME] = '';
......
...@@ -471,14 +471,18 @@ class Save { ...@@ -471,14 +471,18 @@ class Save {
$cwd = getcwd(); $cwd = getcwd();
$sitePath = $this->store->getVar(SYSTEM_SITE_PATH, STORE_SYSTEM); $sitePath = $this->store->getVar(SYSTEM_SITE_PATH, STORE_SYSTEM);
if ($cwd === false || $sitePath === false || !chdir($sitePath)) { if ($cwd === false || $sitePath === false || !chdir($sitePath)) {
throw new UserFormException("getcwd() failed or SITE_PATH undefined or chdir('$sitePath') failed.", ERROR_IO_CHDIR); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'getcwd() failed or SITE_PATH undefined or chdir() failed', ERROR_MESSAGE_SUPPORT => "getcwd() failed or SITE_PATH undefined or chdir('$sitePath') failed."]),
ERROR_IO_CHDIR);
} }
// Get original pathFileName // Get original pathFileName
$field = HelperFormElement::AppendFormElementNameImageCut($formElement); $field = HelperFormElement::AppendFormElementNameImageCut($formElement);
$pathFileName = $this->store->getVar($field, STORE_SIP); $pathFileName = $this->store->getVar($field, STORE_SIP);
if ($pathFileName == '' || !file_exists($pathFileName)) { if ($pathFileName == '' || !file_exists($pathFileName)) {
throw new UserFormException('Empty file or file not found: ' . $pathFileName, ERROR_IO_FILE_NOT_FOUND); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Empty file or file not found', ERROR_MESSAGE_SUPPORT => 'Empty file or file not found: ' . $pathFileName]),
ERROR_IO_FILE_NOT_FOUND);
} }
// 'data:image/png;base64,AAAFBfj42Pj4...'; // 'data:image/png;base64,AAAFBfj42Pj4...';
...@@ -515,7 +519,9 @@ class Save { ...@@ -515,7 +519,9 @@ class Save {
!file_exists($pathParts['dirname'] . $pathParts['filename'] . $extSave) !file_exists($pathParts['dirname'] . $pathParts['filename'] . $extSave)
) { ) {
if (!rename($pathFileName, $pathFileName . $extSave)) { if (!rename($pathFileName, $pathFileName . $extSave)) {
throw new UserFormException("Rename file: '$pathFileName' > '$pathFileName$extSave'", ERROR_IO_RENAME); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Rename file', ERROR_MESSAGE_SUPPORT => "Rename file: '$pathFileName' > '$pathFileName$extSave'"]),
ERROR_IO_RENAME);
} }
} }
} }
...@@ -525,7 +531,9 @@ class Save { ...@@ -525,7 +531,9 @@ class Save {
} }
if (false === file_put_contents($pathFileName, base64_decode($imageData))) { if (false === file_put_contents($pathFileName, base64_decode($imageData))) {
throw new UserFormException("Write new image failed: $pathFileName", ERROR_IO_WRITE); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Write new image failed', ERROR_MESSAGE_SUPPORT => "Write new image failed: $pathFileName"]),
ERROR_IO_WRITE);
} }
$this->store->setVar($formElement[FE_NAME], $pathFileName, STORE_FORM, true); $this->store->setVar($formElement[FE_NAME], $pathFileName, STORE_FORM, true);
...@@ -573,7 +581,9 @@ class Save { ...@@ -573,7 +581,9 @@ class Save {
$cwd = getcwd(); $cwd = getcwd();
$sitePath = $this->store->getVar(SYSTEM_SITE_PATH, STORE_SYSTEM); $sitePath = $this->store->getVar(SYSTEM_SITE_PATH, STORE_SYSTEM);
if ($cwd === false || $sitePath === false || !chdir($sitePath)) { if ($cwd === false || $sitePath === false || !chdir($sitePath)) {
throw new UserFormException("getcwd() failed or SITE_PATH undefined or chdir('$sitePath') failed.", ERROR_IO_CHDIR); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'getcwd() failed or SITE_PATH undefined or chdir() failed', ERROR_MESSAGE_SUPPORT => "getcwd() failed or SITE_PATH undefined or chdir('$sitePath') failed."]),
ERROR_IO_CHDIR);
} }
// Delete existing old file. // Delete existing old file.
...@@ -582,7 +592,9 @@ class Save { ...@@ -582,7 +592,9 @@ class Save {
$oldFile = $arr[EXISTING_PATH_FILE_NAME]; $oldFile = $arr[EXISTING_PATH_FILE_NAME];
if (file_exists($oldFile)) { if (file_exists($oldFile)) {
if (!unlink($oldFile)) { if (!unlink($oldFile)) {
throw new UserFormException('Unlink file failed: ' . $oldFile, ERROR_IO_UNLINK); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Unlink file failed', ERROR_MESSAGE_SUPPORT => 'Unlink file failed: ' . $oldFile]),
ERROR_IO_UNLINK);
} }
} }
$flagDelete = ($oldFile != ''); $flagDelete = ($oldFile != '');
......
...@@ -138,12 +138,22 @@ class Database { ...@@ -138,12 +138,22 @@ class Database {
$mysqli = new \mysqli($config[SYSTEM_DB_SERVER], $config[SYSTEM_DB_USER], $config[SYSTEM_DB_PASSWORD], $config[SYSTEM_DB_NAME]); $mysqli = new \mysqli($config[SYSTEM_DB_SERVER], $config[SYSTEM_DB_USER], $config[SYSTEM_DB_PASSWORD], $config[SYSTEM_DB_NAME]);
if ($mysqli->connect_error) { if ($mysqli->connect_error) {
throw new UserFormException ("Error open Database 'mysql:host=" . $config[SYSTEM_DB_SERVER] . ";dbname=" . $config[SYSTEM_DB_NAME] . ";dbuser=" . $config[SYSTEM_DB_USER] . "'': " . $mysqli->connect_errno . PHP_EOL . $mysqli->connect_error, ERROR_DB_OPEN); throw new UserFormException (
json_encode([ERROR_MESSAGE_TO_USER => 'Error open Database',
ERROR_MESSAGE_SUPPORT => "Error open Database 'mysql:host=" . $config[SYSTEM_DB_SERVER] .
";dbname=" . $config[SYSTEM_DB_NAME] .
";dbuser=" . $config[SYSTEM_DB_USER] .
"'': " . $mysqli->connect_errno . PHP_EOL . $mysqli->connect_error]),
ERROR_DB_OPEN);
} }
// Necessary that mysqli::real_escape_string() functions properly. // Necessary that mysqli::real_escape_string() functions properly.
if (!$mysqli->set_charset('utf8')) { if (!$mysqli->set_charset('utf8')) {
throw new UserFormException ("Error set_charset('utf8') Database: " . $mysqli->connect_errno . PHP_EOL . $mysqli->connect_error, ERROR_DB_SET_CHARSET); throw new UserFormException (
json_encode([ERROR_MESSAGE_TO_USER => "Error set_charset('utf8')",
ERROR_MESSAGE_SUPPORT => "Error set_charset('utf8') Database: " . $mysqli->connect_errno . PHP_EOL . $mysqli->connect_error]),
ERROR_DB_SET_CHARSET);
} }
return $mysqli; return $mysqli;
...@@ -184,7 +194,7 @@ class Database { ...@@ -184,7 +194,7 @@ class Database {
// CR (& EV) often forgets to specify the $mode and use prepared statement with parameter instead. // CR (& EV) often forgets to specify the $mode and use prepared statement with parameter instead.
if (is_array($mode)) { if (is_array($mode)) {
throw new CodeException("Probably a parameter forgotten: \$mode ?"); throw new CodeException("Probably a parameter forgotten: $mode ?");
} }
// for error reporting in exception // for error reporting in exception
...@@ -387,7 +397,10 @@ class Database { ...@@ -387,7 +397,10 @@ class Database {
case 'DESCRIBE': case 'DESCRIBE':
case 'EXPLAIN': case 'EXPLAIN':
if (false === ($result = $this->mysqli_stmt->get_result())) { if (false === ($result = $this->mysqli_stmt->get_result())) {
throw new DbException('[ mysqli: ' . $this->mysqli_stmt->errno . ' ] ' . $this->mysqli_stmt->error . $specificMessage, ERROR_DB_EXECUTE); throw new DbException(
json_encode([ERROR_MESSAGE_TO_USER => 'Error DB execute', ERROR_MESSAGE_SUPPORT => '[ mysqli: ' . $this->mysqli_stmt->errno . ' ] ' . $this->mysqli_stmt->error . $specificMessage]),
ERROR_DB_EXECUTE);
} }
$queryType = QUERY_TYPE_SELECT; $queryType = QUERY_TYPE_SELECT;
$this->mysqli_result = $result; $this->mysqli_result = $result;
...@@ -693,13 +706,17 @@ class Database { ...@@ -693,13 +706,17 @@ class Database {
* @throws UserFormException * @throws UserFormException
*/ */
private function getFieldDefinitionFromTable($table, $columnName) { private function getFieldDefinitionFromTable($table, $columnName) {
$tableDefinition = $this->getTableDefinition($table); $tableDefinition = $this->getTableDefinition($table);
foreach ($tableDefinition AS $row) { foreach ($tableDefinition AS $row) {
if ($row["Field"] == $columnName) { if ($row["Field"] == $columnName) {
return $row; return $row;
} }
} }
throw new DbException("Column name '$columnName' not found in table '$table'.", ERROR_DB_COLUMN_NOT_FOUND_IN_TABLE);
throw new DbException(
json_encode([ERROR_MESSAGE_TO_USER => 'Column name not found', ERROR_MESSAGE_SUPPORT => "Column name '$columnName' not found in table '$table'."]),
ERROR_DB_COLUMN_NOT_FOUND_IN_TABLE);
} }
/** /**
......
...@@ -313,7 +313,8 @@ class FormAction { ...@@ -313,7 +313,8 @@ class FormAction {
$msg = $this->evaluate->parse($fe[FE_MESSAGE_FAIL]); // Replace possible dynamic parts $msg = $this->evaluate->parse($fe[FE_MESSAGE_FAIL]); // Replace possible dynamic parts
// Throw user error message // Throw user error message
throw new UserFormException($msg, ERROR_REPORT_FAILED_ACTION); throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'validate() failed', ERROR_MESSAGE_SUPPORT => $msg]), ERROR_REPORT_FAILED_ACTION);
} }
/** /**
...@@ -593,7 +594,9 @@ class FormAction { ...@@ -593,7 +594,9 @@ class FormAction {
Support::mkDirParent($rowDest[$key]); Support::mkDirParent($rowDest[$key]);
if (!copy($val, $rowDest[$key])) { if (!copy($val, $rowDest[$key])) {
throw new UserFormException("Error copy file from [$val] to [" . $rowDest[$key] . "]", ERROR_IO_COPY_FILE); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Error copy file', ERROR_MESSAGE_SUPPORT => "Error copy file from [$val] to [" . $rowDest[$key] . "]"]),
ERROR_IO_COPY_FILE);
} }
} }
} }
......
...@@ -231,7 +231,9 @@ class HelperFile { ...@@ -231,7 +231,9 @@ class HelperFile {
if ($chmod !== false) { if ($chmod !== false) {
if (false === chmod($pathFileName, $chmod)) { if (false === chmod($pathFileName, $chmod)) {
throw new UserFormException("Failed: chmod $chmod '$pathFileName'", ERROR_IO_CHMOD); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Failed: chmod', ERROR_MESSAGE_SUPPORT => "Failed: chmod $chmod '$pathFileName'"]),
ERROR_IO_CHMOD);
} }
} }
......
...@@ -41,7 +41,9 @@ class Ldap { ...@@ -41,7 +41,9 @@ class Ldap {
$ds = ldap_connect($ldapServer); // must be a valid LDAP server! $ds = ldap_connect($ldapServer); // must be a valid LDAP server!
if (!$ds) { if (!$ds) {
throw new UserFormException("Unable to connect to LDAP server: $ldapServer", ERROR_LDAP_CONNECT); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Unable to connect to LDAP server', ERROR_MESSAGE_SUPPORT => "Unable to connect to LDAP server: $ldapServer"]),
ERROR_LDAP_CONNECT);
} }
// http://php.net/manual/en/function.ldap-set-option.php >> This function is only available when using OpenLDAP 2.x.x OR Netscape Directory SDK x.x. // http://php.net/manual/en/function.ldap-set-option.php >> This function is only available when using OpenLDAP 2.x.x OR Netscape Directory SDK x.x.
......
...@@ -42,12 +42,18 @@ class Logger { ...@@ -42,12 +42,18 @@ class Logger {
// Try to open the file a second time. // Try to open the file a second time.
if (!$handle = fopen($filename, $mode)) { if (!$handle = fopen($filename, $mode)) {
throw new UserFormException("Error - cannot open. File: " . $filename . " ( CWD: " . getcwd() . ") - " . error_get_last(), ERROR_IO_OPEN); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Error: cannot open file',
ERROR_MESSAGE_SUPPORT => "Error - cannot open. File: " . $filename . " ( CWD: " . getcwd() . ") - " . error_get_last()]),
ERROR_IO_OPEN);
} }
} }
if (fwrite($handle, $msg . PHP_EOL) === false) { if (fwrite($handle, $msg . PHP_EOL) === false) {
throw new UserFormException("Error - cannot write. File: " . $filename . " ( CWD: " . getcwd() . ") - " . error_get_last(), ERROR_IO_WRITE); throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Error: cannot write file',
ERROR_MESSAGE_SUPPORT => "Error - cannot open. File: " . $filename . " ( CWD: " . getcwd() . ") - " . error_get_last()]),
ERROR_IO_WRITE);
} }
fclose($handle); fclose($handle);
......
...@@ -70,6 +70,7 @@ class FillStoreForm { ...@@ -70,6 +70,7 @@ class FillStoreForm {
$form = $this->store->getVar(SIP_FORM, STORE_SIP, SANITIZE_ALLOW_ALNUMX); $form = $this->store->getVar(SIP_FORM, STORE_SIP, SANITIZE_ALLOW_ALNUMX);
if (!empty($form)) { if (!empty($form)) {
// To make STORE_RECORD available at a very early stage.
$recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP, SANITIZE_ALLOW_DIGIT); $recordId = $this->store->getVar(SIP_RECORD_ID, STORE_SIP, SANITIZE_ALLOW_DIGIT);
$tableFromFormSql = "SELECT tableName, primaryKey FROM Form WHERE name=?"; $tableFromFormSql = "SELECT tableName, primaryKey FROM Form WHERE name=?";
$form = $this->dbArray[$this->dbIndexQfq]->sql($tableFromFormSql, ROW_EXPECT_1, [$form]); $form = $this->dbArray[$this->dbIndexQfq]->sql($tableFromFormSql, ROW_EXPECT_1, [$form]);
...@@ -79,8 +80,8 @@ class FillStoreForm { ...@@ -79,8 +80,8 @@ class FillStoreForm {
} }
$this->store->fillStoreWithRecord($form[F_TABLE_NAME], $recordId, $this->dbArray[$this->dbIndexData], $form[F_PRIMARY_KEY]); $this->store->fillStoreWithRecord($form[F_TABLE_NAME], $recordId, $this->dbArray[$this->dbIndexData], $form[F_PRIMARY_KEY]);
} }
$this->evaluate = new Evaluate($this->store, $this->dbArray[$this->dbIndexData]);
$this->evaluate = new Evaluate($this->store, $this->dbArray[$this->dbIndexData]);
} }
/** /**
......
Markdown is supported
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