From e760f86a93b18b23734d226e07441f913376fc4f Mon Sep 17 00:00:00 2001 From: bastien ollier Date: Fri, 16 Dec 2022 11:26:10 +0100 Subject: [PATCH 1/3] continuation administration.php --- controllers/ControllerAdmin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/ControllerAdmin.php b/controllers/ControllerAdmin.php index 2209483..d79e3cb 100644 --- a/controllers/ControllerAdmin.php +++ b/controllers/ControllerAdmin.php @@ -51,7 +51,7 @@ class controllerAdmin { $source = new Sources($_REQUEST["linkSource"]); $gate->addSources($source); } - header("location: ".$vues['administration']); + //header("location: ".$vues['administration']); } function validationConnexion() { From 1549f1467d207aa2f9e11f1dce4df4a10134cf03 Mon Sep 17 00:00:00 2001 From: bastien ollier Date: Fri, 16 Dec 2022 13:06:22 +0100 Subject: [PATCH 2/3] fin add source --- controllers/ControllerAdmin.php | 6 +++--- vues/administration.php | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/controllers/ControllerAdmin.php b/controllers/ControllerAdmin.php index d79e3cb..c81eb0b 100644 --- a/controllers/ControllerAdmin.php +++ b/controllers/ControllerAdmin.php @@ -45,13 +45,13 @@ class controllerAdmin { } function ajoutSource() { - global $con,$vues; + global $dsn,$user,$pass,$vues; if(isset($_REQUEST["linkSource"])) { - $gate = new GatewaySources($con); + $gate = new GatewaySources(new Connection($dsn,$user,$pass)); $source = new Sources($_REQUEST["linkSource"]); $gate->addSources($source); } - //header("location: ".$vues['administration']); + header("location: ".$vues['administration']); } function validationConnexion() { diff --git a/vues/administration.php b/vues/administration.php index 3838658..77e6afc 100644 --- a/vues/administration.php +++ b/vues/administration.php @@ -1,4 +1,6 @@ -
- - -
+ +
+ + +
+ From 7bf0c8e0a036e67658ca98069df9a490f7a7ab35 Mon Sep 17 00:00:00 2001 From: bastien ollier Date: Fri, 16 Dec 2022 13:28:18 +0100 Subject: [PATCH 3/3] fin add source --- controllers/ControllerAdmin.php | 4 +++- vues/Validation.php | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/controllers/ControllerAdmin.php b/controllers/ControllerAdmin.php index c81eb0b..de09f83 100644 --- a/controllers/ControllerAdmin.php +++ b/controllers/ControllerAdmin.php @@ -46,7 +46,9 @@ class controllerAdmin { function ajoutSource() { global $dsn,$user,$pass,$vues; - if(isset($_REQUEST["linkSource"])) { + $error =[]; + $link = $_REQUEST["linkSource"]; + if(isset($_REQUEST["linkSource"]) && Validation::url_form($link,$error)) { $gate = new GatewaySources(new Connection($dsn,$user,$pass)); $source = new Sources($_REQUEST["linkSource"]); $gate->addSources($source); diff --git a/vues/Validation.php b/vues/Validation.php index be41d37..cef220f 100644 --- a/vues/Validation.php +++ b/vues/Validation.php @@ -38,19 +38,21 @@ } - static function url_form(string &$url,array &$dVueEreur) + static function url_form(string $url,array &$dVueEreur) { - if (!isset($url)||$url=="") { $dVueEreur[] = "pas d'url"; $url=""; + return false; } - if ($url != filter_var($name, FILTER_VALIDATE_URL)) + if (!filter_var($url, FILTER_VALIDATE_URL)) { $dVueEreur[] = "url invalide"; $url=""; + return false; } + return true; }