Skip to content
Extraits de code Groupes Projets
inc_presentation.php3 71 ko
Newer Older
<?php

//
// Ce fichier ne sera execute qu'une fois
if (defined("_ECRIRE_INC_PRESENTATION")) return;
define("_ECRIRE_INC_PRESENTATION", "1");


//
ARNO*'s avatar
ARNO* a validé
	global $couleur_foncee;

	if (!ereg("/ecrire/", $GLOBALS['REQUEST_URI']))
		$dir_ecrire = 'ecrire/';

	return "&nbsp;&nbsp;<script><!--\n".
	'document.write("<a href=\"javascript:window.open(\''.$dir_ecrire.'aide_index.php3?aide='.
Fil's avatar
Fil a validé
	$aide.
	"', 'aide_spip', 'scrollbars=yes,resizable=yes,width=740,height=580'); ".
Fil's avatar
Fil a validé
	'void(0);\">");'.
	"\n// --></script><noscript>".
	'<a href="'.$dir_ecrire.'aide_index.php3?aide='.
Fil's avatar
Fil a validé
	$aide.
ARNO*'s avatar
ARNO* a validé
	'" target="_blank"></noscript><img src="'.$dir_ecrire.'img_pack/aide.gif" alt="AIDE" title="De l\'aide sur cet &eacute;l&eacute;ment" width="12" height="12" border="0" align="middle"></a>';
}


