Commit 9566e140 authored by Marc Egger's avatar Marc Egger Committed by Carsten Rose
Browse files

Switch to psr4 composer

parent 1a63db46
...@@ -58,7 +58,7 @@ Bug Fixes ...@@ -58,7 +58,7 @@ Bug Fixes
^^^^^^^^^ ^^^^^^^^^
* Fix uniqIdQfq() - returned always badcaffeee1234 * Fix uniqIdQfq() - returned always badcaffeee1234
* Refactor functions.sql to function.sql. Implement constants for Version numbers. * Refactor function.sql to function.sql. Implement constants for Version numbers.
* Update NewDoc.md * Update NewDoc.md
Version 19.6.0 Version 19.6.0
...@@ -495,7 +495,7 @@ Notes ...@@ -495,7 +495,7 @@ Notes
* Autocron: update the system crontab entry to the new path (old 'qfq', new 'Source'): * Autocron: update the system crontab entry to the new path (old 'qfq', new 'Source'):
.../typo3conf/ext/qfq/Source/external/autocron.php .../typo3conf/ext/qfq/Classes/External/autocron.php
Features Features
^^^^^^^^ ^^^^^^^^
...@@ -513,7 +513,7 @@ Features ...@@ -513,7 +513,7 @@ Features
to FormEditor example page. to FormEditor example page.
* Move bootstrap.php and BindParamTest.php due to refactoring. * Move bootstrap.php and BindParamTest.php due to refactoring.
* phpunit.xml: implement const 'PHPUNIT_QFQ'. Store.php: set self::$phpUnit on const 'PHPUNIT_QFQ' * phpunit.xml: implement const 'PHPUNIT_QFQ'. Store.php: set self::$phpUnit on const 'PHPUNIT_QFQ'
* Refactor: 'extension/qfq/qfq/...' to 'extension/Source/core/...' * Refactor: 'extension/qfq/qfq/...' to 'extension/Classes/Core/...'
* Refactor: Manual.rst update config variables (reorder), add 'qfqLog'. Support.php: formSubmitLog hardcoded to * Refactor: Manual.rst update config variables (reorder), add 'qfqLog'. Support.php: formSubmitLog hardcoded to
fileadmin/protected/log. DOCUMENTATION_QFQ > SYSTEM_DOCUMENTATION_QFQ. Remove config var 'logDir'. fileadmin/protected/log. DOCUMENTATION_QFQ > SYSTEM_DOCUMENTATION_QFQ. Remove config var 'logDir'.
* Refactor: SITE_PATH >> sitePath, EXT_PATH >> extPath, SYSTEM_PATH_EXT >> SYSTEM_EXT_PATH * Refactor: SITE_PATH >> sitePath, EXT_PATH >> extPath, SYSTEM_PATH_EXT >> SYSTEM_EXT_PATH
......
...@@ -135,7 +135,7 @@ Different browser prints the same page in different variations. To prevent this, ...@@ -135,7 +135,7 @@ Different browser prints the same page in different variations. To prevent this,
Provide a `print this page`-link (replace 'current pageId' ):: Provide a `print this page`-link (replace 'current pageId' )::
<a href="typo3conf/ext/qfq/Source/api/print.php?id={current pageId}">Print this page</a> <a href="typo3conf/ext/qfq/Classes/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. Any parameter specified after `print.php` will be delivered to `wkhtmltopdf` as part of the URL.
...@@ -143,7 +143,7 @@ Typoscript code to implement a print link on every page:: ...@@ -143,7 +143,7 @@ Typoscript code to implement a print link on every page::
10 = TEXT 10 = TEXT
10 { 10 {
wrap = <a href="typo3conf/ext/qfq/Source/api/print.php?id=|&type=99"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a> wrap = <a href="typo3conf/ext/qfq/Classes/api/print.php?id=|&type=99"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a>
data = page:uid data = page:uid
} }
...@@ -5775,11 +5775,11 @@ Link Examples ...@@ -5775,11 +5775,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 "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/Source/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/Classes/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/Source/api/delete.php?s=badcaffee1234">Delete</a> | | SELECT "U:form=Person&r=123|x|t:Delete" as _link | <a href="typo3conf/ext/qfq/Classes/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/Source/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/Classes/api/download.php?s=badcaffee1234">Download</a> |
| t:Download|a:Create complete PDF - please wait" as _link | | | 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> | | 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> |
...@@ -7015,7 +7015,7 @@ element. Such HTML element: ...@@ -7015,7 +7015,7 @@ element. Such HTML element:
A `<div>` example HTML output (HTML send to the browser): :: A `<div>` example HTML output (HTML send to the browser): ::
<div class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Source/api/dragAndDrop.php?s=badcaffee1234"> <div class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Classes/api/dragAndDrop.php?s=badcaffee1234">
<div class="anyClass" id="<uniq1>" data-dnd-id="55"> <div class="anyClass" id="<uniq1>" data-dnd-id="55">
Numbero Uno Numbero Uno
</div> </div>
...@@ -7045,7 +7045,7 @@ A `<table>` based setup is also possible. Note the attribute `data-columns="3"` ...@@ -7045,7 +7045,7 @@ A `<table>` based setup is also possible. Note the attribute `data-columns="3"`
which is the same column width as the outer table. :: which is the same column width as the outer table. ::
<table> <table>
<tbody class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Source/api/dragAndDrop.php?s=badcaffee1234" data-columns="3"> <tbody class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Classes/api/dragAndDrop.php?s=badcaffee1234" data-columns="3">
<tr> class="anyClass" id="<uniq1>" data-dnd-id="55"> <tr> class="anyClass" id="<uniq1>" data-dnd-id="55">
<td>Numbero Uno</td><td>Numbero Uno.2</td><td>Numbero Uno.3</td> <td>Numbero Uno</td><td>Numbero Uno.2</td><td>Numbero Uno.3</td>
</tr> </tr>
...@@ -7608,24 +7608,24 @@ four most used REST HTTP methods: ...@@ -7608,24 +7608,24 @@ four most used REST HTTP methods:
GET - Read GET - Read
Shows a list of database records or a single record. The QFQ form holds the definition which and what to show. Shows a list of database records or a single record. The QFQ form holds the definition which and what to show.
List: ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/`` List: ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/``
Data (id=123): ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123`` Data (id=123): ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123``
POST - Create new record POST - Create new record
The QFQ form defines wich columns will be written in which table. Most of QFQ Form functionality can be used. Example: The QFQ form defines wich columns will be written in which table. Most of QFQ Form functionality can be used. Example:
``curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/" -d '{"name":"Miller","firstname":"Joe"}'`` ``curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/" -d '{"name":"Miller","firstname":"Joe"}'``
PUT - Update a record PUT - Update a record
Similar to POST, but a given record will be updated. Similar to POST, but a given record will be updated.
``curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123" -d '{"name":"Miller","firstname":"Joe"}'`` ``curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123" -d '{"name":"Miller","firstname":"Joe"}'``
DELETE - Delete a record DELETE - Delete a record
Similar to a QFQ Delete form. Similar to a QFQ Delete form.
``curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123"`` ``curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123"``
All data will imported / exported in JSON notation. All data will imported / exported in JSON notation.
...@@ -7636,19 +7636,19 @@ Endpoint ...@@ -7636,19 +7636,19 @@ Endpoint
.. tip:: .. tip::
The basic REST API endpoint: ``<domain>/typo3conf/ext/qfq/Source/api/rest.php`` The basic REST API endpoint: ``<domain>/typo3conf/ext/qfq/Classes/api/rest.php``
``<domain>/typo3conf/ext/qfq/Source/api/rest.php/<level1>/<id1>/<level2>/<id2>/.../?<var1>=<value1>&...`` ``<domain>/typo3conf/ext/qfq/Classes/api/rest.php/<level1>/<id1>/<level2>/<id2>/.../?<var1>=<value1>&...``
Append level names and ids after `.../rest.php/`, each separated by '/' . Append level names and ids after `.../rest.php/`, each separated by '/' .
E.g.: E.g.:
1. List of all persons: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person` 1. List of all persons: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person`
2. Data of person 123: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person/123` 2. Data of person 123: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person/123`
3. Adresses of person 123: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person/123/address` 3. Adresses of person 123: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person/123/address`
4. Adress details of address 45 from person 123: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person/123/address/45` 4. Adress details of address 45 from person 123: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person/123/address/45`
QFQ 'Forms' are used as a 'container' (to define all details). QFQ 'Forms' are used as a 'container' (to define all details).
...@@ -7862,7 +7862,7 @@ Example: :: ...@@ -7862,7 +7862,7 @@ Example: ::
form.parameter.restToken=myCrypticString0123456789 form.parameter.restToken=myCrypticString0123456789
Test via commandline: curl -X GET -H 'Authorization: Token token=myCrypticString0123456789' "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123/address/" Test via commandline: curl -X GET -H 'Authorization: Token token=myCrypticString0123456789' "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123/address/"
The static setup with ``form.parameter.restToken=myCrypticString0123456789`` is fine, as long as only one token The static setup with ``form.parameter.restToken=myCrypticString0123456789`` is fine, as long as only one token
exist. In case of multiple tokens, replace the static string against a SQL query. exist. In case of multiple tokens, replace the static string against a SQL query.
...@@ -7899,7 +7899,7 @@ The `AutoCron` service fires periodically jobs like `open a webpage` (typically ...@@ -7899,7 +7899,7 @@ The `AutoCron` service fires periodically jobs like `open a webpage` (typically
actions) or `send mail`. actions) or `send mail`.
* AutoCron will be triggered via system cron. Minimal time distance therefore is 1 minute. If this is not sufficient, * 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/Source/external/autocron.php` via `/usr/bin/php` frequently might be used. any process who starts `.../typo3conf/ext/qfq/Classes/External/autocron.php` via `/usr/bin/php` frequently might be used.
* Custom start time and frequency. * Custom start time and frequency.
* Per job: * Per job:
...@@ -7922,7 +7922,7 @@ Setup ...@@ -7922,7 +7922,7 @@ Setup
Cron task: :: Cron task: ::
* * * * * /usr/bin/php /var/www/html/typo3conf/ext/qfq/Source/external/autocron.php * * * * * /usr/bin/php /var/www/html/typo3conf/ext/qfq/Classes/External/autocron.php
AutoCron Jobs of type 'website' needs the php.ini setting: :: AutoCron Jobs of type 'website' needs the php.ini setting: ::
......
...@@ -58,7 +58,7 @@ Bug Fixes ...@@ -58,7 +58,7 @@ Bug Fixes
^^^^^^^^^ ^^^^^^^^^
* Fix uniqIdQfq() - returned always badcaffeee1234 * Fix uniqIdQfq() - returned always badcaffeee1234
* Refactor functions.sql to function.sql. Implement constants for Version numbers. * Refactor function.sql to function.sql. Implement constants for Version numbers.
* Update NewDoc.md * Update NewDoc.md
Version 19.6.0 Version 19.6.0
...@@ -495,7 +495,7 @@ Notes ...@@ -495,7 +495,7 @@ Notes
* Autocron: update the system crontab entry to the new path (old 'qfq', new 'Source'): * Autocron: update the system crontab entry to the new path (old 'qfq', new 'Source'):
.../typo3conf/ext/qfq/Source/external/autocron.php .../typo3conf/ext/qfq/Classes/External/autocron.php
Features Features
^^^^^^^^ ^^^^^^^^
...@@ -513,7 +513,7 @@ Features ...@@ -513,7 +513,7 @@ Features
to FormEditor example page. to FormEditor example page.
* Move bootstrap.php and BindParamTest.php due to refactoring. * Move bootstrap.php and BindParamTest.php due to refactoring.
* phpunit.xml: implement const 'PHPUNIT_QFQ'. Store.php: set self::$phpUnit on const 'PHPUNIT_QFQ' * phpunit.xml: implement const 'PHPUNIT_QFQ'. Store.php: set self::$phpUnit on const 'PHPUNIT_QFQ'
* Refactor: 'extension/qfq/qfq/...' to 'extension/Source/core/...' * Refactor: 'extension/qfq/qfq/...' to 'extension/Classes/Core/...'
* Refactor: Manual.rst update config variables (reorder), add 'qfqLog'. Support.php: formSubmitLog hardcoded to * Refactor: Manual.rst update config variables (reorder), add 'qfqLog'. Support.php: formSubmitLog hardcoded to
fileadmin/protected/log. DOCUMENTATION_QFQ > SYSTEM_DOCUMENTATION_QFQ. Remove config var 'logDir'. fileadmin/protected/log. DOCUMENTATION_QFQ > SYSTEM_DOCUMENTATION_QFQ. Remove config var 'logDir'.
* Refactor: SITE_PATH >> sitePath, EXT_PATH >> extPath, SYSTEM_PATH_EXT >> SYSTEM_EXT_PATH * Refactor: SITE_PATH >> sitePath, EXT_PATH >> extPath, SYSTEM_PATH_EXT >> SYSTEM_EXT_PATH
......
...@@ -8,7 +8,7 @@ RELEASE_DATE = $(shell date '+%Y%m%d%H%M') ...@@ -8,7 +8,7 @@ RELEASE_DATE = $(shell date '+%Y%m%d%H%M')
GIT_REVISION_SHORT = $(shell git rev-parse --short HEAD || true) GIT_REVISION_SHORT = $(shell git rev-parse --short HEAD || true)
GIT_REVISION_LONG = $(shell git rev-parse HEAD || true) GIT_REVISION_LONG = $(shell git rev-parse HEAD || true)
EXTENSION_CONTENT = Classes Configuration Source Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config.qfq.example.php RELEASE.txt vendor EXTENSION_CONTENT = Classes Configuration Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config.qfq.example.php RELEASE.txt vendor
DISTDIR=dist DISTDIR=dist
......
...@@ -4,6 +4,13 @@ ...@@ -4,6 +4,13 @@
"description": "Framework to build web applications: Form generator (bootstrap based), dynamic update, typeahead, multi language, image annotation (via fabric), reports (defined via SQL), SIP protected links, PDF rendering, send mail (dynamic attachments, PDFs), multiple databases, record locking, secure up/download.", "description": "Framework to build web applications: Form generator (bootstrap based), dynamic update, typeahead, multi language, image annotation (via fabric), reports (defined via SQL), SIP protected links, PDF rendering, send mail (dynamic attachments, PDFs), multiple databases, record locking, secure up/download.",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"require": { "require": {
"typo3/cms-core": "^8.7" "typo3/cms-core": "^8.7",
"ext-json": "*",
"ext-apache": "*",
"ext-mysqli": "*",
"ext-fileinfo": "*",
"ext-ldap": "*",
"ext-intl": "*",
"ext-iconv": "*"
} }
} }
\ No newline at end of file
...@@ -12,11 +12,11 @@ General Concept ...@@ -12,11 +12,11 @@ General Concept
* There is one PHP file to handle all REST calls: * There is one PHP file to handle all REST calls:
typo3conf/ext/qfq/Source/api/rest.php typo3conf/ext/qfq/Classes/api/rest.php
* All further endpoints are appended after rest.php, seperated by '/'. Example: * All further endpoints are appended after rest.php, seperated by '/'. Example:
http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/1/restAddress/123?myEmail=jonni@miller.com http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/1/restAddress/123?myEmail=jonni@miller.com
The argument 'myEmail' is just to show how GET variables will be submitted. The argument 'myEmail' is just to show how GET variables will be submitted.
...@@ -39,7 +39,7 @@ GET - export ...@@ -39,7 +39,7 @@ GET - export
Example: Example:
curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson" curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson"
Details: Details:
...@@ -55,7 +55,7 @@ POST - insert ...@@ -55,7 +55,7 @@ POST - insert
Example: Example:
curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson" -d '{"name":"Miller","firstname":"Jonni"}' curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson" -d '{"name":"Miller","firstname":"Jonni"}'
Details: Details:
...@@ -69,7 +69,7 @@ PUT - update ...@@ -69,7 +69,7 @@ PUT - update
Example: Example:
curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/1" -d '{"name":"Miller","firstname":"Jonni"}' curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/1" -d '{"name":"Miller","firstname":"Jonni"}'
Details: Details:
...@@ -83,7 +83,7 @@ Delete ...@@ -83,7 +83,7 @@ Delete
Example: Example:
curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/1" curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/1"
Details: Details:
...@@ -97,7 +97,7 @@ Header Token Authorization ...@@ -97,7 +97,7 @@ Header Token Authorization
Example: Example:
curl -X GET -H 'Authorization: Token token="mySuperSecretToken"' "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/" curl -X GET -H 'Authorization: Token token="mySuperSecretToken"' "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/"
Static token Static token
------------ ------------
...@@ -120,6 +120,6 @@ Append the GET variable `?XDEBUG_SESSION_START=1` ...@@ -120,6 +120,6 @@ Append the GET variable `?XDEBUG_SESSION_START=1`
Example: Example:
curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson?XDEBUG_SESSION_START=1" -d '{"name":"Miller","firstname":"Jonni"}' curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson?XDEBUG_SESSION_START=1" -d '{"name":"Miller","firstname":"Jonni"}'
PhpStorm with activated debugger will stop at any breakpoint and 'stepping' through the code is possible. PhpStorm with activated debugger will stop at any breakpoint and 'stepping' through the code is possible.
...@@ -6,14 +6,13 @@ ...@@ -6,14 +6,13 @@
* Time: 6:16 PM * Time: 6:16 PM
*/ */
namespace qfq; namespace IMATHUZH\Qfq\Api;
use qfq; require_once(__DIR__ . '/../../vendor/autoload.php');
use IMATHUZH\Qfq\Core\QuickFormQuery;
use IMATHUZH\Qfq\Core\Store\Store;
require_once(__DIR__ . '/../core/QuickFormQuery.php');
require_once(__DIR__ . '/../core/store/Store.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/exceptions/CodeException.php');
/** /**
...@@ -75,7 +74,7 @@ $flagSuccess = false; ...@@ -75,7 +74,7 @@ $flagSuccess = false;
try { try {
try { try {
$qfq = new \qfq\QuickFormQuery(['bodytext' => '']); $qfq = new QuickFormQuery(['bodytext' => '']);
$answer = $qfq->delete(); $answer = $qfq->delete();
...@@ -100,7 +99,7 @@ try { ...@@ -100,7 +99,7 @@ try {
case MODE_HTML: case MODE_HTML:
if ($targetUrl === false || $targetUrl === '') { if ($targetUrl === false || $targetUrl === '') {
throw new CodeException('Missing target URL', ERROR_MISSING_VALUE); throw new \CodeException('Missing target URL', ERROR_MISSING_VALUE);
} }
if ($flagSuccess) { if ($flagSuccess) {
...@@ -109,11 +108,11 @@ try { ...@@ -109,11 +108,11 @@ try {
break; break;
default: default:
throw new CodeException('Unknown mode: ' . $modeAnswer, ERROR_UNKNOWN_MODE); throw new \CodeException('Unknown mode: ' . $modeAnswer, ERROR_UNKNOWN_MODE);
break; break;
} }
} catch (qfq\UserFormException $e) { } catch (\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage(); $answer[API_MESSAGE] = $e->formatMessage();
$val = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM); $val = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM);
...@@ -126,9 +125,9 @@ try { ...@@ -126,9 +125,9 @@ try {
$answer[API_FIELD_MESSAGE] = $val; $answer[API_FIELD_MESSAGE] = $val;
} }
} catch (qfq\CodeException $e) { } catch (\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage(); $answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) { } catch (\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage(); $answer[API_MESSAGE] = $e->formatMessage();
} }
......
...@@ -6,13 +6,11 @@ ...@@ -6,13 +6,11 @@
* Time: 6:17 PM * Time: 6:17 PM
*/ */
namespace IMATHUZH\Qfq\Api;
namespace qfq; require_once(__DIR__ . '/../../vendor/autoload.php');
use qfq; use IMATHUZH\Qfq\Core\Form\Dirty;
require_once(__DIR__ . '/../core/form/Dirty.php');
require_once(__DIR__ . '/../core/Constants.php');
/** /**
...@@ -20,7 +18,7 @@ require_once(__DIR__ . '/../core/Constants.php'); ...@@ -20,7 +18,7 @@ require_once(__DIR__ . '/../core/Constants.php');
* *
*/ */
try { try {
$dirty = new \qfq\Dirty(); $dirty = new Dirty();
$answer = $dirty->process(); $answer = $dirty->process();
......
...@@ -8,19 +8,14 @@ ...@@ -8,19 +8,14 @@
* Check: CODING.md > Download * Check: CODING.md > Download
*/ */
namespace qfq; namespace IMATHUZH\Qfq\Api;
use qfq; require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/report/Download.php'); use IMATHUZH\Qfq\Core\Report\Download;
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/exceptions/DownloadException.php');
require_once(__DIR__ . '/../core/exceptions/CodeException.php');
require_once(__DIR__ . '/../core/exceptions/DbException.php');
require_once(__DIR__ . '/../core/exceptions/ErrorHandler.php');
set_error_handler("\\qfq\\ErrorHandler::exception_error_handler"); set_error_handler("\\IMATHUZH\\Qfq\\Core\\Exception\\ErrorHandler::exception_error_handler");
$output = ''; $output = '';
...@@ -31,11 +26,11 @@ try { ...@@ -31,11 +26,11 @@ try {
// If all is fine: process() will output file via print() !! // If all is fine: process() will output file via print() !!
$output = $download->process(STORE_SIP, OUTPUT_MODE_DIRECT); $output = $download->process(STORE_SIP, OUTPUT_MODE_DIRECT);
} catch (qfq\CodeException $e) { } catch (\CodeException $e) {
$output = $e->formatMessage(); $output = $e->formatMessage();
} catch (qfq\DbException $e) { } catch (\DbException $e) {
$output = $e->formatMessage(); $output = $e->formatMessage();
} catch (qfq\DownloadException $e) { } catch (\DownloadException $e) {
$output = $e->formatMessage(); $output = $e->formatMessage();
} }
} catch (\Exception $e) { } catch (\Exception $e) {
......
...@@ -6,18 +6,12 @@ ...@@ -6,18 +6,12 @@
* Time: 6:17 PM * Time: 6:17 PM
*/ */
namespace qfq; namespace IMATHUZH\Qfq\Api;
use qfq; require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/store/Store.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/QuickFormQuery.php');
//require_once(__DIR__ . '/../qfq/exceptions/UserFormException.php');
//require_once(__DIR__ . '/../qfq/exceptions/CodeException.php');
//require_once(__DIR__ . '/../qfq/exceptions/DbException.php');
//require_once(__DIR__ . '/../qfq/exceptions/ErrorHandler.php');
use IMATHUZH\Qfq\Core\QuickFormQuery;
/** /**
* Return JSON encoded answer * Return JSON encoded answer
...@@ -68,11 +62,11 @@ try { ...@@ -68,11 +62,11 @@ try {
// unset($answer[API_FORM_UPDATE][API_ELEMENT_UPDATE]); // unset($answer[API_FORM_UPDATE][API_ELEMENT_UPDATE]);
// $answer[API_ELEMENT_UPDATE] = [ 'dynamic-125' => [ 'content' => 'latest news', 'attr' => [ 'title' => 'latest title'] ] ]; // $answer[API_ELEMENT_UPDATE] = [ 'dynamic-125' => [ 'content' => 'latest news', 'attr' => [ 'title' => 'latest title'] ] ];
} catch (qfq\UserFormException $e) { } catch (\UserFormException $e) {