Commit a9d71f91 authored by Carsten  Rose's avatar Carsten Rose
Browse files

FE.type='annotate': a) always save with encode='none' (upto 30% less size than...

FE.type='annotate': a) always save with encode='none' (upto 30% less size than htmlspecialchar), b) Check fabric data for valid JSON read from database.
parent bf238262
...@@ -2832,6 +2832,10 @@ abstract class AbstractBuildForm { ...@@ -2832,6 +2832,10 @@ abstract class AbstractBuildForm {
} }
} }
if (!empty($value) && json_decode($value) === null) {
throw new UserFormException("Fabric data: JSON structure not valid", ERROR_BROKEN_JSON_STRUCTURE);
}
// $attributeImage = Support::doAttribute('id', 'qfq-fabric-image-1'); // $attributeImage = Support::doAttribute('id', 'qfq-fabric-image-1');
// $attributeImage .= Support::doAttribute('src', $this->fileToSipUrl($formElement[FE_IMAGE_SOURCE])); // $attributeImage .= Support::doAttribute('src', $this->fileToSipUrl($formElement[FE_IMAGE_SOURCE]));
// $attributeImage .= Support::doAttribute('class', 'qfq-fabric-image'); // $attributeImage .= Support::doAttribute('class', 'qfq-fabric-image');
......
...@@ -137,7 +137,7 @@ const ERROR_CHECKBOX_EQUAL = 1026; ...@@ -137,7 +137,7 @@ const ERROR_CHECKBOX_EQUAL = 1026;
const ERROR_MISSING_ITEM_LIST = 1027; const ERROR_MISSING_ITEM_LIST = 1027;
const ERROR_UNKNOWN_FORM_RENDER = 1028; const ERROR_UNKNOWN_FORM_RENDER = 1028;
const ERROR_NAME_LABEL_EMPTY = 1029; const ERROR_NAME_LABEL_EMPTY = 1029;
const ERROR_BROKEN_JSON_STRUCTURE = 1030;
const ERROR_DEBUG = 1031; const ERROR_DEBUG = 1031;
const ERROR_UNKNOWN_MODE = 1032; const ERROR_UNKNOWN_MODE = 1032;
const ERROR_NOT_IMPLEMENTED = 1033; const ERROR_NOT_IMPLEMENTED = 1033;
......
...@@ -12,7 +12,6 @@ use qfq; ...@@ -12,7 +12,6 @@ use qfq;
require_once(__DIR__ . '/../../qfq/helper/Sanitize.php'); require_once(__DIR__ . '/../../qfq/helper/Sanitize.php');
class Client { class Client {
public static function getParam() { public static function getParam() {
...@@ -29,6 +28,7 @@ class Client { ...@@ -29,6 +28,7 @@ class Client {
if (isset($_POST)) { if (isset($_POST)) {
$post = $_POST; $post = $_POST;
// Logger::logMessage(var_export($post, true) . PHP_EOL . PHP_EOL,'post.txt');
} }
if (isset($_COOKIE[SESSION_NAME])) { if (isset($_COOKIE[SESSION_NAME])) {
......
...@@ -12,6 +12,7 @@ require_once(__DIR__ . '/Store.php'); ...@@ -12,6 +12,7 @@ require_once(__DIR__ . '/Store.php');
require_once(__DIR__ . '/../database/Database.php'); require_once(__DIR__ . '/../database/Database.php');
require_once(__DIR__ . '/../Constants.php'); require_once(__DIR__ . '/../Constants.php');
require_once(__DIR__ . '/../helper/HelperFormElement.php'); require_once(__DIR__ . '/../helper/HelperFormElement.php');
require_once(__DIR__ . '/../helper/Logger.php');
require_once(__DIR__ . '/../exceptions/UserFormException.php'); require_once(__DIR__ . '/../exceptions/UserFormException.php');
class FillStoreForm { class FillStoreForm {
...@@ -56,7 +57,6 @@ class FillStoreForm { ...@@ -56,7 +57,6 @@ class FillStoreForm {
$this->dbArray[$this->dbIndexQfq] = new Database($this->dbIndexQfq); $this->dbArray[$this->dbIndexQfq] = new Database($this->dbIndexQfq);
} }
$this->feSpecNative = $this->loadFormElementsBasedOnSIP(); $this->feSpecNative = $this->loadFormElementsBasedOnSIP();
$this->evaluate = new Evaluate($this->store, $this->dbArray[$this->dbIndexData]); $this->evaluate = new Evaluate($this->store, $this->dbArray[$this->dbIndexData]);
...@@ -219,12 +219,19 @@ class FillStoreForm { ...@@ -219,12 +219,19 @@ class FillStoreForm {
continue; continue;
} }
// Checkbox Multi: collect values switch ($formElement[FE_TYPE]) {
if ($formElement[FE_TYPE] === 'checkbox') { case FE_TYPE_CHECKBOX:
$val = $this->collectMultiValues($clientFieldName, $clientValues); // Checkbox Multi: collect values
if ($val !== false) { $val = $this->collectMultiValues($clientFieldName, $clientValues);
$clientValues[$clientFieldName] = $val; if ($val !== false) {
} $clientValues[$clientFieldName] = $val;
}
break;
case FE_TYPE_ANNOTATE:
$formElement[FE_ENCODE] = FE_ENCODE_NONE;
break;
default:
break;
} }
if ($formElement[FE_MODE] === FE_MODE_REQUIRED) { if ($formElement[FE_MODE] === FE_MODE_REQUIRED) {
...@@ -272,6 +279,7 @@ class FillStoreForm { ...@@ -272,6 +279,7 @@ class FillStoreForm {
} }
$this->store->setStore($newValues, STORE_FORM, true); $this->store->setStore($newValues, STORE_FORM, true);
} }
/** /**
......
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