Commit 7e49d63f authored by Carsten  Rose's avatar Carsten Rose
Browse files

AdminstratorManual/Index.rst: Update config.qfq.ini description to new...

AdminstratorManual/Index.rst: Update config.qfq.ini description to new parameter 'class'. Remove 'DB_NAME_TEST' cause that is only interesting to PHP Unit Tests and not to enduser.
UserManual/Index.rst: Update STORE_SYSTEM description of known variables.
Store.php, QuickFormQuery.php: Refactor building STORE_SYSTEM. Make it more generic if new parameters are introduced. Setting up new config.qfq.ini built in defaults and form defaults at one place. Renaming of parameter names in config.qfq.ini to STORE_SYSTEM at one place implemented with an extensible array.
AbstractBuildForm.php, BuildFormBootstrap.php, BuildFormTable.php: User constant F_CLASS  in $this->formSpec['class']
config.qfq.example.ini: comment empty variables - the new default setting is, that empty parameter in config.qfq.ini means EMPTY, not UNDEFINED.
parent 96fd3c00
...@@ -164,19 +164,19 @@ Example: *typo3conf/config.qfq.ini* ...@@ -164,19 +164,19 @@ Example: *typo3conf/config.qfq.ini*
DB_SERVER = localhost DB_SERVER = localhost
DB_PASSWORD = 12345678 DB_PASSWORD = 12345678
DB_NAME = qfq_db DB_NAME = qfq_db
DB_NAME_TEST = qfq_db_test
DB_INIT = set names utf8 DB_INIT = set names utf8
SQL_LOG = sql.log SQL_LOG = sql.log
SHOW_DEBUG_INFO = auto SHOW_DEBUG_INFO = auto
CSS_LINK_CLASS_INTERNAL = internal CSS_LINK_CLASS_INTERNAL = internal
CSS_LINK_CLASS_EXT = external CSS_LINK_CLASS_EXT = external
CSS_CLASS_QFQ_CONTAINER = ;CSS_CLASS_QFQ_CONTAINER =
;CSS_CLASS_QFQ_FORM =
CSS_CLASS_QFQ_FORM_PILL = qfq-color-grey-1 CSS_CLASS_QFQ_FORM_PILL = qfq-color-grey-1
CSS_CLASS_QFQ_FORM_BODY = qfq-color-grey-2 CSS_CLASS_QFQ_FORM_BODY = qfq-color-grey-2
FORM_DATA_PATTERN_ERROR = ;FORM_DATA_PATTERN_ERROR =
FORM_DATA_REQUIRED_ERROR = ;FORM_DATA_REQUIRED_ERROR =
FORM_DATA_MATCH_ERROR = ;FORM_DATA_MATCH_ERROR =
FORM_DATA_ERROR = ;FORM_DATA_ERROR =
Documentation Documentation
------------- -------------
......
...@@ -425,49 +425,61 @@ Store: *VARS* - V ...@@ -425,49 +425,61 @@ Store: *VARS* - V
Store: *SYSTEM* - Y Store: *SYSTEM* - Y
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| Name | Explanation | | Name | Explanation |
+=========================+============================================================+ +=========================+==========================================================================+
| DB_USER | defined in config.ini | | DB_USER | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| DB_SERVER | defined in config.ini | | DB_SERVER | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| DB_NAME | defined in config.ini | | DB_NAME | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| DB_INIT | defined in config.ini | | DB_INIT | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| SQL_LOG | defined in config.ini | | SQL_LOG | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| SQL_LOG_MODE | defined in config.ini | | SQL_LOG_MODE | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| SHOW_DEBUG_INFO | defined in config.ini | | SHOW_DEBUG_INFO | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| CSS_LINK_CLASS_INTERNAL | defined in config.ini | | CSS_LINK_CLASS_INTERNAL | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| CSS_LINK_CLASS_EXTERNAL | defined in config.ini | | CSS_LINK_CLASS_EXTERNAL | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| CSS_CLASS_QFQ_CONTAINER | defined in config.ini | | CSS_CLASS_QFQ_CONTAINER | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| EXT_PATH | computed during runtime | | EXT_PATH | computed during runtime |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| SITE_PATH | computed during runtime | | SITE_PATH | computed during runtime |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| DATE_FORMAT | defined in config.ini | | DATE_FORMAT | defined in config.ini |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| FORM_DATA_PATTERN_ERROR | defined in config.ini | | class | defined in config.ini (CSS_CLASS_QFQ_FORM) or form definition |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| FORM_DATA_REQUIRED_ERROR| defined in config.ini | | classPill | defined in config.ini (CSS_CLASS_QFQ_FORM_PILL) or form definition |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| FORM_DATA_MATCH_ERROR | defined in config.ini | | classBody | defined in config.ini (CSS_CLASS_QFQ_FORM_BODY) or form definition |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| FORM_DATA_ERROR | defined in config.ini | | data-pattern-error | defined in config.ini or form definition |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| sqlFinal | computed during runtime, used for error reporting | | data-require-error | defined in config.ini or form definition |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| sqlParamArray | computed during runtime, used for error reporting | | data-match-error | defined in config.ini or form definition |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| sqlCount | computed during runtime, used for error reporting | | data-error | defined in config.ini or form definition |
+-------------------------+------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------+
| bsLabelColumns | defined in config.ini (FORM_BS_LABEL_COLUMNS) or form definition |
+-------------------------+--------------------------------------------------------------------------+
| bsInputColumns | defined in config.ini (FORM_BS_INPUT_COLUMNS) or form definition |
+-------------------------+--------------------------------------------------------------------------+
| bsNoteColumns | defined in config.ini (FORM_BS_NOTE_COLUMNS) or form definition |
+-------------------------+--------------------------------------------------------------------------+
| sqlFinal | computed during runtime, used for error reporting |
+-------------------------+--------------------------------------------------------------------------+
| sqlParamArray | computed during runtime, used for error reporting |
+-------------------------+--------------------------------------------------------------------------+
| sqlCount | computed during runtime, used for error reporting |
+-------------------------+--------------------------------------------------------------------------+
SQL Statement SQL Statement
------------- -------------
......
...@@ -22,7 +22,7 @@ CSS_LINK_CLASS_INTERNAL = internal ...@@ -22,7 +22,7 @@ CSS_LINK_CLASS_INTERNAL = internal
CSS_LINK_CLASS_EXTERNAL = external CSS_LINK_CLASS_EXTERNAL = external
; QFQ with own Bootstrap: 'container'. QFQ already nested in Bootstrap of mainpage: <empty> ; QFQ with own Bootstrap: 'container'. QFQ already nested in Bootstrap of mainpage: <empty>
CSS_CLASS_QFQ_CONTAINER = ;CSS_CLASS_QFQ_CONTAINER =
; Default background color, specified via CSS class ; Default background color, specified via CSS class
CSS_CLASS_QFQ_FORM_PILL = qfq-color-grey-1 CSS_CLASS_QFQ_FORM_PILL = qfq-color-grey-1
...@@ -32,12 +32,12 @@ CSS_CLASS_QFQ_FORM_BODY = qfq-color-grey-2 ...@@ -32,12 +32,12 @@ CSS_CLASS_QFQ_FORM_BODY = qfq-color-grey-2
DATE_FORMAT = yyyy-mm-dd DATE_FORMAT = yyyy-mm-dd
; validator.js: data-pattern-error="", data-required-error="", data-match-error="", data-error="" ; validator.js: data-pattern-error="", data-required-error="", data-match-error="", data-error=""
FORM_DATA_PATTERN_ERROR = ;FORM_DATA_PATTERN_ERROR =
FORM_DATA_REQUIRED_ERROR = ;FORM_DATA_REQUIRED_ERROR =
FORM_DATA_MATCH_ERROR = ;FORM_DATA_MATCH_ERROR =
FORM_DATA_ERROR = ;FORM_DATA_ERROR =
; Default size for Bootstrap Form Elements ; Default size for Bootstrap Form Elements
FORM_BS_LABEL_COLUMNS = 3 ;FORM_BS_LABEL_COLUMNS = 3
FORM_BS_INPUT_COLUMNS = 6 ;FORM_BS_INPUT_COLUMNS = 6
FORM_BS_NOTE_COLUMNS = 3 ;FORM_BS_NOTE_COLUMNS = 3
...@@ -196,7 +196,7 @@ abstract class AbstractBuildForm { ...@@ -196,7 +196,7 @@ abstract class AbstractBuildForm {
public function head() { public function head() {
$html = ''; $html = '';
$html .= '<div ' . Support::doAttribute('class', $this->formSpec['class'], TRUE) . '>'; // main <div class=...> around everything $html .= '<div ' . Support::doAttribute('class', $this->formSpec[F_CLASS], TRUE) . '>'; // main <div class=...> around everything
// Logged in BE User will see a FormEdit Link // Logged in BE User will see a FormEdit Link
$sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ':', ', ', "'"); $sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ':', ', ', "'");
......
...@@ -101,7 +101,7 @@ class BuildFormBootstrap extends AbstractBuildForm { ...@@ -101,7 +101,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
public function head() { public function head() {
$html = ''; $html = '';
$html .= '<div ' . Support::doAttribute('class', $this->formSpec['class'], TRUE) . '>'; // main <div class=...> around everything, Whole FORM; class="container" or class="container-fluid" $html .= '<div ' . Support::doAttribute('class', $this->formSpec[F_CLASS], TRUE) . '>'; // main <div class=...> around everything, Whole FORM; class="container" or class="container-fluid"
$title = Support::wrapTag('<div class="hidden-xs col-sm-6 col-md-8">', Support::wrapTag('<h3>', $this->formSpec['title'])); $title = Support::wrapTag('<div class="hidden-xs col-sm-6 col-md-8">', Support::wrapTag('<h3>', $this->formSpec['title']));
$button = Support::wrapTag('<div class="col-xs-12 col-sm-6 col-md-4">', $this->buildButtons()); $button = Support::wrapTag('<div class="col-xs-12 col-sm-6 col-md-4">', $this->buildButtons());
......
...@@ -70,7 +70,7 @@ class BuildFormTable extends AbstractBuildForm { ...@@ -70,7 +70,7 @@ class BuildFormTable extends AbstractBuildForm {
public function head() { public function head() {
$html = ''; $html = '';
$html .= '<div ' . Support::doAttribute('class', $this->formSpec['class'], TRUE) . '>'; // main <div class=...> around everything $html .= '<div ' . Support::doAttribute('class', $this->formSpec[F_CLASS], TRUE) . '>'; // main <div class=...> around everything
// Logged in BE User will see a FormEdit Link // Logged in BE User will see a FormEdit Link
$sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ':', ', ', "'"); $sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ':', ', ', "'");
......
...@@ -297,6 +297,7 @@ const SYSTEM_SHOW_DEBUG_INFO = 'SHOW_DEBUG_INFO'; ...@@ -297,6 +297,7 @@ const SYSTEM_SHOW_DEBUG_INFO = 'SHOW_DEBUG_INFO';
const SYSTEM_CSS_LINK_CLASS_INTERNAL = 'CSS_LINK_CLASS_INTERNAL'; const SYSTEM_CSS_LINK_CLASS_INTERNAL = 'CSS_LINK_CLASS_INTERNAL';
const SYSTEM_CSS_LINK_CLASS_EXTERNAL = 'CSS_LINK_CLASS_EXTERNAL'; const SYSTEM_CSS_LINK_CLASS_EXTERNAL = 'CSS_LINK_CLASS_EXTERNAL';
const SYSTEM_CSS_CLASS_QFQ_CONTAINER = 'CSS_CLASS_QFQ_CONTAINER'; const SYSTEM_CSS_CLASS_QFQ_CONTAINER = 'CSS_CLASS_QFQ_CONTAINER';
const SYSTEM_CSS_CLASS_QFQ_FORM = 'CSS_CLASS_QFQ_FORM';
const SYSTEM_CSS_CLASS_QFQ_FORM_PILL = 'CSS_CLASS_QFQ_FORM_PILL'; const SYSTEM_CSS_CLASS_QFQ_FORM_PILL = 'CSS_CLASS_QFQ_FORM_PILL';
const SYSTEM_CSS_CLASS_QFQ_FORM_BODY = 'CSS_CLASS_QFQ_FORM_BODY'; const SYSTEM_CSS_CLASS_QFQ_FORM_BODY = 'CSS_CLASS_QFQ_FORM_BODY';
...@@ -464,6 +465,7 @@ const F_FINAL_DELETE_FORM = 'finalDeleteForm'; ...@@ -464,6 +465,7 @@ const F_FINAL_DELETE_FORM = 'finalDeleteForm';
const F_SUBMIT_BUTTON_TEXT = 'submitButtonText'; const F_SUBMIT_BUTTON_TEXT = 'submitButtonText';
const F_CLASS = 'class';
const F_CLASS_PILL = 'classPill'; const F_CLASS_PILL = 'classPill';
const F_CLASS_BODY = 'classBody'; const F_CLASS_BODY = 'classBody';
......
...@@ -387,7 +387,8 @@ class QuickFormQuery { ...@@ -387,7 +387,8 @@ class QuickFormQuery {
$formSpec = $this->eval->parseArray($form); $formSpec = $this->eval->parseArray($form);
HelperFormElement::explodeParameter($formSpec); HelperFormElement::explodeParameter($formSpec);
$formSpec = $this->setFormDefault($formSpec); $formSpec = $this->syncSystemFormConfig($formSpec);
$formSpec = $this->initForm($formSpec);
// Set F_FINAL_DELETE_FORM // Set F_FINAL_DELETE_FORM
$formSpec[F_FINAL_DELETE_FORM] = ($formSpec[F_EXTRA_DELETE_FORM] != '') ? $formSpec[F_EXTRA_DELETE_FORM] : $formSpec[F_NAME]; $formSpec[F_FINAL_DELETE_FORM] = ($formSpec[F_EXTRA_DELETE_FORM] != '') ? $formSpec[F_EXTRA_DELETE_FORM] : $formSpec[F_NAME];
...@@ -505,56 +506,62 @@ class QuickFormQuery { ...@@ -505,56 +506,62 @@ class QuickFormQuery {
} }
/** /**
* If not already defined, set various defaults on the form. * The named $keys will be synced between STORE_SYSTEM and $formSpec (both directions).
* The per form definition has precedence over STORE_SYSTEM.
* STORE_SYSTEM if filled with the default values (config.qfq.ini or if note exist than QFQ hardcoded)
* Copying the 'Form' definition back to the system store helps to access the values
* by '{{ ...:Y}}' (system store). E.g. the value of bs-*-columns might be displayed as placeholder in the
* corresponding inputfield.
* *
* @param array $formSpec * @param array $formSpec
* @return array * @return array
*/ */
private function setFormDefault(array $formSpec) { private function syncSystemFormConfig(array $formSpec) {
$keys = [F_BS_LABEL_COLUMNS,
# Set defaults: F_BS_INPUT_COLUMNS,
Support::setIfNotSet($formSpec, 'class', ''); F_BS_NOTE_COLUMNS,
F_FE_DATA_PATTERN_ERROR,
$value = $this->store->getVar(F_BS_LABEL_COLUMNS, STORE_SYSTEM); F_FE_DATA_REQUIRED_ERROR,
Support::setIfNotSet($formSpec, F_BS_LABEL_COLUMNS, $value, ''); F_FE_DATA_MATCH_ERROR,
F_FE_DATA_ERROR,
$value = $this->store->getVar(F_BS_INPUT_COLUMNS, STORE_SYSTEM); F_CLASS,
Support::setIfNotSet($formSpec, F_BS_INPUT_COLUMNS, $value, ''); F_CLASS_PILL,
F_CLASS_BODY,
$value = $this->store->getVar(F_BS_NOTE_COLUMNS, STORE_SYSTEM); ];
Support::setIfNotSet($formSpec, F_BS_NOTE_COLUMNS, $value, '');
// By definition: existing vars which are empty, means: EMPTY - do not use any default!
Support::setIfNotSet($formSpec, F_SUBMIT_BUTTON_TEXT, ''); // But: if these variables are table columns, they always exist. For those: empty value means 'not set' - unset those.
Support::setIfNotSet($formSpec, F_EXTRA_DELETE_FORM, ''); foreach ([F_BS_LABEL_COLUMNS, F_BS_INPUT_COLUMNS, F_BS_NOTE_COLUMNS] as $key) {
if ($formSpec[$key] == '') {
// Take default from config.ini unset ($formSpec[$key]);
$value = $this->store->getVar(SYSTEM_FORM_DATA_PATTERN_ERROR, STORE_SYSTEM); }
Support::setIfNotSet($formSpec, F_FE_DATA_PATTERN_ERROR, ($value !== false) ? $value : ''); }
// Take default from config.ini
$value = $this->store->getVar(SYSTEM_FORM_DATA_REQUIRED_ERROR, STORE_SYSTEM);
Support::setIfNotSet($formSpec, F_FE_DATA_REQUIRED_ERROR, ($value !== false) ? $value : '');
// Take default from config.ini foreach ($keys as $key) {
$value = $this->store->getVar(SYSTEM_FORM_DATA_MATCH_ERROR, STORE_SYSTEM);
Support::setIfNotSet($formSpec, F_FE_DATA_MATCH_ERROR, ($value !== false) ? $value : '');
// Take default from config.ini if (isset($formSpec[$key])) {
$value = $this->store->getVar(SYSTEM_FORM_DATA_ERROR, STORE_SYSTEM); $this->store->setVar($key, $formSpec[$key], STORE_SYSTEM);
Support::setIfNotSet($formSpec, F_FE_DATA_ERROR, ($value !== false) ? $value : ''); } else {
// if not found set ''
$formSpec[$key] = $this->store->getVar($key, STORE_SYSTEM . STORE_EMPTY);
}
}
// Take default from config.ini return $formSpec;
$class = $this->store->getVar(SYSTEM_CSS_CLASS_QFQ_FORM_PILL, STORE_SYSTEM); }
$class = $class ? $class : 'qfq-color-grey-1';
Support::setIfNotSet($formSpec, F_CLASS_PILL, $class);
// Take default from config.ini /**
$class = $this->store->getVar(SYSTEM_CSS_CLASS_QFQ_FORM_BODY, STORE_SYSTEM); * Set form parameter which are expected to exist.
$class = $class ? $class : 'qfq-color-grey-2'; *
Support::setIfNotSet($formSpec, F_CLASS_BODY, $class); * @param array $config
* @return array
*/
private function initForm(array $config) {
Support::setIfNotSet($config, F_EXTRA_DELETE_FORM, '');
Support::setIfNotSet($config, F_SUBMIT_BUTTON_TEXT, '');
return $formSpec; return $config;
} }
/** /**
......
...@@ -166,7 +166,7 @@ class Store { ...@@ -166,7 +166,7 @@ class Store {
} }
/** /**
* Fills the system store. * Fill the system store by reading config.qfq.ini. Also setup config defaults.
* *
* @throws CodeException * @throws CodeException
* @throws qfq\UserFormException * @throws qfq\UserFormException
...@@ -197,26 +197,14 @@ class Store { ...@@ -197,26 +197,14 @@ class Store {
Support::setIfNotSet($config, F_BS_LABEL_COLUMNS, '3'); Support::setIfNotSet($config, F_BS_LABEL_COLUMNS, '3');
Support::setIfNotSet($config, F_BS_INPUT_COLUMNS, '6'); Support::setIfNotSet($config, F_BS_INPUT_COLUMNS, '6');
Support::setIfNotSet($config, F_BS_NOTE_COLUMNS, '3'); Support::setIfNotSet($config, F_BS_NOTE_COLUMNS, '3');
Support::setIfNotSet($config, F_CLASS_PILL, 'qfq-color-grey-1');
Support::setIfNotSet($config, F_CLASS_BODY, 'qfq-color-grey-2');
// Adjust config
if ($config[SYSTEM_SHOW_DEBUG_INFO] === 'auto') {
$config[SYSTEM_SHOW_DEBUG_INFO] = (isset($GLOBALS["TSFE"]->beUserLogin) && $GLOBALS["TSFE"]->beUserLogin === true) ? 'yes' : 'no';
}
$config = self::doSystemPath($config); $config = self::doSystemPath($config);
$config = self::adjustConfig($config);
// make SQL PATH absolute. This is necessary to work in different directories correctly. self::checkMandatoryParameter($config);
if (isset($config[SYSTEM_SQL_LOG]) && $config[SYSTEM_SQL_LOG][0] !== '/') {
$config[SYSTEM_SQL_LOG] = $config[SYSTEM_PATH_EXT] . '/' . $config[SYSTEM_SQL_LOG];
}
// Check mandatory config vars.
$names = array('DB_USER', 'DB_SERVER', 'DB_PASSWORD', 'DB_NAME', 'SQL_LOG', 'SQL_LOG_MODE');
foreach ($names as $name) {
if (!isset($config[$name])) {
throw new qfq\UserFormException ("Missing configuration in `config.ini`: $name", ERROR_MISSING_CONFIG_INI_VALUE);
}
}
self::setVarArray($config, STORE_SYSTEM, true); self::setVarArray($config, STORE_SYSTEM, true);
} }
...@@ -235,6 +223,13 @@ class Store { ...@@ -235,6 +223,13 @@ class Store {
[SYSTEM_FORM_BS_LABEL_COLUMNS, F_BS_LABEL_COLUMNS], [SYSTEM_FORM_BS_LABEL_COLUMNS, F_BS_LABEL_COLUMNS],
[SYSTEM_FORM_BS_INPUT_COLUMNS, F_BS_INPUT_COLUMNS], [SYSTEM_FORM_BS_INPUT_COLUMNS, F_BS_INPUT_COLUMNS],
[SYSTEM_FORM_BS_NOTE_COLUMNS, F_BS_NOTE_COLUMNS], [SYSTEM_FORM_BS_NOTE_COLUMNS, F_BS_NOTE_COLUMNS],
[SYSTEM_FORM_DATA_PATTERN_ERROR, F_FE_DATA_PATTERN_ERROR],
[SYSTEM_FORM_DATA_REQUIRED_ERROR, F_FE_DATA_REQUIRED_ERROR],
[SYSTEM_FORM_DATA_MATCH_ERROR, F_FE_DATA_MATCH_ERROR],
[SYSTEM_FORM_DATA_ERROR, F_FE_DATA_ERROR],
[SYSTEM_CSS_CLASS_QFQ_FORM, F_CLASS],
[SYSTEM_CSS_CLASS_QFQ_FORM_PILL, F_CLASS_PILL],
[SYSTEM_CSS_CLASS_QFQ_FORM_BODY, F_CLASS_BODY],
]; ];
foreach ($setting as $row) { foreach ($setting as $row) {
...@@ -253,6 +248,7 @@ class Store { ...@@ -253,6 +248,7 @@ class Store {
} }
/** /**
* QFQ might be called via Typo3 (index.php) or directly via AJAX (directory: api). The
* @param array $config * @param array $config
* @return array * @return array
*/ */
...@@ -281,9 +277,46 @@ class Store { ...@@ -281,9 +277,46 @@ class Store {
$config[SYSTEM_PATH_EXT] = getcwd(); $config[SYSTEM_PATH_EXT] = getcwd();
} }
} }
return $config;
}
/**
* Depending on some configuration value, update corresponding values.
*
* @param array $config
* @return array
*/
private static function adjustConfig(array $config) {
// Adjust config
if ($config[SYSTEM_SHOW_DEBUG_INFO] === 'auto') {
$config[SYSTEM_SHOW_DEBUG_INFO] = (isset($GLOBALS["TSFE"]->beUserLogin) && $GLOBALS["TSFE"]->beUserLogin === true) ? 'yes' : 'no';
}
// make SQL PATH absolute. This is necessary to work in different directories correctly.
if (isset($config[SYSTEM_SQL_LOG]) && $config[SYSTEM_SQL_LOG][0] !== '/') {
$config[SYSTEM_SQL_LOG] = $config[SYSTEM_PATH_EXT] . '/' . $config[SYSTEM_SQL_LOG];
}
return $config; return $config;
} }
/**
* Iterate over all Parameter which have to exist in the config. Throw an array if any is missing.
*
* @param array $config
* @throws UserFormException
*/
private static function checkMandatoryParameter(array $config) {
// Check mandatory config vars.
$names = array('DB_USER', 'DB_SERVER', 'DB_PASSWORD', 'DB_NAME', 'SQL_LOG', 'SQL_LOG_MODE');
foreach ($names as $name) {
if (!isset($config[$name])) {
throw new qfq\UserFormException ("Missing configuration in `config.ini`: $name", ERROR_MISSING_CONFIG_INI_VALUE);
}
}
}
/** /**
* Set or overwrite a complete store. * Set or overwrite a complete store.
* *
...@@ -645,6 +678,7 @@ class Store { ...@@ -645,6 +678,7 @@ class Store {
/** /**
* Return an array with non system SIP parameter. Take the whole STORE_SIP and search for non system parameter. * Return an array with non system SIP parameter. Take the whole STORE_SIP and search for non system parameter.
*
* @return array * @return array
* @throws UserFormException * @throws UserFormException
* @throws \qfq\CodeException * @throws \qfq\CodeException
......
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