diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..dbbf07f
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,79 @@
+kind: pipeline
+type: docker
+name: Témoignages_Formulaire
+
+
+trigger:
+ event:
+ - push
+
+
+steps:
+
+ #PHP compilation with php -l
+ - name: PHP_Compilation
+ image: php:8.1
+ commands:
+ - find -name "*.php" -exec php -l "{}" \;
+
+
+ - name: setup_PHP_for_SonarQube
+ image: sonarsource/sonar-scanner-cli
+ environment:
+ SONAR_TOKEN:
+ from_secret: SONARQ_TOKEN
+ commands:
+
+ - sonar-scanner -Dsonar.projectKey=SAE4.01_FORMULAIRE -Dsonar.sources=. -Dsonar.login=$${SONAR_TOKEN} -Dsonar.language=php -Dsonar.host.url=https://codefirst.iut.uca.fr/sonar -Dsonar.php.coverage.reportPaths=coverage.xml
+
+
+ # docker image build
+ - name: set_api_form
+ image: plugins/docker
+ settings:
+ dockerfile: ./Source/API/Dockerfile
+ context: Source/API
+ registry: hub.codefirst.iut.uca.fr
+ repo: hub.codefirst.iut.uca.fr/dorian.hodin/sae4.01_formulaire
+ username:
+ from_secret: SECRET_USERNAME
+ password:
+ from_secret: SECRET_PASSWD
+
+ # conteneur deployment
+ - name: deploy_api_form
+ image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
+ environment:
+ IMAGENAME: hub.codefirst.iut.uca.fr/dorian.hodin/sae4.01_formulaire:latest
+ CONTAINERNAME: deploy_api_form
+ COMMAND: create
+ OVERWRITE: true
+ CODEFIRST_CLIENTDRONE_ENV_HOST:
+ from_secret: db_host
+ CODEFIRST_CLIENTDRONE_ENV_DATABASE:
+ from_secret: db_database
+ CODEFIRST_CLIENTDRONE_ENV_USER:
+ from_secret: db_user
+ CODEFIRST_CLIENTDRONE_ENV_PASSWORD:
+ from_secret: db_password
+ CODEFIRST_CLIENTDRONE_ENV_ROOT_PASSWORD:
+ from_secret: db_root_password
+ ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal
+ depends_on: [ set_api_form ]
+
+ # database container deployment
+ - name: db_form
+ image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
+ environment:
+ IMAGENAME: mariadb:10.5
+ CONTAINERNAME: db_form
+ COMMAND: create
+ CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD:
+ from_secret: db_root_password
+ CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE:
+ from_secret: db_database
+ CODEFIRST_CLIENTDRONE_ENV_MARIADB_USER:
+ from_secret: db_user
+ CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD:
+ from_secret: db_password
+ depends_on: [ deploy_api_form ]
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..66fe86b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/Source/API/script/Config/vendor
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/SAE4.01_API_FORM.iml b/.idea/SAE4.01_API_FORM.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/SAE4.01_API_FORM.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b01c5f5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/API/Dockerfile b/Source/API/Dockerfile
new file mode 100644
index 0000000..edcc08f
--- /dev/null
+++ b/Source/API/Dockerfile
@@ -0,0 +1,7 @@
+FROM php:8.1-apache
+RUN apt-get update && apt-get upgrade -y && apt-get install -y git
+RUN docker-php-ext-install pdo pdo_mysql
+COPY ./script /var/www/html
+WORKDIR /var/www/html/Config
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
+RUN composer update && composer install
diff --git a/Source/API/script/Config/Connection.php b/Source/API/script/Config/Connection.php
new file mode 100644
index 0000000..cee3679
--- /dev/null
+++ b/Source/API/script/Config/Connection.php
@@ -0,0 +1,38 @@
+setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ }
+
+
+ /** * @param string $query
+ * @param array $parameters *
+ * @return bool Returns `true` on success, `false` otherwise
+ */
+ public function executeQuery(string $query, array $parameters = []): bool
+ {
+ $this->stmt = parent::prepare($query);
+ foreach ($parameters as $name => $value) {
+ $this->stmt->bindValue($name, $value[0], $value[1]);
+ }
+
+ return $this->stmt->execute();
+ }
+
+ public function getResults(): array
+ {
+ return $this->stmt->fetchAll();
+
+ }
+}
diff --git a/Source/API/script/Config/composer.json b/Source/API/script/Config/composer.json
new file mode 100644
index 0000000..4d1afe0
--- /dev/null
+++ b/Source/API/script/Config/composer.json
@@ -0,0 +1,13 @@
+{
+ "name": "dorian/script",
+ "description": "Composer for API",
+ "type": "project",
+ "require": {
+ "slim/slim": "^4.11",
+ "slim/psr7": "dev-master",
+ "psr/http-message": "^1.0",
+ "guzzlehttp/psr7": "^2.4",
+ "guzzlehttp/guzzle": "^7.5",
+ "selective/basepath": "^2.1"
+ }
+}
diff --git a/Source/API/script/Config/composer.lock b/Source/API/script/Config/composer.lock
new file mode 100644
index 0000000..0340c3f
--- /dev/null
+++ b/Source/API/script/Config/composer.lock
@@ -0,0 +1,1277 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "74bc65c3a5caaaf1d8b2b1be7026f6de",
+ "packages": [
+ {
+ "name": "fig/http-message-util",
+ "version": "1.1.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message-util.git",
+ "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765",
+ "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3 || ^7.0 || ^8.0"
+ },
+ "suggest": {
+ "psr/http-message": "The package containing the PSR-7 interfaces"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Fig\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Utility classes and constants for use with PSR-7 (psr/http-message)",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "issues": "https://github.com/php-fig/http-message-util/issues",
+ "source": "https://github.com/php-fig/http-message-util/tree/1.1.5"
+ },
+ "time": "2020-11-24T22:02:12+00:00"
+ },
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "7.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba",
+ "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "guzzlehttp/promises": "^1.5",
+ "guzzlehttp/psr7": "^1.9 || ^2.4",
+ "php": "^7.2.5 || ^8.0",
+ "psr/http-client": "^1.0",
+ "symfony/deprecation-contracts": "^2.2 || ^3.0"
+ },
+ "provide": {
+ "psr/http-client-implementation": "1.0"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.8.1",
+ "ext-curl": "*",
+ "php-http/client-integration-tests": "^3.0",
+ "phpunit/phpunit": "^8.5.29 || ^9.5.23",
+ "psr/log": "^1.1 || ^2.0 || ^3.0"
+ },
+ "suggest": {
+ "ext-curl": "Required for CURL handler support",
+ "ext-intl": "Required for Internationalized Domain Name (IDN) support",
+ "psr/log": "Required for using the Log middleware"
+ },
+ "type": "library",
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": true,
+ "forward-command": false
+ },
+ "branch-alias": {
+ "dev-master": "7.5-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ],
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Jeremy Lindblom",
+ "email": "jeremeamia@gmail.com",
+ "homepage": "https://github.com/jeremeamia"
+ },
+ {
+ "name": "George Mponos",
+ "email": "gmponos@gmail.com",
+ "homepage": "https://github.com/gmponos"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://github.com/sagikazarmark"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
+ }
+ ],
+ "description": "Guzzle is a PHP HTTP client library",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "psr-18",
+ "psr-7",
+ "rest",
+ "web service"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/guzzle/issues",
+ "source": "https://github.com/guzzle/guzzle/tree/7.5.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-08-28T15:39:27+00:00"
+ },
+ {
+ "name": "guzzlehttp/promises",
+ "version": "1.5.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/promises.git",
+ "reference": "b94b2807d85443f9719887892882d0329d1e2598"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598",
+ "reference": "b94b2807d85443f9719887892882d0329d1e2598",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "^4.4 || ^5.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.5-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ],
+ "psr-4": {
+ "GuzzleHttp\\Promise\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
+ }
+ ],
+ "description": "Guzzle promises library",
+ "keywords": [
+ "promise"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/promises/issues",
+ "source": "https://github.com/guzzle/promises/tree/1.5.2"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-08-28T14:55:35+00:00"
+ },
+ {
+ "name": "guzzlehttp/psr7",
+ "version": "2.4.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "67c26b443f348a51926030c83481b85718457d3d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d",
+ "reference": "67c26b443f348a51926030c83481b85718457d3d",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2.5 || ^8.0",
+ "psr/http-factory": "^1.0",
+ "psr/http-message": "^1.0",
+ "ralouphie/getallheaders": "^3.0"
+ },
+ "provide": {
+ "psr/http-factory-implementation": "1.0",
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.8.1",
+ "http-interop/http-factory-tests": "^0.9",
+ "phpunit/phpunit": "^8.5.29 || ^9.5.23"
+ },
+ "suggest": {
+ "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
+ },
+ "type": "library",
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": true,
+ "forward-command": false
+ },
+ "branch-alias": {
+ "dev-master": "2.4-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Psr7\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "George Mponos",
+ "email": "gmponos@gmail.com",
+ "homepage": "https://github.com/gmponos"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://github.com/sagikazarmark"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://sagikazarmark.hu"
+ }
+ ],
+ "description": "PSR-7 message implementation that also provides common utility methods",
+ "keywords": [
+ "http",
+ "message",
+ "psr-7",
+ "request",
+ "response",
+ "stream",
+ "uri",
+ "url"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/psr7/issues",
+ "source": "https://github.com/guzzle/psr7/tree/2.4.3"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-10-26T14:07:24+00:00"
+ },
+ {
+ "name": "nikic/fast-route",
+ "version": "v1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/FastRoute.git",
+ "reference": "181d480e08d9476e61381e04a71b34dc0432e812"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812",
+ "reference": "181d480e08d9476e61381e04a71b34dc0432e812",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35|~5.7"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/functions.php"
+ ],
+ "psr-4": {
+ "FastRoute\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov",
+ "email": "nikic@php.net"
+ }
+ ],
+ "description": "Fast request router for PHP",
+ "keywords": [
+ "router",
+ "routing"
+ ],
+ "support": {
+ "issues": "https://github.com/nikic/FastRoute/issues",
+ "source": "https://github.com/nikic/FastRoute/tree/master"
+ },
+ "time": "2018-02-13T20:26:39+00:00"
+ },
+ {
+ "name": "psr/container",
+ "version": "2.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/container.git",
+ "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
+ "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Container\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common Container Interface (PHP FIG PSR-11)",
+ "homepage": "https://github.com/php-fig/container",
+ "keywords": [
+ "PSR-11",
+ "container",
+ "container-interface",
+ "container-interop",
+ "psr"
+ ],
+ "support": {
+ "issues": "https://github.com/php-fig/container/issues",
+ "source": "https://github.com/php-fig/container/tree/2.0.2"
+ },
+ "time": "2021-11-05T16:47:00+00:00"
+ },
+ {
+ "name": "psr/http-client",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-client.git",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0 || ^8.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Client\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP clients",
+ "homepage": "https://github.com/php-fig/http-client",
+ "keywords": [
+ "http",
+ "http-client",
+ "psr",
+ "psr-18"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-client/tree/master"
+ },
+ "time": "2020-06-29T06:28:15+00:00"
+ },
+ {
+ "name": "psr/http-factory",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-factory.git",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for PSR-7 HTTP message factories",
+ "keywords": [
+ "factory",
+ "http",
+ "message",
+ "psr",
+ "psr-17",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-factory/tree/master"
+ },
+ "time": "2019-04-30T12:38:16+00:00"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-message/tree/master"
+ },
+ "time": "2016-08-06T14:39:51+00:00"
+ },
+ {
+ "name": "psr/http-server-handler",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-server-handler.git",
+ "reference": "aff2f80e33b7f026ec96bb42f63242dc50ffcae7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/aff2f80e33b7f026ec96bb42f63242dc50ffcae7",
+ "reference": "aff2f80e33b7f026ec96bb42f63242dc50ffcae7",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Server\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP server-side request handler",
+ "keywords": [
+ "handler",
+ "http",
+ "http-interop",
+ "psr",
+ "psr-15",
+ "psr-7",
+ "request",
+ "response",
+ "server"
+ ],
+ "support": {
+ "issues": "https://github.com/php-fig/http-server-handler/issues",
+ "source": "https://github.com/php-fig/http-server-handler/tree/master"
+ },
+ "time": "2018-10-30T16:46:14+00:00"
+ },
+ {
+ "name": "psr/http-server-middleware",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-server-middleware.git",
+ "reference": "2296f45510945530b9dceb8bcedb5cb84d40c5f5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/2296f45510945530b9dceb8bcedb5cb84d40c5f5",
+ "reference": "2296f45510945530b9dceb8bcedb5cb84d40c5f5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0",
+ "psr/http-message": "^1.0",
+ "psr/http-server-handler": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Server\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP server-side middleware",
+ "keywords": [
+ "http",
+ "http-interop",
+ "middleware",
+ "psr",
+ "psr-15",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "issues": "https://github.com/php-fig/http-server-middleware/issues",
+ "source": "https://github.com/php-fig/http-server-middleware/tree/master"
+ },
+ "time": "2018-10-30T17:12:04+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001",
+ "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/3.0.0"
+ },
+ "time": "2021-07-14T16:46:02+00:00"
+ },
+ {
+ "name": "ralouphie/getallheaders",
+ "version": "3.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/ralouphie/getallheaders.git",
+ "reference": "120b605dfeb996808c31b6477290a714d356e822"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
+ "reference": "120b605dfeb996808c31b6477290a714d356e822",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "require-dev": {
+ "php-coveralls/php-coveralls": "^2.1",
+ "phpunit/phpunit": "^5 || ^6.5"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/getallheaders.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ralph Khattar",
+ "email": "ralph.khattar@gmail.com"
+ }
+ ],
+ "description": "A polyfill for getallheaders.",
+ "support": {
+ "issues": "https://github.com/ralouphie/getallheaders/issues",
+ "source": "https://github.com/ralouphie/getallheaders/tree/develop"
+ },
+ "time": "2019-03-08T08:55:37+00:00"
+ },
+ {
+ "name": "selective/basepath",
+ "version": "2.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/selective-php/basepath.git",
+ "reference": "63961fbfcaf492bd0ae8e40653f6c3c750c2f8ad"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/selective-php/basepath/zipball/63961fbfcaf492bd0ae8e40653f6c3c750c2f8ad",
+ "reference": "63961fbfcaf492bd0ae8e40653f6c3c750c2f8ad",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0",
+ "psr/http-server-middleware": "^1"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^2",
+ "overtrue/phplint": "^2",
+ "phpstan/phpstan": "0.*",
+ "phpunit/phpunit": "^8 || ^9",
+ "slim/psr7": "^1",
+ "slim/slim": "^4",
+ "squizlabs/php_codesniffer": "^3"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Selective\\BasePath\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "A URL base path detector for Slim 4",
+ "homepage": "https://github.com/selective-php/basepath",
+ "keywords": [
+ "basepath",
+ "slim",
+ "slim4"
+ ],
+ "support": {
+ "issues": "https://github.com/selective-php/basepath/issues",
+ "source": "https://github.com/selective-php/basepath/tree/2.1.0"
+ },
+ "time": "2021-07-17T10:03:02+00:00"
+ },
+ {
+ "name": "slim/psr7",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/slimphp/Slim-Psr7.git",
+ "reference": "2d53022f48bd2583911d2a10de5529c10453346a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/2d53022f48bd2583911d2a10de5529c10453346a",
+ "reference": "2d53022f48bd2583911d2a10de5529c10453346a",
+ "shasum": ""
+ },
+ "require": {
+ "fig/http-message-util": "^1.1.5",
+ "php": "^8.0",
+ "psr/http-factory": "^1.0",
+ "psr/http-message": "^1.0",
+ "ralouphie/getallheaders": "^3.0",
+ "symfony/polyfill-php80": "^1.27"
+ },
+ "provide": {
+ "psr/http-factory-implementation": "1.0",
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "adriansuter/php-autoload-override": "^1.4",
+ "ext-json": "*",
+ "http-interop/http-factory-tests": "^0.9.0",
+ "php-http/psr7-integration-tests": "dev-master",
+ "phpspec/prophecy": "^1.16",
+ "phpspec/prophecy-phpunit": "^2.0",
+ "phpstan/phpstan": "^1.9",
+ "phpunit/phpunit": "^9.5",
+ "squizlabs/php_codesniffer": "^3.7"
+ },
+ "default-branch": true,
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Slim\\Psr7\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Josh Lockhart",
+ "email": "hello@joshlockhart.com",
+ "homepage": "http://joshlockhart.com"
+ },
+ {
+ "name": "Andrew Smith",
+ "email": "a.smith@silentworks.co.uk",
+ "homepage": "http://silentworks.co.uk"
+ },
+ {
+ "name": "Rob Allen",
+ "email": "rob@akrabat.com",
+ "homepage": "http://akrabat.com"
+ },
+ {
+ "name": "Pierre Berube",
+ "email": "pierre@lgse.com",
+ "homepage": "http://www.lgse.com"
+ }
+ ],
+ "description": "Strict PSR-7 implementation",
+ "homepage": "https://www.slimframework.com",
+ "keywords": [
+ "http",
+ "psr-7",
+ "psr7"
+ ],
+ "support": {
+ "issues": "https://github.com/slimphp/Slim-Psr7/issues",
+ "source": "https://github.com/slimphp/Slim-Psr7/tree/master"
+ },
+ "time": "2023-02-13T07:36:36+00:00"
+ },
+ {
+ "name": "slim/slim",
+ "version": "4.11.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/slimphp/Slim.git",
+ "reference": "b0f4ca393ea037be9ac7292ba7d0a34d18bac0c7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/slimphp/Slim/zipball/b0f4ca393ea037be9ac7292ba7d0a34d18bac0c7",
+ "reference": "b0f4ca393ea037be9ac7292ba7d0a34d18bac0c7",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "nikic/fast-route": "^1.3",
+ "php": "^7.4 || ^8.0",
+ "psr/container": "^1.0 || ^2.0",
+ "psr/http-factory": "^1.0",
+ "psr/http-message": "^1.0",
+ "psr/http-server-handler": "^1.0",
+ "psr/http-server-middleware": "^1.0",
+ "psr/log": "^1.1 || ^2.0 || ^3.0"
+ },
+ "require-dev": {
+ "adriansuter/php-autoload-override": "^1.3",
+ "ext-simplexml": "*",
+ "guzzlehttp/psr7": "^2.4",
+ "httpsoft/http-message": "^1.0",
+ "httpsoft/http-server-request": "^1.0",
+ "laminas/laminas-diactoros": "^2.17",
+ "nyholm/psr7": "^1.5",
+ "nyholm/psr7-server": "^1.0",
+ "phpspec/prophecy": "^1.15",
+ "phpspec/prophecy-phpunit": "^2.0",
+ "phpstan/phpstan": "^1.8",
+ "phpunit/phpunit": "^9.5",
+ "slim/http": "^1.2",
+ "slim/psr7": "^1.5",
+ "squizlabs/php_codesniffer": "^3.7"
+ },
+ "suggest": {
+ "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware",
+ "ext-xml": "Needed to support XML format in BodyParsingMiddleware",
+ "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim",
+ "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Slim\\": "Slim"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Josh Lockhart",
+ "email": "hello@joshlockhart.com",
+ "homepage": "https://joshlockhart.com"
+ },
+ {
+ "name": "Andrew Smith",
+ "email": "a.smith@silentworks.co.uk",
+ "homepage": "http://silentworks.co.uk"
+ },
+ {
+ "name": "Rob Allen",
+ "email": "rob@akrabat.com",
+ "homepage": "http://akrabat.com"
+ },
+ {
+ "name": "Pierre Berube",
+ "email": "pierre@lgse.com",
+ "homepage": "http://www.lgse.com"
+ },
+ {
+ "name": "Gabriel Manricks",
+ "email": "gmanricks@me.com",
+ "homepage": "http://gabrielmanricks.com"
+ }
+ ],
+ "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
+ "homepage": "https://www.slimframework.com",
+ "keywords": [
+ "api",
+ "framework",
+ "micro",
+ "router"
+ ],
+ "support": {
+ "docs": "https://www.slimframework.com/docs/v4/",
+ "forum": "https://discourse.slimframework.com/",
+ "irc": "irc://irc.freenode.net:6667/slimphp",
+ "issues": "https://github.com/slimphp/Slim/issues",
+ "rss": "https://www.slimframework.com/blog/feed.rss",
+ "slack": "https://slimphp.slack.com/",
+ "source": "https://github.com/slimphp/Slim",
+ "wiki": "https://github.com/slimphp/Slim/wiki"
+ },
+ "funding": [
+ {
+ "url": "https://opencollective.com/slimphp",
+ "type": "open_collective"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/slim/slim",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-11-06T16:33:39+00:00"
+ },
+ {
+ "name": "symfony/deprecation-contracts",
+ "version": "v3.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/deprecation-contracts.git",
+ "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3",
+ "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.3-dev"
+ },
+ "thanks": {
+ "name": "symfony/contracts",
+ "url": "https://github.com/symfony/contracts"
+ }
+ },
+ "autoload": {
+ "files": [
+ "function.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "A generic function and convention to trigger deprecation notices",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-11-25T10:21:52+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php80",
+ "version": "v1.27.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php80.git",
+ "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
+ "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.27-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Php80\\": ""
+ },
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ion Bazan",
+ "email": "ion.bazan@gmail.com"
+ },
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-11-03T14:55:06+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": {
+ "slim/psr7": 20
+ },
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "2.3.0"
+}
diff --git a/Source/API/script/Config/config.php b/Source/API/script/Config/config.php
new file mode 100644
index 0000000..4f59321
--- /dev/null
+++ b/Source/API/script/Config/config.php
@@ -0,0 +1,26 @@
+con = connect();
+ }
+
+ public function executeScript(): void
+ {
+ $queryScript = 'CREATE TABLE `Categorize` (
+ `response` int(11) NOT NULL,
+ `keyword` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `Form` (
+ `id` int(11) NOT NULL,
+ `title` varchar(50) NOT NULL,
+ `description` text NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `Keyword` (
+ `id` int(11) NOT NULL,
+ `word` varchar(50) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `ListResponsesOfCandidate` (
+ `id` int(11) NOT NULL,
+ `date` datetime NOT NULL,
+ `titleForm` varchar(50) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `PossibleResponse` (
+ `id` int(11) NOT NULL,
+ `content` text NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `Propose` (
+ `question` int(11) NOT NULL,
+ `possibleResponse` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `Question` (
+ `id` int(11) NOT NULL,
+ `content` text NOT NULL,
+ `type` varchar(50) NOT NULL,
+ `form` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `Reference` (
+ `possibleResponse` int(11) NOT NULL,
+ `keyword` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `Response` (
+ `id` int(11) NOT NULL,
+ `content` varchar(200) NOT NULL,
+ `questionContent` text NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+CREATE TABLE `Submit` (
+ `responsesCandidate` int(11) NOT NULL,
+ `response` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+ALTER TABLE `Categorize`
+ ADD PRIMARY KEY (`response`,`keyword`),
+ ADD KEY `keyword` (`keyword`);
+ALTER TABLE `Form`
+ ADD PRIMARY KEY (`id`);
+ALTER TABLE `Keyword`
+ ADD PRIMARY KEY (`id`);
+ALTER TABLE `ListResponsesOfCandidate`
+ ADD PRIMARY KEY (`id`);
+ALTER TABLE `PossibleResponse`
+ ADD PRIMARY KEY (`id`);
+ALTER TABLE `Propose`
+ ADD PRIMARY KEY (`question`,`possibleResponse`),
+ ADD KEY `possibleResponse` (`possibleResponse`);
+ALTER TABLE `Question`
+ ADD PRIMARY KEY (`id`),
+ ADD KEY `form` (`form`);
+ALTER TABLE `Reference`
+ ADD PRIMARY KEY (`possibleResponse`,`keyword`),
+ ADD KEY `keyword` (`keyword`);
+ALTER TABLE `Response`
+ ADD PRIMARY KEY (`id`);
+ALTER TABLE `Submit`
+ ADD PRIMARY KEY (`responsesCandidate`,`response`),
+ ADD KEY `response` (`response`);
+ALTER TABLE `Form`
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
+ALTER TABLE `Keyword`
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
+ALTER TABLE `ListResponsesOfCandidate`
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
+ALTER TABLE `PossibleResponse`
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
+ALTER TABLE `Question`
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
+ALTER TABLE `Response`
+ MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
+ALTER TABLE `Categorize`
+ ADD CONSTRAINT `Categorize_ibfk_1` FOREIGN KEY (`keyword`) REFERENCES `Keyword` (`id`),
+ ADD CONSTRAINT `Categorize_ibfk_2` FOREIGN KEY (`response`) REFERENCES `Response` (`id`);
+ALTER TABLE `Propose`
+ ADD CONSTRAINT `Propose_ibfk_1` FOREIGN KEY (`possibleResponse`) REFERENCES `PossibleResponse` (`id`),
+ ADD CONSTRAINT `Propose_ibfk_2` FOREIGN KEY (`question`) REFERENCES `Question` (`id`);
+ALTER TABLE `Question`
+ ADD CONSTRAINT `Question_ibfk_1` FOREIGN KEY (`form`) REFERENCES `Form` (`id`);
+ALTER TABLE `Reference`
+ ADD CONSTRAINT `Reference_ibfk_1` FOREIGN KEY (`keyword`) REFERENCES `Keyword` (`id`),
+ ADD CONSTRAINT `Reference_ibfk_2` FOREIGN KEY (`possibleResponse`) REFERENCES `PossibleResponse` (`id`);
+ALTER TABLE `Submit`
+ ADD CONSTRAINT `Submit_ibfk_1` FOREIGN KEY (`response`) REFERENCES `Response` (`id`),
+ ADD CONSTRAINT `Submit_ibfk_2` FOREIGN KEY (`responsesCandidate`) REFERENCES `ListResponsesOfCandidate` (`id`);
+COMMIT;';
+
+
+ $this->con->executeQuery($queryScript);
+ try {
+ $test = "SELECT * FROM Categorize;";
+ $this->con->executeQuery($test);
+ }catch (Exception $e){
+ echo $e->getMessage();
+ }
+
+
+ }
+
+}
diff --git a/Source/API/script/Gateway/GatewayForm.php b/Source/API/script/Gateway/GatewayForm.php
new file mode 100644
index 0000000..451e14e
--- /dev/null
+++ b/Source/API/script/Gateway/GatewayForm.php
@@ -0,0 +1,100 @@
+connection = connect();
+ }
+
+ public function insertForm(array $parameters): void
+ {
+ if(empty($this->getForm(array())))
+ {
+ $query = "INSERT INTO Form(title, description) VALUES(:title, :description)";
+ $this->connection->executeQuery($query, array(
+ ':title' => array($parameters[0], PDO::PARAM_STR), //parameters[0] = title of the form
+ ':description' => array($parameters[1], PDO::PARAM_STR) //parameters[1] = description of the form
+ ));
+ }
+ }
+
+ public function getForm(array $ignore): array //parameters never used cause every function require this parameter
+ {
+ $query = "SELECT * FROM Form";
+ $this->connection->executeQuery($query);
+ $result = $this->connection->getResults();
+ print(json_encode($result));
+ return $result;
+ }
+
+ public function deleteForm(array $idform): void
+ {
+ $query = "DELETE FROM Form WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($idform[0], PDO::PARAM_INT)
+ ));
+ }
+
+ public function selectForDeleteAndInsert(int $idQuestion, string $response){
+ $query = "SELECT pr.id FROM Propose p, PossibleResponse pr WHERE p.question = :id AND p.possibleResponse = pr.id AND pr.content = :response";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($idQuestion, PDO::PARAM_INT),
+ ':response' => array($response, PDO::PARAM_STR)
+ ));
+
+ return $this->connection->getResults()[0][0];
+ }
+
+ public function assignKeywordToQuestion(array $parameters): void
+ {
+ $query = "INSERT INTO Reference(possibleResponse, keyword) VALUES(:possibleResponse, :keyword)";
+ $this->connection->executeQuery($query, array(
+ ':possibleResponse' => array($this->selectForDeleteAndInsert($parameters[2],$parameters[1]), PDO::PARAM_INT),
+ ':keyword' => array($parameters[0], PDO::PARAM_STR) //parameters[0] = keyword
+ ));
+ }
+
+ public function deleteKeywordFromQuestion(array $parameters): void
+ {
+ $query = "DELETE FROM Reference WHERE response = :idResponse AND keyword = :idKeword";
+ $this->connection->executeQuery($query, array(
+ ':possibleResponse' => array($this->selectForDeleteAndInsert($parameters[2],$parameters[1]), PDO::PARAM_INT),
+ ':keyword' => array($parameters[0], PDO::PARAM_STR) //parameters[0] = keyword
+ ));
+ }
+
+ public function updateTitleToForm(array $parameters): void
+ {
+ $query = "UPDATE Form SET title = :title WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':title' => array($parameters[0], PDO::PARAM_STR), //parameters[0] = title
+ ':id' => array($parameters[1], PDO::PARAM_INT) //parameters[1] = idForm
+ ));
+ }
+
+ public function updateDescriptionToForm(array $parameters): void
+ {
+ $query = "UPDATE Form SET title = :title WHERE description = :description";
+ $this->connection->executeQuery($query, array(
+ ':description' => array($parameters[0], PDO::PARAM_STR), //parameters[0] = description
+ ':id' => array($parameters[1], PDO::PARAM_INT) //parameters[1] = idForm
+ ));
+ }
+
+ public function deleteDescriptionToForm(array $idForm): void
+ {
+ $query = "UPDATE Form SET title = :title WHERE description = :description";
+ $this->connection->executeQuery($query, array(
+ ':description' => array('', PDO::PARAM_STR),
+ ':id' => array($idForm[0], PDO::PARAM_INT)
+ ));
+ }
+}
diff --git a/Source/API/script/Gateway/GatewayKeyword.php b/Source/API/script/Gateway/GatewayKeyword.php
new file mode 100644
index 0000000..4631a52
--- /dev/null
+++ b/Source/API/script/Gateway/GatewayKeyword.php
@@ -0,0 +1,57 @@
+connection = connect();
+ }
+
+ public function insertKeyword(array $keyword): void
+ {
+ $query = "INSERT INTO Keyword(word) VALUES(:word)";
+ $this->connection->executeQuery($query, array(
+ ':word' => array($keyword[0], PDO::PARAM_STR)
+ ));
+ }
+
+ public function deleteKeyword(array $keyword): void
+ {
+ $query = "DELETE FROM Keyword WHERE word = :word";
+ $this->connection->executeQuery($query, array(
+ ':word' => array($keyword[0], PDO::PARAM_STR)
+ ));
+ }
+
+ public function getAllKeyword(array $ignore): void
+ {
+ $query = "SELECT * FROM Keyword";
+ $this->connection->executeQuery($query);
+ $result = $this->connection->getResults();
+ print(json_encode($result));
+ }
+
+ public function getKeywordsContentByReference(array $id): array
+ {
+ $query = "SELECT k.* FROM Keyword k, Reference r
+ WHERE k.word = r.keyword AND r.possibleResponse = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($id[0], PDO::PARAM_STR)
+ ));
+
+
+ $tab = [];
+ foreach ($this->connection->getResults() as $result)
+ {
+ $tab[] = $result["word"];
+ }
+ return $tab;
+ }
+}
\ No newline at end of file
diff --git a/Source/API/script/Gateway/GatewayListResponseOfCandidate.php b/Source/API/script/Gateway/GatewayListResponseOfCandidate.php
new file mode 100644
index 0000000..49984c5
--- /dev/null
+++ b/Source/API/script/Gateway/GatewayListResponseOfCandidate.php
@@ -0,0 +1,85 @@
+connection = connect();
+ }
+
+ public function getDetailsListResponsesOfCandidate(array $idListResponse): void
+ {
+ $gatewayResponse = new GatewayResponse();
+ $gatewayKeyword = new GatewayKeyword();
+ $tabKeywords = [];
+
+ $query = "SELECT * FROM ListResponsesOfCandidate WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($idListResponse[0], PDO::PARAM_INT)
+ ));
+
+ $questionList = $this->connection->getResults()[0];
+
+ $responses = $gatewayResponse->getResponsesByIdListCandidate($questionList['id']);
+
+ foreach ($responses as $row) {
+ $tabKeywords[] = $gatewayKeyword->getKeywordsContentByReference(array($row['id']));
+ }
+
+ print(json_encode(array($questionList, $responses, $tabKeywords)));
+ }
+
+ public function getAllListResponsesOfCandidate(array $ignore): void
+ {
+ $query = "SELECT * FROM ListResponsesOfCandidate";
+ $this->connection->executeQuery($query);
+
+ print(json_encode($this->connection->getResults()));
+ }
+
+ public function deleteListResponseOfCandidate(array $id): void
+ {
+ $gatewayResponse = new GatewayResponse();
+
+ foreach ( $gatewayResponse->getResponsesIdByIdListCandidate($id[0]) as $response){
+ $gatewayResponse->deleteResponseById(array($response));
+ }
+
+ $query = "DELETE FROM ListResponsesOfCandidate WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ 'id' => array($id[0], PDO::PARAM_STR)
+ ));
+ }
+
+ public function insertListResponsesOfCandidate(array $parameters): void
+ {
+ $gatewayResponse = new GatewayResponse();
+ $gatewayQuestion = new GatewayQuestion();
+
+ $query = "INSERT INTO ListResponsesOfCandidate(date, titleForm) VALUES(:date, :titleForm)";
+ $this->connection->executeQuery($query, array(
+ ':date' => array(date('Y-m-d H:i:s'), PDO::PARAM_STR),
+ ':titleForm' => array($parameters[3], PDO::PARAM_STR) //parameters[3] = titleForm
+ ));
+
+ $idListQuestion = $this->connection->lastInsertId();
+
+ for($i = 0; $i < count($parameters[1]); $i++) //parameters[1] = answer
+ {
+ $idResponse = $gatewayResponse->insertResponse(array($gatewayQuestion->getQuestionContentById(array($parameters[0][$i])), $parameters[1][$i], $parameters[2][$i])); //parameters[1] = answer, parameters[2] = category, parameters[3] = id
+
+ $query = "INSERT INTO Submit (responsesCandidate, response) VALUES(:responsesCandidate, :response)";
+ $this->connection->executeQuery($query, array(
+ ':responsesCandidate' => array($idListQuestion, PDO::PARAM_STR),
+ 'response' => array($idResponse, PDO::PARAM_STR)
+ ));
+ }
+ }
+}
diff --git a/Source/API/script/Gateway/GatewayPossibleResponse.php b/Source/API/script/Gateway/GatewayPossibleResponse.php
new file mode 100644
index 0000000..0598e9b
--- /dev/null
+++ b/Source/API/script/Gateway/GatewayPossibleResponse.php
@@ -0,0 +1,37 @@
+connection = connect();
+ }
+
+ public function getPossibleResponseByQuestion(array $idQuestion): array
+ {
+ $query = "SELECT pr.* FROM Propose p, PossibleResponse pr
+ WHERE p.question = :questionId AND p.possibleResponse = pr.id";
+ $this->connection->executeQuery($query, array(
+ ':questionId' => array($idQuestion[0], PDO::PARAM_INT)
+ ));
+
+ return $this->connection->getResults();
+ }
+
+ public function insertPossibleResponse(array $contentPossibleResponse): int
+ {
+ $query = "INSERT INTO PossibleResponse(content) VALUES(:content)";
+ $this->connection->executeQuery($query, array(
+ ':content' => array($contentPossibleResponse[0], PDO::PARAM_STR)
+ ));
+
+ return $this->connection->lastInsertId();
+ }
+}
\ No newline at end of file
diff --git a/Source/API/script/Gateway/GatewayQuestion.php b/Source/API/script/Gateway/GatewayQuestion.php
new file mode 100644
index 0000000..d39d868
--- /dev/null
+++ b/Source/API/script/Gateway/GatewayQuestion.php
@@ -0,0 +1,144 @@
+connection = connect();
+ }
+
+ public function insertQuestion(QuestionAPI $question, int $idForm): void
+ {
+ $gatewayPossibleResponse = new GatewayPossibleResponse();
+
+ $query = "INSERT INTO Question(content, type, form) VALUES(:content, :type, :form)";
+ $this->connection->executeQuery($query, array(
+ ':content' => array($question->getContent(), PDO::PARAM_STR),
+ ':type' => array(get_class($question), PDO::PARAM_STR),
+ ':form' => array($idForm, PDO::PARAM_INT)
+ ));
+
+ $idQuestion = $this->connection->lastInsertId();
+
+ if(get_class($question) != TextQuestionAPI::class){
+ $listPossibleResponse = $question->getPossibleResponses();
+
+ for($i = 0; $i < count($listPossibleResponse); $i++){
+
+ $idPossibleResponse = $gatewayPossibleResponse->insertPossibleResponse($listPossibleResponse[$i]);
+
+ $query = "INSERT INTO Propose(question, possibleResponse) VALUES(:question, :possibleResponse)";
+ $this->connection->executeQuery($query, array(
+ ':question' => array($idQuestion, PDO::PARAM_INT),
+ ':possibleResponse' => array($idPossibleResponse, PDO::PARAM_INT)
+ ));
+
+
+ foreach ($question->getCategories()[$i] as $keyword){
+ $gatewayForm = new GatewayForm();
+ $gatewayForm->assignKeywordToQuestion(array($keyword, $listPossibleResponse[$i], $idQuestion));
+ }
+ }
+ }
+
+ }
+
+ public function deleteQuestion(QuestionAPI $question): void
+ {
+ if(get_class($question) == BoxQuestionAPI::class) {
+ $query = "DELETE FROM Propose WHERE question = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($question->getId(), PDO::PARAM_INT)
+ ));
+
+ $listPossibleResponse = $question->getPossibleResponses();
+ for ($i = 0; $i < count($listPossibleResponse); $i++){
+ $query = "DELETE FROM Reference WHERE response = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($listPossibleResponse[$i]->getId(), PDO::PARAM_INT)
+ ));
+
+ $query = "DELETE FROM PossibleResponse WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($listPossibleResponse[$i]->getId(), PDO::PARAM_INT)
+ ));
+ }
+ }
+
+ $query = "DELETE FROM Question WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($question->getId(), PDO::PARAM_INT)
+ ));
+ }
+
+ public function updateQuestion(QuestionAPI $question): void
+ {
+ $query = "UPDATE Question SET content = :content, type = :type, form = :form WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':content' => array($question->getContent(), PDO::PARAM_STR),
+ ':type' => array(get_class($question), PDO::PARAM_STR),
+ ':form' => array($question->getForm(), PDO::PARAM_STR),
+ ':id' => array($question->getId(), PDO::PARAM_STR)
+ ));
+ }
+
+ public function getAllQuestions(array $idForm): void //print en json un array contenant trois qui pour chaque indice commun de ces 3 array une question, sa liste de reponse possible et sa liste de keyword associer au réponse. les deux autres sont null si c'est une textBox
+ {
+ $query = "SELECT * FROM Question WHERE form = :form";
+ $this->connection->executeQuery($query, array(
+ ':form' => array($idForm[0], PDO::PARAM_INT)
+ ));
+
+ $listQuestions = $this->connection->getResults();
+ $possibleResponsesContent = [];
+ $keywordsResponses = [];
+ $gatewayKeyword = new GatewayKeyword();
+ $gatewayPossibleResponse = new GatewayPossibleResponse();
+
+ if(!empty($listQuestions)) {
+
+ for ($i = 0; $i < count($listQuestions); $i++) {
+
+ if ($listQuestions[$i]["type"] != "BusinessClass/TextQuestion") {
+ $possibleResponses = $gatewayPossibleResponse->getPossibleResponseByQuestion(array($listQuestions[$i]["id"])); //$this->connection->getResults();
+
+ $tmpTabKeyword = [];
+ $tmpTabPossibleResponse = [];
+ foreach ($possibleResponses as $row){
+ $tmpTabKeyword[] = $gatewayKeyword->getKeywordsContentByReference(array($row["id"]));
+
+ $tmpTabPossibleResponse[] = $row["content"];
+ }
+ $possibleResponsesContent[] = $tmpTabPossibleResponse;
+ $keywordsResponses[] = $tmpTabKeyword;
+ }
+ else{
+ $possibleResponsesContent[] = null;
+ $keywordsResponses[] = null;
+ }
+ }
+ print(json_encode(array($listQuestions, $possibleResponsesContent, $keywordsResponses)));
+ }
+ print (json_encode(array()));
+ }
+
+ public function getQuestionContentById(array $id): string
+ {
+ $query = "SELECT content FROM Question WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($id[0], PDO::PARAM_INT)
+ ));
+
+ return $this->connection->getResults()[0][0];
+ }
+}
\ No newline at end of file
diff --git a/Source/API/script/Gateway/GatewayResponse.php b/Source/API/script/Gateway/GatewayResponse.php
new file mode 100644
index 0000000..a8a5a8d
--- /dev/null
+++ b/Source/API/script/Gateway/GatewayResponse.php
@@ -0,0 +1,77 @@
+connection = connect();
+ }
+
+ public function getResponsesByIdListCandidate(array $listResponsesOfCandidateId): array
+ {
+
+ $result = $this->getResponsesIdByIdListCandidate(array($listResponsesOfCandidateId[0]));
+ $tab = [];
+ foreach ($result as $row){
+ $tab[] = (new GatewayKeyword())->getKeywordsContentByReference(array($row['id']));
+ }
+
+ return array($result, $tab);
+ }
+
+ public function getResponsesIdByIdListCandidate(array $listResponsesOfCandidateId): array
+ {
+ $query = "SELECT r.id FROM Response r, Submit s WHERE s.responseCandidate = :id AND r.id = s.response";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($listResponsesOfCandidateId[0], PDO::PARAM_INT)
+ ));
+ return $this->connection->getResults();
+ }
+
+ public function deleteResponseById(array $responseId): void
+ {
+ $query = "DELETE FROM Categorize WHERE response = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($responseId[0], PDO::PARAM_INT)
+ ));
+
+ $query = "DELETE FROM Submit WHERE response = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($responseId[0], PDO::PARAM_INT)
+ ));
+
+ $query = "DELETE FROM Response WHERE id = :id";
+ $this->connection->executeQuery($query, array(
+ ':id' => array($responseId[0], PDO::PARAM_INT)
+ ));
+ }
+
+ public function insertResponse(array $parameters): int
+ {
+ $query = "INSERT INTO Response(content, questionContent) VALUES (:content, :questionContent)";
+ $this->connection->executeQuery($query, array(
+ ':content' => array($parameters[0], PDO::PARAM_STR), //parameters[0] = content
+ ':questionContent' => array($parameters[1], PDO::PARAM_STR) //parameters[1] = questionContent
+ ));
+
+ $idResponse = $this->connection->lastInsertId();
+
+
+ foreach ($parameters[2] as $keyword){ //parameters[2] = category (array)
+ $query = "INSERT INTO Categorize (response, keyword) VALUES(:response, :keyword)";
+ $this->connection->executeQuery($query, array(
+ ':response' => array($idResponse, PDO::PARAM_STR),
+ ':keyword' => array($keyword, PDO::PARAM_STR)
+ ));
+ }
+
+ return $idResponse;
+ }
+}
\ No newline at end of file
diff --git a/Source/API/script/index.php b/Source/API/script/index.php
new file mode 100644
index 0000000..2de6b9d
--- /dev/null
+++ b/Source/API/script/index.php
@@ -0,0 +1,56 @@
+addRoutingMiddleware();
+
+// Set the base path to run the app in a subdirectory.
+// This path is used in urlFor().
+ $app->add(new BasePathMiddleware($app));
+ /**
+ * Add Error Handling Middleware
+ *
+ * @param bool $displayErrorDetails -> Should be set to false in production
+ * @param bool $logErrors -> Parameter is passed to the default ErrorHandler
+ * @param bool $logErrorDetails -> Display error details in error log
+ */
+ $errorMiddleware = $app->addErrorMiddleware(true, true, true);
+
+ $app->get('/', function (Request $request, Response $response) {
+ $response->getBody()->write("Hello, this is the base page");
+ return $response;
+ });
+
+
+ $app->get('/api/{method}', function (Request $request, Response $response, $args) {
+ $method = $args['method'];
+ $parameters = $request->getQueryParams();
+ $listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion");
+ foreach ($listGateway as $gateway) // Pour chaque Gateway
+ {
+ if (method_exists($gateway, $method)) {
+ (new $gateway)->$method($parameters); // Si oui, on appelle cette fonction
+ }
+ }
+ $response->getBody()->write("Use the method $method, with the parameters ");
+ return $response;
+ });
+// Run app
+ $app->run();
+}catch (HttpNotFoundException|Exception $e){
+ echo "Error :".$e->getMessage();
+}
+