diff --git a/Makefile b/Makefile
index e106bbe0442f8bf92e4a2791afae907b415c2ecd..6402408a3be4abe6f79796a1d383da9cc7c3eaf2 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ RELEASE_DATE = $(shell date '+%Y%m%d%H%M')
 GIT_REVISION_SHORT = $(shell git rev-parse --short HEAD || true)
 GIT_REVISION_LONG = $(shell git rev-parse HEAD || true)
 
-EXTENSION_CONTENT = Classes Configuration Documentation qfq Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config.qfq.example.php RELEASE.txt
+EXTENSION_CONTENT = Classes Configuration Documentation Source Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config.qfq.example.php RELEASE.txt
 
 DISTDIR=dist
 
diff --git a/doc/PROTOCOL.md b/doc/PROTOCOL.md
index f2fc00627f6dff412c3ac0595b1cee154b9e6e5c..3ce0eee89d89157d57406c87ff947a757574ed11 100644
--- a/doc/PROTOCOL.md
+++ b/doc/PROTOCOL.md
@@ -387,7 +387,7 @@ URL Parameters
 Server Response
 :	header("Content-type: $mimetype");
 	header("Content-Length: $length");
-	header("Content-Disposition: inline; filename=\"$outputFilename\"");
+	header("Content-Disposition: inline; filename='$outputFilename'");
 	header("Pragma: no-cache");
 	header("Expires: 0");
 	file_get_contents($file);
@@ -506,10 +506,10 @@ Server Response
 Asynchronous request (read AJAX) initiated by the Client receive a
 JSON Response from the server (extended [Minimal Response]) containing:
 
-	{
-		"status": "success"|"error"|"conflict"|"conflict_allow_force",
-		"message": "<message>"e5
-    }
+:	{
+:		"status": "success"|"error"|"conflict"|"conflict_allow_force",
+:		"message": "<message>"e5
+:    }
    
 `status` indicates how the request has been fulfilled by the server. 
 On`"success"`, the Client display nothing to the user. 
diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst
index 91669c271992871be33dea0553b720f21c7874e8..4a8cd47ecc6c5dd8b932c30382b0dd6ccb94e9f9 100644
--- a/extension/Documentation/Manual.rst
+++ b/extension/Documentation/Manual.rst
@@ -130,7 +130,7 @@ Different browser prints the same page in different variations. To prevent this,
 
 Provide a `print this page`-link (replace 'current pageId' )::
 
-	<a href="typo3conf/ext/qfq/qfq/api/print.php?id={current pageId}">Print this page</a>
+	<a href="typo3conf/ext/qfq/Source/api/print.php?id={current pageId}">Print this page</a>
 
 Any parameter specified after `print.php` will be delivered to `wkhtmltopdf` as part of the URL.
 
@@ -138,7 +138,7 @@ Typoscript code to implement a print link on every page::
 
 	10 = TEXT
 	10 {
-		wrap = <a href="typo3conf/ext/qfq/qfq/api/print.php?id=|&type=99"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a>
+		wrap = <a href="typo3conf/ext/qfq/Source/api/print.php?id=|&type=99"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a>
 		data = page:uid
 	}
 
@@ -148,7 +148,7 @@ Send Email
 QFQ sends mail via `sendEmail` http://caspian.dotconf.net/menu/Software/SendEmail/ - a small perl script without a central
 configuration.
 
