ajout de la lib Encoding et mise en place de la class caracter du projet VLAN
FIXME: appel curl ou fopen d'une methode http depuis une action ou un controlleur. TODO: sécuriser les accès HTTP1.1 par un fichier config similaire a l'applet Discourse faite pour Tinternet TODO: ajouter un plug-in symfony permettant de charger un utilisateur dans les apps a partir de l'authentification multiple TODO: lire les documentation officielles provenant des 4 plate-formes tranquillement afin de comprendre commet doit on tester ces type d'auth quitte a créé un sous domaine particulier directement hebergé sur gittea -->Sécuriser le serveur de dev
This commit is contained in:
parent
893becebab
commit
db7101b922
6 changed files with 96 additions and 5 deletions
1
.idea/MVC---Objet.iml
generated
1
.idea/MVC---Objet.iml
generated
|
|
@ -11,6 +11,7 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/filesystem" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/view" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/neitanod/forceutf8" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/windwalker/renderer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/windwalker/structure" />
|
||||
|
|
|
|||
1
.idea/php.xml
generated
1
.idea/php.xml
generated
|
|
@ -12,6 +12,7 @@
|
|||
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
|
||||
<path value="$PROJECT_DIR$/vendor/windwalker/structure" />
|
||||
<path value="$PROJECT_DIR$/vendor/hybridauth/hybridauth" />
|
||||
<path value="$PROJECT_DIR$/vendor/neitanod/forceutf8" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ class Bdd
|
|||
switch($bdd) {
|
||||
case 'bdd1':
|
||||
$this->bdd = new PDO(DSN_BDD1, USER_BDD1, PASS_BDD1);
|
||||
break;
|
||||
break;
|
||||
case 'bdd2':
|
||||
$this->bdd = new PDO(DSN_BDD2, USER_BDD2, PASS_BDD2);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$this->bdd = new PDO(DSN_FICHES, USER_FICHES, PASS_FICHES);
|
||||
$this->bdd = new PDO(DSN_BDD_DEFAULT, USER_BDD_DEFAULT, PASS_BDD_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,6 +30,9 @@ class Bdd
|
|||
|
||||
$tab = array();
|
||||
foreach($res as $key => $row){
|
||||
if (is_string($row)) {
|
||||
$row = Caracter::normalise_ChaineDeCaracteresDownload($row);
|
||||
}
|
||||
$tab[$key] = $row;
|
||||
}
|
||||
return $tab;
|
||||
|
|
|
|||
80
application/class/Caracter.php
Normal file
80
application/class/Caracter.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace MVC\Classe;
|
||||
|
||||
|
||||
use ForceUTF8\Encoding;
|
||||
|
||||
class Caracter
|
||||
{
|
||||
|
||||
public static function normalise_ChaineDeCaracteresDownload($chaine)
|
||||
{
|
||||
//return Caracter::remplacerAccents($chaine);
|
||||
return Encoding::fixUTF8(Caracter::fp_stripslashes($chaine));
|
||||
}
|
||||
|
||||
public static function fp_stripslashes($str)
|
||||
{
|
||||
if (get_magic_quotes_gpc() == 1) {
|
||||
return stripslashes($str);
|
||||
} else {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
public static function normalise_ChaineDeCaracteresUpload($chaine)
|
||||
{
|
||||
return Caracter::fp_addslashes(Encoding::fixUTF8($chaine));
|
||||
}
|
||||
|
||||
public static function fp_addslashes($str)
|
||||
{
|
||||
if (get_magic_quotes_gpc() == 1) {
|
||||
return $str;
|
||||
} else {
|
||||
return addslashes($str);
|
||||
}
|
||||
}
|
||||
|
||||
public static function remplacerAccents($chaine)
|
||||
{
|
||||
$chaine = str_replace('é', 'é', $chaine);
|
||||
$chaine = str_replace('è', 'è', $chaine);
|
||||
$chaine = str_replace('ë', 'ë', $chaine);
|
||||
$chaine = str_replace('ê', 'ê', $chaine);
|
||||
$chaine = str_replace('ç', 'ç', $chaine);
|
||||
$chaine = str_replace('Ç', 'Ç', $chaine);
|
||||
$chaine = str_replace('à', 'à', $chaine);
|
||||
// $chaine = str_replace('','&aeacute;',$chaine);
|
||||
$chaine = str_replace('â', 'ˆ', $chaine);
|
||||
$chaine = str_replace('ä', '¨', $chaine);
|
||||
$chaine = str_replace('î', 'î', $chaine);
|
||||
$chaine = str_replace('ï', 'ï', $chaine);
|
||||
$chaine = str_replace('ù', 'ù', $chaine);
|
||||
$chaine = str_replace('û', 'û', $chaine);
|
||||
$chaine = str_replace('ü', 'ü', $chaine);
|
||||
$chaine = str_replace('É', 'É', $chaine);
|
||||
$chaine = str_replace('Ê', 'Ê', $chaine);
|
||||
$chaine = str_replace('È', 'È', $chaine);
|
||||
$chaine = str_replace('Ë', 'Ë', $chaine);
|
||||
$chaine = str_replace('À', 'À', $chaine);
|
||||
// $chaine = str_replace('','&Aeacute;',$chaine);
|
||||
$chaine = str_replace('Â', 'Â', $chaine);
|
||||
$chaine = str_replace('Ä', 'Ä', $chaine);
|
||||
$chaine = str_replace('Î', 'Î', $chaine);
|
||||
$chaine = str_replace('Ï', 'Ï', $chaine);
|
||||
$chaine = str_replace('Ù', 'Ù', $chaine);
|
||||
$chaine = str_replace('Û', 'Û', $chaine);
|
||||
$chaine = str_replace('Ü', 'Ü', $chaine);
|
||||
return Caracter::remplacerGuillemets($chaine);
|
||||
}
|
||||
|
||||
public static function remplacerGuillemets($chaine)
|
||||
{
|
||||
$chaine = str_replace("'", "'", $chaine);
|
||||
$chaine = str_replace('"', '"', $chaine);
|
||||
return $chaine;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
<?php
|
||||
|
||||
|
||||
define('DSN_BDD_DEFAULT', "mysql:host=localhost;dbname=default");
|
||||
define('USER_BDD_DEFAULT', "user_default");
|
||||
define('PASS_BDD_DEFAULT', "pass_default");
|
||||
|
||||
define('DSN_BDD1',"mysql:host=localhost;dbname=db1");
|
||||
define('USER_BDD1',"user1");
|
||||
define('PASS_BDD1',"pass1");
|
||||
|
|
@ -8,4 +13,4 @@ define('DSN_BDD2',"mysql:host=localhost;dbname=db2");
|
|||
define('USER_BDD2',"user2");
|
||||
define('PASS_BDD2',"pass2");
|
||||
|
||||
define('PATH_URL',"http://vlan.localhost/");
|
||||
//define('PATH_URL',"http://localhost/");
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
"ext-curl": "*",
|
||||
"windwalker/renderer": "3.*",
|
||||
"illuminate/view": "4.*",
|
||||
"hybridauth/hybridauth": "~3.0"
|
||||
"hybridauth/hybridauth": "~3.0",
|
||||
"neitanod/forceutf8": "^2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue