Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
0a20e3c
comments
cedricfrancoys Nov 20, 2023
d5bbc4a
added log field
cedricfrancoys Nov 20, 2023
fe6455d
added ignore rule for messages already marked as sent
cedricfrancoys Nov 20, 2023
18d1386
Merge branch 'dev-2.0' of https://github.com/equalframework/equal int…
cedricfrancoys Nov 20, 2023
410cc0e
comments
cedricfrancoys Nov 20, 2023
0c2e631
comments
cedricfrancoys Nov 20, 2023
19b2f77
edited properties of computed type
f7ed0 Nov 21, 2023
7d11e39
corrected some errors in update-controller
f7ed0 Nov 21, 2023
d8a7369
corrected some errors in update-controller
f7ed0 Nov 21, 2023
a25e740
fixed lang ref for cache in store()
cedricfrancoys Nov 23, 2023
746b49d
fixed syntax errors
cedricfrancoys Nov 23, 2023
dbdacf4
added support for custom domain in auth cookie
cedricfrancoys Nov 23, 2023
321e272
fixed mailMessage object ref
cedricfrancoys Nov 23, 2023
4452453
comments
cedricfrancoys Nov 23, 2023
4b4eff4
comments
cedricfrancoys Nov 23, 2023
8179098
marked as deprecated
cedricfrancoys Nov 23, 2023
e729453
added schema to response
cedricfrancoys Nov 23, 2023
e55f600
added usage to entity param
cedricfrancoys Nov 23, 2023
cab8836
prevented events callbacks when creating an object + minor fixes
cedricfrancoys Nov 23, 2023
fd7b45b
comments
cedricfrancoys Nov 23, 2023
bb09ff0
splitted creation and update calls
cedricfrancoys Nov 23, 2023
db93a3e
added workbench submodule
f7ed0 Nov 24, 2023
cf2d624
added workbench's submodule
f7ed0 Nov 24, 2023
5622f6b
checked out workbench to dev
f7ed0 Nov 24, 2023
0552013
edited directory for workbench
f7ed0 Nov 24, 2023
7180fdf
updated workbench
f7ed0 Nov 24, 2023
09b4c30
updated R_ constants
cedricfrancoys Nov 27, 2023
a9f49da
updated contant name
cedricfrancoys Nov 27, 2023
bc70cb7
marked rights_txt as a dependency of rights
cedricfrancoys Nov 27, 2023
2a22a4e
updated constants names
cedricfrancoys Nov 27, 2023
f34f2e1
updated output format
cedricfrancoys Nov 27, 2023
d5c8cce
fixed isAllowed call
cedricfrancoys Nov 27, 2023
1c88c07
fixed isAllowed call
cedricfrancoys Nov 27, 2023
a831ddb
fixed isAllowed call
cedricfrancoys Nov 27, 2023
1b0e1ad
syntax
cedricfrancoys Nov 27, 2023
7807c0c
removed sql check for existing objects + log fix
cedricfrancoys Nov 27, 2023
e8bcef0
updaetd getUserRights
cedricfrancoys Nov 27, 2023
b5e90b2
added menu support
f7ed0 Nov 29, 2023
560205c
add a controller to run console in terminal
Nov 30, 2023
1dd4a8c
remove error white variable error unknown
Nov 30, 2023
0cb3d86
fix search param time, remove error php variable, display messages in…
Dec 1, 2023
63deb61
Merge pull request #81 from swann-martin/controller-console
cedricfrancoys Dec 1, 2023
c9b5ede
Merge pull request #80 from f7ed0/controller_bind
cedricfrancoys Dec 1, 2023
e6f428a
increased size for params
cedricfrancoys Dec 1, 2023
df5f2e3
added date.short.day
cedricfrancoys Dec 1, 2023
85b0585
Merge branch 'dev-2.0' of https://github.com/equalframework/equal int…
cedricfrancoys Dec 1, 2023
2c65861
restored file permissions
Dec 1, 2023
d269483
Merge branch 'dev-2.0' of https://github.com/equalframework/equal int…
cedricfrancoys Dec 1, 2023
fd12535
fixed for cross-env & changed layout minor
cedricfrancoys Dec 1, 2023
98845ce
minor fix
cedricfrancoys Dec 1, 2023
e423ef0
added
cedricfrancoys Dec 4, 2023
879117e
added
cedricfrancoys Dec 4, 2023
9578905
comments
cedricfrancoys Dec 4, 2023
0332f3e
comments
cedricfrancoys Dec 4, 2023
fad5138
added
cedricfrancoys Dec 4, 2023
343a6a1
improved (removed unnecessary)
cedricfrancoys Dec 4, 2023
bcc8c9d
comments
cedricfrancoys Dec 4, 2023
b9bfd7d
moved to apps
cedricfrancoys Dec 4, 2023
4bd21b2
added tests
cedricfrancoys Dec 4, 2023
f029b66
fixed missing use statement (Locale)
cedricfrancoys Dec 4, 2023
41e6398
updated action handler
cedricfrancoys Dec 4, 2023
c8ed832
updated layout
cedricfrancoys Dec 4, 2023
c471e60
syntax
cedricfrancoys Dec 4, 2023
13ddd99
improved layout
cedricfrancoys Dec 4, 2023
a4ee5c1
refactored code
cedricfrancoys Dec 4, 2023
4ccc9be
fixed invoked controller
cedricfrancoys Dec 4, 2023
1a4cb34
improved layout
cedricfrancoys Dec 4, 2023
fba9e71
added getRole()
cedricfrancoys Dec 5, 2023
3b1b835
updated
cedricfrancoys Dec 8, 2023
d0eb2b5
updated
cedricfrancoys Dec 8, 2023
2976b04
updated
cedricfrancoys Dec 8, 2023
a78243b
updated
cedricfrancoys Dec 8, 2023
8ffc1e5
updated
cedricfrancoys Dec 8, 2023
1cb56eb
updated
cedricfrancoys Dec 8, 2023
25e3a5d
updated
cedricfrancoys Dec 8, 2023
42d93eb
updated
cedricfrancoys Dec 8, 2023
ccd7e78
updated
cedricfrancoys Dec 8, 2023
755ae70
Added init data cli logger and console 2
f7ed0 Dec 8, 2023
49e4684
added test on returned header (is_array)
cedricfrancoys Dec 10, 2023
19ad54b
added support for sqlite
cedricfrancoys Dec 10, 2023
02ff526
added support for sqlite
cedricfrancoys Dec 10, 2023
926a3c3
added support for sqlite
cedricfrancoys Dec 10, 2023
d55a51e
comments
cedricfrancoys Dec 10, 2023
e85fae2
added explicit eQual namespace
cedricfrancoys Dec 10, 2023
6d51875
added tab with settings values
cedricfrancoys Dec 10, 2023
9de8534
comments
cedricfrancoys Dec 10, 2023
9578739
fixed tests
cedricfrancoys Dec 10, 2023
e1b7ca9
fixed creation with predefined id
cedricfrancoys Dec 10, 2023
8fc88d2
fixed unicity check in create() + added trigger_error prefix
cedricfrancoys Dec 10, 2023
b85b413
removed 'parts' param
cedricfrancoys Dec 10, 2023
0710279
added
cedricfrancoys Dec 10, 2023
9cc7488
added
cedricfrancoys Dec 10, 2023
2246e61
added support for error level based on http status
cedricfrancoys Dec 11, 2023
ace482b
Updated cli console, init data and workbench
f7ed0 Dec 11, 2023
e6a4b5b
Merge pull request #82 from f7ed0/controller_bind
cedricfrancoys Dec 11, 2023
2823506
Merge branch 'dev-2.0' of https://github.com/equalframework/equal int…
cedricfrancoys Dec 11, 2023
9bb7a7c
added announce()
cedricfrancoys Dec 11, 2023
b199080
syntax
cedricfrancoys Dec 11, 2023
210a75f
added doc as submodule
cedricfrancoys Dec 11, 2023
e5df501
added as submodule
cedricfrancoys Dec 11, 2023
16cf893
added
cedricfrancoys Dec 11, 2023
9f7e1b3
restored to latest working
cedricfrancoys Dec 11, 2023
84c6077
replaced unhex conversions
cedricfrancoys Dec 11, 2023
d947ade
added support for HTTP_PROCESS_USERNAME
cedricfrancoys Dec 11, 2023
33ee325
comments
cedricfrancoys Dec 11, 2023
c4821a4
fixed autoincrement
cedricfrancoys Dec 11, 2023
9ddbf5c
added log for empty ids
cedricfrancoys Dec 11, 2023
099a074
tmp removed
cedricfrancoys Dec 13, 2023
a077d1c
fixed UsageUri
cedricfrancoys Dec 13, 2023
59f5802
renamed + fixed
cedricfrancoys Dec 13, 2023
f34ff6c
improved backtrace stack handling
cedricfrancoys Dec 13, 2023
6af0b95
increased reporting for Throwable
cedricfrancoys Dec 13, 2023
50214e9
added trailing slash for api URL
cedricfrancoys Dec 13, 2023
c37bfa6
added
cedricfrancoys Dec 13, 2023
9ef6e5e
tmp removed
cedricfrancoys Dec 13, 2023
e512baa
added
cedricfrancoys Dec 13, 2023
203ea42
removed
cedricfrancoys Dec 13, 2023
b0b14dc
added UsageUri
cedricfrancoys Dec 13, 2023
ad4ef31
added getSanitizedPath and getDirFlatten
cedricfrancoys Dec 13, 2023
6a43a69
refactored and removed sanitize-path
cedricfrancoys Dec 13, 2023
86c75f1
refactored and removed sanitize-path
cedricfrancoys Dec 13, 2023
36e0602
removed
cedricfrancoys Dec 13, 2023
2211dd7
syntax
cedricfrancoys Dec 13, 2023
6e3af77
updated
cedricfrancoys Dec 14, 2023
2a5f413
refactored to prevent 404
cedricfrancoys Dec 14, 2023
531c004
added support for fallback to default
cedricfrancoys Dec 14, 2023
b9d580c
merged with console
cedricfrancoys Dec 14, 2023
81489e9
added
cedricfrancoys Dec 18, 2023
4c644eb
changed scope of members to protected
cedricfrancoys Dec 18, 2023
332d7d1
added own constructor with default length
cedricfrancoys Dec 18, 2023
b545a07
added json as text/json
cedricfrancoys Dec 18, 2023
e3df229
comments
cedricfrancoys Dec 18, 2023
ac9a3f3
added
cedricfrancoys Dec 18, 2023
45c3aa6
comments
cedricfrancoys Dec 18, 2023
d667395
updated
cedricfrancoys Dec 18, 2023
78ccea9
comments
cedricfrancoys Dec 18, 2023
409851e
improved memory consumption
cedricfrancoys Dec 18, 2023
6072cfc
updated rewrite rule regex
cedricfrancoys Dec 18, 2023
3276775
added
cedricfrancoys Dec 18, 2023
e6df890
added
cedricfrancoys Dec 18, 2023
1f2f414
fixed infinite loop in recursion
cedricfrancoys Dec 18, 2023
1e74931
added Exception for invalid id returned by SQL (autoincrement)
cedricfrancoys Dec 18, 2023
4fbc281
added
cedricfrancoys Dec 18, 2023
f803a9f
removed styles generating inconsistencies
cedricfrancoys Dec 19, 2023
d8adc29
minor
cedricfrancoys Dec 19, 2023
c72cafb
added support for io_error exception
cedricfrancoys Dec 19, 2023
9f973a3
updated workbench and console
f7ed0 Dec 21, 2023
694d4fc
Added help command for controller
f7ed0 Dec 21, 2023
291c4ec
Merge pull request #83 from f7ed0/workflow
cedricfrancoys Dec 21, 2023
c83b6cb
renamed
cedricfrancoys Dec 21, 2023
69f5d1e
added support for CLI help
cedricfrancoys Dec 21, 2023
4b9a2ca
syntax
cedricfrancoys Dec 21, 2023
30400eb
comments
cedricfrancoys Dec 21, 2023
fd1c69f
Merge branch 'dev-2.0' of https://github.com/equalframework/equal int…
cedricfrancoys Dec 21, 2023
ee6ba8e
removed
cedricfrancoys Dec 21, 2023
bff1fc7
renamed
cedricfrancoys Dec 21, 2023
8f79dd7
comments
cedricfrancoys Dec 21, 2023
eff7058
added autocomplete
cedricfrancoys Dec 21, 2023
43a2675
added ORG_ and APP_
cedricfrancoys Dec 23, 2023
b2a3015
fixed cas sensitive like
cedricfrancoys Dec 23, 2023
bf359aa
minor refactor
cedricfrancoys Dec 23, 2023
85fe025
converted output for CLI
cedricfrancoys Dec 23, 2023
5de532d
minor
cedricfrancoys Dec 23, 2023
1a95d3c
added
cedricfrancoys Dec 23, 2023
7054ec9
added error details for invalid param
cedricfrancoys Dec 27, 2023
794a934
comments
cedricfrancoys Dec 27, 2023
6ba1249
added check on config.json constants validity and deprecation
cedricfrancoys Dec 27, 2023
873da5f
updated label
cedricfrancoys Dec 27, 2023
cd84ce3
updated label
cedricfrancoys Dec 27, 2023
078c0ad
added SB_ERROR_NON_REMOVABLE
cedricfrancoys Dec 28, 2023
b0726b7
Added support for workbench UML and updated Workbench
f7ed0 Jan 5, 2024
bc764f4
fix: modify admin group name to admins to match created administrator…
lucaslaurent04 Jan 5, 2024
06d3861
Merge branch 'uml' into dev-2.0
f7ed0 Jan 8, 2024
df8d636
Merge branch 'dev-2.0' into bugfix/issue-85/problem-running-cron_run-…
lucaslaurent04 Jan 8, 2024
bf73375
Update administratior group used in access groups for uml actions
lucaslaurent04 Jan 8, 2024
d797b08
Merge branch 'dev-2.0' of https://github.com/equalframework/equal int…
cedricfrancoys Jan 8, 2024
9f37341
updates workbench submodule
cedricfrancoys Jan 8, 2024
17149fb
Merge pull request #87 from lucaslaurent04/bugfix/issue-85/problem-ru…
cedricfrancoys Jan 8, 2024
74e54b7
changed admin to admins
cedricfrancoys Jan 8, 2024
e7be500
fix: missing default value for user_id of SettingValue
lucaslaurent04 Jan 25, 2024
e185758
fix: wrong names for setting values in core/init/data/
lucaslaurent04 Jan 25, 2024
2e3c4f2
fix: trying to get name of non object warning when update workflow
lucaslaurent04 Jan 26, 2024
2a68e3d
fix: add missing text type for json usage
lucaslaurent04 Jan 29, 2024
59bcf95
Merge pull request #90 from lucaslaurent04/bugfix/fix-missing-default…
cedricfrancoys Feb 5, 2024
4c9935d
Merge pull request #93 from lucaslaurent04/bugfix/fix-wrong-names-in-…
cedricfrancoys Feb 5, 2024
5852bae
Merge pull request #94 from lucaslaurent04/bugfix/fix-name-warnings-i…
cedricfrancoys Feb 5, 2024
23797c8
Merge pull request #96 from lucaslaurent04/bugfix/fix-text-json-usage
cedricfrancoys Feb 5, 2024
6242785
adapted for output improvement
cedricfrancoys Feb 7, 2024
5025b1c
comments
cedricfrancoys Feb 7, 2024
0ee1814
comments
cedricfrancoys Feb 7, 2024
b64382f
splitted subtype and tree
cedricfrancoys Feb 7, 2024
2c4890e
updates
cedricfrancoys Feb 7, 2024
5e3225e
updated icons
cedricfrancoys Feb 7, 2024
d40e929
increased limit for groups
cedricfrancoys Feb 7, 2024
c319ff1
updates
cedricfrancoys Feb 7, 2024
4cdc247
added datetime notations
cedricfrancoys Feb 7, 2024
6d2f86b
added fullname
cedricfrancoys Feb 7, 2024
c18eddb
Merge branch 'dev-2.0' of https://github.com/equalframework/equal int…
cedricfrancoys Feb 7, 2024
669a51c
updated workbench
cedricfrancoys Feb 20, 2024
cb2dca3
added (empty behavior)
cedricfrancoys Feb 21, 2024
61bbb76
fixed support for sub-objects
cedricfrancoys Feb 21, 2024
97d50e4
removed reference to lodging
cedricfrancoys Feb 21, 2024
a2918de
added support for wildcard package - closes #97
cedricfrancoys Feb 28, 2024
c51a614
fixed untimely break in apps loop
cedricfrancoys Feb 29, 2024
8600fff
added onafterupdate + minor changes
cedricfrancoys Mar 2, 2024
b83a205
syntax
cedricfrancoys Mar 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ RUN apt-get update && apt-get install -y \
vim
COPY ./mpm_prefork.conf /etc/apache2/mods-available/
COPY ./000-default.conf /etc/apache2/sites-available/

