Old stuff/old_sites/epik/include/inc_forum/repondre.php
(Deskargatu)
</h3>
<?
$chemin[3] = preg_replace("/^(\d+).*/","$1",$chemin[3]);
$date=date(Y)."-".date(m)."-".date(d)." ".date(H).":".date(i).":".date(s);
if (empty($axx)) { echo "<p>Vous devez etre identifies pour repondre a un element</p>\n"; }
else {
$nom = $_POST['nom'] or $nom = "";
$contenu = $_POST['contenu'] or $contenu = "";
$action = $_POST['action'] or $action = "";
if (empty($nom) or empty($contenu) or empty($nick))
{
$query = "SELECT nom FROM forum_$chemin[2] WHERE topic_id='$chemin[3]' and com_id='1' LIMIT 1";
$result = mysql_query($query);
$ancien_nom = mysql_fetch_assoc($result);
echo "<p>Reponse element: $chemin[3]</p>";
echo "
<p class=\"part\">Seules les balises <i> </i> (texte en italique) et <b> </b> (texte en gras) sont acceptees. Toute autre balise sera converti en &lt;balise&gt;. Les liens sous la forme http:// ou ftp:// sont prise en compte automatiquement, pas besoin de balises specifiques.
Pour donner des urls en specifiant un nom, vous pouvez utiliser la syntaxe <span class=\"underline\">[http://votre_url.org|le nom du lien]</span> ce qui donnera un affichage "le nom du lien".
</p>
<form action=\"/site/forum/$chemin[2]/$chemin[3]/repondre\" method=\"post\">
<dl>
<dt>Titre: </dt><dd><input name=\"nom\" type=\"text\" value=\"re: ".$ancien_nom["nom"]."\" /></dd>
<dt>Message:</dt><dd><textarea maxlength=\"30\" name=\"contenu\" rows=\"15\" cols=\"60\">$contenu</textarea></dd>
<dt>Action</dt><dd><input name=\"action\" type=\"submit\" value=\"Visualiser\" /></dd>
<dd><input name=\"action\" type=\"submit\" value=\"Accepter\" /></dd>
</dl>
</form>
";
echo "<h3>Anciens messages</h3>\n";
$query = "SELECT nom,pseudo,date,contenu FROM forum_$chemin[2] WHERE topic_id='$chemin[3]' ORDER by com_id DESC LIMIT 5";
$result = mysql_query($query) or die(mysql_error());
$compteur=1;
while ($row = mysql_fetch_assoc($result))
{
$compteur++;
if(fmod($compteur,2)==0) { $style="foruma"; } else {$style="forumb"; }
echo "<div class=\"$style\"><p>".$row["nom"]." par ".$row["pseudo"]." le ".$row["date"]."</p><div>".$row["contenu"]."</div></div>\n";
}
}
else {
if ($action == "Accepter")
{
$contenu = text2html($contenu);
$nom = text2html($nom);
$query = "SELECT MAX(com_id) from forum_$chemin[2] WHERE topic_id='$chemin[3]'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
$com_id = $row[0]+1;
}
if ($com_id < 2) { die("ID $com_id error"); }
echo "<p>Ajout du topic: $topic_id<p>";
$query = "INSERT INTO forum_$chemin[2] (topic_id,com_id,nom,pseudo,date,contenu) VALUES('$chemin[3]','$com_id','".text2html($nom)."','".text2html($nick)."','$date','$contenu')";
mysql_query($query) or die(mysql_error()."<br>$query");
echo "<dl>
<dt>Pseudo:<dt><dd>$nick</dd>
<dt>Titre</dt><dd>$nom</dd>
<dt>Message</dt><dd>$contenu</dd>
</dl>
<p><a href=\"/site/forum/$chemin[2]\" title=\"retour\">Retour</a> :: <a href=\"/site/forum/$chemin[2]/$chemin[3]-".normalise($nom)."#bas\" title=\"$nom\">Visualier</a></a>";
}
elseif($action == "Visualiser")
{
$date = preg_replace("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/","$3/$2/$1 à $4:$5:$6",$date);
echo "<p>Reponse element: $chemin[3]</p>";
aide();
echo "
<form action=\"/site/forum/$chemin[2]/$chemin[3]/repondre\" method=\"post\">
<dl>
<dt>Titre: </dt><dd><input name=\"nom\" type=\"text\" value=\"$nom\" /></dd>
<dt>Message:</dt><dd><textarea maxlength=\"30\" name=\"contenu\" rows=\"15\" cols=\"60\">$contenu</textarea></dd>
<dt>Action</dt><dd><input name=\"action\" type=\"submit\" value=\"Visualiser\" /></dd>
<dd><input name=\"action\" type=\"submit\" value=\"Accepter\" /></dd>
</dl>
</form>
<div class=\"foruma\">
<dl><dt>$nom</dt><dd>par $nick le $date</dd></dl>
<div>
";
$row = explode("\n",$contenu);
foreach($row as $key) { echo "<p>$key</p>\n"; }
echo "</div>
</div>\n";
echo "<h3>Anciens messages</h3>\n";
$query = "SELECT nom,pseudo,date,contenu FROM forum_$chemin[2] WHERE topic_id='$chemin[3]' ORDER by com_id DESC LIMIT 5";
$result = mysql_query($query) or die(mysql_error());
$compteur=1;
while ($row = mysql_fetch_assoc($result))
{
$compteur++;
if(fmod($compteur,2)==0) { $style="foruma"; } else {$style="forumb"; }
echo "<div class=\"$style\"><dl><dt>".$row["nom"]."</dt><dd>par ".$row["pseudo"]." le ".$row["date"]."</dd></dl>\n<div>";
$contenu = explode("\n",$row["contenu"]);
foreach($contenu as $key) { echo "<p>$key</p>\n"; }
echo "</div></div>\n";
}
}
}
}
?>