Skip to content
Extraits de code Groupes Projets
presentation.php 65,9 ko
Newer Older
		case "1comite":
			if ($connect_statut == '0minirezo' AND ($row['source'] == 'spip' AND !($row['pass'] AND $row['login'])))
			  return http_img_pack("visit-12.gif",_T('titre_image_redacteur'), "", _T('titre_image_redacteur'));
			  return http_img_pack("redac-12.gif",_T('titre_image_redacteur'), "", _T('titre_image_redacteur_02'));
			break;
		case "5poubelle":
		  return http_img_pack("poubelle.gif", _T('titre_image_auteur_supprime'), "",_T('titre_image_auteur_supprime'));
		case "6forum":
		  return http_img_pack("visit-12.gif", _T('titre_image_visiteur'), "",_T('titre_image_visiteur'));
		case "nouveau":
		default:
			return '';
// La couleur du statut
// http://doc.spip.org/@puce_statut
function puce_statut($statut, $type='article') {
	switch ($statut) {
		case 'publie':
			return 'verte';
		case 'prepa':
			return 'blanche';
		case 'prop':
			return 'orange';
		case 'refuse':
			return 'rouge';
		case 'poubelle':
			return 'poubelle';
	}
}


// http://doc.spip.org/@afficher_forum
function afficher_forum($request, $retour, $arg, $controle_id_article = false) {
esj's avatar
esj a validé
	global $spip_display;
	static $compteur_forum = 0;
	static $nb_forum = array();
	$compteur_forum++;
	$nb_forum[$compteur_forum] = spip_num_rows($request);
	$res = '';

	if ($spip_display == 4) $res .= "<ul>";
 	while($row = spip_fetch_array($request)) {
		if ($compteur_forum==1) $res .= "\n<br />";
		if (($controle_id_article) ? ($statut!="perso") :
			(($statut=="prive" OR $statut=="privrac" OR $statut=="privadm" OR $statut=="perso")
			 OR ($statut=="publie" AND $id_parent > 0))) {
			$res .= afficher_forum_thread($row, $controle_id_article, $compteur_forum, $nb_forum, $thread, $retour, $arg)
			. afficher_forum(spip_query("SELECT * FROM spip_forum WHERE id_parent='" . $row['id_forum'] . "'" . ($controle_id_article ? '':" AND statut<>'off'") . " ORDER BY date_heure"), $retour, $arg, $controle_id_article);
esj's avatar
esj a validé
		}
esj's avatar
esj a validé
	}
	if ($spip_display == 4) $res .= "</ul>";
esj's avatar
esj a validé
	spip_free_result($request);
	$compteur_forum--;
esj's avatar
esj a validé
}