-By default, `sendEmail` uses the local installed MTA, writes a logfile to `typo3conf/mail.log` and handles attachments
+By default, `sendEmail` uses the local installed MTA, writes a logfile to `fileadmin/protected/log/mail.log` and handles attachments
 via commandline options. A basic HTML email support is implemented.
 
 The latest version is v1.56, which has at least one bug. That one is patched in the QFQ internal version v1.56p1 (see
@@ -171,17 +171,17 @@ Usage: `column-thumbnail`_.
 Setup
 -----
 
-* Install the extension via the Extensionmanager.
+* Install the extension via the Extension Manager.
 
   * If you install the extension by manual download/upload and get an error message
-    "can't activate extension": rename the downloaded zip file to `qfq.zip` or `qfq_<version>.zip` (e.g. version: 0.9.1).
+    "can't activate extension": rename the downloaded zip file to `qfq.zip` or `qfq_<version>.zip` (e.g. version: 18.12.0).
 
-  * If the Extensionmanager stops after importing: check your memory limit in php.ini.
+  * If the Extension Manager stops after importing: check your memory limit in php.ini.
 
-* Copy/rename the file *<site path>/typo3conf/ext/qfq/config.example.qfq.php* to *config.qfq.php*.
+* Copy/rename the file *<site path>/typo3conf/ext/qfq/config.example.qfq.php* to *<site path>/typo3conf/config.qfq.php*.
   Configure the necessary settings `configuration`_
-  The configuration file is outside the of extension directory, to not loose it during updates.
-* When the QFQ Extension is called the first time on the Typo3 Frontend, the file *<ext_dir>/qfq/sql/formEditor.sql* will
+  The configuration file is outside of the extension directory, to not loose it during de-install and install again.
+* When the QFQ Extension is called the first time on the Typo3 frontend, the file *<ext_dir>/qfq/sql/formEditor.sql* will
   played and fills the database with the *Form editor* records. This also happens automatically after each update of QFQ.
 * Configure Typoscript to include Bootstrap, jQuery, QFQ javascript and CSS files.
 
@@ -272,8 +272,8 @@ Setup a *report* to manage all *forms*:
 
 .. _install-checklist:
 
-Install Check List
-------------------
+Installation: Check List
+------------------------
 
 * Protect the directory `<T3 installation>/fileadmin/protected` in Apache against direct file access.
 
@@ -337,14 +337,6 @@ Example: *typo3conf/config.qfq.php*: ::
         // LDAP_1_PASSWORD =
     ];
 
-After parsing the configuration, the following variables will be set automatically in STORE_SYSTEM:
-
-+---------------+-----------------------------------------------------------------------------------+
-| dbNameData    | Can be used to dynamically access the current selected database: {{dbNameData:Y}} |
-+---------------+-----------------------------------------------------------------------------------+
-| dbNameQfq     | Can be used to dynamically access the current selected database: {{dbNameQfq:Y}}  |
-+---------------+-----------------------------------------------------------------------------------+
-
 .. _extension-manager-qfq-configuration:
 
 Extension Manager: QFQ Configuration
@@ -528,7 +520,7 @@ Extension Manager: QFQ Configuration
 | cssClassColumnId              | text-muted                                            | A column in a subrecord with the name id|ID|Id gets this class.            |
 +-------------------------------+-------------------------------------------------------+----------------------------------------------------------------------------+
 
-Automatically filled by QFQ:
+After parsing the configuration, the following variables will be set automatically in STORE_SYSTEM:
 
 +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
 | Keyword                       | Description                                                                                                                        |
@@ -5546,11 +5538,11 @@ Link Examples
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
 | SELECT "p:form_person|C:green" AS _link                               | <a href="?form_person"><img alttext="Check" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif"></a>                       |
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
-| SELECT "U:form=Person&r=123|x|D" as _link                             | <a href="typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234"><span class="glyphicon glyphicon-trash" ></span>"></a>                   |
+| SELECT "U:form=Person&r=123|x|D" as _link                             | <a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234"><span class="glyphicon glyphicon-trash" ></span>"></a>                |
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
-| SELECT "U:form=Person&r=123|x|t:Delete" as _link                      | <a href="typo3conf/ext/qfq/qfq/api/delete.php?s=badcaffee1234">Delete</a>                                                               |
+| SELECT "U:form=Person&r=123|x|t:Delete" as _link                      | <a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234">Delete</a>                                                            |
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
-| SELECT "s:1|d:full.pdf|M:pdf|p:id=det1&r=12|p:id=det2|F:cv.pdf|       | <a href="typo3conf/ext/qfq/qfq/api/download.php?s=badcaffee1234">Download</a>                                                           |
+| SELECT "s:1|d:full.pdf|M:pdf|p:id=det1&r=12|p:id=det2|F:cv.pdf|       | <a href="typo3conf/ext/qfq/Source/api/download.php?s=badcaffee1234">Download</a>                                                        |
 |         t:Download|a:Create complete PDF - please wait" as _link      |                                                                                                                                         |
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
 | SELECT  "y:iatae3Ieem0jeet|t:Password|o:Clipboard|b" AS _link         | <button class="btn btn-info" onClick="new QfqNS.Clipboard({text: 'iatae3Ieem0jeet'});" title='Copy to clipboard'>Password</button>      |