# install sqlsrv drivers
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get -y --no-install-recommends install msodbcsql17 odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc-dev=2.3.7 unixodbc=2.3.7
RUN pecl install sqlsrv-5.10.1 pdo_sqlsrv-5.10.1

# install required PHP extensions
RUN set -ex; \
\
Expand All @@ -38,7 +36,8 @@ RUN set -ex; \
; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install gd mysqli opcache zip tidy; \
docker-php-ext-configure intl; \
docker-php-ext-install gd mysqli opcache zip tidy intl; \
docker-php-ext-enable sqlsrv pdo_sqlsrv; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor/
tests/
log/*
!log/.gitkeep
cache/*
Expand All @@ -18,4 +19,5 @@ public/*
!public/index.php
!public/console.php
!public/assets
!public/console2.php
public/assets/env/config.json
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "doc"]
path = doc
url = https://github.com/equalframework/equal-doc.git
[submodule "packages/core/apps/workbench/source"]
path = packages/core/apps/workbench/source
url = https://github.com/equalframework/apps-core-workbench.git
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ git clone https://github.com/equalframework/equal.git
For more info, see : [http://doc.equal.run/getting-started/installation](http://doc.equal.run/getting-started/installation/)


## CLI autocomplete
To ease commands typing in CLI, you can enable autocompletion by running `source autocomplete`.


## Code Coverage setup

Expand Down
2 changes: 1 addition & 1 deletion equal_autocomplete → autocomplete
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# this script is meant to be placed at /etc/bash_completion.d/
# and activated with source /etc/bash_completion.d/equal_autocomplete
# and activated with `source /etc/bash_completion.d/autocomplete`

_equal_completion()
{
Expand Down
37 changes: 35 additions & 2 deletions config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"DEFAULT_LANG": {
"type": "string",
"description": "The language in which the content must be displayed by default (ISO 639-1).",
"description": "The language in which the multilang content must be provided/stored by default (ISO 639-1).",
"instant": true,
"default": "en"
},
Expand Down Expand Up @@ -78,6 +78,12 @@
"instant": true,
"default": 10
},
"HTTP_PROCESS_USERNAME": {
"type": "string",
"description": "Username used by the HTTP service (for rights checks).",
"instant": true,
"default": "www-data"
},
"EMAIL_SMTP_HOST": {
"type": "string",
"description": "Hostname of the SMTP server to use for sending emails.",
Expand Down Expand Up @@ -137,7 +143,7 @@
},
"DB_DBMS": {
"type": "string",
"description": "Database Management System running on the DB host. Possible values are: 'MYSQL', 'SQLSRV', 'MARIADB', 'POSTGRESQL'",
"description": "Database Management System running on the DB host. Possible values are: 'MYSQL', 'SQLSRV', 'MARIADB', 'SQLITE', 'POSTGRESQL'",
"instant": true,
"default": "MYSQL",
"examples": [
Expand Down Expand Up @@ -270,6 +276,8 @@
},
"ROOT_APP_URL": {
"type": "string",
"deprecated": "Please use APP_URL instead.",
"description": "The URL of the root folder (mapped with `./public`), with the scheme but without trailing slash (no path).",
"default": "http://equal.local"
},
"USER_ACCOUNT_DISPLAYNAME": {
Expand All @@ -286,5 +294,30 @@
"type": "boolean",
"description": "Flag telling if a new user account needs to be validated before being active.",
"default": true
},
"ORG_NAME" : {
"type": "string",
"description": "Name of the organisation to which belongs the instance.",
"default": "eQual"
},
"ORG_URL": {
"type": "string",
"description": "URL of the official website of the organisation.",
"default": "https://equal.run"
},
"APP_NAME": {
"type": "string",
"description": "Specific brand name of the application, if any.",
"default": "eQual"
},
"APP_URL": {
"type": "string",
"description": "The URL of the root folder (mapped with `./public`), with the scheme but without trailing slash (no path).",
"default": "http://equal.local"
},
"APP_LOGO_URL": {
"type": "string",
"description": "The URL of the image to be displayed in UI as App logo in the top left corner.",
"default": "/assets/img/logo.svg"
}
}
3 changes: 2 additions & 1 deletion config/usages.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"xml" : {},
"html" : {},
"markdown" : {},
"wiki" : {}
"wiki" : {},
"json" : {}
},
"length_free" : true,
"boundary" : true
Expand Down
Binary file added console
Binary file not shown.
1 change: 1 addition & 0 deletions doc
Submodule doc added at 6f04d0
19 changes: 11 additions & 8 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);

$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [
'syntax' => 'short',
]);

$ecsConfig->sets([
// run and fix, one by one
SetList::SPACES,
SetList::ARRAY,
SetList::DOCBLOCK,
SetList::SYMPLIFY,
// SetList::COMMON, // adds declare(strict_types=1)
SetList::CLEAN_CODE,
SetList::DOCBLOCK,
// #memo - messes with COMMENTS blocks
// SetList::SYMPLIFY,
// #memo - adds declare(strict_types=1)
// SetList::COMMON,
SetList::CLEAN_CODE,
SetList::PSR_12,
]);

$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [
'syntax' => 'short',
]);

};
71 changes: 52 additions & 19 deletions eq.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**
* Current version of eQual
*/
define('QN_VERSION', '1.0.0');
define('EQ_VERSION', '2.0.0');

