Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/epik/include/backup_forum.php

(Deskargatu)
<div class="article">
<div class="element">
<h2>Forum</h2>
<div class="forum">
<? if ($axx < 5) { ?>
<h2>erreur :) page en cstruction</h2>
<div class="element">
<h2>non</h2>
<div>
<p>Vous n avez rien a faire ici, loggez vous :)</p>
</div>
</div>
<?  } else { 

echo "    <h3>Repertoire: /<a href=\"/site/forum\" title=\"Forums\">Forum</a>\n";
if (empty($chemin[2])) { 
    echo "</h3>
    <dl>
    ";
    $result=mysql_list_tables("informatique");
    while ($row  = mysql_fetch_row($result))
    	{
	if (ereg("^forum_(.*)",$row[0],$reg)) { 
	    $result = mysql_query("SELECT nom,description FROM description WHERE ref='$row[0]'") or die(mysql_error());
	    $compteur=1;
	    while ($ref = mysql_fetch_assoc($result))
		{ 
		    $compteur++;
		    if (fmod($compteur,2) ==0) { $style="foruma"; } else { $style="forumb"; }
		    $requete = "SELECT pseudo,date,topic_id from forum_$reg[1] ORDER BY id DESC LIMIT 1";
		    $resultat = mysql_query($requete) or die(mysql_error());
		    $dernier = mysql_fetch_assoc($resultat);
   	    	    $dernier["date"] = preg_replace("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/","$3/$2/$1 &agrave; $4:$5:$6",$dernier["date"]);
    		
		
		    echo "<dt class=\"$style\"><a href=\"/site/forum/$reg[1]\" title=\"".$ref["nom"]."\">".$ref["nom"]."</a></dt><dd>".$ref["description"]."</dd>\n"; 
		    if (!empty($dernier["pseudo"])) {
		    echo "<dd><a href=\"/site/forum/$reg[1]/".$dernier["topic_id"]."#bas\">Dernier message</a> 
		    le ".$dernier["date"]." par <a href=\"http://epiknet.org/club/fiche.asp?nick=".$dernier["pseudo"]."\">".$dernier["pseudo"]."</a>
		    </dd>  "; }
		    
		}
	    }
	}    
    echo "</dl>
    </div>";
    
    }

else {
    $chemin[2] = preg_replace("/[^a-zA-Z]/","",$chemin[2]);
    echo "/ <a href=\"/site/forum/$chemin[2]\" title=\"Forum $chemin[2]\">$chemin[2]</a> \n";
    if (empty($chemin[3]))
    {
	echo "</h3>
	<p><a href=\"/site/forum/$chemin[2]/new\" title=\"Ajout\">Nouveau</a></p>";

	    $requete = "SELECT COUNT(*) from forum_$chemin[2] WHERE topic_id='$table'";	    
	    $resultat = mysql_query($requete) or die(mysql_error());
	    $pages = mysql_fetch_array($resultat);
	    $page = ceil($pages[0]/10);
	    if ($page == 1) { echo "( 1 page )"; }
	    else { echo "("; for($i=1;$i<=$page;$i++) { echo "<a href=\"/site/forum/$chemin[2]/$table-$i\">$i</a> "; } echo " )";}
	    $start =($start-1)*10;
	


        $query = "SELECT DISTINCT topic_id,nom,pseudo FROM forum_".$chemin[2]." WHERE com_id='1' ORDER BY topic_id DESC LIMIT 30";
        $result = mysql_query($query) or die("Not found?");
	$compteur=1;
	echo "<dl>\n";
        while($row = mysql_fetch_assoc($result))
        {
	    $requete = "SELECT COUNT(*) from forum_$chemin[2] WHERE topic_id='".$row["topic_id"]."'";
	    $resultat = mysql_query($requete) or die(mysql_error());
	    $reponses = mysql_fetch_array($resultat);
	    
	    $requete = "SELECT pseudo,date from forum_$chemin[2] WHERE topic_id='".$row["topic_id"]."' and com_id>1 ORDER BY com_id DESC LIMIT 1";
	    $resultat = mysql_query($requete) or die(mysql_error());
	    $dernier = mysql_fetch_assoc($resultat);

	    
	    $compteur++;
	    if (fmod($compteur,2) ==0) { $style="foruma"; } else { $style="forumb"; }
		echo "<dt class=\"$style\">
	      <a href=\"/site/forum/$chemin[2]/".$row["topic_id"]."-1-".normalise($row["nom"])."\" title=\"".$row["nom"]."\">".$row["nom"]."</a></dt>
	      <dd class=\"nick\">par <a href=\"http://epiknet.org/club/fiche.asp?nick=".$row["pseudo"]."\">".$row["pseudo"]."</a</dd>
	      <dd class=\"reponses\">";
	      if (($reponses[0]-1)== 0)  echo "pas de reponses";
	      elseif(($reponses[0]-1) == 1) { echo "1 reponse"; }
	      else { echo ($reponses[0]-1)." reponses"; }
   	     $dernier["date"] = preg_replace("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/","$3/$2/$1 &agrave; $4:$5:$6",$dernier["date"]);
	      echo " </dd>";
	      if (!empty($dernier["pseudo"])) {
	      echo "<dd class=\"dernier\">Dernier message le ".$dernier["date"]." par <a href=\"http://epiknet.org/club/fiche.asp?nick=".$dernier["pseudo"]."\">".$dernier["pseudo"]."</a></dd>  "; }
	      echo "\n";
	}
	echo "</dl>\n";
    }
    
    else 
    { 
	if ($chemin[3] == "new") 
	    { 
		include(dirname(__FILE__)."/inc_forum/new.php"); 
	    }
	else 
	{
	$chemin[3] = preg_replace("/^(\d+)\-(\d+).*/","$1-$2",$chemin[3]);    
	if ($chemin[4]=="repondre") { include(dirname(__FILE__)."/inc_forum/repondre.php"); }
	else 
	    {
	    if (!empty($chemin[4])) { include(dirname(__FILE__)."/inc_forum/edit.php"); }
	    else 
	    {
	    list($table,$start) = split("-",$chemin[3]);
	    $requete = "SELECT COUNT(*) from forum_$chemin[2] WHERE topic_id='$table'";	    
	    $resultat = mysql_query($requete) or die(mysql_error());
	    $pages = mysql_fetch_array($resultat);
	    $page = ceil($pages[0]/10);
	    if ($page == 1) { echo "( 1 page )"; }
	    else { echo "("; for($i=1;$i<=$page;$i++) { echo "<a href=\"/site/forum/$chemin[2]/$table-$i\">$i</a> "; } echo " )";}
	    $start =($start-1)*10;
    	    
	    echo "</h3>\n<div>";
	    $query = "SELECT com_id,nom,pseudo,date,contenu FROM forum_$chemin[2] WHERE topic_id='$table' ORDER BY id ASC LIMIT $start,10";
	    $result =  mysql_query($query) or die("Erreur !");
	    $compteur=1;
	    while ($row = mysql_fetch_assoc($result))
	        {
		$date = preg_replace("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/","$3/$2/$1 &agrave; $4:$5:$6",$row["date"]);
		$compteur++;
		if (fmod($compteur,2) ==0) { $style="foruma"; } else { $style="forumb"; }
	        echo "<div id=\"id".$row["com_id"]."\" class=\"$style\"><dl><dt>".$row["nom"]." </dt>
		             <dd>(<a href=\"/site/forum/$chemin[2]/$table/#id".$row["com_id"]."\">#</a>)par <a href=\"http://epiknet.org/club/fiche.asp?nick=".$row["pseudo"]."\">".$row["pseudo"]."</a> le ".$date."</dd></dl>
		<div>";
		$contenu = explode("\n",$row["contenu"]);
		foreach($contenu as $key) { echo "<p>$key\n</p>"; }
		if ($nick == $row["pseudo"]) { echo "<p><a href=\"/site/forum/$chemin[2]/$table/".$row["com_id"]."/Editer\">Editer</a> :: <a href=\"/site/forum/$chemin[2]/$table/".$row["com_id"]."/Supprimer\">Supprimer</a></p>"; }
		echo "
		</div></div>\n"; 
		}
	    echo "<p><a href=\"/site/forum/$chemin[2]/$table/repondre\" title=\"repondre\">Repondre</a></p>\n";
	    echo "</div>";
	    }
	    }
	}
    }
}


 } ?>
</div>
</div>
</div>