@@ -6740,7 +6732,7 @@ element. Such HTML element:
 
 A `<div>` example HTML output (HTML send to the browser): ::
 
-    <div class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/qfq/api/dragAndDrop.php?s=badcaffee1234">
+    <div class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Source/api/dragAndDrop.php?s=badcaffee1234">
         <div class="anyClass" id="<uniq1>" data-dnd-id="55">
             Numbero Uno
         </div>
@@ -6770,7 +6762,7 @@ A `<table>` based setup is also possible. Note the attribute  `data-columns="3"`
 which is the same column width as the outer table. ::
 
     <table>
-        <tbody class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/qfq/api/dragAndDrop.php?s=badcaffee1234" data-columns="3">
+        <tbody class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Source/api/dragAndDrop.php?s=badcaffee1234" data-columns="3">
             <tr> class="anyClass" id="<uniq1>" data-dnd-id="55">
                 <td>Numbero Uno</td><td>Numbero Uno.2</td><td>Numbero Uno.3</td>
             </tr>
@@ -7355,7 +7347,7 @@ The `AutoCron` service fires periodically jobs like `open a webpage` (typically
 actions) or `send mail`.
 
 * AutoCron will be triggered via system cron. Minimal time distance therefore is 1 minute. If this is not sufficient,
-  any process who starts `.../typo3conf/ext/qfq/qfq/external/autocron.php` via `/usr/bin/php` frequently might be used.
+  any process who starts `.../typo3conf/ext/qfq/Source/external/autocron.php` via `/usr/bin/php` frequently might be used.
 
 * Custom start time and frequency.
 * Per job:
@@ -7378,7 +7370,7 @@ Setup
 
 Cron task:  ::
 
-  * * * * * /usr/bin/php /var/www/html/typo3conf/ext/qfq/qfq/external/autocron.php
+  * * * * * /usr/bin/php /var/www/html/typo3conf/ext/qfq/Source/external/autocron.php
 
 AutoCron Jobs of type 'website' needs the php.ini setting: ::
 