/**
* Root directory of current install
Expand Down Expand Up @@ -109,13 +109,15 @@
define('QN_R_WRITE', 4);
define('QN_R_DELETE', 8);
define('QN_R_MANAGE', 16);
define('QN_R_ALL', 31);

/* equivalence map for naming migration */
define('R_CREATE', QN_R_CREATE);
define('R_READ', QN_R_READ);
define('R_WRITE', QN_R_WRITE);
define('R_DELETE', QN_R_DELETE);
define('R_MANAGE', QN_R_MANAGE);
define('EQ_R_CREATE', QN_R_CREATE);
define('EQ_R_READ', QN_R_READ);
define('EQ_R_WRITE', QN_R_WRITE);
define('EQ_R_DELETE', QN_R_DELETE);
define('EQ_R_MANAGE', QN_R_MANAGE);
define('EQ_R_ALL', QN_R_ALL);

/**
* Built-in Users and Groups
Expand Down Expand Up @@ -821,6 +823,7 @@ public static function announce(array $announcement) {
}



// 1) check if all required parameters have been received

// build mandatory fields array
Expand All @@ -831,23 +834,53 @@ public static function announce(array $announcement) {
}
// if at least one mandatory param is missing
$missing_params = array_values(array_diff($mandatory_params, array_keys($body)));
if( count($missing_params)
|| isset($body['announce'])
|| $method == 'OPTIONS' ) {
if( count($missing_params) || isset($body['announce']) || $method == 'OPTIONS' ) {
// #memo - we don't remove anything from the schema, so it can be returned as is for the UI
// (for public and protected controllers this might be considered as security issue as it may reveals a part of the configuration)
// no feedback about services
if(isset($announcement['providers'])) {
// unset($announcement['providers']);
}
// no feedback about constants
if(isset($announcement['constants'])) {
// unset($announcement['constants']);
// if 'help' is amongst the params and request was made through CLI
if(php_sapi_name() == 'cli' && isset($body['help'])) {
$operation = $context->get('operation');
$help = 'Help about ';
$help .= strtoupper($operation['type']).' '.$operation['operation']." :\n\n";
$help .= "Description:\n";
$help .= $announcement["description"]."\n\n";
$help .= "Parameters:\n";
foreach($announcement['params'] as $name => $info) {
$help .= str_pad("--".$name, 20, ' ', STR_PAD_RIGHT);
$required = (isset($info['required']))?'(required)':'';
$help .= str_pad($required, 12, ' ');
$type = $info['type'].( (isset($info['usage']))?'>'.$info['usage']:'');
$help .= str_pad($type, 28, ' ');
$help .= $info['description']."\n";
}
$help.= "\nMore Info :\n";
foreach($body as $key => $value) {
if(isset($announcement['params'][$key])) {
$help.= "--".$key." :\n";
if(isset($announcement['params'][$key]['help'])) {
$help .= ' help: ';
$help .= preg_replace("/ {2,}/", str_pad('', 9, ' '), $announcement['params'][$key]['help'])."\n";
}
if(isset($announcement['params'][$key]['default'])) {
$help .= ' default value: ';
$help .= json_encode($announcement['params'][$key]['default'], true)."\n";
}
if(isset($announcement['params'][$key]['selection'])) {
$help .= ' selection: ';
$help .= json_encode($announcement['params'][$key]['selection'], true)."\n";
}
}
}
$response->status(200)
->header('Content-Type', 'text/plain')
->body($help)
->send();
throw new \Exception('', 0);
}
// add announcement to response body
$response->body(['announcement' => $announcement]);
// if user asked for the announcement or browser requested fingerprint, set status and header accordingly
if(isset($body['announce']) || $method == 'OPTIONS') {
// user asked for the announcement or browser requested fingerprint
$response->status(200)
// allow browser to cache the response for 1 year
->header('Cache-Control', 'max-age=31536000')
Expand Down Expand Up @@ -972,7 +1005,7 @@ public static function announce(array $announcement) {
$response->body(['announcement' => $announcement]);
foreach($invalid_params as $invalid_param => $error_id) {
// raise an exception with error details
throw new \Exception(serialize([$invalid_param => [$error_id => 'Invalid parameter']]), QN_ERROR_INVALID_PARAM);
throw new \Exception(serialize([$invalid_param => [$error_id => "Invalid value {$result[$invalid_param]} for parameter {$invalid_param}."]]), QN_ERROR_INVALID_PARAM);
}
}

Expand Down Expand Up @@ -1215,7 +1248,7 @@ public static function run($type, $operation, $body=[], $root=false) {
// restore original HTTP Response headers
// #memo - this is mandatory for integration with other frameworks (i.e. WP) while calling `run()` when (some) headers have already been set
$headers_orig = $context_orig->getHttpResponse()->getHeaders(true);
if(count($headers_orig)) {
if(is_array($headers_orig) && count($headers_orig)) {
header_remove();
foreach($headers_orig as $header => $value) {
header($header.': '.$value);
Expand Down
Loading