diff --git a/extension/Classes/Api/dataReport.php b/extension/Classes/Api/dataReport.php index 170f73cb459ed3c2cad945c3bf1c2759407f621b..0b81cbffae08670e113f40a06d8819144a7ba47b 100644 --- a/extension/Classes/Api/dataReport.php +++ b/extension/Classes/Api/dataReport.php @@ -10,7 +10,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\QuickFormQuery; use IMATHUZH\Qfq\Core\Store\Store; diff --git a/extension/Classes/Api/delete.php b/extension/Classes/Api/delete.php index b4183c10b7fad22547690c5afb6b3a30e683768c..c930d65dbdf72f363cc0f437eedd47287c7138b5 100644 --- a/extension/Classes/Api/delete.php +++ b/extension/Classes/Api/delete.php @@ -10,7 +10,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\QuickFormQuery; use IMATHUZH\Qfq\Core\Store\Store; diff --git a/extension/Classes/Api/dirty.php b/extension/Classes/Api/dirty.php index 26ccc82da75cd8a45a4e39a3cc937edcde33cfe6..b6c1e6e9fe7dc5f43b3a63e0c176255371443cea 100644 --- a/extension/Classes/Api/dirty.php +++ b/extension/Classes/Api/dirty.php @@ -11,7 +11,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); use IMATHUZH\Qfq\Core\Form\Dirty; -use IMATHUZH\Qfq\Core\Helper\Path; /** * Return JSON encoded answer diff --git a/extension/Classes/Api/download.php b/extension/Classes/Api/download.php index d5e88b5cf7a11d7da967a8b47c79220ef2077fd5..d248a51f408f8da0c7c04d806521996ccde0b14d 100644 --- a/extension/Classes/Api/download.php +++ b/extension/Classes/Api/download.php @@ -12,7 +12,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\Report\Download; diff --git a/extension/Classes/Api/dragAndDrop.php b/extension/Classes/Api/dragAndDrop.php index 3712afb08e5494a5ef42b51eccba241f00d1046c..ded49267606b58abb849d90303c7bb7d95e8d28d 100644 --- a/extension/Classes/Api/dragAndDrop.php +++ b/extension/Classes/Api/dragAndDrop.php @@ -10,7 +10,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\QuickFormQuery; diff --git a/extension/Classes/Api/file.php b/extension/Classes/Api/file.php index 3f0f786c16c120bdb97845d856de166674fdd6b2..c075113d1e598d9aef967689a1338e88bad7d375 100644 --- a/extension/Classes/Api/file.php +++ b/extension/Classes/Api/file.php @@ -11,7 +11,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); use IMATHUZH\Qfq\Core\File; -use IMATHUZH\Qfq\Core\Helper\Path; /** * Process File Upload - immediately when the the user selects a file. diff --git a/extension/Classes/Api/load.php b/extension/Classes/Api/load.php index 2eae0f122ca7ec3457bd84d63cb9e8ab8dbfefca..65d077a91ebbb7d490f839aac102951f2db321d9 100644 --- a/extension/Classes/Api/load.php +++ b/extension/Classes/Api/load.php @@ -10,9 +10,8 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; -use IMATHUZH\Qfq\Core\Store\Store; use IMATHUZH\Qfq\Core\QuickFormQuery; +use IMATHUZH\Qfq\Core\Store\Store; /** diff --git a/extension/Classes/Api/print.php b/extension/Classes/Api/print.php index 218af62d21e2dea8c837e22e8fac163070d6751e..6a78e22032b26de7195a2ad29139405588fa9ae5 100644 --- a/extension/Classes/Api/print.php +++ b/extension/Classes/Api/print.php @@ -11,7 +11,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\Report\Html2Pdf; use IMATHUZH\Qfq\Core\Store\Config; diff --git a/extension/Classes/Api/rest.php b/extension/Classes/Api/rest.php index 82c029af5ad7c45a5caa94be08cf750fa06b8fe8..22b1012f5efc93c5991daf924ce18f8dbabbc4e1 100644 --- a/extension/Classes/Api/rest.php +++ b/extension/Classes/Api/rest.php @@ -10,9 +10,8 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; -use IMATHUZH\Qfq\Core\QuickFormQuery; use IMATHUZH\Qfq\Core\Helper\OnString; +use IMATHUZH\Qfq\Core\QuickFormQuery; $restId = array(); $restForm = array(); diff --git a/extension/Classes/Api/save.php b/extension/Classes/Api/save.php index b97a424fb404a78303f2ec345945966c105b8230..be9e26d4880d66aa4a93d5e19f1130233ffcacc6 100644 --- a/extension/Classes/Api/save.php +++ b/extension/Classes/Api/save.php @@ -10,10 +10,9 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; +use IMATHUZH\Qfq\Core\Helper\Support; use IMATHUZH\Qfq\Core\QuickFormQuery; use IMATHUZH\Qfq\Core\Store\Store; -use IMATHUZH\Qfq\Core\Helper\Support; /** * Return JSON encoded answer diff --git a/extension/Classes/Api/setting.php b/extension/Classes/Api/setting.php index d80df0cbba4849d8ae6c28586363af686b10ab97..98282283144a93edf58be5f7147c485db2a67981 100644 --- a/extension/Classes/Api/setting.php +++ b/extension/Classes/Api/setting.php @@ -10,7 +10,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\QuickFormQuery; /** diff --git a/extension/Classes/Api/typeahead.php b/extension/Classes/Api/typeahead.php index 2a9f94f86a692172f9c2d6251e748b0b1085a28b..f94f51d945d50be4327c785a712b1e944d21cebe 100644 --- a/extension/Classes/Api/typeahead.php +++ b/extension/Classes/Api/typeahead.php @@ -12,7 +12,6 @@ namespace IMATHUZH\Qfq\Api; require_once(__DIR__ . '/../../vendor/autoload.php'); use IMATHUZH\Qfq\Core\Form\TypeAhead; -use IMATHUZH\Qfq\Core\Helper\Path; /** * Return JSON encoded answer diff --git a/extension/Classes/Controller/QfqController.php b/extension/Classes/Controller/QfqController.php index 1e57369be212701f99d4282edfd0e7a922aaf2e0..d380f2b88dd614985f85eef11e6f903bac0e0d7d 100644 --- a/extension/Classes/Controller/QfqController.php +++ b/extension/Classes/Controller/QfqController.php @@ -7,7 +7,6 @@ namespace IMATHUZH\Qfq\Controller; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\QuickFormQuery; diff --git a/extension/Classes/Core/AbstractBuildForm.php b/extension/Classes/Core/AbstractBuildForm.php index e7be03ecba8873c2b9ae818e93fdb59992be2949..772f656acbd88f752cb338fe76afa74fcdec2396 100644 --- a/extension/Classes/Core/AbstractBuildForm.php +++ b/extension/Classes/Core/AbstractBuildForm.php @@ -1489,7 +1489,7 @@ abstract class AbstractBuildForm { } } // If type password is selected then type text with own class will be taken to fake password over CSS - if($formElement[FE_TYPE] === 'password'){ + if ($formElement[FE_TYPE] === 'password') { $formElement[FE_TYPE] = 'text'; $class .= ' qfq-password'; } @@ -1499,9 +1499,9 @@ abstract class AbstractBuildForm { } // Set for password to give choice of generated password for user and not autofill password field. Deprecated, we dont use type password anymore. - // if($formElement[FE_TYPE] === 'password') { - // $attribute .= Support::doAttribute('autocomplete', 'new-password'); - // } + // if($formElement[FE_TYPE] === 'password') { + // $attribute .= Support::doAttribute('autocomplete', 'new-password'); + // } $attribute .= HelperFormElement::getAttributeList($formElement, [FE_INPUT_AUTOCOMPLETE, 'autofocus', 'placeholder']); diff --git a/extension/Classes/Core/BodytextParser.php b/extension/Classes/Core/BodytextParser.php index 982a45e412942f721d8c2b75f6a56812b66e071c..2b5394e383fdd34607fbd27b20bd20f5e90b30ef 100644 --- a/extension/Classes/Core/BodytextParser.php +++ b/extension/Classes/Core/BodytextParser.php @@ -8,7 +8,7 @@ namespace IMATHUZH\Qfq\Core; - + use IMATHUZH\Qfq\Core\Helper\Support; const NESTING_TOKEN_OPEN = '#&nesting-open-&#'; @@ -121,7 +121,7 @@ class BodytextParser { if ($firstLine[0] === '#') { $token = substr($firstLine, -1); - switch($token) { + switch ($token) { case '<': $nestingOpen = '<'; $nestingClose = '>'; diff --git a/extension/Classes/Core/BuildFormBootstrap.php b/extension/Classes/Core/BuildFormBootstrap.php index 3e45bb7b5a38740be3be3cc9a4b65b5cf35ef2e0..9ea6f1df1276d12d7a176176ef282a2b41ec022a 100644 --- a/extension/Classes/Core/BuildFormBootstrap.php +++ b/extension/Classes/Core/BuildFormBootstrap.php @@ -22,6 +22,7 @@ use IMATHUZH\Qfq\Core\Helper\Support; class BuildFormBootstrap extends AbstractBuildForm { private $isFirstPill; + /** * @param array $formSpec * @param array $feSpecAction @@ -155,7 +156,7 @@ class BuildFormBootstrap extends AbstractBuildForm { $class[] = 'qfq-form-no-title'; } } - $html .= "<div " . Support::doAttribute('class', $class) .">"; + $html .= "<div " . Support::doAttribute('class', $class) . ">"; return $html; } @@ -267,7 +268,7 @@ class BuildFormBootstrap extends AbstractBuildForm { $toolTip = "Form not 'form' or 'formElement'"; $status = 'disabled'; } else { - if($requiredNew === ''){ + if ($requiredNew === '') { $requiredNew = $this->store->getVar(F_REQUIRED_PARAMETER_NEW, STORE_RECORD . STORE_EMPTY); } if (trim($requiredNew) !== '') { @@ -648,8 +649,8 @@ class BuildFormBootstrap extends AbstractBuildForm { $submitTo = Path::urlApi(API_SAVE_PHP); $refreshUrl = Path::urlApi(API_LOAD_PHP); - $fileUploadTo = Path::urlApi(API_FILE_PHP) . '?' . $actionUpload; - $fileDeleteUrl = Path::urlApi(API_FILE_PHP) . '?' . $actionDelete; + $fileUploadTo = Path::urlApi(API_FILE_PHP) . '?' . $actionUpload; + $fileDeleteUrl = Path::urlApi(API_FILE_PHP) . '?' . $actionDelete; $html .= '</form>'; // <form class="form-horizontal" ... $html .= <<<EOF @@ -703,10 +704,6 @@ EOF; } - - - - $html .= '</div>'; // <div class="container-fluid"> === main <div class=...> around everything return $html; diff --git a/extension/Classes/Core/BuildFormPlain.php b/extension/Classes/Core/BuildFormPlain.php index a4a7232b34098ed43eb1523f61e52e5596059093..f13d9af10f932de3260212a1b7b7bb27a043b10e 100644 --- a/extension/Classes/Core/BuildFormPlain.php +++ b/extension/Classes/Core/BuildFormPlain.php @@ -9,8 +9,6 @@ namespace IMATHUZH\Qfq\Core; - - /** * Class BuildFormPlain * @package qfq diff --git a/extension/Classes/Core/BuildFormTable.php b/extension/Classes/Core/BuildFormTable.php index 770346c1f1e2ab0110da83b39f3f1e0feca5d381..fa2f738b0e0c4eac33a0dc32d7180539714a00c8 100644 --- a/extension/Classes/Core/BuildFormTable.php +++ b/extension/Classes/Core/BuildFormTable.php @@ -8,7 +8,7 @@ namespace IMATHUZH\Qfq\Core; - + use IMATHUZH\Qfq\Core\Helper\OnArray; use IMATHUZH\Qfq\Core\Helper\Support; diff --git a/extension/Classes/Core/Constants.php b/extension/Classes/Core/Constants.php index 2704ca9a9c92ab23971640b59d6a67c211723e4d..0be229fb1a21db2a4694cced5ad1a6aa34006d36 100644 --- a/extension/Classes/Core/Constants.php +++ b/extension/Classes/Core/Constants.php @@ -79,7 +79,6 @@ const NAME_TG_COPIES = '_tgCopies'; // Number of templatesGroup copies to creat const FE_TG_INDEX = '_tgIndex'; // Index of the current copy of a templateGroup FE. - // Index wrap setup table const WRAP_SETUP_TITLE = 'title'; const WRAP_SETUP_ELEMENT = 'element'; @@ -494,7 +493,7 @@ const TYPO3_PAGE_TITLE = 'pageTitle'; const TYPO3_PAGE_TYPE = 'pageType'; const TYPO3_PAGE_ABSTRACT = 'pageAbstract'; const TYPO3_PAGE_DESCRIPTION = 'pageDescription'; -const TYPO3_PAGE_KEYWORDS= 'pageKeywords'; +const TYPO3_PAGE_KEYWORDS = 'pageKeywords'; const TYPO3_PAGE_NAV_TITLE = 'pageNavTitle'; const TYPO3_PAGE_LANGUAGE = 'pageLanguage'; diff --git a/extension/Classes/Core/Database/Database.php b/extension/Classes/Core/Database/Database.php index 8dfb9dbb894bbc1c2eb47bac00a9b8b5bdccb320..21db2b20f110fdadc19f14a85ba7fb4c2c9ca92d 100644 --- a/extension/Classes/Core/Database/Database.php +++ b/extension/Classes/Core/Database/Database.php @@ -456,10 +456,10 @@ class Database { case 'CALL': $result = $this->mysqli_stmt->get_result(); $queryType = QUERY_TYPE_SELECT; - If($result === false){ + if ($result === false) { $stat[DB_NUM_ROWS] = 0; $msg = 'Read rows: ' . $stat[DB_NUM_ROWS] . '(No SELECT statement)'; - }else{ + } else { $this->mysqli_result = $result; $stat[DB_NUM_ROWS] = $this->mysqli_result->num_rows; $msg = 'Read rows: ' . $stat[DB_NUM_ROWS]; diff --git a/extension/Classes/Core/Database/DatabaseUpdate.php b/extension/Classes/Core/Database/DatabaseUpdate.php index 2a430a86c5e4adc8fdf7a1dcb7cc44f12facf5f2..a36d54bd51d269774459d47d5ec4dd88a48655f0 100644 --- a/extension/Classes/Core/Database/DatabaseUpdate.php +++ b/extension/Classes/Core/Database/DatabaseUpdate.php @@ -91,7 +91,7 @@ class DatabaseUpdate { foreach ($arr as $row) { if (isset($row['Comment'])) { parse_str($row['Comment'], $arr); - if (($arr[QFQ_VERSION_KEY] ?? '') !== '' AND (version_compare($arr[QFQ_VERSION_KEY], $found) == 1)) { + if (($arr[QFQ_VERSION_KEY] ?? '') !== '' && (version_compare($arr[QFQ_VERSION_KEY], $found) == 1)) { $found = $arr; } } else { @@ -212,7 +212,7 @@ class DatabaseUpdate { */ private function checkT3QfqConfig($old, $new) { - if ($new == $old || $old===false ) { + if ($new == $old || $old === false) { return; } @@ -406,7 +406,7 @@ class DatabaseUpdate { $qfqFunctionSqlRelToApp = Path::appToExt('Classes/Sql/' . QFQ_FUNCTION_SQL); - if ($functionHash !== null AND $functionsHashTest === $functionHash) { + if ($functionHash !== null && $functionsHashTest === $functionHash) { return $functionHash; } else { $errorMsg[ERROR_MESSAGE_TO_USER] = 'Error while updating qfq.'; diff --git a/extension/Classes/Core/Delete.php b/extension/Classes/Core/Delete.php index 81f5c2a674eb1979514b52b074e4fe967ed17c36..503d2c79f19409b7ae2176ce9049d229f0607939 100644 --- a/extension/Classes/Core/Delete.php +++ b/extension/Classes/Core/Delete.php @@ -9,10 +9,9 @@ namespace IMATHUZH\Qfq\Core; use IMATHUZH\Qfq\Core\Database\Database; +use IMATHUZH\Qfq\Core\Helper\HelperFile; use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\Store\Store; - -use IMATHUZH\Qfq\Core\Helper\HelperFile; /** @@ -114,7 +113,7 @@ class Delete { */ private function deleteReferencedFiles(array $row, $tableName, $primaryKey) { - foreach ($row AS $key => $file) { + foreach ($row as $key => $file) { if (false === strpos($key, COLUMN_PATH_FILE_NAME)) { continue; diff --git a/extension/Classes/Core/Exception/AbstractException.php b/extension/Classes/Core/Exception/AbstractException.php index 4d4d26ffacb02f587658ce2f99bd5e407f0a8260..cbc65d02feb4e99b39786ef92fa5197bc61337db 100644 --- a/extension/Classes/Core/Exception/AbstractException.php +++ b/extension/Classes/Core/Exception/AbstractException.php @@ -176,7 +176,7 @@ class AbstractException extends \Exception { $arrMerged[ERROR_MESSAGE_TO_DEVELOPER] = QuickFormQuery::buildInlineReport(\UserReportException::$report_uid, \UserReportException::$report_pathFileName, \UserReportException::$report_bodytext, \UserReportException::$report_header) . $arrMerged[ERROR_MESSAGE_TO_DEVELOPER]; - } catch (\Error | \Exception $e) { + } catch (\Error|\Exception $e) { $arrMerged[ERROR_MESSAGE_TO_DEVELOPER] .= "<br>(inline report editor not available)"; } diff --git a/extension/Classes/Core/Exception/CodeException.php b/extension/Classes/Core/Exception/CodeException.php index 1a5e8b1ce826395d445da4e13bc8f62293c6181b..cfd8be8c1f0ce443fe5909d9829a6bfc33687b9a 100644 --- a/extension/Classes/Core/Exception/CodeException.php +++ b/extension/Classes/Core/Exception/CodeException.php @@ -19,10 +19,10 @@ use IMATHUZH\Qfq\Core\Exception\AbstractException; * * Throw with message for User and message for Support. * - throw new \UserFormException( json_encode( - [ERROR_MESSAGE_TO_USER => 'Failed: chmod', - ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]), - ERROR_IO_CHMOD); + * throw new \UserFormException( json_encode( + * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', + * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]), + * ERROR_IO_CHMOD); * * @package Exception */ diff --git a/extension/Classes/Core/Exception/DbException.php b/extension/Classes/Core/Exception/DbException.php index f31143c2f6ad95b19770a4f2a431f5273a566443..9ee26dec9f50df5b6515a4db06084356f6fe9d63 100644 --- a/extension/Classes/Core/Exception/DbException.php +++ b/extension/Classes/Core/Exception/DbException.php @@ -37,12 +37,12 @@ class DbException extends AbstractException { * [ERROR_MESSAGE_SUPPORT] 'support' - help for the developer * [ERROR_MESSAGE_OS] 'os' - message from the OS, like 'file not found' * - throw new \UserFormException( json_encode( - [ERROR_MESSAGE_TO_USER => 'Failed: chmod', - ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", - ERROR_MESSAGE_OS => 'os' - message from the OS, like 'file not found' - ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), - ERROR_IO_CHMOD); + * throw new \UserFormException( json_encode( + * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', + * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", + * ERROR_MESSAGE_OS => 'os' - message from the OS, like 'file not found' + * ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), + * ERROR_IO_CHMOD); * * @return string HTML formatted error string * @return string diff --git a/extension/Classes/Core/Exception/DownloadException.php b/extension/Classes/Core/Exception/DownloadException.php index 39fa2f9a6d97dd88127458933cfd8f8a9907057d..e1259906566e2104970c6bbabbce05056990eeeb 100644 --- a/extension/Classes/Core/Exception/DownloadException.php +++ b/extension/Classes/Core/Exception/DownloadException.php @@ -20,11 +20,11 @@ use IMATHUZH\Qfq\Core\Exception\AbstractException; * * Throw with message for User and message for Support. * - throw new \UserFormException( json_encode( - [ERROR_MESSAGE_TO_USER => 'Failed: chmod', - ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", - ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), - ERROR_IO_CHMOD); + * throw new \UserFormException( json_encode( + * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', + * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", + * ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), + * ERROR_IO_CHMOD); * * @package Exception */ diff --git a/extension/Classes/Core/Exception/ErrorHandler.php b/extension/Classes/Core/Exception/ErrorHandler.php index 3c33e1536cdb52c479ec2236c8d46a2996cd9305..f75310877b4d8c6abe8fa7314b8610fd580d80d5 100644 --- a/extension/Classes/Core/Exception/ErrorHandler.php +++ b/extension/Classes/Core/Exception/ErrorHandler.php @@ -35,7 +35,7 @@ class ErrorHandler { } $store = Store::getInstance(); - if($store->getVar(SYSTEM_THROW_GENERAL_ERROR, STORE_SYSTEM) == 'yes'){ + if ($store->getVar(SYSTEM_THROW_GENERAL_ERROR, STORE_SYSTEM) == 'yes') { // 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. diff --git a/extension/Classes/Core/Exception/ShellException.php b/extension/Classes/Core/Exception/ShellException.php index 9a370419ca32ea543875c14c84d8e958e75cc8ee..e8d19f8838329b5eda45321d70da8989c2a2f5a2 100644 --- a/extension/Classes/Core/Exception/ShellException.php +++ b/extension/Classes/Core/Exception/ShellException.php @@ -20,11 +20,11 @@ use IMATHUZH\Qfq\Core\Exception\AbstractException; * * Throw with message for User and message for Support. * - throw new \UserFormException( json_encode( - [ERROR_MESSAGE_TO_USER => 'Failed: chmod', - ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", - ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), - ERROR_IO_CHMOD); + * throw new \UserFormException( json_encode( + * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', + * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", + * ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), + * ERROR_IO_CHMOD); * * @package Exception */ diff --git a/extension/Classes/Core/Exception/Thrower.php b/extension/Classes/Core/Exception/Thrower.php index 7e7a3e7c6cf7884e40afb816e9a36d936fd6b160..d3a30d46f0d5d1df44aecf8524a693185ceebe6b 100644 --- a/extension/Classes/Core/Exception/Thrower.php +++ b/extension/Classes/Core/Exception/Thrower.php @@ -2,8 +2,7 @@ namespace IMATHUZH\Qfq\Core\Exception; -class Thrower -{ +class Thrower { /** * Throws UserFormException with given messages to user and developer. * diff --git a/extension/Classes/Core/Exception/UserFormException.php b/extension/Classes/Core/Exception/UserFormException.php index 9f72faf6c19a1a105aa933e48cf272b8459e9c47..05ca817c825e7ec16c5262022cfa9cb40826c747 100644 --- a/extension/Classes/Core/Exception/UserFormException.php +++ b/extension/Classes/Core/Exception/UserFormException.php @@ -20,11 +20,11 @@ use IMATHUZH\Qfq\Core\Store\Store; * * Throw with message for User and message for Support. * - * throw new \UserFormException( json_encode( - * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', - * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", - * ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), - * ERROR_IO_CHMOD); + * throw new \UserFormException( json_encode( + * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', + * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", + * ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), + * ERROR_IO_CHMOD); * * Call * diff --git a/extension/Classes/Core/Exception/UserReportException.php b/extension/Classes/Core/Exception/UserReportException.php index 6c3aab299080a6a94a0a78ffdc29a976095d75de..3af3d7c20d0a8c226dd2b7ad84498f6a6ff4337e 100644 --- a/extension/Classes/Core/Exception/UserReportException.php +++ b/extension/Classes/Core/Exception/UserReportException.php @@ -20,11 +20,11 @@ use IMATHUZH\Qfq\Core\Store\Store; * * Throw with message for User and message for Support. * - * throw new \UserFormException( json_encode( - * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', - * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", - * ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), - * ERROR_IO_CHMOD); + * throw new \UserFormException( json_encode( + * [ERROR_MESSAGE_TO_USER => 'Failed: chmod', + * ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'", + * ERROR_MESSAGE_HTTP_STATUS => 'HTTP/1.0 409 Bad Request' ]), + * ERROR_IO_CHMOD); * * @package Exception */ diff --git a/extension/Classes/Core/Form/FormAsFile.php b/extension/Classes/Core/Form/FormAsFile.php index af9fbad5b46f9a83ee505a156c45dcc9f4f5cff3..c0f946d88de90a275306f4f8b1ec195538ebfcd3 100644 --- a/extension/Classes/Core/Form/FormAsFile.php +++ b/extension/Classes/Core/Form/FormAsFile.php @@ -124,8 +124,7 @@ class FormAsFile { * @throws \DbException * @throws \UserFormException */ - public static function jsonToDatabase(string $formName, string $formRawJson, Database $database, string $absoluteFormFilePath = null, string $fileStatsNew = null) - { + public static function jsonToDatabase(string $formName, string $formRawJson, Database $database, string $absoluteFormFilePath = null, string $fileStatsNew = null) { $formFromJson = json_decode($formRawJson, true); if (json_last_error() !== JSON_ERROR_NONE) { Thrower::userFormException('Error during form import.', 'Json encode error: ' . json_last_error_msg()); @@ -511,8 +510,7 @@ class FormAsFile { * @throws \DbException * @throws \UserFormException */ - public static function renderColumnFormJson($columnValue, $database): string - { + public static function renderColumnFormJson($columnValue, $database): string { // Parse arguments $param = KeyValueStringParser::parse($columnValue, PARAM_TOKEN_DELIMITER, PARAM_DELIMITER); foreach ($param as $key => $value) { @@ -724,8 +722,7 @@ class FormAsFile { ERROR_IO_WRITE_FILE); } - if (FEATURE_FORM_FILE_SYNC) - { + if (FEATURE_FORM_FILE_SYNC) { // export all forms self::exportAllForms($database); } @@ -921,8 +918,7 @@ class FormAsFile { * @throws \DbException * @throws \UserFormException */ - private static function getColumnDefaults(string $tableName, Database $database): array - { + private static function getColumnDefaults(string $tableName, Database $database): array { $tableDefinition = $database->getTableDefinition($tableName); return array_reduce($tableDefinition, function ($result, $column) { $result[$column['Field']] = ($column['Default'] ?? ''); @@ -944,8 +940,7 @@ class FormAsFile { * @throws \DbException * @throws \UserFormException */ - private static function filterNonDefaultColumns(array $row, string $tableName, Database $database): array - { + private static function filterNonDefaultColumns(array $row, string $tableName, Database $database): array { static $cache = []; if (!key_exists($tableName, $cache)) { $cache[$tableName] = self::getColumnDefaults($tableName, $database); diff --git a/extension/Classes/Core/Form/TypeAhead.php b/extension/Classes/Core/Form/TypeAhead.php index 9cb408106a8d6e75448dfe077d02f2a6b854592f..afec74b071e3ae3f0c2be5f128693f79fd70642b 100644 --- a/extension/Classes/Core/Form/TypeAhead.php +++ b/extension/Classes/Core/Form/TypeAhead.php @@ -8,11 +8,11 @@ namespace IMATHUZH\Qfq\Core\Form; - -use IMATHUZH\Qfq\Core\Store\Sip; -use IMATHUZH\Qfq\Core\Store\Session; -use IMATHUZH\Qfq\Core\Helper\Ldap; + use IMATHUZH\Qfq\Core\Database\Database; +use IMATHUZH\Qfq\Core\Helper\Ldap; +use IMATHUZH\Qfq\Core\Store\Session; +use IMATHUZH\Qfq\Core\Store\Sip; /** @@ -80,7 +80,7 @@ class TypeAhead { $this->db = new Database($dbIndex); if (isset($sipVars[FE_TYPEAHEAD_SQL])) { - if($this->vars[TYPEAHEAD_API_PREFETCH] == '') { + if ($this->vars[TYPEAHEAD_API_PREFETCH] == '') { $arr = $this->typeAheadSql($sipVars, $this->vars[TYPEAHEAD_API_QUERY]); } else { $arr = $this->typeAheadSqlPrefetch($sipVars, $this->vars[TYPEAHEAD_API_PREFETCH], $this->db); @@ -179,10 +179,10 @@ class TypeAhead { // return first result as key-value pair (concatenate columns) $value = ''; - foreach($arr[0] AS $name => $column) { + foreach ($arr[0] as $name => $column) { $value .= $column; } - return [ [ API_TYPEAHEAD_KEY => $key, API_TYPEAHEAD_VALUE => $value ] ]; + return [[API_TYPEAHEAD_KEY => $key, API_TYPEAHEAD_VALUE => $value]]; } } \ No newline at end of file diff --git a/extension/Classes/Core/Helper/DownloadPage.php b/extension/Classes/Core/Helper/DownloadPage.php index 122fcd4e70e277dcb29737048d0bd964b72ec347..3ad821c31bb963709331c127bdbc5f6658cf9f4b 100644 --- a/extension/Classes/Core/Helper/DownloadPage.php +++ b/extension/Classes/Core/Helper/DownloadPage.php @@ -64,7 +64,7 @@ class DownloadPage { 'header' => "Accept-language: en\r\n" . "Cookie: " . SESSION_NAME . "=" . $_COOKIE[SESSION_NAME] . "\r\n", ); - $ctx['http'] = array_merge($ctx['http'],$cookie_http); + $ctx['http'] = array_merge($ctx['http'], $cookie_http); } // The current session needs to be closed, cause the SESSION needs to be opened again by processing get_file_contents() diff --git a/extension/Classes/Core/Helper/HelperFile.php b/extension/Classes/Core/Helper/HelperFile.php index 82cead6be1e3d38c4e66f9d236accf5126c8ad08..2b3b18451fb3cb6e36dfdddd0bc4c438d54c10ad 100644 --- a/extension/Classes/Core/Helper/HelperFile.php +++ b/extension/Classes/Core/Helper/HelperFile.php @@ -566,7 +566,7 @@ class HelperFile { $errorMessage = ''; try { $success = mkdir($path, 0777, true); - } catch (\Error | \Exception $e) { + } catch (\Error|\Exception $e) { $errorMessage = 'Reason: ' . $e->getMessage(); $success = false; } diff --git a/extension/Classes/Core/Helper/Ldap.php b/extension/Classes/Core/Helper/Ldap.php index f690b5e6d2b1d285c88190590db449fae8239660..30adc224ea52c29ecdf857516597574fcb737f55 100644 --- a/extension/Classes/Core/Helper/Ldap.php +++ b/extension/Classes/Core/Helper/Ldap.php @@ -8,8 +8,6 @@ namespace IMATHUZH\Qfq\Core\Helper; - - /** * Class Ldap @@ -20,7 +18,7 @@ class Ldap { /** * */ - public function __construct() { + public function __construct() { // This handler is necessary to catch 'ldap_bind()' errors. set_error_handler("\\IMATHUZH\\Qfq\\Core\\Exception\\ErrorHandler::exception_error_handler"); @@ -142,7 +140,7 @@ class Ldap { } $searchString = ''; - foreach ($tokenArr AS $word) { + foreach ($tokenArr as $word) { $searchString .= str_replace(TYPEAHEAD_PLACEHOLDER, $word, $ldapSearch); } diff --git a/extension/Classes/Core/Helper/Logger.php b/extension/Classes/Core/Helper/Logger.php index 723ea9793d85a2d31cc7effa19b525cac55d3c3a..60e9ab8451a3375db0fe0d2e9bfc017acb86acb2 100644 --- a/extension/Classes/Core/Helper/Logger.php +++ b/extension/Classes/Core/Helper/Logger.php @@ -8,7 +8,6 @@ namespace IMATHUZH\Qfq\Core\Helper; - /** * Class Logger @@ -112,7 +111,7 @@ class Logger { */ public static function formatFormElementName(array $fe) { - return ($fe['id']??'') . ' / ' . ($fe[FE_NAME]??'') . ' / ' . ($fe[FE_LABEL]??''); + return ($fe['id'] ?? '') . ' / ' . ($fe[FE_NAME] ?? '') . ' / ' . ($fe[FE_LABEL] ?? ''); } /** diff --git a/extension/Classes/Core/Helper/OnArray.php b/extension/Classes/Core/Helper/OnArray.php index cf306bf85caabd58e65733cb954d879dcaf77f3a..07e5e30eebd4e25ac64a9ab4143fe86bfb7a78a3 100644 --- a/extension/Classes/Core/Helper/OnArray.php +++ b/extension/Classes/Core/Helper/OnArray.php @@ -391,7 +391,7 @@ class OnArray { public static function arrayValueReplace(array $src, $search, $replace) { $new = array(); - foreach ($src AS $key => $element) { + foreach ($src as $key => $element) { $new[$key] = str_replace($search, $replace, $element); } @@ -458,9 +458,10 @@ class OnArray { * @param array $array * @return array */ - public static function keysNotSet(array $keys, array $array) - { - return array_filter($keys, function($key) use ($array) {return !isset($array[$key]);}); + public static function keysNotSet(array $keys, array $array) { + return array_filter($keys, function ($key) use ($array) { + return !isset($array[$key]); + }); } /** diff --git a/extension/Classes/Core/Helper/SessionCookie.php b/extension/Classes/Core/Helper/SessionCookie.php index 0c7fe559ba9193efa978710a130bcea3e00bed7a..4c40e2b12137e11a8a1b864a92f200a6979ee655 100644 --- a/extension/Classes/Core/Helper/SessionCookie.php +++ b/extension/Classes/Core/Helper/SessionCookie.php @@ -75,9 +75,9 @@ class SessionCookie { $this->arrQfqPdfCookie[] = "name:$key,value:$value"; } $linesForWkhtml = ''; - for($i = 0; $i < count($wkhtml); $i++){ - $linesForWkhtml .= $wkhtml[$i]['name'] . "=".$wkhtml[$i]['value']. "; domain=".$wkhtml[$i]['url']."; "."path=".$wkhtml[$i]['path'].";"; - if($i+1 < count($wkhtml)){ + for ($i = 0; $i < count($wkhtml); $i++) { + $linesForWkhtml .= $wkhtml[$i]['name'] . "=" . $wkhtml[$i]['value'] . "; domain=" . $wkhtml[$i]['url'] . "; " . "path=" . $wkhtml[$i]['path'] . ";"; + if ($i + 1 < count($wkhtml)) { $linesForWkhtml .= "\n"; } } diff --git a/extension/Classes/Core/Helper/SqlQuery.php b/extension/Classes/Core/Helper/SqlQuery.php index 4bf6920ab5623e8ab824f39197efa9292f72230e..3345b6647718dc8559a1b57883746972a3eec5ea 100644 --- a/extension/Classes/Core/Helper/SqlQuery.php +++ b/extension/Classes/Core/Helper/SqlQuery.php @@ -20,8 +20,7 @@ class SqlQuery { * @return array|int * @throws \CodeException */ - public static function updateRecord(string $tableName, array $values, int $recordId, string $primaryKey = F_PRIMARY_KEY_DEFAULT) - { + public static function updateRecord(string $tableName, array $values, int $recordId, string $primaryKey = F_PRIMARY_KEY_DEFAULT) { if (count($values) === 0) throw new \CodeException('No columns given to update - this should not happen.', ERROR_CODE_SHOULD_NOT_HAPPEN); if ($recordId === 0) { @@ -45,8 +44,7 @@ class SqlQuery { * @return array * @throws \CodeException */ - public static function insertRecord($tableName, array $values): array - { + public static function insertRecord($tableName, array $values): array { if (count($values) === 0) { $sql = "INSERT INTO `$tableName` VALUES ()"; return array($sql, []); @@ -64,8 +62,7 @@ class SqlQuery { * @param array|null $columnsToSelect * @return array */ - public static function selectFormByName(string $formName, array $columnsToSelect = null): array - { + public static function selectFormByName(string $formName, array $columnsToSelect = null): array { $NAME = F_NAME; // can't use constants in strings directly $FORM = TABLE_NAME_FORM; $DELETED = F_DELETED; @@ -78,8 +75,7 @@ class SqlQuery { * @param array|null $columnsToSelect * @return array */ - public static function selectFormById(int $fId, array $columnsToSelect = null): array - { + public static function selectFormById(int $fId, array $columnsToSelect = null): array { $FORM = TABLE_NAME_FORM; // can't use constants in strings directly $ID = F_ID; $DELETED = F_DELETED; @@ -92,8 +88,7 @@ class SqlQuery { * @param array|null $columnsToSelect * @return array */ - public static function selectFormElementById(int $feId, array $columnsToSelect = null): array - { + public static function selectFormElementById(int $feId, array $columnsToSelect = null): array { $FORM_ELEMENT = TABLE_NAME_FORM_ELEMENT; // can't use constants in strings directly $FORM_ID = FE_FORM_ID; $ORD = FE_ORD; @@ -107,8 +102,7 @@ class SqlQuery { * @param array|null $columnsToSelect * @return array */ - public static function selectInformationSchemaByTableName(string $tableName, array $columnsToSelect = null): array - { + public static function selectInformationSchemaByTableName(string $tableName, array $columnsToSelect = null): array { $sql = "SELECT" . self::columnListSelect($columnsToSelect) . "FROM information_schema.tables WHERE `table_name` = '$tableName' LIMIT 1;"; return array($sql, [$tableName]); } diff --git a/extension/Classes/Core/Helper/Support.php b/extension/Classes/Core/Helper/Support.php index 88f25266a15611415142118887587a640995bb8b..dd11a61392f7af8e0f56a15d3d531442eb0fe5bd 100644 --- a/extension/Classes/Core/Helper/Support.php +++ b/extension/Classes/Core/Helper/Support.php @@ -1526,7 +1526,7 @@ class Support { * Executes the Command in $cmd * RC: if RC==0 Returns Output, else 'RC - Output' * - * @param string $cmd : command to start + * @param string $cmd : command to start * * @param int $rc * @return string The content that is displayed on the website diff --git a/extension/Classes/Core/Report/ColumnScript.php b/extension/Classes/Core/Report/ColumnScript.php index dbb2e4156ddd58365be495a3b83f3741a059fdc2..46d20f93331990e4e7924261ecfc8ae48d3a29aa 100644 --- a/extension/Classes/Core/Report/ColumnScript.php +++ b/extension/Classes/Core/Report/ColumnScript.php @@ -59,12 +59,11 @@ class ColumnScript { ob_start(); $success = include_once $absoluteScriptPath; ob_end_clean(); - if($success === false) - { + if ($success === false) { // this will be caught bellow throw new \Exception('Include failed.'); } - } catch (\Exception | \Error $e) { + } catch (\Exception|\Error $e) { Thrower::userReportException('Error during reading script file.', "Error message:\n" . $e->getMessage()); } @@ -76,15 +75,17 @@ class ColumnScript { try { $return = call_user_func_array($param[TOKEN_FUNCTION_CALL], [$param, new ScriptFunctions()]); $output = ob_get_clean(); - } catch (\Exception | \Error $e) { + } catch (\Exception|\Error $e) { ob_end_clean(); Thrower::userReportException('Function execution failed.', - "Error message:\n" . $e->getMessage() . "\n\nFunction: " . $param[TOKEN_FUNCTION_CALL] . "\n\nParameters:\n" . print_r($param,true)); + "Error message:\n" . $e->getMessage() . "\n\nFunction: " . $param[TOKEN_FUNCTION_CALL] . "\n\nParameters:\n" . print_r($param, true)); } // return buffer output and fill store if (is_array($return)) { - $returnNoArrays = array_filter($return, function ($value) {return !is_array($value);}); + $returnNoArrays = array_filter($return, function ($value) { + return !is_array($value); + }); Store::appendToStore($returnNoArrays, STORE_VAR); } return $output; @@ -105,9 +106,10 @@ class ScriptFunctions { return [$http_code, $answer]; } + public static function getVar($key, $useStores = STORE_USE_DEFAULT, $sanitizeClass = '', &$foundInStore = '', $typeMessageViolate = SANITIZE_TYPE_MESSAGE_VIOLATE_CLASS) { return Store::getInstance()->getVar($key, $useStores, $sanitizeClass, $foundInStore, - $typeMessageViolate); + $typeMessageViolate); } } \ No newline at end of file diff --git a/extension/Classes/Core/Report/Download.php b/extension/Classes/Core/Report/Download.php index 6eca992c2eb52ed9ce2cbb929ccaae636468fde0..ad78dec5552b67e5fb65c8828cb3521e8b2e458d 100644 --- a/extension/Classes/Core/Report/Download.php +++ b/extension/Classes/Core/Report/Download.php @@ -690,7 +690,7 @@ class Download { break; default: - throw new \DownloadException("Unknown downloadMode: $downloadMode", ERROR_UNKNOWN_MODE); + throw new \DownloadException("Unknown download mode: $downloadMode", ERROR_UNKNOWN_MODE); break; } diff --git a/extension/Classes/Core/Report/Excel.php b/extension/Classes/Core/Report/Excel.php index 3130a08651836bc904a414b960ba81427e4c42d8..8d357d4ba75dfa3ffba17a86227902e67d783fbd 100644 --- a/extension/Classes/Core/Report/Excel.php +++ b/extension/Classes/Core/Report/Excel.php @@ -11,10 +11,9 @@ namespace IMATHUZH\Qfq\Core\Report; use IMATHUZH\Qfq\Core\Helper\HelperFile; - +use IMATHUZH\Qfq\Core\Helper\OnString; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use IMATHUZH\Qfq\Core\Helper\OnString; const COLUMN = 0; const ROW = 1; @@ -97,8 +96,8 @@ class Excel { } $token = explode('=', $line, 2); - $key = trim($token[0]??''); - $value = trim($token[1]??''); + $key = trim($token[0] ?? ''); + $value = trim($token[1] ?? ''); switch ($key) { case EXCEL_WORKSHEET: @@ -132,15 +131,15 @@ class Excel { case EXCEL_NULL: case EXCEL_INLINE: case EXCEL_ERROR: - if($key==EXCEL_BASE64){ - $value=base64_decode($value); - $key=EXCEL_STRING; + if ($key == EXCEL_BASE64) { + $value = base64_decode($value); + $key = EXCEL_STRING; } // if type numeric is not a number replace wit '' or 'not a number' - if($key === EXCEL_NUMERIC && !is_numeric($value)) { + if ($key === EXCEL_NUMERIC && !is_numeric($value)) { $value = (ctype_space($value) || $value === '') ? '' : 'not a number'; - $key=EXCEL_STRING; + $key = EXCEL_STRING; } $spreadsheet->getActiveSheet() diff --git a/extension/Classes/Core/Report/Html2Pdf.php b/extension/Classes/Core/Report/Html2Pdf.php index f7380f7a96b0454861c070a754cd2432a931df6a..3def6e94f2f3bbb12db9bacaba97c749f1b11524 100644 --- a/extension/Classes/Core/Report/Html2Pdf.php +++ b/extension/Classes/Core/Report/Html2Pdf.php @@ -195,7 +195,7 @@ class Html2Pdf { $cmd = $this->config[SYSTEM_CMD_QFQPDF] . " $urlPrint $filenameEscape $customHeader $cookieOptions $options"; break; default: - throw new \exception("Unknown Download mode: $downloadMode", ERROR_UNKNOWN_MODE); + throw new \exception("Unknown download mode: $downloadMode", ERROR_UNKNOWN_MODE); } if ($this->logFilePathAbsolute != '') { diff --git a/extension/Classes/Core/Report/Link.php b/extension/Classes/Core/Report/Link.php index 58cf3e10030da924c6f3d63f5f1491b16a9fda38..f7085404819da19b0b3b703a031ab444c3d81207 100644 --- a/extension/Classes/Core/Report/Link.php +++ b/extension/Classes/Core/Report/Link.php @@ -1756,10 +1756,10 @@ EOF; // Depending on 'text' or 'file' different JS class are necessary. // onClick="new QfqNS.Clipboard({text: 'test clipboard'});"> // onmousedown="new QfqNS.Clipboard({uri: 'mockData/downloadResponse.json'});"> - $copyFeedback = ''; + $copyFeedback = ''; // Needed JS code for changing copyToClipboard button after clicking - if($jsAction === 'onClick') { + if ($jsAction === 'onClick') { $copyFeedback = 'let btn = $(this); let btnIcon = $(this).find("span"); btnIcon.fadeOut(400); btnIcon.removeClass("glyphicon-copy").addClass("glyphicon-ok"); this.style.borderColor = "green"; btnIcon.fadeIn(400); var delayInMilliseconds = 3000; setTimeout(function() { btnIcon.removeClass("glyphicon-ok").addClass("glyphicon-copy"); btn.css("border-color", "");},delayInMilliseconds);'; } diff --git a/extension/Classes/Core/Report/Monitor.php b/extension/Classes/Core/Report/Monitor.php index cf450b9132603f4dd4401eaa204f6b887b4ef1c1..4be9d098659ad1e5f152782ac63477f787b1e85c 100644 --- a/extension/Classes/Core/Report/Monitor.php +++ b/extension/Classes/Core/Report/Monitor.php @@ -10,11 +10,11 @@ namespace IMATHUZH\Qfq\Core\Report; - + use IMATHUZH\Qfq\Core\Helper\Path; +use IMATHUZH\Qfq\Core\Helper\Support; use IMATHUZH\Qfq\Core\Store\Session; use IMATHUZH\Qfq\Core\Store\Store; -use IMATHUZH\Qfq\Core\Helper\Support; /** * Class Thumbnail @@ -147,7 +147,7 @@ EOF; * @param $sip * @return string */ - private function getSeekSessionKey($sip){ + private function getSeekSessionKey($sip) { return MONITOR_SESSION_FILE_SEEK . '-' . $sip; } @@ -173,16 +173,16 @@ EOF; /** * Slightly modified version of http://www.geekality.net/2011/05/28/php-tail-tackling-large-files/ - * @author Torleif Berger, Lorenzo Stanco - * @link http://stackoverflow.com/a/15025877/995958 - * @license http://creativecommons.org/licenses/by/3.0/ - * * @param string $filepath * @param int $lines * @param bool $adaptive * @param null $f * @return string * @throws \DownloadException + * @author Torleif Berger, Lorenzo Stanco + * @link http://stackoverflow.com/a/15025877/995958 + * @license http://creativecommons.org/licenses/by/3.0/ + * */ private function tailCustom($filepath, $lines = 1, $adaptive = true, $f = null) { diff --git a/extension/Classes/Core/Report/Report.php b/extension/Classes/Core/Report/Report.php index 0800cbfa470d3770c677cecee4d3f8b8c6f8859a..aef51ed5f471c3d152393bc6606c70e2fb7f43ce 100644 --- a/extension/Classes/Core/Report/Report.php +++ b/extension/Classes/Core/Report/Report.php @@ -330,7 +330,7 @@ class Report { } // set defaults - if ($frCmd === TOKEN_SQL || $frCmd === TOKEN_FUNCTION ) { + if ($frCmd === TOKEN_SQL || $frCmd === TOKEN_FUNCTION) { $arr = explode('|', TOKEN_VALID_LIST); foreach ($arr as $key) { if (!isset($this->frArray[$level . "." . $key])) { diff --git a/extension/Classes/Core/Report/ReportAsFile.php b/extension/Classes/Core/Report/ReportAsFile.php index 8364ba2fcb43c49be7e54f0ae4ce22e3a1e52c12..649759acd0ac111c7177a3f11eba3a141b374788 100644 --- a/extension/Classes/Core/Report/ReportAsFile.php +++ b/extension/Classes/Core/Report/ReportAsFile.php @@ -5,13 +5,11 @@ namespace IMATHUZH\Qfq\Core\Report; use IMATHUZH\Qfq\Core\Database\Database; use IMATHUZH\Qfq\Core\Exception\Thrower; use IMATHUZH\Qfq\Core\Helper\HelperFile; -use IMATHUZH\Qfq\Core\Helper\OnString; use IMATHUZH\Qfq\Core\Helper\Path; use IMATHUZH\Qfq\Core\Helper\Sanitize; use IMATHUZH\Qfq\Core\Store\Store; -class ReportAsFile -{ +class ReportAsFile { /** * Finds the keyword file=<pathFileName> and returns pathFileName of report. * If the given path starts with an underscore and a system report with the given path exists, then the path of the system file is returned instead. @@ -25,10 +23,10 @@ class ReportAsFile { if (preg_match('/^\s*' . TOKEN_REPORT_FILE . '\s*=\s*([^\s]*)/m', $bodyText, $matches)) { $providedPathFileName = $matches[1]; - if(isset($providedPathFileName[0]) && $providedPathFileName[0] === '_') { + if (isset($providedPathFileName[0]) && $providedPathFileName[0] === '_') { $pathFileNameSystem = Path::absoluteExt(Path::EXT_TO_REPORT_SYSTEM, substr($providedPathFileName, 1) . REPORT_FILE_EXTENSION); - if(HelperFile::isReadableException($pathFileNameSystem)) { + if (HelperFile::isReadableException($pathFileNameSystem)) { return $pathFileNameSystem; } } @@ -45,8 +43,7 @@ class ReportAsFile * @return string|null * @throws \UserReportException */ - public static function read_report_file(string $reportPathFileNameFull): string - { + public static function read_report_file(string $reportPathFileNameFull): string { $fileContents = file_get_contents($reportPathFileNameFull); if ($fileContents === false) { throw new \UserReportException(json_encode([ @@ -72,8 +69,7 @@ class ReportAsFile * @throws \UserFormException * @throws \UserReportException */ - public static function create_file_from_ttContent(int $uid, Database $databaseT3): string - { + public static function create_file_from_ttContent(int $uid, Database $databaseT3): string { // Select tt_content $dbT3 = Store::getInstance()->getVar(SYSTEM_DB_NAME_T3, STORE_SYSTEM); $sql = "SELECT `bodytext`, `header`, `pid` FROM `$dbT3`.`tt_content` WHERE `uid` = ?"; @@ -189,10 +185,8 @@ class ReportAsFile * @param string $absoluteReportFilePath * @throws \UserFormException */ - private static function backupReportFile(string $absoluteReportFilePath) - { - if (file_exists($absoluteReportFilePath)) - { + private static function backupReportFile(string $absoluteReportFilePath) { + if (file_exists($absoluteReportFilePath)) { if (!is_readable($absoluteReportFilePath)) { Thrower::userFormException('Error while trying to backup report file.', "Report file is not readable: $absoluteReportFilePath"); } @@ -214,8 +208,7 @@ class ReportAsFile * @return string * @throws \UserFormException */ - private static function newBackupPathFileName(string $absoluteReportFilePath): string - { + private static function newBackupPathFileName(string $absoluteReportFilePath): string { // create backup path if not exists $absoluteBackupPath = Path::join(dirname($absoluteReportFilePath), Path::REPORT_FILE_TO_BACKUP); if (!is_dir($absoluteBackupPath)) { @@ -231,7 +224,7 @@ class ReportAsFile $index = 1; while (file_exists($absoluteBackupFilePath)) { $absoluteBackupFilePath = Path::join($absoluteBackupPath, basename($absoluteReportFilePath, REPORT_FILE_EXTENSION) . REPORT_FILE_EXTENSION . '.' . date('Y-m-d_H-i-s') . ".$index"); - $index ++; + $index++; if ($index > 20) { Thrower::userFormException('Error while trying to backup report file.', 'Infinite loop.'); } @@ -247,8 +240,7 @@ class ReportAsFile * @return string * @throws \UserFormException */ - private static function reportPath(): string - { + private static function reportPath(): string { $absoluteReportPath = Path::absoluteProject(Path::projectToReport()); HelperFile::createPathRecursive($absoluteReportPath); return $absoluteReportPath; diff --git a/extension/Classes/Core/Report/Tablesorter.php b/extension/Classes/Core/Report/Tablesorter.php index e57b18359243d771c08fbb13c2f0d6df03d21024..84cad22738e9900ce5a1199dbe275082499df9ba 100644 --- a/extension/Classes/Core/Report/Tablesorter.php +++ b/extension/Classes/Core/Report/Tablesorter.php @@ -112,7 +112,7 @@ class Tablesorter { "` AS sett WHERE `type`=? AND `tableId`=? AND ((!`public` AND `feUser`=?) OR `public`) ORDER BY `sett`.`public` DESC, `sett`.`name`, `sett`.`id`", ROW_REGULAR, [SETTING_TYPE_TABLESORTER, $tableId, $feUser]); - foreach ($tablesorterViews AS $key => $row) { + foreach ($tablesorterViews as $key => $row) { // Convert mysql boolean 0/1 to json true/false (not a string!). $tablesorterViews[$key]['public'] = (bool)$tablesorterViews[$key]['public']; } diff --git a/extension/Classes/Core/Report/Thumbnail.php b/extension/Classes/Core/Report/Thumbnail.php index c6aaf132a746eff620b5f5f0bc1071172a288f57..7e16488801d6fca788c7872e6bc67f2d6fbc1d97 100644 --- a/extension/Classes/Core/Report/Thumbnail.php +++ b/extension/Classes/Core/Report/Thumbnail.php @@ -10,13 +10,13 @@ namespace IMATHUZH\Qfq\Core\Report; - + use IMATHUZH\Qfq\Core\Helper\HelperFile; +use IMATHUZH\Qfq\Core\Helper\OnString; use IMATHUZH\Qfq\Core\Helper\Path; -use IMATHUZH\Qfq\Core\Store\Store; use IMATHUZH\Qfq\Core\Helper\Support; use IMATHUZH\Qfq\Core\Helper\Token; -use IMATHUZH\Qfq\Core\Helper\OnString; +use IMATHUZH\Qfq\Core\Store\Store; //use qfq; @@ -110,14 +110,14 @@ class Thumbnail { */ private function getOrCreateThumbnail($pathFilenameSource, $pathFilenameThumbnail, array $control, $modeRender) { $debugMode = false; - $statThumbnail=false; + $statThumbnail = false; // Using stat() on non existing files throws an exception if (!file_exists($pathFilenameSource) || false === ($statSource = stat($pathFilenameSource))) { throw new \UserFormException('File not found: "' . OnString::strrstr($pathFilenameSource, '/') . '"', ERROR_IO_FILE_NOT_FOUND); } - if(file_exists($pathFilenameThumbnail)) { + if (file_exists($pathFilenameThumbnail)) { $statThumbnail = stat($pathFilenameThumbnail); } diff --git a/extension/Classes/Core/Store/FillStoreForm.php b/extension/Classes/Core/Store/FillStoreForm.php index e45d971d03fd404d6c2ec2ad906ddd9929bcb4da..cc4c2356e1b403e4f7db739b01efb6eadfba0450 100644 --- a/extension/Classes/Core/Store/FillStoreForm.php +++ b/extension/Classes/Core/Store/FillStoreForm.php @@ -13,9 +13,9 @@ use IMATHUZH\Qfq\Core\Evaluate; use IMATHUZH\Qfq\Core\Helper\HelperFormElement; use IMATHUZH\Qfq\Core\Helper\KeyValueStringParser; use IMATHUZH\Qfq\Core\Helper\Logger; +use IMATHUZH\Qfq\Core\Helper\OnString; use IMATHUZH\Qfq\Core\Helper\Sanitize; use IMATHUZH\Qfq\Core\Helper\Support; -use IMATHUZH\Qfq\Core\Helper\OnString; /** * Class FillStoreForm @@ -221,7 +221,7 @@ class FillStoreForm { } // Iterate over all FormElements. Sanitize values. Built an assoc array $newValues. - foreach ($this->feSpecNative AS $formElement) { + foreach ($this->feSpecNative as $formElement) { // Never get a predefined 'id' if ($formElement[FE_NAME] === COLUMN_ID) { diff --git a/extension/Classes/Core/Store/Session.php b/extension/Classes/Core/Store/Session.php index cd471facd22b74dfb2c65706226cd0ba205c13da..05d9bbbaef42a147782da2f89b9d5a0f34d2f3d0 100644 --- a/extension/Classes/Core/Store/Session.php +++ b/extension/Classes/Core/Store/Session.php @@ -16,8 +16,7 @@ use IMATHUZH\Qfq\Core\Typo3\T3Handler; * Class Session * @package qfq */ -class Session -{ +class Session { private static $instance = null; private static $phpUnit = null; @@ -56,11 +55,11 @@ class Session $samesite = 'lax'; // Needed expire date for header() method - $expireDate = date("D, d-M-Y H:i:s", strtotime('+2 days')). ' GMT'; + $expireDate = date("D, d-M-Y H:i:s", strtotime('+2 days')) . ' GMT'; // More information about previous dots in domains: https://stackoverflow.com/questions/348282/php-cookie-domain-subdomain-control - if(PHP_VERSION_ID < 70300) { - session_set_cookie_params($lifetime, $path.';SameSite='.$samesite, null, $secure, $httponly); + if (PHP_VERSION_ID < 70300) { + session_set_cookie_params($lifetime, $path . ';SameSite=' . $samesite, null, $secure, $httponly); } else { session_set_cookie_params([ 'lifetime' => $lifetime, @@ -84,7 +83,7 @@ class Session // For PHP Version < 7.3 cookie with samesite can only be set over the header() method. // Secure is actually set to false because of testing instance, otherwise SIP cant get requested without HTTPS. // Setup for Secure-> true : 1. Change value of $secure from false to true. 2. Write String "Secure;" after "HttpOnly;" in header() function below. - if(PHP_VERSION_ID < 70300) { + if (PHP_VERSION_ID < 70300) { // header() here makes no senss, cause it's to late: T3 already sent some non header content. // header("Set-Cookie: ".SESSION_NAME."=".session_id()."; expires=".$date."; path=".$path."; domain=".$currentCookieParams['domain']."; HttpOnly; SameSite=Lax"); } else { diff --git a/extension/Classes/Core/Store/Sip.php b/extension/Classes/Core/Store/Sip.php index 61acddd5169600dac3f0634d4ef8e437a2b36643..8620857b942e05a20e75600e761a84a98eac4335 100644 --- a/extension/Classes/Core/Store/Sip.php +++ b/extension/Classes/Core/Store/Sip.php @@ -8,7 +8,7 @@ namespace IMATHUZH\Qfq\Core\Store; - + use IMATHUZH\Qfq\Core\Helper\KeyValueStringParser; use IMATHUZH\Qfq\Core\Helper\OnArray; @@ -131,7 +131,7 @@ class Sip { // ?a=1&s=4b3403665fea6&r=45&type=99&id=person // a=1&s=4b3403665fea6&r=45&type=99&id=person $flagFirst = true; - foreach ($paramArray AS $key => $value) { + foreach ($paramArray as $key => $value) { // first key/value pair: a) save potential existing url/script part, b) if no keyname is specified, call it 'id'. if ($flagFirst) { diff --git a/extension/Classes/Core/Store/T3Info.php b/extension/Classes/Core/Store/T3Info.php index ad5cf41a14ba4d5b76e79bc042b6797d377f0b7f..cf8372756a8a0a3607f40e3d4923105bb067008a 100644 --- a/extension/Classes/Core/Store/T3Info.php +++ b/extension/Classes/Core/Store/T3Info.php @@ -62,8 +62,7 @@ class T3Info { * * @return string */ - public static function getLanguageId() - { + public static function getLanguageId() { if (class_exists('TYPO3\CMS\Core\Context\Context')) { // Typo3 version >=9 $context = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class); diff --git a/extension/Classes/External/AutoCron.php b/extension/Classes/External/AutoCron.php index 8d3a301234320ce2eea8072e4cf9c407ff2b2efd..612cb8bb50ee5db6283913f7c6cabd97dfbec52e 100644 --- a/extension/Classes/External/AutoCron.php +++ b/extension/Classes/External/AutoCron.php @@ -253,7 +253,7 @@ class AutoCron { $mailEntry = $this->mailEntryFill($mailEntry); $content = $this->evaluate->parse($job[AUTOCRON_CONTENT]); - if ($content == '' OR ($mailEntry[FE_SENDMAIL_TO] == '' AND $mailEntry[FE_SENDMAIL_CC] == '' AND $mailEntry[FE_SENDMAIL_BCC] == '')) { + if ($content == '' || ($mailEntry[FE_SENDMAIL_TO] == '' && $mailEntry[FE_SENDMAIL_CC] == '' && $mailEntry[FE_SENDMAIL_BCC] == '')) { continue; // no receiver: skip } $mail[SENDMAIL_TOKEN_RECEIVER] = $this->evaluate->parse($mailEntry[FE_SENDMAIL_TO]); diff --git a/extension/Classes/External/autocron.php b/extension/Classes/External/autocron.php index e339df8d35b8b27930ed1e38a46e9eafdfa05912..d52550a5a79bdbf5d427c71ae60453a98632ecd6 100644 --- a/extension/Classes/External/autocron.php +++ b/extension/Classes/External/autocron.php @@ -10,9 +10,6 @@ namespace IMATHUZH\Qfq\External; require_once(__DIR__ . '/../../vendor/autoload.php'); -use IMATHUZH\Qfq\Core\Helper\Path; -use IMATHUZH\Qfq\External\AutoCron; - global $argv; try { @@ -25,12 +22,12 @@ try { // If this script is started via an absolute path: set CWD to the T3 installation directory if ($argv[0][0] == '/') { - $baseDir=''; + $baseDir = ''; // /var/www/html/typo3conf/ext/qfq/Classes/External/autocron.php $arr = explode('/', $argv[0]); $cnt = count($arr) - 6; // Strip the last '6' entries, these are below T3 basedir until this script. for ($ii = 0; $ii < $cnt; $ii++) { - if($arr[$ii]!='') { + if ($arr[$ii] != '') { $baseDir .= '/' . $arr[$ii]; } } diff --git a/extension/Classes/Sql/copyFormFromExt.sql b/extension/Classes/Sql/copyFormFromExt.sql index 9e09fc99475d559036197fc6f4a3ad9c30f19ef8..1bfa70713860df89566cfc0e1170f82feab49e25 100644 --- a/extension/Classes/Sql/copyFormFromExt.sql +++ b/extension/Classes/Sql/copyFormFromExt.sql @@ -4,10 +4,37 @@ VALUES (80, 'copyFormFromExt', 'Copy a form (external)', '', 'Clipboard', 'sip', '?id={{pageId:T}}&form=form&r={{formId:P0}}', '', '', '', 'submitButtonText = Copy Form', '', '', '', '', 900, 'no', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO `FormElement` VALUES(NULL, 80, 0, 'no', 'yes', 'idSrc', 'Source Form', 'show', '', 'native', 'select', '', 'specialchar', 'alnumx', '', '', 10, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '{{!SELECT f.id, CONCAT(f.name, \" / \", f.title) FROM ExtForm AS f ORDER BY f.name}}', '', '', '', '', '', '', '', 'no', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO `FormElement` VALUES(NULL, 80, 0, 'no', 'yes', 'myNewFormName', 'New Form Name', 'show', '', 'native', 'text', '', 'specialchar', 'alnumx', '', '', 20, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '{{SELECT f.name FROM ExtForm AS f WHERE f.id={{idSrc:F0}} }}', '', '', '', '', '', '', '', '', 'no', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO `FormElement` VALUES(NULL, 80, 0, 'no', 'yes', 'clearClipboard', '', 'show', '', 'action', 'beforeSave', '', 'specialchar', 'alnumx', '', '', 100, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', 'sqlValidate={{!SELECT f.id FROM Form AS f WHERE f.name LIKE \"{{myName:FE:alnumx}}\" LIMIT 1}}\nexpectRecords = 0\nmessageFail = There is already a form with this name\nsqlAfter={{DELETE FROM Clipboard WHERE cookie=\"{{cookieQfq:C0:alnumx}}\" }}', '', '', '', '', '', '', 'no', '2017-08-20 18:01:32', '2017-08-20 20:01:32'); -INSERT INTO `FormElement` VALUES(NULL, 80, 0, 'no', 'yes', 'updateClipboardRecord', '', 'show', '', 'action', 'afterSave', '', 'specialchar', 'alnumx', '', '', 110, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', 'sqlAfter={{UPDATE Clipboard AS c, Form AS f SET c.cookie=\"{{cookieQfq:C0:alnumx}}\", c.formIdPaste=f.id /* PasteForm */ WHERE c.id={{id:R}} AND f.name=\"{{form:SE}}\" }}', '', '', '', '', '', '', 'no', '2017-08-20 18:01:32', '2017-08-20 20:01:32'); -INSERT INTO `FormElement` VALUES(NULL, 80, 0, 'no', 'yes', 'formId', '', 'show', '', 'action', 'paste', '', 'specialchar', 'alnumx', '', '', 200, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '{{!SELECT {{id:P}} AS id, \"{{myNewFormName:FE:allbut}}\" AS name}}', 'recordSourceTable=ExtForm\r\nrecordDestinationTable=Form\r\n', '', '', '', '', '', '', 'no', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); -INSERT INTO `FormElement` VALUES(NULL, 80, 0, 'no', 'yes', 'formElementId', '', 'show', '', 'action', 'paste', '', 'specialchar', 'alnumx', '', '', 210, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '{{!SELECT fe.id AS id, {{formId:P}} AS formId FROM ExtFormElement AS fe WHERE fe.formId={{id:P}} ORDER BY fe.ord}}', 'recordSourceTable=ExtFormElement\r\nrecordDestinationTable=FormElement\r\ntranslateIdColumn=feIdContainer', '', '', '', '', '', '', 'no', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO `FormElement` +VALUES (NULL, 80, 0, 'no', 'yes', 'idSrc', 'Source Form', 'show', '', 'native', 'select', '', 'specialchar', 'alnumx', + '', '', 10, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', + '{{!SELECT f.id, CONCAT(f.name, \" / \", f.title) FROM ExtForm AS f ORDER BY f.name}}', '', '', '', '', '', '', + '', 'no', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO `FormElement` +VALUES (NULL, 80, 0, 'no', 'yes', 'myNewFormName', 'New Form Name', 'show', '', 'native', 'text', '', 'specialchar', + 'alnumx', '', '', 20, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', + '{{SELECT f.name FROM ExtForm AS f WHERE f.id={{idSrc:F0}} }}', '', '', '', '', '', '', '', '', 'no', + '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO `FormElement` +VALUES (NULL, 80, 0, 'no', 'yes', 'clearClipboard', '', 'show', '', 'action', 'beforeSave', '', 'specialchar', 'alnumx', + '', '', 100, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', + 'sqlValidate={{!SELECT f.id FROM Form AS f WHERE f.name LIKE \"{{myName:FE:alnumx}}\" LIMIT 1}}\nexpectRecords = 0\nmessageFail = There is already a form with this name\nsqlAfter={{DELETE FROM Clipboard WHERE cookie=\"{{cookieQfq:C0:alnumx}}\" }}', + '', '', '', '', '', '', 'no', '2017-08-20 18:01:32', '2017-08-20 20:01:32'); +INSERT INTO `FormElement` +VALUES (NULL, 80, 0, 'no', 'yes', 'updateClipboardRecord', '', 'show', '', 'action', 'afterSave', '', 'specialchar', + 'alnumx', '', '', 110, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', + '', '', + 'sqlAfter={{UPDATE Clipboard AS c, Form AS f SET c.cookie=\"{{cookieQfq:C0:alnumx}}\", c.formIdPaste=f.id /* PasteForm */ WHERE c.id={{id:R}} AND f.name=\"{{form:SE}}\" }}', + '', '', '', '', '', '', 'no', '2017-08-20 18:01:32', '2017-08-20 20:01:32'); +INSERT INTO `FormElement` +VALUES (NULL, 80, 0, 'no', 'yes', 'formId', '', 'show', '', 'action', 'paste', '', 'specialchar', 'alnumx', '', '', 200, + 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', + '{{!SELECT {{id:P}} AS id, \"{{myNewFormName:FE:allbut}}\" AS name}}', + 'recordSourceTable=ExtForm\r\nrecordDestinationTable=Form\r\n', '', '', '', '', '', '', 'no', + '0000-00-00 00:00:00', '0000-00-00 00:00:00'); +INSERT INTO `FormElement` +VALUES (NULL, 80, 0, 'no', 'yes', 'formElementId', '', 'show', '', 'action', 'paste', '', 'specialchar', 'alnumx', '', + '', 210, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', + '{{!SELECT fe.id AS id, {{formId:P}} AS formId FROM ExtFormElement AS fe WHERE fe.formId={{id:P}} ORDER BY fe.ord}}', + 'recordSourceTable=ExtFormElement\r\nrecordDestinationTable=FormElement\r\ntranslateIdColumn=feIdContainer', '', + '', '', '', '', '', 'no', '0000-00-00 00:00:00', '0000-00-00 00:00:00'); diff --git a/extension/Classes/Sql/customTable.sql b/extension/Classes/Sql/customTable.sql index c3de5fd9ec2e547d2d95bf4fb2e55e1fae4e983a..56814819833b21a12021452ecf3c1152b6379851 100644 --- a/extension/Classes/Sql/customTable.sql +++ b/extension/Classes/Sql/customTable.sql @@ -1,17 +1,17 @@ CREATE TABLE IF NOT EXISTS `Period` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `start` DATETIME NOT NULL, - `name` VARCHAR(255) NOT NULL, - `modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` INT(11) NOT NULL AUTO_INCREMENT, + `start` DATETIME NOT NULL, + `name` VARCHAR(255) NOT NULL, + `modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `start` (`start`) + PRIMARY KEY (`id`), + KEY `start` (`start`) ) - ENGINE = InnoDB - DEFAULT CHARSET = utf8 - AUTO_INCREMENT = 0; + ENGINE = InnoDB + DEFAULT CHARSET = utf8 + AUTO_INCREMENT = 0; # Default record for table Period INSERT INTO Period (start, name, created) diff --git a/extension/Classes/Sql/function.sql b/extension/Classes/Sql/function.sql index 765598f895f14dd63ca53f61cb09900751aadd13..171d85f1a67ef485d87850b5119da3dc186fda66 100644 --- a/extension/Classes/Sql/function.sql +++ b/extension/Classes/Sql/function.sql @@ -5,16 +5,15 @@ # DROP FUNCTION IF EXISTS GETFUNCTIONSHASH; CREATE FUNCTION GETFUNCTIONSHASH() - RETURNS TEXT - DETERMINISTIC - SQL SECURITY INVOKER + RETURNS TEXT + DETERMINISTIC + SQL SECURITY INVOKER BEGIN - RETURN '%%FUNCTIONSHASH%%'; + RETURN '%%FUNCTIONSHASH%%'; END; - ### # # QMORE(input, maxlen) @@ -22,20 +21,20 @@ END; # DROP FUNCTION IF EXISTS QMORE; CREATE FUNCTION QMORE(input TEXT, maxlen INT) - RETURNS TEXT - DETERMINISTIC - SQL SECURITY INVOKER + RETURNS TEXT + DETERMINISTIC + SQL SECURITY INVOKER BEGIN - DECLARE output TEXT; - IF maxlen < 1 THEN - SET maxlen = 1; - END IF; - IF CHAR_LENGTH(input) > maxlen THEN - SET output = CONCAT(INSERT(input, maxlen, 0, '<span class="qfq-more-text">'), '</span>'); - ELSE - SET output = input; - END IF; - RETURN output; + DECLARE output TEXT; + IF maxlen < 1 THEN + SET maxlen = 1; + END IF; + IF CHAR_LENGTH(input) > maxlen THEN + SET output = CONCAT(INSERT(input, maxlen, 0, '<span class="qfq-more-text">'), '</span>'); + ELSE + SET output = input; + END IF; + RETURN output; END; @@ -82,9 +81,9 @@ CREATE FUNCTION QNL2BR(input TEXT) DETERMINISTIC SQL SECURITY INVOKER BEGIN - DECLARE output TEXT; - SET output = REPLACE(REPLACE(input, CHAR(13), ''), CHAR(10), '<br>'); - RETURN output; + DECLARE output TEXT; + SET output = REPLACE(REPLACE(input, CHAR(13), ''), CHAR(10), '<br>'); + RETURN output; END; ### @@ -94,15 +93,16 @@ END; # DROP FUNCTION IF EXISTS QIFEMPTY; CREATE FUNCTION QIFEMPTY(input TEXT, token TEXT) - RETURNS TEXT - DETERMINISTIC - SQL SECURITY INVOKER + RETURNS TEXT + DETERMINISTIC + SQL SECURITY INVOKER BEGIN - DECLARE output TEXT; - SET output = - IF(ISNULL(input) OR input = '' OR input = '0' OR input = '0000-00-00' OR input = '0000-00-00 00:00:00', token, - input); - RETURN output; + DECLARE output TEXT; + SET output = + IF(ISNULL(input) OR input = '' OR input = '0' OR input = '0000-00-00' OR input = '0000-00-00 00:00:00', + token, + input); + RETURN output; END; ### @@ -111,18 +111,18 @@ END; # DROP FUNCTION IF EXISTS strip_tags; CREATE FUNCTION `strip_tags`(str TEXT) - RETURNS TEXT - DETERMINISTIC - SQL SECURITY INVOKER + RETURNS TEXT + DETERMINISTIC + SQL SECURITY INVOKER BEGIN - DECLARE start, end INT DEFAULT 1; - LOOP - SET start = LOCATE("<", str, start); - IF (!start) THEN RETURN str; END IF; - SET end = LOCATE(">", str, start); - IF (!end) THEN SET end = start; END IF; - SET str = INSERT(str, start, end - start + 1, ''); - END LOOP; + DECLARE start, end INT DEFAULT 1; + LOOP + SET start = LOCATE("<", str, start); + IF (!start) THEN RETURN str; END IF; + SET end = LOCATE(">", str, start); + IF (!end) THEN SET end = start; END IF; + SET str = INSERT(str, start, end - start + 1, ''); + END LOOP; END; ### diff --git a/extension/Classes/Sql/testtables.sql b/extension/Classes/Sql/testtables.sql index ccb4c0ebcb1eb22ae3a3f65de3dd23fffa46a41e..891eb2c4d897e799387160f0bed697d04c76fd93 100644 --- a/extension/Classes/Sql/testtables.sql +++ b/extension/Classes/Sql/testtables.sql @@ -1,131 +1,136 @@ DROP TABLE IF EXISTS Person; -CREATE TABLE Person ( - id BIGINT AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(128) NOT NULL DEFAULT '', - firstname VARCHAR(128) NOT NULL DEFAULT '', - pathFileName VARCHAR(128) NOT NULL DEFAULT '', - gender ENUM('', 'male', 'female') NOT NULL DEFAULT 'male', - groups SET('', 'a', 'b', 'c') NOT NULL DEFAULT '', - birthday DATE NOT NULL DEFAULT '0000-00-00', - noteId BIGINT NOT NULL DEFAULT 0, - modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' +CREATE TABLE Person +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(128) NOT NULL DEFAULT '', + firstname VARCHAR(128) NOT NULL DEFAULT '', + pathFileName VARCHAR(128) NOT NULL DEFAULT '', + gender ENUM ('', 'male', 'female') NOT NULL DEFAULT 'male', + groups SET ('', 'a', 'b', 'c') NOT NULL DEFAULT '', + birthday DATE NOT NULL DEFAULT '0000-00-00', + noteId BIGINT NOT NULL DEFAULT 0, + modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ); # # Create Demo -INSERT INTO Person (id, name, firstname, gender, groups) VALUES - (NULL, 'Doe', 'John', 'male', 'c'), - (NULL, 'Smith', 'Jane', 'female', 'a,c'); +INSERT INTO Person (id, name, firstname, gender, groups) +VALUES (NULL, 'Doe', 'John', 'male', 'c'), + (NULL, 'Smith', 'Jane', 'female', 'a,c'); DROP TABLE IF EXISTS PersFunction; -CREATE TABLE PersFunction ( - id BIGINT AUTO_INCREMENT PRIMARY KEY, - personId BIGINT, - type ENUM('Student', 'Assistant', 'Professor', 'Administration'), - start DATE NOT NULL DEFAULT '0000-00-00', - end DATE NOT NULL DEFAULT '0000-00-00', - note VARCHAR(255), - modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' +CREATE TABLE PersFunction +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + personId BIGINT, + type ENUM ('Student', 'Assistant', 'Professor', 'Administration'), + start DATE NOT NULL DEFAULT '0000-00-00', + end DATE NOT NULL DEFAULT '0000-00-00', + note VARCHAR(255), + modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ); # --------------------------- # Form: plain -REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) VALUES - (3, 'formplain', 'Form: Plain', '', 'Form', 'always', 'always', 'plain', '', ''); +REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) +VALUES (3, 'formplain', 'Form: Plain', '', 'Form', 'always', 'always', 'plain', '', ''); # FormEditor: FormElements -REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) -VALUES - (300, 3, 'id', 'id', 'readonly', 'text', 'all', 'native', 100, 0, 11, '', '', '', '', '', '', 0, '', ''), - (310, 3, 'name', 'Name', 'show', 'text', 'all', 'native', 120, 0, 255, '', '', '', '', '', '', 0, '', ''); +REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, + value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) +VALUES (300, 3, 'id', 'id', 'readonly', 'text', 'all', 'native', 100, 0, 11, '', '', '', '', '', '', 0, '', ''), + (310, 3, 'name', 'Name', 'show', 'text', 'all', 'native', 120, 0, 255, '', '', '', '', '', '', 0, '', ''); # Form: table -REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) VALUES - (4, 'formtable', 'Form: Table', '', 'Form', 'always', 'always', 'table', '', ''); +REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) +VALUES (4, 'formtable', 'Form: Table', '', 'Form', 'always', 'always', 'table', '', ''); # FormEditor: FormElements -REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) -VALUES - (400, 4, 'id', 'id', 'readonly', 'text', 'all', 'native', 100, 0, 11, '', '', '', '', '', '', 0, '', ''), - (410, 4, 'name', 'Name', 'show', 'text', 'all', 'native', 120, 0, 255, '', '', '', '', '', '', 0, '', ''); +REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, + value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) +VALUES (400, 4, 'id', 'id', 'readonly', 'text', 'all', 'native', 100, 0, 11, '', '', '', '', '', '', 0, '', ''), + (410, 4, 'name', 'Name', 'show', 'text', 'all', 'native', 120, 0, 255, '', '', '', '', '', '', 0, '', ''); # Form: Person -REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) VALUES - (5, 'person', 'Person {{SELECT ": ", firstName, " ", name, " (", id, ")" FROM Person WHERE id = {{r:S0}}}}', - 'Please secure the form', - 'Person', 'always', 'always', 'bootstrap', '', ''); +REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) +VALUES (5, 'person', 'Person {{SELECT ": ", firstName, " ", name, " (", id, ")" FROM Person WHERE id = {{r:S0}}}}', + 'Please secure the form', + 'Person', 'always', 'always', 'bootstrap', '', ''); # FormEditor: FormElements person -REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) -VALUES - - (500, 5, 'name', 'Name', 'show', 'text', 'all', 'native', 10, 0, 255, '', '', '', '', '', '', 0, '', ''), - (501, 5, 'firstname', 'Firstname', 'show', 'text', 'all', 'native', 20, 0, 255, '', '', '', '', '', '', 0, '', ''), - (502, 5, 'birthday', 'Birthday', 'show', 'date', 'all', 'native', 30, 0, 255, '', '', '', '', '', '', 0, '', ''), - (506, 5, 'gender', 'Sex', 'show', 'radio', 'alnumx', 'native', 40, 0, 0, '', '', '', '', '', 'itemList=female,male', - 0, '', ''), - (503, 5, 'datumZeit', 'Datum & Zeit', 'show', 'datetime', 'alnumx', 'native', 50, 0, 0, '', '', '', '', '', '', 0, - '', ''), - (504, 5, 'zeit', 'Zeit', 'show', 'time', 'alnumx', 'native', 60, 0, 0, '', '', '', '', '', '', 0, '', ''), - (505, 5, 'pathFileName', 'Picture', 'show', 'upload', 'allbut', 'native', 70, 0, 0, '', '', '', '', '', - 'fileDestination={{SELECT ''fileadmin/user/pictures/'', p.name, ''-{{_filename}}'' FROM Person AS p WHERE p.id={{r}} }}', - 0, '', ''), - - (506, 5, '', 'Address', 'show', 'subrecord', 'all', 'native', 100, 0, 0, '', '', '', - '{{!SELECT a.id, a.street, a.city, a.country FROM Address AS a WHERE a.personId={{r:S0}} }}', - '', 'form=address\ndetail=id:personId', 0, 'new,edit,delete', ''); +REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, + value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) +VALUES (500, 5, 'name', 'Name', 'show', 'text', 'all', 'native', 10, 0, 255, '', '', '', '', '', '', 0, '', ''), + (501, 5, 'firstname', 'Firstname', 'show', 'text', 'all', 'native', 20, 0, 255, '', '', '', '', '', '', 0, '', + ''), + (502, 5, 'birthday', 'Birthday', 'show', 'date', 'all', 'native', 30, 0, 255, '', '', '', '', '', '', 0, '', ''), + (506, 5, 'gender', 'Sex', 'show', 'radio', 'alnumx', 'native', 40, 0, 0, '', '', '', '', '', + 'itemList=female,male', + 0, '', ''), + (503, 5, 'datumZeit', 'Datum & Zeit', 'show', 'datetime', 'alnumx', 'native', 50, 0, 0, '', '', '', '', '', '', + 0, + '', ''), + (504, 5, 'zeit', 'Zeit', 'show', 'time', 'alnumx', 'native', 60, 0, 0, '', '', '', '', '', '', 0, '', ''), + (505, 5, 'pathFileName', 'Picture', 'show', 'upload', 'allbut', 'native', 70, 0, 0, '', '', '', '', '', + 'fileDestination={{SELECT ''fileadmin/user/pictures/'', p.name, ''-{{_filename}}'' FROM Person AS p WHERE p.id={{r}} }}', + 0, '', ''), + + (506, 5, '', 'Address', 'show', 'subrecord', 'all', 'native', 100, 0, 0, '', '', '', + '{{!SELECT a.id, a.street, a.city, a.country FROM Address AS a WHERE a.personId={{r:S0}} }}', + '', 'form=address\ndetail=id:personId', 0, 'new,edit,delete', ''); # Form: Address -REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) VALUES - (6, 'address', - 'Person {{SELECT ": ", p.firstName, " ", p.name, " (", id, ")" FROM Person AS p WHERE p.id = {{personId:S0}}}}', - '', - 'Address', 'always', 'always', 'bootstrap', '', ''); +REPLACE INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) +VALUES (6, 'address', + 'Person {{SELECT ": ", p.firstName, " ", p.name, " (", id, ")" FROM Person AS p WHERE p.id = {{personId:S0}}}}', + '', + 'Address', 'always', 'always', 'bootstrap', '', ''); # FormEditor: FormElements address -REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) -VALUES - - (600, 6, 'street', 'Street', 'show', 'text', 'all', 'native', 10, 0, 255, '', '', '', '', '', '', 0, '', ''), - (601, 6, 'city', 'City', 'show', 'text', 'all', 'native', 20, 0, 255, '', '', '', '', '', '', 0, '', ''), - (602, 6, 'country', 'Country', 'show', 'select', 'all', 'native', 30, 0, 255, '', '', '', '', '', '', 0, '', ''); +REPLACE INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, + value, sql1, sql2, parameter, feIdContainer, subrecordOption, modeSql) +VALUES (600, 6, 'street', 'Street', 'show', 'text', 'all', 'native', 10, 0, 255, '', '', '', '', '', '', 0, '', ''), + (601, 6, 'city', 'City', 'show', 'text', 'all', 'native', 20, 0, 255, '', '', '', '', '', '', 0, '', ''), + (602, 6, 'country', 'Country', 'show', 'select', 'all', 'native', 30, 0, 255, '', '', '', '', '', '', 0, '', ''); # ---------------------------------------------------------------------- # DROP TABLE IF EXISTS Address; -CREATE TABLE Address ( - id BIGINT AUTO_INCREMENT PRIMARY KEY, - personId BIGINT NOT NULL DEFAULT 0, - street VARCHAR(128) NOT NULL DEFAULT '', - city VARCHAR(128) NOT NULL DEFAULT '', - country ENUM('Switzerland', 'Austria', 'France', 'Germany') NOT NULL, - grIdTyp BIGINT NOT NULL DEFAULT 0, - modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' +CREATE TABLE Address +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + personId BIGINT NOT NULL DEFAULT 0, + street VARCHAR(128) NOT NULL DEFAULT '', + city VARCHAR(128) NOT NULL DEFAULT '', + country ENUM ('Switzerland', 'Austria', 'France', 'Germany') NOT NULL, + grIdTyp BIGINT NOT NULL DEFAULT 0, + modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ); -INSERT INTO Address (personId, street, city, country) VALUES - (1, 'Side Street', 'Zurich', 'Switzerland'), - (1, 'Park Street', 'Wien', 'Austria'), - (1, 'Winter Street', 'Paris', 'France'), - (2, 'Summer Street', 'Berlin', 'Germany'); +INSERT INTO Address (personId, street, city, country) +VALUES (1, 'Side Street', 'Zurich', 'Switzerland'), + (1, 'Park Street', 'Wien', 'Austria'), + (1, 'Winter Street', 'Paris', 'France'), + (2, 'Summer Street', 'Berlin', 'Germany'); #------------------------------------------------------------------------ # DROP TABLE IF EXISTS Note; -CREATE TABLE Note ( - id BIGINT AUTO_INCREMENT PRIMARY KEY, - note VARCHAR(128) NOT NULL DEFAULT '', - xId BIGINT NOT NULL DEFAULT 0, - grIdTyp BIGINT NOT NULL DEFAULT 0, - modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' +CREATE TABLE Note +( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + note VARCHAR(128) NOT NULL DEFAULT '', + xId BIGINT NOT NULL DEFAULT 0, + grIdTyp BIGINT NOT NULL DEFAULT 0, + modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' );