// http://doc.spip.org/@afficher_forum_thread
function afficher_forum_thread($row, $controle_id_article, $compteur_forum, $nb_forum, $i, $retour, $arg) {
esj's avatar
esj a validé
	global $spip_lang_rtl, $spip_lang_left, $spip_lang_right, $spip_display;
	static $voir_logo = array(); // pour ne calculer qu'une fois

	if (is_array($voir_logo)) {
		$voir_logo = (($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non") ? 
		      "position: absolute; $spip_lang_right: 0px; margin: 0px; margin-top: -3px; margin-$spip_lang_right: 0px;" 
		      : '');
	}

	$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'];
esj's avatar
esj a validé
	$auteur= extraire_multi($row['auteur']);
esj's avatar
esj a validé
	$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"];
	
esj's avatar
esj a validé
	if ($spip_display == 4) {
		$res .= "<li>".typo($titre)."<br />";
esj's avatar
esj a validé
	} else {

		$titre_boite = '';
		if ($id_auteur AND $voir_logo) {
			$chercher_logo = charger_fonction('chercher_logo', 'inc');
			if ($logo = $chercher_logo($id_auteur, 'id_auteur', 'on')) {
esj's avatar
esj a validé
				list($fid, $dir, $nom, $format) = $logo;
				$logo = ratio_image($fid, $nom, $format, 48, 48, "alt=''");
				if ($logo)
					$titre_boite = "\n<div style='$voir_logo'>$logo</div>" ;
esj's avatar
esj a validé
			}
		} 

		$titre_boite .= typo($titre);

		$res .= "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>";
		$res .= afficher_forum_4($compteur_forum, $nb_forum, $i);

esj's avatar
esj a validé
		if ($compteur_forum == 1) 
			$res .= afficher_forum_logo($statut, $titre_boite);
		else $res .= debut_cadre_thread_forum("", true, "", $titre_boite);
esj's avatar
esj a validé
	}
esj's avatar
esj a validé
	// Si refuse, cadre rouge
	if ($statut=="off") {
		$res .= "\n<div style='border: 2px dashed red; padding: 5px;'>";
esj's avatar
esj a validé
	}
	// Si propose, cadre jaune
	else if ($statut=="prop") {
		$res .= "\n<div style='border: 1px solid yellow; padding: 5px;'>";
esj's avatar
esj a validé
	}
	// Si original, cadre vert
	else if ($statut=="original") {
		$res .= "\n<div style='border: 1px solid green; padding: 5px;'>";
	}

	$res .= "<span class='arial2'>". date_interface($date_heure) . "</span>&nbsp;&nbsp;";
esj's avatar
esj a validé

	if ($id_auteur) {
		$formater_auteur = charger_fonction('formater_auteur', 'inc');
		$res .= join(' ',$formater_auteur($id_auteur));
	} else {
		if ($email_auteur) {
			if (email_valide($email_auteur))
				$email_auteur = "<a href='mailto:"
				.htmlspecialchars($email_auteur)
				."?subject=".rawurlencode($titre)."'>".$email_auteur
				."</a>";
			$auteur .= " &mdash; $email_auteur";
		}
		$res .= safehtml("<span class='arial2'> / <b>$auteur</b></span>");
	}
esj's avatar
esj a validé
	// boutons de moderation
	if ($controle_id_article)
		$res .= boutons_controle_forum($id_forum, $statut, $id_auteur, "id_article=$id_article", $ip);
Fil's avatar
Fil a validé

	$res .= safehtml(justifier(propre($texte)));
esj's avatar
esj a validé
	if ($nom_site) {
		if (strlen($url_site) > 10)
			$res .= "\n<div align='left' class='verdana2'><b><a href='$url_site'>$nom_site</a></b></div>";
		else $res .= "<b>$nom_site</b>";
esj's avatar
esj a validé
	}
esj's avatar
esj a validé
	if (!$controle_id_article) {
		$res .= "\n<div align='right' class='verdana1'>"
		  . generer_url_ecrire("forum_envoi", "id_parent=$id_forum&titre_message=$tm&script=$retour") . '#formulaire'
		. "'>"
		. _T('lien_repondre_message')
		. "</a></b></div>";
esj's avatar
esj a validé
	}
esj's avatar
esj a validé
	if ($GLOBALS['meta']["mots_cles_forums"] == "oui")
		$res .= afficher_forum_mots($id_forum);
	if ($statut == "off" OR $statut == "prop") $res .= "</div>";
esj's avatar
esj a validé
	if ($spip_display != 4) {
		if ($compteur_forum == 1) $res .= fin_cadre_forum(true);
		else $res .= fin_cadre_thread_forum(true);
		$res .= "</td></tr></table>\n";
esj's avatar
esj a validé

// http://doc.spip.org/@afficher_forum_logo
function afficher_forum_logo($statut, $titre_boite)
{
	if ($statut == "prive") $logo = "forum-interne-24.gif";
	else if ($statut == "privadm") $logo = "forum-admin-24.gif";
	else if ($statut == "privrac") $logo = "forum-interne-24.gif";
	else $logo = "forum-public-24.gif";
	return debut_cadre_forum($logo, true, "", $titre_boite);
// http://doc.spip.org/@afficher_forum_mots
function afficher_forum_mots($id_forum)
{
	$result = spip_query("SELECT * FROM spip_mots AS mots, spip_mots_forum AS lien WHERE lien.id_forum = '$id_forum' AND lien.id_mot = mots.id_mot");

	$res = '<ul>';
	while ($row = spip_fetch_array($result)) {
		$res .= "<li> <b>"
		. propre($row['titre'])
		. " :</b> "
		.  propre($row['type'])
}

// affiche les traits de liaisons entre les reponses

// http://doc.spip.org/@afficher_forum_4
function afficher_forum_4($compteur_forum, $nb_forum, $thread)
esj's avatar
esj a validé
	global $spip_lang_rtl;
	$fleche='rien.gif';
	$res = '';
	for ($j=2;$j<=$compteur_forum AND $j<20;$j++){
		$fond[$j]=_DIR_IMG_PACK . 'rien.gif';
		if ($thread[$j]!=$nb_forum[$j]){
			$fond[$j]=_DIR_IMG_PACK . 'forum-vert.gif';
			$fleche="forum-droite$spip_lang_rtl.gif";
		}
		$res .= "<td width='10' valign='top' style='background-color: "
		.  $fond[$j]
		.  "'>"
		. http_img_pack($fleche, "", "width='10' height='13'")
	return $res . "\n<td width='100%' valign='top'>";
// http://doc.spip.org/@envoi_link
function envoi_link($nom_site_spip) {
	global $connect_statut, $connect_toutes_rubriques, $spip_display;
	global $spip_lang, $couleur_claire, $couleur_foncee;
Fil's avatar
Fil a validé

Fil's avatar
Fil a validé
	$args = "couleur_claire=" .
		substr($couleur_claire,1) .
		'&couleur_foncee=' .
		substr($couleur_foncee,1) .
		'&ltr=' . 
	// CSS de secours en cas de non fonct de la suivante
	$res = '<link rel="stylesheet" type="text/css" href="'
	. find_in_path('style_prive_defaut.css')
	// CSS espace prive : la vraie
	. '<link rel="stylesheet" type="text/css" href="'
	. generer_url_public('style_prive', $args) .'" />' . "\n"
Fil's avatar
Fil a validé
	. '<link rel="stylesheet" type="text/css" href="'
	. find_in_path('agenda.css') .'" />' . "\n"

	// CSS imprimante (masque des trucs, a completer)
	. '<link rel="stylesheet" type="text/css" href="'
	. find_in_path('spip_style_print.css')
	. '" media="print" />' . "\n"
	// CSS "visible au chargement" differente selon js actif ou non
	. '<link rel="stylesheet" type="text/css" href="'
	. find_in_path('spip_style_'
		. (_SPIP_AJAX ? 'invisible' : 'visible')
Fil's avatar
Fil a validé
	. '<link rel="shortcut icon" href="'
	. url_absolue(find_in_path('favicon.ico'))
	$js = debut_javascript($connect_toutes_rubriques,
			($GLOBALS['meta']["activer_statistiques"] != 'non'));

	if ($spip_display == 4) return $res . $js;

	$nom = entites_html($nom_site_spip);

	$res .= "<link rel='alternate' type='application/rss+xml' title=\"$nom\" href='"
			. generer_url_public('backend') . "' />\n";
	$res .= "<link rel='help' type='text/html' title=\""._T('icone_aide_ligne') . 
			"\" href='"
			. generer_url_ecrire('aide_index',"var_lang=$spip_lang")
	if ($GLOBALS['meta']["activer_breves"] != "non")
		$res .= "<link rel='alternate' type='application/rss+xml' title=\""
			. $nom
			. ")\" href='" . generer_url_public('backend-breves') . "' />\n";
// http://doc.spip.org/@debut_javascript
function debut_javascript($admin, $stat)
{
	global $spip_lang_left, $browser_name, $browser_version;
Fil's avatar
Fil a validé
	include_spip('inc/charsets');
	// tester les capacites JS :

	// On envoie un script ajah ; si le script reussit le cookie passera a +1
	// on installe egalement un <noscript></noscript> qui charge une image qui
	// pose un cookie valant -1
	$testeur = generer_url_ecrire('test_ajax', 'var_ajaxcharset=utf-8&js=1');
	  // pour le pied de page
			"<noscript>\n<div style='display:none;'><img src='"
		        . generer_url_ecrire('test_ajax', 'var_ajaxcharset=utf-8&js=-1')
		        . "' width='1' height='1' alt='' /></div></noscript>\n"); 
	// envoi le fichier JS de config si browser ok.
		$GLOBALS['browser_layer'] .
			((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1)
			: "$.ajax('GET', '$testeur')") .
			"\nvar ajax_image_searching = \n'<div style=\"float: ".$GLOBALS['spip_lang_right'].";\"><img src=\"".url_absolue(_DIR_IMG_PACK."searching.gif")."\" alt=\"\" /></div>';" .
			"\nvar stat = " . ($stat ? 1 : 0) .
			"\nvar largeur_icone = " .
			intval(_LARGEUR_ICONES_BANDEAU) .
			"\nvar  bug_offsetwidth = " .
// uniquement affichage ltr: bug Mozilla dans offsetWidth quand ecran inverse!
			((($spip_lang_left == "left") &&
			  (($browser_name != "MSIE") ||
			   ($browser_version >= 6))) ? 1 : 0) .
			"\nvar confirm_changer_statut = '" .
			unicode_to_javascript(addslashes(html2unicode(_T("confirm_changer_statut")))) . 
			"';\n") .
		http_script('',_DIR_JAVASCRIPT . 'presentation.js');
Antoine Pitrou's avatar
 
Antoine Pitrou a validé

// http://doc.spip.org/@debut_onglet
esj's avatar
esj a validé
	return "
\n<div style='padding: 7px;'><table cellpadding='0' cellspacing='0' border='0' align='center'><tr>
esj's avatar
esj a validé
";
// http://doc.spip.org/@fin_onglet
esj's avatar
esj a validé
	return "</tr></table></div>\n";
// http://doc.spip.org/@onglet
function onglet($texte, $lien, $onglet_ref, $onglet, $icone=""){
ARNO*'s avatar
ARNO* a validé
	global $spip_display, $spip_lang_left ;

esj's avatar
esj a validé
	$res = "<td>";
ARNO*'s avatar
ARNO* a validé
	
	if ($onglet != $onglet_ref) {
		$res .= "\n<div style='position: relative;'>";
ARNO*'s avatar
ARNO* a validé
		if ($spip_display != 1) {
			if (strlen($icone) > 0) {
				$res .= "\n<div style='z-index: 2; position: absolute; top: 0px; $spip_lang_left: 5px;'>" .
				  http_img_pack("$icone", "", "") . "</div>";
ARNO*'s avatar
ARNO* a validé
				$style = " top: 7px; padding-$spip_lang_left: 32px; z-index: 1;";
			} else {
				$style = " top: 7px;";
		$res .= "\n<div onmouseover=\"changeclass(this, 'onglet_on');\" onmouseout=\"changeclass(this, 'onglet');\" class='onglet' style='position: relative;$style'><a href='$lien'>$texte</a></div>";
esj's avatar
esj a validé
		$res .= "</div>";
ARNO*'s avatar
ARNO* a validé
	} else {
		$res .= "\n<div style='position: relative;'>";
ARNO*'s avatar
ARNO* a validé
		if ($spip_display != 1) {
			if (strlen($icone) > 0) {
				$res .= "\n<div style='z-index: 2; position: absolute; top: 0px; $spip_lang_left: 5px;'>" .
				  http_img_pack("$icone", "", "") . "</div>";
ARNO*'s avatar
ARNO* a validé
				$style = " top: 7px; padding-$spip_lang_left: 32px; z-index: 1;";
			} else {
				$style = " top: 7px;";
		$res .= "\n<div class='onglet_off' style='position: relative;$style'>$texte</div>";
esj's avatar
esj a validé
		$res .= "</div>";
esj's avatar
esj a validé
	$res .= "</td>";
	return $res;
// http://doc.spip.org/@icone
Fil's avatar
 
Fil a validé
function icone($texte, $lien, $fond, $fonction="", $align="", $afficher='oui'){
Antoine Pitrou's avatar
Antoine Pitrou a validé

	if ($fonction == "supprimer.gif") {
		$style = '-danger';
	} else {
		$style = '';
		if (strlen($fonction) < 3) $fonction = "rien.gif";
	}

	if ($spip_display == 1){
		$hauteur = 20;
ARNO*'s avatar
ARNO* a validé
		$largeur = 100;
	}
	else if ($spip_display == 3){
		$hauteur = 30;
		$largeur = 30;
		$title = "\ntitle=\"$texte\"";
ARNO*'s avatar
ARNO* a validé
		$largeur = 100;
Antoine Pitrou's avatar
Antoine Pitrou a validé

	if ($spip_display != 1 AND $spip_display != 4){
		  $icone = http_img_pack($fonction, $alt, "$title width='24' height='24'\n" .
					  http_style_background($fond, "no-repeat center center"));
			$icone = http_img_pack($fond, $alt, "$title width='24' height='24'");
		$icone .= "<span>$texte</span>";
Fil's avatar
 
Fil a validé

	// cas d'ajax_action_auteur: faut defaire le boulot 
	// (il faudrait fusionner avec le cas $javascript)
	if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i",$lien,$r))
	  list($x,$lien,$atts,$texte)= $r;
	else $atts = '';
	$lien = "\nhref='$lien'$atts";

	$icone = "\n<table cellpadding='0' class='pointeur' cellspacing='0' border='0' width='$largeur'"
	. ((strlen($align) > 2) ? " align='$align' " : '')
	. ">\n<tr><td class='icone36$style' style='text-align:center;'><a"
	. $lien
	. '>'
	. $icone
	. "</a></td></tr></table>\n";

	if ($afficher == 'oui')	echo $icone; else return $icone;
// http://doc.spip.org/@icone_horizontale
function icone_horizontale($texte, $lien, $fond = "", $fonction = "", $af = true, $javascript='') {
Antoine Pitrou's avatar
Antoine Pitrou a validé

	// cas d'ajax_action_auteur: faut defaire le boulot 
	// (il faudrait fusionner avec le cas $javascript)
	if (preg_match(",^<a href='([^']*)'([^>]*)>(.*)</a>$,i",$lien,$r))
	  list($x,$lien,$atts,$texte)= $r;
	else $atts = '';
	$lien = "\nhref='$lien'$atts";

ARNO*'s avatar
ARNO* a validé
	if ($spip_display != 4) {
	
		if ($spip_display != 1) {
			$retour .= "\n<table class='cellule-h-table' cellpadding='0' style='vertical-align: middle'>"
			. "\n<tr><td><a $javascript$lien class='cellule-h'>"
			. "<span class='cell-i'>" ;
				$retour .= http_img_pack($fonction, $texte, http_style_background($fond, "center center no-repeat"));
				$retour .= http_img_pack($fond, $texte, "");
			$retour .= "</span></a></td>"
			. "\n<td class='cellule-h-lien'><a $javascript$lien class='cellule-h'>"
ARNO*'s avatar
ARNO* a validé
		}
		else {
			$retour .= "\n<div><a class='cellule-h-texte' $javascript$lien>$texte</a></div>\n";
ARNO*'s avatar
ARNO* a validé
		}
		if ($fonction == "supprimer.gif")
			$retour = "\n<div class='danger'>$retour</div>";
ARNO*'s avatar
ARNO* a validé
	} else {
		$retour = "<li><a$lien>$texte</a></li>";
	if ($af) echo $retour; else return $retour;
// http://doc.spip.org/@gros_titre
function gros_titre($titre, $ze_logo='', $aff=true){
	global $couleur_foncee, $spip_display;
	if ($spip_display == 4) {
		$res = "\n<h1>".typo($titre)."</h1>&nbsp;\n";
		$res = "\n<div class='verdana2' style='font-size: 18px; color: $couleur_foncee; font-weight: bold;'>" .
		  (strlen($ze_logo) <= 3 ? '':  (http_img_pack($ze_logo, "", "align='middle'") . " &nbsp; ")) .
		  typo($titre) .
		  "</div>\n";
	if ($aff) echo $res; else return $res;
// http://doc.spip.org/@debut_grand_cadre
function debut_grand_cadre($return=false){
	global $spip_ecran;
	
	if ($spip_ecran == "large") $largeur = 974;
	else $largeur = 750;
	$res =  "\n<br /><br />\n<table width='$largeur' cellpadding='0' cellspacing='0' border='0'>\n<tr><td width='$largeur' class='serif'>";
	if ($return) return $res; else echo $res;
// http://doc.spip.org/@fin_grand_cadre
function fin_grand_cadre($return=false){
	$res = "\n</td></tr></table>";
	if ($return) return $res; else echo $res;
// http://doc.spip.org/@debut_cadre_formulaire
function debut_cadre_formulaire($style='', $return=false){
	$x = "\n<div class='cadre-formulaire'" .
ARNO*'s avatar
ARNO* a validé
	  (!$style ? "" : " style='$style'") .
	if ($return) return  $x; else echo $x;
// http://doc.spip.org/@fin_cadre_formulaire
function fin_cadre_formulaire($return=false){
	if ($return) return  "</div>\n"; else echo "</div>\n";
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
//
// Debut de la colonne de gauche
//

// http://doc.spip.org/@debut_gauche
function debut_gauche($rubrique = "accueil", $return=false) {
	global $options, $spip_display;
	global $spip_ecran;
	global $flag_3_colonnes, $flag_centre_large;
Fil's avatar
Fil a validé
	global $spip_lang_rtl;
Antoine Pitrou's avatar
Antoine Pitrou a validé

	$flag_3_colonnes = false;
	$largeur = 200;

	// Ecran panoramique ?
	if ($spip_ecran == "large") {
Antoine Pitrou's avatar
Antoine Pitrou a validé
		$largeur_ecran = 974;
Antoine Pitrou's avatar
Antoine Pitrou a validé
		// Si edition de texte, formulaires larges
		if (ereg('((articles|breves|rubriques)_edit|forum_envoi)', $GLOBALS['REQUEST_URI'])) {
			$flag_centre_large = true;
		
		$flag_3_colonnes = true;
Antoine Pitrou's avatar
Antoine Pitrou a validé
		$largeur_ecran = 750;
	$res = "<br /><table width='$largeur_ecran' cellpadding='0' cellspacing='0' border='0'>
		<tr>\n<td width='$largeur' class='colonne_etroite serif' valign='top' $rspan>
		\n<div style='width: ${largeur}px; overflow:hidden;'>
Fil's avatar
 
Fil a validé
\n";
	if ($spip_display == 4) $res .= "<!-- ";
Antoine Pitrou's avatar
 
Antoine Pitrou a validé

	if ($return) return $res; else echo $res;
// Presentation de l''interface privee, marge de droite
Antoine Pitrou's avatar
 
Antoine Pitrou a validé

// http://doc.spip.org/@creer_colonne_droite
function creer_colonne_droite($rubrique="", $return= false){
	static $deja_colonne_droite;
	global $flag_3_colonnes, $flag_centre_large;
esj's avatar
esj a validé
	global $spip_lang_rtl, $spip_lang_left;
	if ((!$flag_3_colonnes) OR $deja_colonne_droite) return '';
			$largeur = 140;
			$espacement = 37;
			$largeur = 200;
	.  $espacement
	.  "' rowspan='2' class='colonne_etroite'>&nbsp;</td>"
	. "\n<td rowspan='1' class='colonne_etroite'></td>"
	. "\n<td width='"
	.  "' rowspan='2' class='colonne_etroite'>&nbsp;</td>"
	. $spip_lang_left
	. "' valign='top' class='colonne_etroite'><p />";

	if ($return) return $res; else echo $res;
// http://doc.spip.org/@debut_droite
function debut_droite($rubrique="", $return= false) {
	global $options, $spip_ecran, $spip_display;
	global $spip_lang_left, $couleur_foncee, $couleur_claire;
	global $flag_3_colonnes, $flag_centre_large;
	if ($spip_display == 4) $res .= " -->";
	$res .= "</div>\n"; # largeur fixe, cf. debut_gauche
		$res .= liste_articles_bloques();
Antoine Pitrou's avatar
Antoine Pitrou a validé

	$res .= "\n<div>&nbsp;</div></td>";
Antoine Pitrou's avatar
Antoine Pitrou a validé
	if (!$flag_3_colonnes) {
		$res .= "<td width='50'>&nbsp;</td>";
		$res .= creer_colonne_droite($rubrique, true)
		. "</td></tr>\n<tr>";
	if ($spip_ecran == 'large' AND $flag_centre_large)
Antoine Pitrou's avatar
Antoine Pitrou a validé
	else
		$largeur = 500;
	$res .= "\n<td width=\"".$largeur.'" valign="top" align="'.$spip_lang_left.'" rowspan="1" class="serif">';
Fil's avatar
 
Fil a validé

	// touche d'acces rapide au debut du contenu
	$res .= "\n<a name='saut' href='#saut' accesskey='s'></a>\n";

	if ($return) return $res; else echo $res;
// http://doc.spip.org/@liste_articles_bloques
function liste_articles_bloques()
{
	global $connect_id_auteur, $couleur_foncee;
	$res = '';
	if ($GLOBALS['meta']["articles_modif"] != "non") {
		include_spip('inc/drapeau_edition');
		$articles_ouverts = liste_drapeau_edition ($connect_id_auteur, 'article');
		if (count($articles_ouverts)) {
			$res .= "\n<div>&nbsp;</div>"
			. "\n<div class='bandeau_rubriques' style='z-index: 1;'>"
			. bandeau_titre_boite2('<b>' . _T('info_cours_edition')  . '</b>', "article-24.gif", $couleur_foncee, 'white', false)
			. "\n<div class='plan-articles-bloques'>";

			foreach ($articles_ouverts as $row) {
				$ze_article = $row['id_article'];
				$ze_titre = $row['titre'];
				$statut = $row["statut"];
					
				$res .= "\n<div class='$statut'><a style='font-size: 10px;' href='" 
				. generer_url_ecrire("articles","id_article=$ze_article")
				. "'>$ze_titre</a>"
				. "\n<div style='text-align:right; font-size: 9px;'>"
				. debloquer_article($ze_article,_T('lien_liberer'))
				. "</div>"
				. "</div>";
			}
			$res .= "</div></div>";
		}
	}
	return $res;
}
	
// Fin de page de l'interface privee. 
// Elle comporte une image invisble declenchant une tache de fond
// http://doc.spip.org/@fin_page
Fil's avatar
Fil a validé
	global $spip_display;
ARNO*'s avatar
ARNO* a validé

	return "</td></tr></table>"
	. debut_grand_cadre(true)
	. (($spip_display == 4)
		? ("<div><a href='./?set_disp=2'>"
		.  _T("access_interface_graphique")
		. "</a></div>")
		: ('<div style="text-align: right; font-family: Verdana; font-size: 8pt">'
		. info_copyright()
		. "<br />"
		. _T('info_copyright_doc')
		. '</div>'))

	. fin_grand_cadre(true)
	. "</div>" // cf. <div center> ouverte dans conmmencer_page()
	. '<div style="background-image: url(\''
	. generer_url_action('cron')
	. '\');"></div>'
	. (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT : '')
	. "</body></html>\n";
Antoine Pitrou's avatar
 
Antoine Pitrou a validé
}

// http://doc.spip.org/@debloquer_article
Fil's avatar
Fil a validé
function debloquer_article($arg, $texte) {
	$lien = parametre_url(self(), 'debloquer_article', $arg, '&');
	return "<a href='" .
	  generer_action_auteur('instituer_collaboration',$arg, _DIR_RESTREINT_ABS . $lien) .
	  "' title=\"" .
	  entites_html($texte) .
	  "\">$texte&nbsp;" .
	  http_img_pack("croix-rouge.gif", ($arg=='tous' ? "" : "X"),
			"width='7' height='7' align='baseline'") .
function meme_rubrique($id_rubrique, $id, $type, $order='date', $limit=30)
{
	if ($options != "avancees") return '';

	$table = $type . 's';
	$key = 'id_' . $type;

	$voss = spip_query("SELECT $key AS id, titre, statut FROM spip_$table WHERE id_rubrique=$id_rubrique AND (statut = 'publie' OR statut = 'prop') AND ($key != $id) ORDER BY $order DESC LIMIT $limit");

	if (!spip_num_rows($voss)) return '';

	$retour = '';

	while($row = spip_fetch_array($voss)) {
		$retour .= afficher_numero_edit($n, $key, $type)
		. $row['statut']
		. "' style='font-size: 10px;' href='"
		. generer_url_ecrire($table,"$key=$n")
	return "\n<div>&nbsp;</div>"
	. "\n<div class='bandeau_rubriques' style='z-index: 1;'>"
	. bandeau_titre_boite2('<b>' . _T('info_meme_rubrique')  . '</b>', "article-24.gif",'','',false)
	. "\n<div class='plan-articles'>"
Christian Lefebvre's avatar
Christian Lefebvre a validé
// http://doc.spip.org/@afficher_numero_edit
function afficher_numero_edit($id, $key, $type)
{
	global $spip_lang_right, $spip_lang_left;
	static $numero , $style='' ;
	if (!$style) {
		$style = " style='float: $spip_lang_right; padding-$spip_lang_left: 4px;font-size: 10px; color: black; '"; 

		$numero = _T('info_numero_abbreviation');
	}

	if (!autoriser('modifier',$type,$id)) {
		$bal ='span';
		$href = '';
	} else {
		$bal = 'a';
		$href = "\nhref='"
		. generer_url_ecrire($type . "s_edit","$key=$id")
		. "'";
	}
	return "<$bal$style$href><b>"
//
// Afficher la hierarchie des rubriques
//
// http://doc.spip.org/@afficher_hierarchie
function afficher_hierarchie($id_rubrique) {
esj's avatar
esj a validé
	global $spip_lang_left;
	$parents = '';
	$style1 = "$spip_lang_left center no-repeat; padding-$spip_lang_left: 15px";
	$style2 = "margin-$spip_lang_left: 15px;";
	while ($id_rubrique) {
		$res = spip_fetch_array(spip_query("SELECT id_parent, titre, lang FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
		if (!$res) break; // rubrique inexistante
		$id_parent = $res['id_parent'];
		changer_typo($res['lang']);
		$logo = (!$id_parent) ? "secteur-12.gif"
		: (acces_restreint_rubrique($id_rubrique)
		? "admin-12.gif" : "rubrique-12.gif");
		$parents = "\n<div class='verdana3' "
		. http_style_background($logo, $style1)
		. "><a href='"
		. generer_url_ecrire("naviguer","id_rubrique=$id_rubrique")
		. "'>"
		. typo(sinon($res['titre'], _T('ecrire:info_sans_titre')))
		. "</a></div>\n<div style='$style2'>"
		. $parents
		. "</div>";

		$id_rubrique = $id_parent;
	return "\n<div class='verdana3' " .
		  http_style_background("racine-site-12.gif", $style1). 
		  "><a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "'><b>"._T('lien_racine_site')."</b></a>".aide ("rubhier")."</div>\n<div style='$style2'>".$parents."</div>";

// http://doc.spip.org/@enfant_rub
function enfant_rub($collection){
	global $couleur_foncee, $lang_dir;
	global $spip_display, $spip_lang_left, $spip_lang_right, $spip_lang;
	
	$voir_logo = ($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non");
		
	if ($voir_logo) {
		$voir_logo = "float: $spip_lang_right; margin-$spip_lang_right: -6px; margin-top: -6px;";
		$chercher_logo = charger_fonction('chercher_logo', 'inc');
	} else $logo ='';

	$les_enfants = "";

	$res = spip_query("SELECT id_rubrique, id_parent, titre, descriptif, lang FROM spip_rubriques WHERE id_parent='$collection' ORDER BY 0+titre,titre");

	while($row=spip_fetch_array($res)){
		$id_rubrique=$row['id_rubrique'];
		$id_parent=$row['id_parent'];
		$titre=$row['titre'];

		$les_sous_enfants = sous_enfant_rub($id_rubrique);

		changer_typo($row['lang']);

		$descriptif=propre($row['descriptif']);

		if ($spip_display == 4) $les_enfants .= "<li>";


		if ($voir_logo) {
			if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) {
				list($fid, $dir, $nom, $format) = $logo;
				$logo = ratio_image($fid, $nom, $format, 48, 36, "alt=''");
				if ($logo)
					$logo =  "\n<div style='$voir_logo'>$logo</div>";
		$les_enfants .= "\n<div class='enfants'>" .
			debut_cadre_sous_rub(($id_parent ? "rubrique-24.gif" : "secteur-24.gif"), true) .
		  (is_string($logo) ? $logo : '') .
		  (!$les_sous_enfants ? "" : bouton_block_invisible("enfants$id_rubrique")) .
		  (!acces_restreint_rubrique($id_rubrique) ? "" :
		   http_img_pack("admin-12.gif", '', " width='12' height='12'", _T('image_administrer_rubrique'))) .
		  " <span dir='$lang_dir'><b><a href='" . 
		  generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") .
		  "'><font color='$couleur_foncee'>".
		  typo($titre) .
		  "</font></a></b></span>" .
		  (!$descriptif ? '' : "\n<div class='verdana1'>$descriptif</div>");

		if ($spip_display != 4) $les_enfants .= $les_sous_enfants;
		
		$les_enfants .= "\n<div style='clear:both;'></div>"  .
		  fin_cadre_sous_rub(true) .
		  "</div>";

		if ($spip_display == 4) $les_enfants .= "</li>";
	}

	changer_typo($spip_lang); # remettre la typo de l'interface pour la suite
	return (($spip_display == 4) ? "<ul> $les_enfants</ul>" :  $les_enfants);

}

// http://doc.spip.org/@sous_enfant_rub
function sous_enfant_rub($collection2){
	global $lang_dir, $spip_lang_dir, $spip_lang_left;

	$result3 = spip_query("SELECT * FROM spip_rubriques WHERE id_parent='$collection2' ORDER BY 0+titre,titre");

	if (!spip_num_rows($result3)) return '';
	$retour = debut_block_invisible("enfants$collection2")."\n<ul style='margin: 0px; padding: 0px; padding-top: 3px;'>\n";
	while($row=spip_fetch_array($result3)){
			$id_rubrique2=$row['id_rubrique'];
			$id_parent2=$row['id_parent'];
			$titre2=$row['titre'];
			changer_typo($row['lang']);

			$retour.="\n<li><div class='arial11' " .
			  http_style_background('rubrique-12.gif', "left center no-repeat; padding: 2px; padding-$spip_lang_left: 18px; margin-$spip_lang_left: 3px") . "><a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique2") . "'><span dir='$lang_dir'>".typo($titre2)."</span></a></div></li>\n";
	}
	$retour .= "</ul>\n\n".fin_block()."\n\n";
	
	return $retour;
}

// http://doc.spip.org/@afficher_enfant_rub
function afficher_enfant_rub($id_rubrique, $bouton=false, $return=false) {
	global  $spip_lang_right;
	
	$les_enfants = enfant_rub($id_rubrique);
	$n = strlen($les_enfants);

	$les_enfants2=substr($les_enfants,round($n/2));

	if (strpos($les_enfants2,"\n<div class='enfants'>")){
		$les_enfants2=substr($les_enfants2,strpos($les_enfants2,"\n<div class='enfants'>"));
		$n2 = strlen($les_enfants2);
		$les_enfants=substr($les_enfants,0,$n-$n2);
	}else{
		$les_enfants2="";
	}
	
	$res = "\n<div>&nbsp;</div>"
	. "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"
	. "\n<tr><td valign='top' width='50%' rowspan='2'>"
	. $les_enfants
	. "</td>"
	. "\n<td width='20' rowspan='2'>"
	. http_img_pack("rien.gif", ' ', "width='20'")
	. "</td>\n"
	. "\n<td valign='top' width='50%'>"
	. $les_enfants2
	. "&nbsp;"
	. "</td></tr>"
	. "\n<tr><td style='text-align: "
	. $spip_lang_right