diff --git a/extension/Source/core/AbstractBuildForm.php b/extension/Source/core/AbstractBuildForm.php
index 49c4e103d300aeaa2e18430a96a9021b75a9fb4b..39b74e31541630ca8e6237a7ddf1fde4eb39f08e 100644
--- a/extension/Source/core/AbstractBuildForm.php
+++ b/extension/Source/core/AbstractBuildForm.php
@@ -975,7 +975,7 @@ abstract class AbstractBuildForm {
 
         $statusHidden = ($formElement[FE_MODE] == 'hidden');
         $pattern = null;
-        if ( isset($formElement[FE_CHECK_PATTERN]) && $formElement[FE_CHECK_PATTERN] != '') {
+        if (isset($formElement[FE_CHECK_PATTERN]) && $formElement[FE_CHECK_PATTERN] != '') {
             $pattern = $statusHidden ? false : $formElement[FE_CHECK_PATTERN];
         }
 
@@ -1264,8 +1264,8 @@ abstract class AbstractBuildForm {
             $value = '';
         }
 
-        if ($formElement[FE_DECIMAL_FORMAT] !== '' ) {
-            if($value!=='') { // empty string causes exception in number_format()
+        if ($formElement[FE_DECIMAL_FORMAT] !== '') {
+            if ($value !== '') { // empty string causes exception in number_format()
                 $decimalScale = explode(',', $formElement[FE_DECIMAL_FORMAT])[1]; // scale: Nachkommastellen
                 $value = number_format($value, $decimalScale, '.', '');
             }
@@ -3247,6 +3247,7 @@ abstract class AbstractBuildForm {
      */
     public function buildDateTime(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $attribute = '';
+        $placeholder = '';
 
         $attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]);
         $attribute .= Support::doAttribute('name', $htmlFormElementName);
@@ -3312,8 +3313,10 @@ abstract class AbstractBuildForm {
             $formElement[FE_PLACEHOLDER] = $placeholder;
         }
 
-        if ($formElement[F_FE_DATA_PATTERN_ERROR] == '')
-            $formElement[F_FE_DATA_PATTERN_ERROR] = "Please match this format: $placeholder";
+        if ($formElement[F_FE_DATA_PATTERN_ERROR] == '') {
+
+            $formElement[F_FE_DATA_PATTERN_ERROR] = "Please match the format: " . $placeholder;
+        }
         $attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
 
         $attribute .= $this->getAttributeList($formElement, [FE_INPUT_AUTOCOMPLETE, 'autofocus', 'placeholder']);
diff --git a/extension/Source/core/Constants.php b/extension/Source/core/Constants.php
index f198921bdb643323717380b1b4e7aa3f75a1eb2a..a7a6ceecc197fdf77f38536cc5305f02dba6f528 100644
--- a/extension/Source/core/Constants.php
+++ b/extension/Source/core/Constants.php
@@ -12,7 +12,10 @@ const CONFIG_QFQ_PHP = "config.qfq.php";  // QFQ configuration file: db access
 const CONFIG_T3 = 'LocalConfiguration.php'; // T3 config file
 
 const GFX_INFO = 'typo3conf/ext/qfq/Resources/Public/icons/note.gif';
-const API_DIR = 'typo3conf/ext/qfq/qfq/api';
+const API_DIR = 'typo3conf/ext/qfq/Source/api';
+const API_DIR_EXT = 'Source/api';
+
+const PATH_ICONS = 'typo3conf/ext/qfq/Resources/Public/icons';
 
 const QFQ_TEMP_FILE_PATTERN = 'qfq.split.XXXXX';
 const QFQ_TEMP_SOURCE = '.temp.source';
diff --git a/extension/Source/core/helper/HelperFile.php b/extension/Source/core/helper/HelperFile.php
index 1b3d395c7813d3148b98633f14e0ce67687d50a7..b66015f972a8d0e62b69fc8b7eb2a8d0a477c7a8 100644
--- a/extension/Source/core/helper/HelperFile.php
+++ b/extension/Source/core/helper/HelperFile.php
@@ -105,7 +105,7 @@ class HelperFile {
     public static function getFileStat($pathFileName) {
         $vars = array();
 
-        if (empty($pathFileName)) {
+        if (empty($pathFileName) || !file_exists ($pathFileName)) {
             return array();
         }
 
@@ -133,7 +133,7 @@ class HelperFile {
             return $pathFileName;
         }
 
-        if (substr(getcwd(), -8) == '/qfq/api') {
+        if (substr(getcwd(), -8) == '/' . API_DIR_EXT) {
             return '../../../../../' . $pathFileName;
         }
 
diff --git a/extension/Source/core/helper/Logger.php b/extension/Source/core/helper/Logger.php
index bdd9c6e335c1277114fa768773b4216bff8bdac1..6ffce19f2e49ae5acab88741fb764dad80e476a0 100644
--- a/extension/Source/core/helper/Logger.php
+++ b/extension/Source/core/helper/Logger.php
@@ -80,7 +80,7 @@ class Logger {
     private static function relativeToT3Dir($filename) {
 
         if (isset($filename[0]) && $filename[0] != '/') {
-            if (strpos(getcwd(), '/qfq/qfq/api') !== false) {
+            if (strpos(getcwd(), 'qfq/' . API_DIR_EXT) !== false) {
                 return ('../../../../../' . $filename);
             }
         }
diff --git a/extension/Source/core/report/Define.php b/extension/Source/core/report/Define.php
deleted file mode 100644
index d02beb7de26fb6c2849f15acbf797d652da2188d..0000000000000000000000000000000000000000
--- a/extension/Source/core/report/Define.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
-define("EXTKEY", "qfq");
-define("FORMREPORT", "formreport");
-define("LENGTH_HASH", 32);
-
-// dbalias of Extension DB
-define("DB", "db");
-define("T3", "t3");
-
-// Constants for tx_form_pi1.php
-define("FR_FORM", "tx_formreport_form");
-define("FR_FORMELEMENT", "tx_formreport_formelement");
-define("FR_LOCK", "tx_formreport_lock");
-
-define("URL_HASH", "S_hash");
-define("URL_RECORD_ID", "N_r");
-define("URL_FORMNAME", "S_form");
-define("URL_FORM", "URL");
-
-
-// Definitions for doQuery()
-//define("EXPECT_0", "expect_0");
-//define("EXPECT_1", "expect_1");
-//define("EXPECT_0_1", "expect_0_1");
-//define("EXPECT_GE_0", "expect_ge_0");
-//define("EXPECT_GE_1", "expect_ge_1");
-define("EXPECT_SQL_OR_STRING", "expect_sql_or_string");
-
-define("MERGE_NONE", "merge_none");
-define("MERGE_ROW", "merge_row");
-define("MERGE_ALL", "merge_all");
-
-define("QUERY", "query");
-
-// Definitions for sanitize() strip_tags
-define("TAGS_NONE", "none");
-define("TAGS_MARKUP", "markup");
-define("TAGS_CUSTOM", "custom");
-define("TAGS_ALL", "all");
-
-// Definitions for sanitize() reaction on changed variables by sanitize them
-define("TAGS_EXCEPTION", "exception");
-define("TAGS_SANITIZE", "sanitize");
-define("TAGS_IGNORE", "ignore");
-
-// define("LIST_MARKUP_TAGS","<br><p><em><strong><code><samp><kbd><var><cite><dfn><abbr><acronym><q>");
-define("LIST_MARKUP_TAGS", "<br><p><em><strong><font><b><u><i><span><div><ol><ul><li><code><samp><kbd><var><cite><dfn><abbr><acronym><q>");
-
-define("DEBUG_SQL", "1");
-define("DEBUG_BASIC", "2");
-define("DEBUG_VERBOSE", "3");
-define("DEBUG_EXTREME", "4");
-
-// Set default values - overridden by ext_localconf.php
-define("LOCK_RECORDS_INTERVAL", "300");
-define("DFLT_UPLOAD_BASE_DIR", "fileadmin");
-define("DFLT_UPLOAD_TMP_DIR", "fileadmin/tempfiles");
-define("DFLT_UPLOAD_TMP_TTL", "300");
-
-//define("PATH_ICONS", "typo3conf/ext/qfq/Resources/Public/icons/");
-const PATH_ICONS = 'typo3conf/ext/qfq/Resources/Public/icons';
-// Definitions to allow successful include of ext_localconf.
-//define( 'TYPO3_MODE', '1' );
-//define( 'FORMREPORT', '1' );
-
diff --git a/extension/Source/core/report/Error.php b/extension/Source/core/report/Error.php
deleted file mode 100644
index 12065d42d52801fe1ed7904343a7fde55d9e30d6..0000000000000000000000000000000000000000
--- a/extension/Source/core/report/Error.php
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 Glowbase GmbH
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-namespace qfq;
-
-//use qfq;
-
-/**
- * syntaxException: Webmaster made a mistake in tt_content record or form definition
- *
- * @param    string $message
- * @param    string $code
- * @param    string $file
- * @param    string $line
- * @param    string|array $customMessage =array()   a) string: "key: value",  b) array("key1: value1","key2: value2",
- *                                       ...) - all items will be displayed on an own line in the error message.
- */
-class SyntaxReportException extends \Exception {
-    private $fr_error;
-
-    /**
-     * @param string $message
-     * @param int $code
-     * @param \Exception $previous
-     * @param            $file
-     * @param            $line
-     * @param array $customMessage
-     * @param array $fr_error
-     */
-    public function __construct($message, $code, $previous, $file, $line, $customMessage = array(), $fr_error = array()) {
-        parent::__construct($message);
-        $this->code = $code;
-        $this->file = $file;
-        $this->line = $line;
-        $this->customMessage = $customMessage;
-        $this->fr_error = $fr_error;
-
-    }
-
-    /**
-     * @return string
-     * @throws CodeException
-     * @throws UserFormException
-     * @throws UserReportException
-     */
-    public function errorMessage() {
-        $store = Store::getInstance();
-
-        // If '$this->customMessage' is a string, convert it to an array.
-        if ($this->customMessage && !is_array($this->customMessage))
-            $this->customMessage = [$this->customMessage];
-
-        //error message
-        if (Support::findInSet(SYSTEM_SHOW_DEBUG_INFO_YES, $store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM))) {
-
-            $errorMsg = nl2br("<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><br />");
-            $errorMsg .= "Formreport statement: <strong>" . htmlentities($this->fr_error["row"]) . "</strong><br />";
-
-            // Print custom messages.
-            foreach ($this->customMessage as $value) {
-                $tmparr = explode(":", $value, 2);
-                $errorMsg .= $tmparr[0] . ":<strong>" . htmlentities($tmparr[1]) . "</strong><br />";
-            }
-
-            $errorMsg .= "T3 Page pid: <strong>" . $this->fr_error["pid"] . "</strong><br />";
-            $errorMsg .= "ttcontent record uid: <strong>" . $this->fr_error["uid"] . "</strong><br />";
-            $errorMsg .= "File:  <strong>" . $this->file . "</strong><br />Line:  <strong>" . $this->line . "</strong><br />MSG: <strong>" . $this->code . "</strong><br />";
-            $errorMsg .= "StackTrace<pre>" . nl2br($this->getTraceAsString()) . "</pre><hr />";
-        } else {
-            $errorMsg = "<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><hr />";
-        }
-
-        return $errorMsg;
-
-    }  // errorMessage()
-} // class syntaxException
-
-/**
- * sqlException: An SQL-Query returned an unexpected result
- *
- * @param    string $message
- * @param    string $sql
- * @param    string $file
- * @param    string $line
- */
-class SqlReportExceptionUnused extends \Exception {
-    private $fr_error;
-
-    /**
-     * @param string $message
-     * @param int $sql
-     * @param \Exception $file
-     * @param            $line
-     * @param array $fr_error
-     */
-    public function __construct($message, $sql, $file, $line, $fr_error = array()) {
-        parent::__construct($message);
-        $this->file = $file;
-        $this->line = $line;
-        $this->sql = $sql;
-        $this->fr_error = $fr_error;
-    }
-
-    /**
-     * @return string
-     */
-    public function errorMessage() {
-//		global $BE_USER; TA: Du sollst kein global verwenden!!
-
-        $formreport = Session::get(FORMREPORT);
-        $beUserUid = ($formreport !== false && isset($formreport['be_user_uid'])) ? $formreport['be_user_uid'] : 0;
-
-        if ($GLOBALS['BE_USER']->user["uid"] > 0 || $beUserUid > 0) {
-            $errorMsg = nl2br("<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><br />MySQL:  <strong>" . mysql_error() . "</strong><hr />");
-            $errorMsg .= "SQL: <strong>" . htmlentities($this->sql) . "</strong><hr />";
-            $errorMsg .= "Formreport: <strong>" . $this->fr_error["row"] . "</strong><hr />";
-            $errorMsg .= "T3 Page pid: <strong>" . $this->fr_error["pid"] . "</strong><br>";
-            $errorMsg .= "ttcontent record uid: <strong>" . $this->fr_error["uid"] . "</strong><br />";
-            $errorMsg .= "Line: <strong>" . $this->line . "</strong><br />File: <strong>" . $this->file . "</strong><hr />";
-
-            $errorMsg .= "StackTrace<pre>" . nl2br($this->getTraceAsString()) . "</pre><hr />";
-        } else {
-            $errorMsg = "<hr />Error: <strong>" . htmlentities($this->getMessage()) . "</strong><hr />";
-        }
-
-        return $errorMsg;
-    }  // errorMessage()
-} // class sqlException
-
-/**
- * codeException: Error in formreport code
- *
- * @param    string $message
- * @param    string $file
- * @param    string $line
- */
-class CodeReportException extends \Exception {
-
-    protected $file;
-    protected $line;
-
-    /**
-     * @param string $message
-     * @param string $file
-     * @param string $line
-     */
-    public function __construct($message, $file = "undefined", $line = "undefined") {
-        parent::__construct($message);
-        $this->file = $file;
-        $this->line = $line;
-    }
-
-    /**
-     * @return string
-     */
-    public function errorMessage() {
-
-        $formreport = Session::get(FORMREPORT);
-        $beUserUid = ($formreport !== false && isset($formreport['be_user_uid'])) ? $formreport['be_user_uid'] : 0;
-        if ($GLOBALS['BE_USER']->user["uid"] > 0 || $beUserUid > 0) {
-            $errorMsg = nl2br("<hr />Error: <strong>" . $this->getMessage() . "</strong><br />File:  <strong>" . $this->file . "</strong><br />Line:  <strong>" . $this->line . "</strong><hr />");
-            $errorMsg .= "StackTrace<pre>" . nl2br($this->getTraceAsString()) . "</pre><hr />";
-        } else {
-            $errorMsg = "<hr />Error: <strong>" . $this->getMessage() . "</strong><hr />";
-        }
-
-        return $errorMsg;
-    }  // errorMessage()
-} // class codeException
-
-
-
-
diff --git a/extension/Source/core/report/Link.php b/extension/Source/core/report/Link.php
index 4fb52e884d8560f5b8278b175915f767fd755bea..ee633bc35288fcc75edb3e4906531aeba3d9f6f9 100644
--- a/extension/Source/core/report/Link.php
+++ b/extension/Source/core/report/Link.php
@@ -25,7 +25,6 @@ namespace qfq;
 
 //use qfq;
 
-require_once(__DIR__ . '/Define.php');
 require_once(__DIR__ . '/../store/Store.php');
 require_once(__DIR__ . '/../store/Sip.php');
 require_once(__DIR__ . '/../exceptions/UserReportException.php');
diff --git a/extension/Source/core/report/Monitor.php b/extension/Source/core/report/Monitor.php
index 70c50598d7c33de3d22cf8dd3fa646aaba0792d5..af2751c902ba4711435d80ca85a54d9b85cd6b53 100644
--- a/extension/Source/core/report/Monitor.php
+++ b/extension/Source/core/report/Monitor.php
@@ -77,7 +77,7 @@ class Monitor {
             '&' . TOKEN_L_TAIL . '=' . $vars[TOKEN_L_TAIL] .
             '&' . TOKEN_L_APPEND . '=' . $vars[TOKEN_L_APPEND];
 //        $url = store::getSipInstance()->queryStringToSip(API_DIR . '/' . API_DOWNLOAD_PHP . '?' . $queryString, RETURN_URL);
-        $arr = store::getSipInstance()->queryStringToSip('../../../qfq/api/' . API_DOWNLOAD_PHP . '?' . $queryString, RETURN_ARRAY);
+        $arr = store::getSipInstance()->queryStringToSip('../../../'. API_DIR_EXT . '/' . API_DOWNLOAD_PHP . '?' . $queryString, RETURN_ARRAY);
         $url = $arr[SIP_SIP_URL];
 
         // On page reload, take care to remove optional exsiting old seek position.
diff --git a/extension/Source/core/report/Report.php b/extension/Source/core/report/Report.php
index 3be4ed3507045b9b587c31a536d80596cc7b8377..dcfb157d9a79d69b75c7eeb69b2daf3f07c58fd7 100644
--- a/extension/Source/core/report/Report.php
+++ b/extension/Source/core/report/Report.php
@@ -25,9 +25,7 @@ namespace qfq;
 
 //use qfq;
 
-require_once(__DIR__ . '/Define.php');
 require_once(__DIR__ . '/Variables.php');
-//require_once(__DIR__ . '/Error.php');
 require_once(__DIR__ . '/../database/Database.php');
 require_once(__DIR__ . '/Link.php');
 require_once(__DIR__ . '/SendMail.php');
@@ -36,7 +34,6 @@ require_once(__DIR__ . '/../Evaluate.php');
 require_once(__DIR__ . '/../helper/KeyValueStringParser.php');
 require_once(__DIR__ . '/../helper/Token.php');
 require_once(__DIR__ . '/Thumbnail.php');
-//require_once(__DIR__ . '/Monitor.php');
 
 const DEFAULT_QUESTION = 'question';
 const DEFAULT_ICON = 'icon';
@@ -571,12 +568,15 @@ class Report {
                 $sql = $this->variables->doVariables($this->frArray[$fullLevel . "." . TOKEN_ALT_SQL]);
                 if (!empty($sql)) {
                     $result = $this->db->sql($sql, ROW_KEYS, array(), '', $keys, $stat);
-                    foreach ($result as $row) {
-                        $rowIndex = 0;
-                        $contentLevel .= $this->collectRow($row, $keys, $fullLevel, $rowIndex);
+                    if(is_array($result)) {
+                        foreach ($result as $row) {
+                            $rowIndex = 0;
+                            $contentLevel .= $this->collectRow($row, $keys, $fullLevel, $rowIndex);
+                        }
                     }
                 }
             }
+
             $contentLevel .= $this->variables->doVariables($this->frArray[$fullLevel . "." . TOKEN_STAIL]);
 
             $token = $this->frArray[$fullLevel . "." . TOKEN_CONTENT];
diff --git a/extension/Source/core/report/Variables.php b/extension/Source/core/report/Variables.php
index 5ca12240b5c7747bfdc25f9b127a8dc968f05014..edc695dbd0bd3fc256cea3d3b7c53492ed42dc0e 100644
--- a/extension/Source/core/report/Variables.php
+++ b/extension/Source/core/report/Variables.php
@@ -147,8 +147,8 @@ class Variables {
         }
 
         if (isset($GLOBALS["TSFE"]->fe_user)) {
-            $arr["fe_user_uid"] = $GLOBALS["TSFE"]->fe_user->user["uid"] ?: '-';
-            $arr["fe_user"] = $GLOBALS["TSFE"]->fe_user->user["username"] ?: '-';
+            $arr["fe_user_uid"] = $GLOBALS["TSFE"]->fe_user->user["uid"] ?? '-';
+            $arr["fe_user"] = $GLOBALS["TSFE"]->fe_user->user["username"] ?? '-';
         } else {
             $arr["fe_user_uid"] = '-';
             $arr["fe_user"] = '-';
@@ -161,26 +161,6 @@ class Variables {
             $arr["page_type"] = $GLOBALS["TSFE"]->type;
             $arr["page_language_uid"] = $GLOBALS["TSFE"]->sys_language_uid;
         }
-        // Add all variables from ext_localconf
-        //		database aliases can be used in form sql queries (e.g. select * from "{{global.t3_name}}".fe_users...)
-        //		localconf can be used to configure an application
-        $tmp = array();
-        if (isset($GLOBALS['TYPO3_CONF_VARS'][FORMREPORT])) {
-            $this->linearizeArray($GLOBALS['TYPO3_CONF_VARS'][FORMREPORT], $tmp);
-        }
-
-        // remove anything that contains "_password" "_username" in the key to prevent the webmaster from doing something stupid
-        foreach ($tmp as $key => $value) {
-            if (!strstr($key, "_password") && !strstr($key, "_username"))
-                $arr[$key] = $value;
-        }
-
-        // Add t3 db name too
-//        require(PATH_typo3conf.'localconf.php');
-        //TODO: $typo_db kommt von T3: PHPSTorm weiss das nicht und meckert hier. Es ist auch nicht gut das die globale Variable genommen wird. Umbauen auf etwas sinnvollerers!
-        //TODO: DBAlias sinnvoll setzen
-        $typo_db = '';
-        $arr["t3_name"] = $typo_db;
 
         return ($arr);
     }
diff --git a/javascript/src/QfqPage.js b/javascript/src/QfqPage.js
index 472bb30fca052009d83b0deee5284251c5b8f3b5..bfebf4ce98386af84d46d68a10a38dd778b9852b 100644
--- a/javascript/src/QfqPage.js
+++ b/javascript/src/QfqPage.js
@@ -29,13 +29,13 @@ var QfqNS = QfqNS || {};
             {
                 tabsId: "qfqTabs",
                 formId: "qfqForm",
-                submitTo: "typo3conf/ext/qfq/qfq/api/save.php",
-                deleteUrl: "typo3conf/ext/qfq/qfq/api/delete.php",
-                refreshUrl: "typo3conf/ext/qfq/qfq/api/load.php",
-                fileUploadTo: "typo3conf/ext/qfq/qfq/api/upload.php",
-                fileDeleteUrl: "typo3conf/ext/qfq/qfq/api/filedelete.php",
-                typeAheadUrl: "typo3conf/ext/qfq/qfq/api/typeahead.php",
-                dirtyUrl: "typo3conf/ext/qfq/qfq/api/dirty.php",
+                submitTo: "typo3conf/ext/qfq/Source/api/save.php",
+                deleteUrl: "typo3conf/ext/qfq/Source/api/delete.php",
+                refreshUrl: "typo3conf/ext/qfq/Source/api/load.php",
+                fileUploadTo: "typo3conf/ext/qfq/Source/api/upload.php",
+                fileDeleteUrl: "typo3conf/ext/qfq/Source/api/filedelete.php",
+                typeAheadUrl: "typo3conf/ext/qfq/Source/api/typeahead.php",
+                dirtyUrl: "typo3conf/ext/qfq/Source/api/dirty.php",
                 pageState: new n.PageState()
             }, settings
         );