You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
1.8 KiB

<?php
// ------------------------- Transformer le code fourmie rentré par l'utilisateur en code HTML / CSS -------------------------
function compilerCodeFourmie($codeEnCompilation) {
$codeEnCompilation = preg_replace('#<br>#', '', $codeEnCompilation);
include "inc/loginsbdd.php";
try {
$bddCF = new PDO('mysql:host=localhost;dbname=anternet;charset=utf8', $userBDD, $mdpBDD, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
catch (Exception $e) {
die('Erreur PHP / MySQL : ' . $e->getMessage()); }
$reponseCF = $bddCF->query('SELECT * FROM codeFourmie');
while ($donneesCF = $reponseCF->fetch()) {
$source = $donneesCF['codeSource'];
$compile = $donneesCF['codeCompilé'];
$codeEnCompilation = preg_replace("$source", "$compile", $codeEnCompilation);
} $reponseCF->closeCursor();
$codeEnCompilation = preg_replace('#\[/vert\]|\[/rouge\]|\[/bleu\]|\[/rose\]|\[/cyan\]|\[/vertfoncé\]|\[/rougefoncé\]|\[/gris\]|\[/orange\]|\[/bleufoncé\]|\[/rosefoncé\]|\[/cyanfoncé\]|\[/jaunefoncé\]|\[/souligné\]|\[/grand\]|\[/gras\]|\[/boite\]|\[/italique\]#', '</span>', $codeEnCompilation);
$codeEnCompilation = preg_replace('#\[/lien\]#', '<span class="icon-external-link"></span></a>', $codeEnCompilation);
$codeEnCompilation = preg_replace('#\|]#', '">', $codeEnCompilation);
$codeEnCompilation = preg_replace('#nepasconfirmer=oui#', '', $codeEnCompilation);
if (isset($_SESSION['confirmerLien']) AND $_SESSION['confirmerLien'] == "non") {
$codeEnCompilation = preg_replace('#\[lien\|#', '<a href="confirmationlien.php?nepasconfirmer=oui&lien=', $codeEnCompilation);
} else {
$codeEnCompilation = preg_replace('#\[lien\|#', '<a href="confirmationlien.php?lien=', $codeEnCompilation);
}
return $codeEnCompilation;
} ?>