//
// affiche un bouton imessage
//
function bouton_imessage($destinataire, $row = '') {
	// si on passe "force" au lieu de $row, on affiche l'icone sans verification
	global $connect_id_auteur;

	$url = new Link("message_edit.php3");

	// verifier que ce n'est pas un auto-message
	if ($destinataire == $connect_id_auteur)
		return;
	// verifier que le destinataire a un login

	if ($row != "force") {
		$login_req = "select login, messagerie from spip_auteurs where id_auteur=$destinataire AND en_ligne>DATE_SUB(NOW(),INTERVAL 15 DAY)";
		$row = mysql_fetch_array(spip_query($login_req));
		
		if (($row['login'] == "") OR ($row['messagerie'] == "non")) {
			return;
		}
	}
	$url->addVar('dest',$destinataire);
	$url->addVar('new','oui');
	$url->addVar('type','normal');

	if ($destinataire) $title = "Envoyer un message priv&eacute; &agrave; cet auteur";
	else $title = "Ecrire un message priv&eacute;";

	$texte_bouton = "<img src='img_pack/m_envoi.gif' width='14' height='7' border='0'>";
	return "<a href='". $url->getUrl() ."' title=\"$title\">$texte_bouton</a>";
function debut_cadre_relief($icone='', $return = false, $fonction=''){
ARNO*'s avatar
ARNO* a validé
			$retour_aff.= "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=\"100%\">";
			$retour_aff.= "<tr>";
			$retour_aff.= "<td width='5'><img src='img_pack/rond-hg-24.gif' alt='/' width='5' height='24'></td>";
			$retour_aff.= "<td background='img_pack/rond-h-24.gif'>";
			if (strlen($fonction)>3) {
				$retour_aff.= "<table cellpadding=0 cellspacing=0 border=0><tr><td background='img_pack/$icone'><img src='img_pack/$fonction' alt='\' width='24' height='24'></td></tr></table>";
			}
			else {
				$retour_aff.= "<img src='img_pack/$icone' alt='\' width='24' height='24'>";
			}
			$retour_aff.= "</td>";
			$retour_aff.= "<td width='5'><img src='img_pack/rond-hd-24.gif' alt='/' width='5' height='24'></td>";
			$retour_aff.= "</tr>";
	
		$retour_aff.= "<TR>";
		$retour_aff.= "<td background='img_pack/rond-g.gif' width='5'><img src='img_pack/rien.gif' alt='/' width='5' height='5'></td>";
		$retour_aff.= "<TD WIDTH=\"100%\">";
		$retour_aff.= "<TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0 WIDTH=\"100%\"><TR><TD BGCOLOR='#ffffff' WIDTH=\"100%\">";
	}
	else {
		$retour_aff = "<p><div style='border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc;'><div style='border: 1px solid #666666; padding: 5px; background-color: white;'>";
function fin_cadre_relief($return = false){
Fil's avatar
Fil a validé
		$retour_aff.= "</td></tr></table>";
		$retour_aff.= "</td>";
		$retour_aff.= "<td background='img_pack/rond-d.gif' width='5'><img src='img_pack/rien.gif' alt='\' width='5' height='5'></td></tr>";
		$retour_aff.= "<tr>";
		$retour_aff.= "<td width='5'><img src='img_pack/rond-bg.gif' alt='\' width='5' height='5'></td>";
		$retour_aff.= "<td background='img_pack/rond-b.gif'><img src='img_pack/rien.gif' alt='-' width='5' height='5'></td>";
		$retour_aff.= "<td width='5'><img src='img_pack/rond-bd.gif' alt='/' width='5' height='5'></td>";
		$retour_aff.= "</tr>";
		$retour_aff.= "<tr><td></td><td bgcolor='#bbbbbb'><img src='img_pack/rien.gif' alt='\' width='5' height='1'></td></tr>";
		$retour_aff.= "<tr><td><img src='img_pack/rien.gif' alt='' width='5' height='4'></td></tr>";
		$retour_aff.= "</table>";

	}
	else {
		$retour_aff = "</div></div></p>\n";
	}

	if ($return) return $retour_aff;
	else echo $retour_aff;
function debut_cadre_enfonce($icone='', $return = false, $fonction=''){
	$img_pack = $GLOBALS['flag_ecrire'] ? 'img_pack' : 'ecrire/img_pack';
	if ($spip_display != 1){	
		if (strlen($icone)<3) $icone = "rien.gif";
			$retour_aff.= "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=\"100%\">";
			$retour_aff.= "<tr>";
			$retour_aff.= "<td width='5'><img src='$img_pack/cadre-hg.gif' alt='/' width='5' height='24'></td>";
			$retour_aff.= "<td background='$img_pack/cadre-h.gif'>";
				$retour_aff.= "<table cellpadding=0 cellspacing=0 border=0><tr><td background='$img_pack/$icone'><img src='$img_pack/$fonction' alt='' width='24' height='24'></td></tr></table>";
				$retour_aff.= "<img src='$img_pack/$icone' alt='' width='24' height='24'>";
			$retour_aff.= "<td width='5'><img src='$img_pack/cadre-hd.gif' alt='\' width='5' height='24'></td>";
		$retour_aff.= "<td background='$img_pack/cadre-g.gif' width='5'><img src='$img_pack/rien.gif' alt='' width='5' height='5'></td>";
		$retour_aff.= "<TD WIDTH=\"100%\" bgcolor='#e0e0e0' background=''>";
		$retour_aff.= "<TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0 WIDTH=\"100%\"><TR><TD WIDTH=\"100%\">";
	}
	else {
		$retour_aff = "<p><div style=\"border: 1px solid #333333; background-color: #e0e0e0;\"><div style=\"padding: 5px; left-right: 1px solid #999999; border-top: 1px solid #999999;\">";
	}
	
	if ($return) return $retour_aff;
	else echo $retour_aff;
}

function fin_cadre_enfonce($return = false){
	$img_pack = $GLOBALS['flag_ecrire'] ? 'img_pack' : 'ecrire/img_pack';

	if ($spip_display != 1){	
		$retour_aff.= "</TD></TR></TABLE>";
		$retour_aff.= "</TD>";
		$retour_aff.= "<td background='$img_pack/cadre-d.gif' width='5'><img src='$img_pack/rien.gif' alt='' width='5' height='5'></td>";
		$retour_aff.= "<td width='5'><img src='$img_pack/cadre-bg.gif' alt='\' width='5' height='5'></td>";
		$retour_aff.= "<td background='$img_pack/cadre-b.gif'><img src='$img_pack/rien.gif' alt='' width='5' height='5'></td>";
		$retour_aff.= "<td width='5'><img src='$img_pack/cadre-bd.gif' alt='/' width='5' height='5'></td>";
		$retour_aff.= "<tr><td><img src='$img_pack/rien.gif' alt='' width='5' height='4'></td></tr>";
		$retour_aff.= "</table>";
	}
	else {
		$retour_aff = "</div></div></p>\n";
	}

	if ($return) return $retour_aff;
	else echo $retour_aff;
//
// une boite alerte
//
function debut_boite_alerte() {
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
	echo "<p><table cellpadding='6' border='0'><tr><td width='100%' bgcolor='red'>";
	echo "<table width='100%' cellpadding='12' border='0'><tr><td width='100%' bgcolor='white'>";
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
	echo "</td></tr></table>";
	echo "</td></tr></table>";
	global $couleur_claire,  $couleur_foncee;
	echo "<p><table cellpadding='5' cellspacing='0' border='1' width='100%' style='border-left: 1px solid $couleur_foncee; border-top: 1px solid $couleur_foncee; border-bottom: 1px solid white; border-bottom: 1px solid white' background=''>";
	echo "<tr><td bgcolor='$couleur_claire' width='100%'>";
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
	echo "<font face='Verdana,Arial,Helvetica,sans-serif' size='2' color='#333333'>";
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
	echo "</font></td></tr></table>";
}

//
// une autre boite
//
function bandeau_titre_boite($titre, $afficher_auteurs, $boite_importante = true) {
	global $couleur_foncee;
	if ($boite_importante) {
		$couleur_fond = $couleur_foncee;
		$couleur_texte = '#FFFFFF';
	}
	else {
		$couleur_fond = '#EEEECC';
		$couleur_texte = '#000000';
	}
ARNO*'s avatar
ARNO* a validé
	echo "<tr bgcolor='$couleur_fond'><td width=\"100%\"><FONT FACE='Verdana,Arial,Helvetica,sans-serif' SIZE=3 COLOR='$couleur_texte'>";
	echo "<B>$titre</B></FONT></TD>";
	if ($afficher_auteurs){
		echo "<TD WIDTH='100'>";
ARNO*'s avatar
ARNO* a validé
		echo "<img src='img_pack/rien.gif' alt='' width='100' height='12' border='0'>";
ARNO*'s avatar
ARNO* a validé
	echo "<img src='img_pack/rien.gif' alt='' width='90' height='12' border='0'>";
//
// La boite raccourcis
//

function debut_raccourcis() {
	debut_cadre_enfonce();
	echo "<font face='Verdana,Arial,Helvetica,sans-serif' size=1>";
	echo "<b>RACCOURCIS :</b><p>";
}

function fin_raccourcis() {
	echo "</font>";
	fin_cadre_enfonce();
}


//
// Une icone avec lien et legende (texte en-dessous)
//

function afficher_icone_texte($url, $texte, $image, $largeur, $hauteur, $align = "") {
	echo "<table";
	if ($align) echo " align='$align'";
	echo " cellspacing='0' cellpadding='10'>";
	echo "<tr><td width='".floor($largeur * 2.0)."' align='center'>\n";
Antoine Pitrou's avatar
Antoine Pitrou a validé
	echo "\t<a class='icone' href=\"$url\"><font face='Verdana,Arial,Helvetica,sans-serif' size='1'>\n";
	echo "\t<img src='$image' border='0' alt='o' width='$largeur' height='$hauteur'><br>\n";
	echo "\t<b>$texte</b></font></a>\n";
	echo "\t</td></tr></table>\n";
}


//
// Une icone avec lien et info-bulle (pas de texte en-dessous)
//

function afficher_icone($url, $texte, $image, $largeur, $hauteur, $align = "") {
	echo "<a class='icone' href=\"$url\">\n";
	$texte = attribut_html($texte);
	echo "\t<img src='$image' border='0' width='$largeur' height='$hauteur' alt=\"$texte\" title=\"$texte\"";
	if ($align) echo " align='$align'";
	echo "></a>\n";
}




//
// Fonctions d'affichage
//

function tableau($texte,$lien,$image){
	echo "<td width=15>&nbsp;</td>\n";
	echo "<td width=80 valign='top' align='center'><a href='$lien'><img src='$image' border='0' alt='o'></a><br><font size=1 face='arial,helvetica' color='#e86519'><b>$texte</b></font></td>";
}

function afficher_liste($largeurs, $table, $styles = '') {
	global $couleur_claire;

	if (!is_array($table)) return;
	reset($table);
	echo "\n";
	while (list(, $t) = each($table)) {
		$couleur_fond = ($ifond ^= 1) ? '#FFFFFF' : $couleur_claire;
		echo "<tr bgcolor=\"$couleur_fond\">";
		reset($largeurs);
		if ($styles) reset($styles);
		while (list(, $texte) = each($t)) {
			$style = $largeur = "";
			list(, $largeur) = each($largeurs);
			if ($styles) list(, $style) = each($styles);
			if (!trim($texte)) $texte .= "&nbsp;";
			echo "<td";
			if ($largeur) echo " width=\"$largeur\"";
			if ($style) echo " class=\"$style\"";
			echo ">$texte</td>";
		}
		echo "</tr>\n";
	}
	echo "\n";
}

function afficher_tranches_requete(&$query, $colspan) {
	$query = trim($query);
	$query_count = eregi_replace('^(SELECT)[[:space:]].*[[:space:]](FROM)[[:space:]]', '\\1 COUNT(*) \\2 ', $query);
	list($num_rows) = mysql_fetch_row(spip_query($query_count));
	if (!$num_rows) return;

	$nb_aff = 10;
	// Ne pas couper pour trop peu
	if ($num_rows <= 1.5 * $nb_aff) $nb_aff = $num_rows;
	if (ereg('LIMIT .*,([0-9]+)', $query, $regs)) {
		if ($num_rows > $regs[1]) $num_rows = $regs[1];
	}

	$texte = "\n";

	if ($num_rows > $nb_aff) {
		$tmp_var = $query;
		$deb_aff = intval(getTmpVar($tmp_var));

		$texte .= "<tr><td background=\"\" class=\"arial2\" colspan=\"".($colspan - 1)."\">";

		for ($i = 0; $i < $num_rows; $i += $nb_aff){
			$deb = $i + 1;
			$fin = $i + $nb_aff;
			if ($fin > $num_rows) $fin = $num_rows;
Fil's avatar
Fil a validé
			if ($deb > 1) $texte .= " | ";
			if ($deb_aff + 1 >= $deb AND $deb_aff + 1 <= $fin) {
Fil's avatar
Fil a validé
				$texte .= "<B>$deb</B>";
			}
			else {
				$link = new Link;
				$link->addTmpVar($tmp_var, strval($deb - 1));
Fil's avatar
Fil a validé
				$texte .= "<A HREF=\"".$link->getUrl()."\">$deb</A>";
			}
		}
		$texte .= "</td>\n";
		$texte .= "<td background=\"\" class=\"arial2\" colspan=\"1\" align=\"right\" valign=\"top\">";
		if ($deb_aff == -1) {
Fil's avatar
Fil a validé
			$texte .= "<B>Tout afficher</B>";
		} else {
			$link = new Link;
			$link->addTmpVar($tmp_var, -1);
Fil's avatar
Fil a validé
			$texte .= "<A HREF=\"".$link->getUrl()."\">Tout afficher</A>";
		}		
	
		$texte .= "</td>\n";
		$texte .= "</tr>\n";
		
		
		if ($deb_aff != -1) {
			$query = eregi_replace('LIMIT[[:space:]].*$', '', $query);
			$query .= " LIMIT $deb_aff, $nb_aff";
		}
	}

	return $texte;
}


//
// Afficher tableau d'articles
//
function afficher_articles($titre_table, $requete, $afficher_visites = false, $afficher_auteurs = true, $toujours_afficher = false, $afficher_cadre = true) {
	global $connect_id_auteur, $connect_statut;
Antoine Pitrou's avatar
Antoine Pitrou a validé
	$activer_messagerie = lire_meta("activer_messagerie");
	$activer_statistiques = lire_meta("activer_statistiques");
ARNO*'s avatar
ARNO* a validé
	$activer_statistiques_ref = lire_meta("activer_statistiques_ref");

	$tranches = afficher_tranches_requete($requete, $afficher_auteurs ? 3 : 2);

	if (strlen($tranches) OR $toujours_afficher) {
	 	$result = spip_query($requete);
		if ($afficher_cadre) debut_cadre_relief("article-24.gif");
		echo "<table width=100% cellpadding=0 cellspacing=0 border=0><tr><td width=100% background=''>";
		echo "<table width=100% cellpadding=3 cellspacing=0 border=0>";

		bandeau_titre_boite($titre_table, $afficher_auteurs);

		echo $tranches;

		while ($row = mysql_fetch_array($result)) {
			$vals = '';

			$id_article = $row['id_article'];
			$titre = $row['titre'];
			$id_rubrique = $row['id_rubrique'];
			$date = $row['date'];
			$statut = $row['statut'];
			$visites = $row['visites'];
ARNO*'s avatar
ARNO* a validé
			$referers = $row['referers'];
			$descriptif = $row['descriptif'];
Fil's avatar
Fil a validé
			if ($descriptif) $descriptif = ' title="'.attribut_html(typo($descriptif)).'"';
			$query_petition = "SELECT id_article FROM spip_petitions WHERE id_article=$id_article";
			$result_petition = spip_query($query_petition);
			$petition = (@mysql_num_rows($result_petition) > 0);

			if ($afficher_auteurs) {
				$les_auteurs = "";
Antoine Pitrou's avatar
Antoine Pitrou a validé
			 	$query2 = "SELECT auteurs.id_auteur, nom, messagerie, login, en_ligne ".
			 		"FROM spip_auteurs AS auteurs, spip_auteurs_articles AS lien ".
			 		"WHERE lien.id_article=$id_article AND auteurs.id_auteur=lien.id_auteur";
				$result_auteurs = spip_query($query2);

				while ($row = mysql_fetch_array($result_auteurs)) {
					$id_auteur = $row['id_auteur'];
					$nom_auteur = typo($row['nom']);
					$auteur_messagerie = $row['messagerie'];
					
					$les_auteurs .= ", $nom_auteur";
					if ($id_auteur != $connect_id_auteur AND $auteur_messagerie != "non" AND $activer_messagerie != "non") {
						$les_auteurs .= "&nbsp;".bouton_imessage($id_auteur, $row);
					}
				}
				$les_auteurs = substr($les_auteurs, 2);
			}

Fil's avatar
Fil a validé
			$s = "<a href=\"articles.php3?id_article=$id_article\">";
			if ($statut=='publie') $puce = 'verte';
			else if ($statut == 'prepa') $puce = 'blanche';
			else if ($statut == 'prop') $puce = 'orange';
			else if ($statut == 'refuse') $puce = 'rouge';
			else if ($statut == 'poubelle') $puce = 'poubelle';
			if (acces_restreint_rubrique($id_rubrique))
				$puce = "puce-$puce-anim.gif";
			else
				$puce = "puce-$puce.gif";

Fil's avatar
Fil a validé
			$s .= "<img src=\"img_pack/$puce\" alt='-' width=\"13\" height=\"14\" border=\"0\"></a>&nbsp;&nbsp;";
			$s .= "<a href=\"articles.php3?id_article=$id_article\"$descriptif>".typo($titre)."</a>";
			if ($petition) $s .= " <Font size=1 color='red'>P&Eacute;TITION</font>";

			$vals[] = $s;
		
			if ($afficher_auteurs) $vals[] = $les_auteurs;

			$s = affdate($date);
			if ($connect_statut == "0minirezo" AND $activer_statistiques != "non" AND $afficher_visites AND $visites > 0) {
ARNO*'s avatar
ARNO* a validé
				$s .= "<br><font size=\"1\"><a href='statistiques_visites.php3?id_article=$id_article'>$visites&nbsp;visites</a></font>";
/*				if ($activer_statistiques_ref == "oui" AND $referers > 0){
ARNO*'s avatar
ARNO* a validé
					$s .= "<br><font size=\"1\"><a href='statistiques_visites.php3?id_article=$id_article'>$referers&nbsp;entr&eacute;es directes</a></font>";
			}
			$vals[] = $s;

			$table[] = $vals;
		}
		mysql_free_result($result);

		if ($afficher_auteurs) {
			$largeurs = array('', 100, 90);
			$styles = array('arial2', 'arial1', 'arial1');
		}
		else {
			$largeurs = array('', 90);
			$styles = array('arial2', 'arial1');
		}
		afficher_liste($largeurs, $table, $styles);
		
		echo "</table></td></tr></table>";
		if ($afficher_cadre) fin_cadre_relief();

}


//
// Afficher tableau de breves
//

function afficher_breves($titre_table, $requete) {
	global $connect_id_auteur;

	$tranches = afficher_tranches_requete($requete, 2);

	if (strlen($tranches)) {
		debut_cadre_relief("breve-24.gif");

		if ($titre_table) {
			echo "<p><table width=100% cellpadding=0 cellspacing=0 border=0 background=''>";
			echo "<tr><td width=100% background=''>";
			echo "<table width=100% cellpadding=3 cellspacing=0 border=0>";
			echo "<tr bgcolor='#EEEECC'><td width=100% colspan=2><font face='Verdana,Arial,Helvetica,sans-serif' size=3 color='#000000'>";
			echo "<b>$titre_table</b></font></td></tr>";
		}
		else {
			echo "<p><table width=100% cellpadding=3 cellspacing=0 border=0 background=''>";
		}

		echo $tranches;

		$result = spip_query($requete);

		$table = '';
		while ($row = mysql_fetch_array($result)) {
			$vals = '';

			$id_breve = $row['id_breve'];
			$date_heure = $row['date_heure'];
			$titre = $row['titre'];
			$statut = $row['statut'];
			if ($statut == 'prop') $puce = "puce-blanche";
			else if ($statut == 'publie') $puce = "puce-verte";
			else if ($statut == 'refuse') $puce = "puce-rouge";
Fil's avatar
Fil a validé
			$s = "<a href='breves_voir.php3?id_breve=$id_breve'>";
			$s .= "<img src='img_pack/$puce.gif' alt='o' width='8' height='9' border='0'></a>&nbsp;&nbsp;";
			$s .= "<a href='breves_voir.php3?id_breve=$id_breve'>";
Fil's avatar
Fil a validé
			$s .= "</a>";
			$s = "<div align=\"right\">";
			if ($statut == "prop") $s .= "[<font color=\"red\">&agrave; valider</font>]";
			else $s .= affdate($date_heure);
			$s .= "</div>";
			$vals[] = $s;
			$table[] = $vals;
		}
		mysql_free_result($result);

		$largeurs = array('', '');
		$styles = array('arial2', 'arial1');
		afficher_liste($largeurs, $table, $styles);

		if ($titre_table) echo "</TABLE></TD></TR>";
		echo "</TABLE>";
}


//
// Afficher tableau de rubriques
//

function afficher_rubriques($titre_table, $requete) {
	global $connect_id_auteur;

	$tranches = afficher_tranches_requete($requete, 2);

	if (strlen($tranches)) {

		debut_cadre_relief("rubrique-24.gif");
		if ($titre_table) {
			echo "<p><table width=100% cellpadding=0 cellspacing=0 border=0 background=''>";
			echo "<tr><td width=100% background=''>";
			echo "<table width=100% cellpadding=3 cellspacing=0 border=0>";
			echo "<tr bgcolor='#333333'><td width=100% colspan=2><font face='Verdana,Arial,Helvetica,sans-serif' size=3 color='#FFFFFF'>";
			echo "<b>$titre_table</b></font></td></tr>";
		}
		else {
			echo "<p><table width=100% cellpadding=3 cellspacing=0 border=0 background=''>";
		}

		echo $tranches;

		$result = spip_query($requete);

		$table = '';
		while ($row = mysql_fetch_array($result)) {
			$vals = '';

			$id_rubrique = $row['id_rubrique'];
			$titre = $row['titre'];

			$s = "<b><a href=\"naviguer.php3?coll=$id_rubrique\">";
			$puce = "puce.gif";
			$s .= "<img src=\"$puce\" alt=\">\" border=\"0\"> ";
			$s .= typo($titre);
			$s .= "</A></b>";
			$vals[] = $s;

			$s = "<div align=\"right\">";
			$s .= "</div>";
			$vals[] = $s;
			$table[] = $vals;
		}
		mysql_free_result($result);

		$largeurs = array('', '');
		$styles = array('arial2', 'arial2');
		afficher_liste($largeurs, $table, $styles);

		if ($titre_table) echo "</TABLE></TD></TR>";
		echo "</TABLE>";

//
// Afficher des auteurs sur requete SQL
//
function bonhomme_statut($row) {
	global $connect_statut;

	switch($row['statut']){
		case "0minirezo":
			$image = "<img src='img_pack/bonhomme-noir.gif' alt='Admin' border='0'>";
			break;
		case "1comite":
			if ($connect_statut == '0minirezo' AND !($row['pass'] AND $row['login']))
				$image = "<img src='img_pack/bonhomme-rouge.gif' alt='Sans acc&egrave;s' border='0'>";
			else
				$image = "<img src='img_pack/bonhomme-bleu.gif' alt='R&eacute;dacteur' border='0'>";
			break;
		case "5poubelle":
			$image = "<img src='img_pack/supprimer.gif' alt='Effac&eacute;' border='0'>";
			break;
		case "nouveau":
		default:
			$image = '';
			break;
	}
	if ($image && $connect_statut=="0minirezo")
		$image = "<A HREF='auteurs_edit.php3?id_auteur=".$row['id_auteur']."'>$image</a>";

	return $image;
}

function afficher_auteurs ($titre_table, $requete) {
	$tranches = afficher_tranches_requete($requete, 2);

	if (strlen($tranches)) {

		debut_cadre_relief("redacteurs-24.gif");

		if ($titre_table) {
			echo "<p><table width=100% cellpadding=0 cellspacing=0 border=0 background=''>";
			echo "<tr><td width=100% background=''>";
			echo "<table width=100% cellpadding=3 cellspacing=0 border=0>";
			echo "<tr bgcolor='#333333'><td width=100% colspan=2><font face='Verdana,Arial,Helvetica,sans-serif' size=3 color='#FFFFFF'>";
			echo "<b>$titre_table</b></font></td></tr>";
		}
		else {
			echo "<p><table width=100% cellpadding=3 cellspacing=0 border=0 background=''>";
		}

		echo $tranches;

		$result = spip_query($requete);

		$table = '';
		while ($row = mysql_fetch_array($result)) {
			$vals = '';

			$id_auteur = $row['id_auteur'];
			$tous_id[] = $id_auteur;
			$nom = $row['nom'];

			$s = bonhomme_statut($row);
			$s .= "<a href=\"auteur_edit.php3?id_auteur=$id_auteur\">";
			$s .= typo($nom);
			$s .= "</a>";
			$vals[] = $s;
			$table[] = $vals;
		}
		mysql_free_result($result);

		$largeurs = array('');
		$styles = array('arial2');
		afficher_liste($largeurs, $table, $styles);

		if ($titre_table) echo "</TABLE></TD></TR>";
		echo "</TABLE>";
		fin_cadre_relief();
	}
	return $tous_id;
}

//
// Afficher les forums
//
 
function afficher_forum($request, $adresse_retour, $controle = "non", $recurrence = "oui") {
	global $debut;
	static $compteur_forum;
	static $nb_forum;
	static $i;
	global $couleur_foncee;
	global $connect_id_auteur;
	global $connect_activer_messagerie;	
	global $mots_cles_forums;


	$activer_messagerie = lire_meta("activer_messagerie");
	
	$compteur_forum++; 

	$nb_forum[$compteur_forum] = mysql_num_rows($request);
	$i[$compteur_forum] = 1;
 	while($row = mysql_fetch_array($request)) {
		$id_forum=$row['id_forum'];
		$id_parent=$row['id_parent'];
		$id_rubrique=$row['id_rubrique'];
		$id_article=$row['id_article'];
		$id_breve=$row['id_breve'];
		$id_message=$row['id_message'];
		$id_syndic=$row['id_syndic'];
		$date_heure=$row['date_heure'];
		$titre=$row['titre'];
		$texte=$row['texte'];
		$auteur=$row['auteur'];
		$email_auteur=$row['email_auteur'];
		$nom_site=$row['nom_site'];
		$url_site=$row['url_site'];
		$statut=$row['statut'];
		$ip=$row["ip"];
		$id_auteur=$row["id_auteur"];

		if ($compteur_forum==1){echo "<BR><BR>\n";}

		$afficher = ($controle=="oui") ? ($statut!="perso") :
			(($statut=="prive" OR $statut=="privrac" OR $statut=="privadm" OR $statut=="perso")
			OR ($statut=="publie" AND $id_parent > 0));

		if ($afficher) {
			echo "<table width=100% cellpadding=0 cellspacing=0 border=0><tr>";
			for ($count=2;$count<=$compteur_forum AND $count<20;$count++){
				$fond[$count]='img_pack/rien.gif';
				if ($i[$count]!=$nb_forum[$count]){
					$fond[$count]='img_pack/forum-vert.gif';
				$fleche='img_pack/rien.gif';
					$fleche='img_pack/forum-droite.gif';
				echo "<td width=10 valign='top' background=$fond[$count]><img src=$fleche alt='o' width=10 height=13 border=0></td>\n";
			echo "\n<td width=100% valign='top'>";

			// Si refuse, cadre rouge
			if ($statut=="off") {
				echo "<table width=100% cellpadding=2 cellspacing=0 border=0><tr><td>";
			}
			// Si propose, cadre jaune
			else if ($statut=="prop") {
				echo "<table width=100% cellpadding=2 cellspacing=0 border=0><tr><td>";
			
			if ($compteur_forum == 1) echo debut_cadre_relief("forum-interne-24.gif");
			echo "<table width=100% cellpadding=3 cellspacing=0><tr><td bgcolor='$couleur_foncee'><font face='Verdana,Arial,Helvetica,sans-serif' size=2 color='#FFFFFF'><b>".typo($titre)."</b></font></td></tr>";
			echo "<tr><td bgcolor='#EEEEEE'>";
			echo "<font size=2 face='Georgia,Garamond,Times,serif'>";
			echo "<font face='arial,helvetica'>$date_heure</font>";

			if ($email_auteur) {
				echo " <a href=\"mailto:$email_auteur?subject=".rawurlencode($titre)."\">$auteur</a>";
			}
			else {
				echo " $auteur";
			}

			if ($id_auteur AND $activer_messagerie != "non" AND $connect_activer_messagerie != "non") {
				$bouton = bouton_imessage($id_auteur,$row_auteur);
				if ($bouton) echo "&nbsp;".$bouton;
			}

			if ($controle == "oui") {
				if ($statut != "off") {
					icone ("Supprimer ce message", "articles_forum.php3?id_article=$id_article&supp_forum=$id_forum&debut=$debut", "forum-interne-24.gif", "supprimer.gif", "right");
				}
				else {
					echo "<br><font color='red'><b>MESSAGE SUPPRIM&Eacute; $ip</b></font>";
					if ($id_auteur) {
						echo " - <a href='auteurs_edit.php3?id_auteur=$id_auteur'>Voir cet auteur</A>";
					}
				}
				if ($statut == "prop" OR $statut == "off") {
					icone ("Valider ce message", "articles_forum.php3?id_article=$id_article&valid_forum=$id_forum&debut=$debut", "forum-interne-24.gif", "creer.gif", "right");
				}
			}
			echo justifier(propre($texte));
			
			if (strlen($url_site) > 10 AND $nom_site) {
				echo "<p align='left'><font face='Verdana,Arial,Helvetica,sans-serif'><b><a href='$url_site'>$nom_site</a></b></font>";
			}
				
			if ($controle != "oui") {
				echo "<p align='right'><font face='Verdana,Arial,Helvetica,sans-serif' size=1>";
				$url = "forum_envoi.php3?id_parent=$id_forum&adresse_retour=".rawurlencode($adresse_retour)
					."&titre_message=".rawurlencode($titre);
				echo "<b><a href=\"$url\">R&eacute;pondre &agrave; ce message</a></b></font>";
			}
ARNO*'s avatar
ARNO* a validé
			if ($mots_cles_forums == "oui"){
			
				$query_mots = "SELECT * FROM spip_mots AS mots, spip_mots_forum AS lien WHERE lien.id_forum = '$id_forum' AND lien.id_mot = mots.id_mot";
				$result_mots = spip_query($query_mots);
				
				while ($row_mots = mysql_fetch_array($result_mots)) {
					$id_mot = $row_mots['id_mot'];
					$titre_mot = propre($row_mots['titre']);
					$type_mot = propre($row_mots['type']);
					echo "<li> <b>$type_mot :</b> $titre_mot";
				}
				
			}



			echo "</font>";
			echo "</td></tr></table>";
			if ($compteur_forum == 1) echo fin_cadre_relief();
			if ($statut == "off" OR $statut == "prop") {
				echo "</td></tr></table>";
			}			
			echo "</td></tr></table>\n";

			if ($recurrence == "oui") forum($id_forum,$adresse_retour,$controle);
		}
		$i[$compteur_forum]++;
	}
	mysql_free_result($request);
	$compteur_forum--;
}

function forum($le_forum, $adresse_retour, $controle = "non") {
	global $id_breve;
      	echo "<font size=2 face='Georgia,Garamond,Times,serif'>";
	
	if ($controle == "oui") {
		$query_forum2 = "SELECT * FROM spip_forum WHERE id_parent='$le_forum' ORDER BY date_heure";
	}
	else {
		$query_forum2 = "SELECT * FROM spip_forum WHERE id_parent='$le_forum' AND statut<>'off' ORDER BY date_heure";
	}
 	$result_forum2 = spip_query($query_forum2);
	afficher_forum($result_forum2, $adresse_retour, $controle);
}

//
// un bouton (en POST) a partir d'un URL en format GET
//
function bouton($titre,$lien) {
	$lapage=substr($lien,0,strpos($lien,"?"));
	$lesvars=substr($lien,strpos($lien,"?")+1,strlen($lien));

	echo "\n<form action='$lapage' method='get'>\n";
	$lesvars=explode("&",$lesvars);
	
	for($i=0;$i<count($lesvars);$i++){
		$var_loc=explode("=",$lesvars[$i]);
		echo "<input type='Hidden' name='$var_loc[0]' value=\"$var_loc[1]\">\n";
	}
	echo "<input type='submit' name='Submit' class='fondo' value=\"$titre\">\n";
	echo "</form>";
}


//
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
// Presentation de l'interface privee, debut du HTML
Antoine Pitrou's avatar
 
Antoine Pitrou a validé

function debut_html($titre = "") {
ARNO*'s avatar
ARNO* a validé
	global $couleur_foncee, $couleur_claire, $couleur_lien, $couleur_lien_off;
Antoine Pitrou's avatar
Antoine Pitrou a validé
	global $flag_ecrire;

Fil's avatar
Fil a validé
	$nom_site_spip = entites_html(lire_meta("nom_site"));
Antoine Pitrou's avatar
Antoine Pitrou a validé
	if (!$nom_site_spip) $nom_site_spip="SPIP";
	if (!$charset = lire_meta('charset')) $charset = 'iso-8859-1';
Fil's avatar
Fil a validé

	@Header("Expires: 0");
	@Header("Cache-Control: no-cache,no-store");
	@Header("Pragma: no-cache");
	@Header("Content-Type: text/html; charset=$charset");
	
	echo "<html>\n<head>\n<title>[$nom_site_spip] $titre</title>\n";
	echo '<link rel="stylesheet" type="text/css" href="';
	if (!$flag_ecrire) echo 'ecrire/';
	echo "spip_style.php3?couleur_claire=".urlencode($couleur_claire)."&couleur_foncee=" . urlencode($couleur_foncee) ."\">\n";

	afficher_script_layer();
Antoine Pitrou's avatar
Antoine Pitrou a validé
<script language="JavaScript"><!--
function changeclass(objet, myClass)
{ 
  objet.className = myClass;
}
//--></script>
ARNO*'s avatar
ARNO* a validé
<body text="#000000" bgcolor="#e4e4e4" background="img_pack/degrade.jpg" link="<?php echo $couleur_lien; ?>" vlink="<?php echo $couleur_lien_off; ?>" alink="<?php echo $couleur_lien_off ?>"  topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
<?php
}

// Fonctions onglets

function onglet_relief_inter(){
ARNO*'s avatar
ARNO* a validé
	global $spip_display;
	if ($spip_display != 1) {
		echo "<td background='img_pack/barre-noir.gif'><img src='img_pack/rien.gif' alt='o' width='1' height='40'></td>";
	}
ARNO*'s avatar
ARNO* a validé
	global $spip_display;
	if ($spip_display == 1) {
		echo "\n";
		echo "<p><table cellpadding=0 cellspacing=3 border=0>";
		echo "<tr>";
	}
	else {
		echo "\n";
		echo "<p><table cellpadding=0 cellspacing=0 border=0>";
		echo "<tr><td>";
Fil's avatar
Fil a validé
		echo "<img src='img_pack/barre-g.gif' alt='&lt;' width='16' height='40'>";
ARNO*'s avatar
ARNO* a validé
		echo "</td>";
	}
ARNO*'s avatar
ARNO* a validé
	global $spip_display;
ARNO*'s avatar
ARNO* a validé
	if ($spip_display == 1) {
		echo "</tr>";
		echo "</table>";
	} else {
		echo "<td>";
Fil's avatar
Fil a validé
		echo "<img src='img_pack/barre-d.gif' alt='&gt;' width='16' height='40'>";
ARNO*'s avatar
ARNO* a validé
		echo "</td></tr>";
		echo "</table>";
	}
}

function onglet($texte, $lien, $onglet_ref, $onglet, $icone=""){
ARNO*'s avatar
ARNO* a validé
	global $spip_display ;
	if ($spip_display == 1) {
		if ($onglet_ref == $onglet){
			echo "\n<td  class='iconeon' valign='middle'>";
Antoine Pitrou's avatar
Antoine Pitrou a validé
			echo "<font face='Verdana,Arial,Helvetica,sans-serif' size='2' color='black'><b>$texte</b></font>";
ARNO*'s avatar
ARNO* a validé
			echo "</td>";
		}
		else {
			echo "\n<td class='iconeoff' onMouseOver=\"changeclass(this,'iconeon');\" onMouseOut=\"changeclass(this,'iconeoff');\" onClick=\"document.location='$lien'\" valign='middle'>";
Antoine Pitrou's avatar
Antoine Pitrou a validé
			echo "<a href='$lien' class='icone'><font face='Verdana,Arial,Helvetica,sans-serif' size='2' color='#666666'><b>$texte</b></font></a>";
ARNO*'s avatar
ARNO* a validé
			echo "</td>";
ARNO*'s avatar
ARNO* a validé
		if ($onglet_ref == $onglet){
			onglet_relief_inter();
			if (strlen($icone)>3){
Fil's avatar
Fil a validé
				echo "\n<td background='img_pack/barre-noir.gif' height=40 valign='top'>";
ARNO*'s avatar
ARNO* a validé
				echo "&nbsp; <img src='img_pack/$icone' border=0>";
Fil's avatar
Fil a validé
				echo "</td>";
ARNO*'s avatar
ARNO* a validé
			}
			echo "\n<td background='img_pack/barre-noir.gif' height=40 valign='middle'>";
Antoine Pitrou's avatar
Antoine Pitrou a validé
			echo "&nbsp; <font face='Verdana,Arial,Helvetica,sans-serif' size='2' color='black'><b>$texte</b></font> &nbsp;";
ARNO*'s avatar
ARNO* a validé
			echo "</td>";
		}
		else {
			onglet_relief_inter();
Antoine Pitrou's avatar
Antoine Pitrou a validé
			echo "\n<td class='reliefblanc' onMouseOver=\"changeclass(this,'reliefgris');\" onMouseOut=\"changeclass(this,'reliefblanc');\" height='40' valign='middle'>\n";
			echo "<table border='0' cellspacing='0' cellpadding='0'><tr>\n";

ARNO*'s avatar
ARNO* a validé
			if (strlen($icone)>3){
Antoine Pitrou's avatar
Antoine Pitrou a validé
				echo "\n<td height=40 valign='middle'>";
				echo "<a href='$lien' class='icone'><img src='img_pack/$icone' border=0></a>";
				echo "</td>";
Antoine Pitrou's avatar
Antoine Pitrou a validé
			echo "\n<td height=40 valign='middle'>";
			echo "<a href='$lien' class='icone'>&nbsp; <font face='Verdana,Arial,Helvetica,sans-serif' size='2' color='#666666'><b>$texte</b></font></a> &nbsp;";
ARNO*'s avatar
ARNO* a validé
			echo "</td>";
Antoine Pitrou's avatar
Antoine Pitrou a validé

			echo "\n</tr></table>";
			echo "\n</td>\n";