1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
|
<?php
// =========================EDITEUR================================
if (isset($_POST["larticle"])) $larticle=trim($_POST["larticle"]);
else $larticle="";
if (isset($_POST["Action"])) $Action=trim($_POST["Action"]);
else $Action="";
if (isset($_POST["NewTexte"])) $NewTexte=$_POST["NewTexte"];
else $NewTexte="";
$larticle="000editeur.txt";
// ======== avant tout si pas d article page on retourne =============
if ( $larticle=="")
{
header('Location: index.php');
exit;
}
// ======== C est OK il y a un nom article page on le lit ==========
$Letexte="";
$LeFichier=$larticle;
$Laray=file($LeFichier);
$NbrLig=count($Laray)-1;
for($a=0;$a<=$NbrLig;$a++)
{
$Letexte .= stripslashes($Laray[$a]);
}
if ( $Letexte=="")
{
header('Location: index.php');
exit;
}
if ( $Action =="abandon")
{
header('Location: index.php');
exit;
}
// ============Actions =====================================
// Action peut valoir valide = validation des modifs
// alors la page est reecrite
// abandon = abandon de la modif en cour
// alors on quitte
// = on a donc action actuelle Action de l article larticle texte NewTexte
if ($NewTexte=="" ) $NewTexte=$Letexte;
if ($NewTexte!="")
{
$NewTexte= stripslashes($NewTexte);
$NewTexte=str_replace("","' ",$NewTexte);
$NewTexte=str_replace(" "," ",$NewTexte);
$NewTexte=str_replace("<"," ",$NewTexte);
$NewTexte=str_replace(">"," ",$NewTexte);
$NewTexte=str_replace("&"," ",$NewTexte);
$NewTexte=str_replace("''","' ",$NewTexte);
$NewTexte=str_replace(" "," ",$NewTexte);
$NewTexte=str_replace("","OE",$NewTexte);
$NewTexte=str_replace("","oe",$NewTexte);
$NewTexte=str_replace(" \0","",$NewTexte);
$NewTexte=str_replace("\0","",$NewTexte);
$NewTexte=$NewTexte;
if ($Action =="valide")
{
$LeFichier=fopen($larticle,"w+");
fputs($LeFichier,$NewTexte."");
fclose($LeFichier);
header('Location: index.php');
exit;
}
}
// ==========Tout est controle et ok===============================
// =========================EDITEUR================================
?>
<html><body>
<style>
* {font-size : 100%;}
html { width:100%;height : 100%;font-size : 100%;
}
BODY {
width:100%;height : 100%;background-color : #557bac;
font-family : Verdana, Myranda,Arial, Helvetica, sans-serif;
font-size : 100%; color : #ffffff; margin-left : 0;
margin-right : 0;text-align:center;
}
input {font-family : Verdana, Myranda,Arial, Helvetica, sans-serif; font-size : 1.0em; color : #000000; }
input.Boutons_Saisie {background-color: #267474;}
input.Zone_Saisie {background-color: #eeeeff;color:#BB9999;}
button.Boutons_Saisie {background-color: #267474;}
textarea { font-family : Verdana, Myranda,Arial, Helvetica, sans-serif; font-size : 1.0em; color : #000000; }
img { border : 0}
div {font-family : Verdana, Myranda,Arial, Helvetica, sans-serif;color : #ffffff;}
div.bbcode3 { margin : auto;text-align:center;width: 800px;z-index: 10;}
div.centre2 {width: 800px;margin : auto;text-align:center;}
a.LesA12 { font-family : Verdana, Myranda,Arial, Helvetica, sans-serif; font-size: 1.4em; color: #ffffff; text-decoration: none;}
a.LesA12:link { }
a.LesA12:hover {color : #ff9999; }
</style>
<div class="bbcode3" >
<input type="button" onclick="Ajout(2,'b')" value=" B " style="font-weight:bold; width: 30px" />
<input type="button" onclick="Ajout(2,'i')" value=" i " style="font-style:italic; width: 30px" />
<input type="button" onclick="Ajout(2,'u')" value=" u " style="text-decoration: underline; width: 30px" />
<input type="button" onclick="Ajout(2,'quote')" value=" Quote " style="width: 50px" />
<input type="button" onclick="Ajout(1,'[br /]')" value=" Retour Ligne " style="width: 90px" />
<input type="button" onclick="Ajout(2,'url')" value=" Web " style="width: 50px" />
<input type="button" onclick="Ajout(2,'img')" value=" Img " style="width: 50px" />
</div>
<DIV CLASS="centre2">
<br />
<form id='LeForm' name='LeForm' action='000editeur.php' method='POST'>
<input name='Action' value='' type='hidden' />
<input name='larticle' value='<?PHP echo ("".$larticle.""); ?>' type='hidden' />
<br />
<?PHP
echo ("<br /><textarea class='Zone_Saisie' rows='20' name='NewTexte' id='NewTexte' cols='90' wrap='virtual' >".$NewTexte."</textarea>");
?>
<br>
<input type='submit' value=' Abandonnez ce texte ' onclick='Mabandon()' /><br /><br />
<input type='submit' value=' Validez cette page pour le Web ' onclick='Cvalide()'>
</form>
</div>
<!-- ======================JAVASCRIPT EDITEUR================== -->
<script type="text/javascript">
<!--
function VaY()
{
Tout=document.LeForm.NewTexte.value;
Tout=Tout.replace(/[\>]/g," ");
Tout=Tout.replace(/[\<]/g," ");
document.LeForm.NewTexte.value=Tout;
document.LeForm.submit();
return true;
}
function Ajout(Cas,Lui)
{
var mess = document.LeForm.NewTexte;
if (Cas==2)
{
if (Lui=="b" || Lui=="u" || Lui=="i" || Lui=="diag" || Lui=="img" || Lui=="url" || Lui=="quote")
{
if (!document.selection) vapa=99;
else
{
mess.focus();
sel = document.selection.createRange();
if ( sel.text !="")
{
if (Lui!="url") sel.text = "["+Lui+"]" + sel.text + "[/" + Lui+"]";
if (Lui=="url" ) sel.text = "["+Lui+"]" + sel.text + "[/" + Lui+"]...[/urltxt]";
document.LeForm.focus();
}
else {
Tout=document.LeForm.NewTexte.value;
if (Lui!="url") document.LeForm.NewTexte.value=Tout+"["+Lui+"]"+"[/"+Lui+"]";
if (Lui=="url") document.LeForm.NewTexte.value=Tout+"["+Lui+"]"+"[/"+Lui+"]...[/urltxt]";
}
}
}
}
if (Cas==1)
{
if (!document.selection) vapa=99;
else
{
mess.focus();
sel = document.selection.createRange();
sel.text = sel.text + " " + Lui+" ";
document.LeForm.focus();
}
}
}
function MaPrevisu()
{
var xxxy=document.LeForm.NewTexte.value;
var chaine=xxxy;
chaine=chaine.replace(/[\]]/g,">");
chaine=chaine.replace(/[\[]/g,"<");
}
function MaPrevisuNon()
{
gloop.style.visibility='hidden';
Limage.style.visibility='hidden';
FenetreTxt2.style.visibility='hidden';
FenetreTxt.style.visibility='visible';
boutons.style.visibility='visible';
return true;
}
function Cvalide()
{
document.LeForm.Action.value="valide";
document.LeForm.submit();
return true;
}
function Mabandon()
{
document.LeForm.Action.value="abandon";
document.LeForm.submit();
return true;
}
//-->
</script>
</body></html> |