Jeremy DUCOURTHIAL 3 years ago
commit 8bdc5f1e5c

@ -50,9 +50,11 @@ class controllerAdmin {
}
function ajoutSource() {
global $con,$vues;
if(isset($_REQUEST["linkSource"])) {
$gate = new GatewaySources($con);
global $dsn,$user,$pass,$vues;
$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);
}

@ -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;
}

@ -1,7 +1,9 @@
<form action="index.php?action=ajoutSource" method="POST">
<html>
<form action="../index.php?action=ajoutSource" method="POST">
<input type="text" name="linkSource" placeholder="source" />
<input type="submit" value="add source">
</form>
</html>
<?php
foreach ($listeSources as $n){

Loading…
Cancel
Save